Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

55 строки
1.1KB

  1. import arcade
  2. from cld import *
  3. from desktop_Platform import *
  4. # Convert String config value to Bool or Float if possible
  5. def desktop_aux_convertValue(
  6. value: str
  7. ) -> any:
  8. # Bool.
  9. if (
  10. value == "false"
  11. ):
  12. return False
  13. elif (
  14. value == "true"
  15. ):
  16. return True
  17. # Float.
  18. elif (
  19. cld_isdigit(value)
  20. ):
  21. return float(value)
  22. # String.
  23. return value
  24. def desktop_aux_createStaticSprite(
  25. p: desktop_Platform,
  26. name: str,
  27. desc: dict[str, str]
  28. ):
  29. sp = arcade.Sprite()
  30. sp.guid = name
  31. texName = desc["texture"]
  32. sp.texture = p.textures[texName]
  33. # Position.
  34. sp.left = float(desc["left"])
  35. sp.top = float(desc["top"])
  36. # Visibility.
  37. sp.visible = True if desc["visible"] == "true" else False
  38. return sp
  39. def desktop_aux_loadTexture(
  40. resDir: str,
  41. desc: dict[str, str]
  42. ):
  43. path = resDir + "/" + desc["file"]
  44. return arcade.load_texture(
  45. path,
  46. x = float(desc["x"]),
  47. y = float(desc["y"]),
  48. width = float(desc["width"]),
  49. height = float(desc["height"])
  50. )