Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/usmpgames/applicationstate.py
diff options
context:
space:
mode:
authorMateu Batle <mateu.batle@collabora.co.uk>2010-11-11 05:09:24 (GMT)
committer Mateu Batle <mateu.batle@collabora.co.uk>2010-11-11 05:09:24 (GMT)
commit80a86f5984710328599167fe9187557aa103a77c (patch)
treefad7691b0b00175155a79275dfa42f1224880aee /usmpgames/applicationstate.py
parentb742088d3e4662df573caebc77a7f7d4e2eb3f06 (diff)
Delayed load of backgrounds
Implementation of basic resource system in application
Diffstat (limited to 'usmpgames/applicationstate.py')
-rwxr-xr-xusmpgames/applicationstate.py24
1 files changed, 12 insertions, 12 deletions
diff --git a/usmpgames/applicationstate.py b/usmpgames/applicationstate.py
index fc5ca72..de4fc6c 100755
--- a/usmpgames/applicationstate.py
+++ b/usmpgames/applicationstate.py
@@ -1,17 +1,18 @@
#!/usr/bin/python
-# -*- coding: iso-8859-15 -*-
+# -*- coding: utf-8 -*-
import pygame
from application import *
class ApplicationState():
- def __init__(self, next_state = None, background = None):
+ def __init__(self, next_state = None, background_name = None):
self._running = True
self._screen = None
self._next_state = next_state
- self._background = background
-
+ self._background_name = background_name
+ self._background = None
+
def input(self, ms):
pass
@@ -28,13 +29,13 @@ class ApplicationState():
def post_render(self, ms):
pygame.display.flip()
- def set_background(self, background):
- self._background = background
+ def set_background(self, background_name):
+ self._background_name = background
+ self._background = None
def background(self):
- if self._background is not None:
- return self._background
- return None
+ self._background = Application.get_resource_background(self._background_name)
+ return self._background
def set_running(self, newValue):
self._running = newValue
@@ -56,12 +57,11 @@ class ApplicationState():
self.post_render(ms)
def entering_state(self, fromStack):
- print "Entering state ", self
+ #print "Entering state ", self
self.set_running(True)
- pass
def exiting_state(self, toStack):
- print "Exiting state ", self
+ #print "Exiting state ", self
pass
def go_to_next_state(self):