Research portable Memory game | Исследовать портируемую игру Память
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.

gui.py 1.6KB

4 months ago
4 months ago
4 months ago
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. from memory_Context import *
  2. from gui_TextureDescription import *
  3. from llm import *
  4. # Generate tile position
  5. #
  6. # Conditions:
  7. # 1.
  8. @llm_by_value
  9. def gui_generateTilePositions(
  10. c: memory_Context
  11. ) -> memory_Context:
  12. if (
  13. c.recentField == "windowHeight" or
  14. c.recentField == "windowWidth"
  15. ):
  16. tds: list[gui_TextureDescription] = []
  17. for id in range(0, c.tileImageCount):
  18. td = gui_createTextureDescription()
  19. td.fileName = c.tileImage
  20. td.height = c.tileImageHeight
  21. td.width = c.tileImageWidth
  22. td.x = id * c.tileImageWidth
  23. td.y = 0
  24. tds.append(td)
  25. #}
  26. c.textureDescriptions = tds
  27. c.recentField = "textureDescriptions"
  28. return c
  29. #}
  30. c.recentField = "none"
  31. return c
  32. #}
  33. # Generate textures descriptions
  34. #
  35. # Conditions:
  36. # 1. tileImage or tileImageCount or tileImageHeight or tileImageWidth has just changed
  37. # 2. tileImage, tileImageCount, tileImageHeight, tileImageWidth are not empty
  38. @llm_by_value
  39. def gui_generateTextureDescriptions(
  40. c: memory_Context
  41. ) -> memory_Context:
  42. if (
  43. c.recentField == "tileImage" or
  44. c.recentField == "tileImageCount" or
  45. c.recentField == "tileImageHeight" or
  46. c.recentField == "tileImageWidth"
  47. ):
  48. tds: list[gui_TextureDescription] = []
  49. for id in range(0, c.tileImageCount):
  50. td = gui_createTextureDescription()
  51. td.fileName = c.tileImage
  52. td.height = c.tileImageHeight
  53. td.width = c.tileImageWidth
  54. td.x = id * c.tileImageWidth
  55. td.y = 0
  56. tds.append(td)
  57. #}
  58. c.textureDescriptions = tds
  59. c.recentField = "textureDescriptions"
  60. return c
  61. #}
  62. c.recentField = "none"
  63. return c
  64. #}