You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

60 line
1.4KB

  1. from cfg_aux import *
  2. from cld import *
  3. from desktop_aux import *
  4. from desktop_Platform import *
  5. # Pass config init key-value pairs to context controller
  6. #
  7. # Conditions:
  8. # 1. Config tree has just been parsed
  9. def desktop_applyConfigInit(p):
  10. if (
  11. p.c.recentField != "cfgTree"
  12. ):
  13. return
  14. for key in p.c.cfgTree["init"]:
  15. val = p.c.cfgTree["init"][key]
  16. value = desktop_aux_convertValue(val)
  17. p.ctrl.set(key, value)
  18. # Create static sprites
  19. #
  20. # Conditions:
  21. # 1. Config textures has just been loaded
  22. def desktop_createConfigStaticSprites(p):
  23. if (
  24. p.c.recentField != "didLoadConfigTextures"
  25. ):
  26. return
  27. for key in p.c.cfgTree:
  28. if (
  29. cld_startswith(key, "static ")
  30. ):
  31. name = cfg_aux_spriteName(key)
  32. sprite = desktop_aux_createSprite(p.c.cfgTree[key])
  33. p.statics[name] = sprite
  34. # Report finish.
  35. p.ctrl.set("didCreateConfigStaticSprites", True)
  36. # Load textures
  37. #
  38. # Conditions:
  39. # 1. Config tree has just been parsed
  40. def desktop_loadConfigTextures(p):
  41. if (
  42. p.c.recentField != "cfgTree"
  43. ):
  44. return
  45. for key in p.c.cfgTree:
  46. if (
  47. cld_startswith(key, "texture ")
  48. ):
  49. name = cfg_aux_textureName(key)
  50. tex = desktop_aux_loadTexture(p.c.cfgDir, p.c.cfgTree[key])
  51. p.textures[name] = tex
  52. # Report finish.
  53. p.ctrl.set("didLoadConfigTextures", True)