diff options
author | Mateu 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) |
commit | 80a86f5984710328599167fe9187557aa103a77c (patch) | |
tree | fad7691b0b00175155a79275dfa42f1224880aee /usmpgames/application.py | |
parent | b742088d3e4662df573caebc77a7f7d4e2eb3f06 (diff) |
Delayed load of backgrounds
Implementation of basic resource system in application
Diffstat (limited to 'usmpgames/application.py')
-rwxr-xr-x | usmpgames/application.py | 16 |
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 |