Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/usmpgames/application.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/application.py
parentb742088d3e4662df573caebc77a7f7d4e2eb3f06 (diff)
Delayed load of backgrounds
Implementation of basic resource system in application
Diffstat (limited to 'usmpgames/application.py')
-rwxr-xr-xusmpgames/application.py16
1 files changed, 15 insertions, 1 deletions
diff --git a/usmpgames/application.py b/usmpgames/application.py
index cd6b863..d492b5c 100755
--- a/usmpgames/application.py
+++ b/usmpgames/application.py
@@ -1,17 +1,31 @@
#!/usr/bin/python
-# -*- coding: iso-8859-15 -*-
+# -*- coding: utf-8 -*-
import sys
import pygame
+import olpcgames
+import constants
class Application():
_instance = None
+ _resources = {}
@staticmethod
def instance():
return Application._instance
+ @staticmethod
+ def get_resource_background(name):
+ if name is None:
+ return None
+ if not Application._resources.has_key(name) :
+ size = constants.screen_size
+ if olpcgames.ACTIVITY:
+ size = olpcgames.ACTIVITY.game_size
+ Application._resources[name] = pygame.transform.scale( pygame.image.load(name), size)
+ return Application._resources[name]
+
def __init__(self):
self._state_stack = []
self._current_state = None