Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

61 lines
1.5KB

  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_staticSpriteName(key)
  32. sprite = desktop_aux_createStaticSprite(p, name, p.c.cfgTree[key])
  33. p.statics[name] = sprite
  34. p.staticSprites.append(sprite)
  35. # Report finish.
  36. p.ctrl.set("didCreateConfigStaticSprites", True)
  37. # Load textures
  38. #
  39. # Conditions:
  40. # 1. Config tree has just been parsed
  41. def desktop_loadConfigTextures(p):
  42. if (
  43. p.c.recentField != "cfgTree"
  44. ):
  45. return
  46. for key in p.c.cfgTree:
  47. if (
  48. cld_startswith(key, "texture ")
  49. ):
  50. name = cfg_aux_textureName(key)
  51. tex = desktop_aux_loadTexture(p.c.cfgDir, p.c.cfgTree[key])
  52. p.textures[name] = tex
  53. # Report finish.
  54. p.ctrl.set("didLoadConfigTextures", True)