parent
commit
a91bc3fffd
4 changed files with 26 additions and 0 deletions
  1. +1
    -0
      main.py
  2. +22
    -0
      py/desktop.py
  3. +1
    -0
      py/desktop_Platform.py
  4. +2
    -0
      py/ht_Context.py

+ 1
- 0
main.py View File

@@ -44,6 +44,7 @@ def process(c):
# Perform context dependent calls of desktop functions.
# Similar to context functions, but no platform is returned.
desktop_applyConfigInit(p)
desktop_createConfigStaticSprites(p)
desktop_loadConfigTextures(p)
ctrl.registerCallback(process)



+ 22
- 0
py/desktop.py View File

@@ -18,6 +18,26 @@ def desktop_applyConfigInit(p):
value = desktop_aux_convertValue(val)
p.ctrl.set(key, value)

# Create static sprites
#
# Conditions:
# 1. Config textures has just been loaded
def desktop_createConfigStaticSprites(p):
if (
p.c.recentField != "didLoadConfigTextures"
):
return

for key in p.c.cfgTree:
if (
cld_startswith(key, "static ")
):
name = cfg_aux_spriteName(key)
sprite = desktop_aux_createSprite(p.c.cfgTree[key])
p.statics[name] = sprite
# Report finish.
p.ctrl.set("didCreateConfigStaticSprites", True)

# Load textures
#
# Conditions:
@@ -35,3 +55,5 @@ def desktop_loadConfigTextures(p):
name = cfg_aux_textureName(key)
tex = desktop_aux_loadTexture(p.c.cfgDir, p.c.cfgTree[key])
p.textures[name] = tex
# Report finish.
p.ctrl.set("didLoadConfigTextures", True)

+ 1
- 0
py/desktop_Platform.py View File

@@ -4,5 +4,6 @@ class desktop_Platform:
def __init__(self):
self.c = None
self.ctrl = None
self.statics = {}
self.staticSprites = arcade.SpriteList()
self.textures = {}

+ 2
- 0
py/ht_Context.py View File

@@ -4,7 +4,9 @@ class ht_Context:
self.cfgDir = None
self.cfgPath = None
self.cfgTree = {}
self.didCreateConfigStaticSprites = False
self.didLaunch = False
self.didLoadConfigTextures = False
self.recentField = "none"
self.windowAntialiasing = False
self.windowBackgroundColor = "#000000"


Loading…
Cancel
Save