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.

4 maanden geleden
4 maanden geleden
4 maanden geleden
4 maanden geleden
4 maanden geleden
4 maanden geleden
4 maanden geleden
4 maanden geleden
4 maanden geleden
4 maanden geleden
4 maanden geleden
4 maanden geleden
4 maanden geleden
4 maanden geleden
4 maanden geleden
4 maanden geleden
4 maanden geleden
4 maanden geleden
4 maanden geleden
4 maanden geleden
4 maanden geleden
4 maanden geleden
4 maanden geleden
4 maanden geleden
4 maanden geleden
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. from gui_aux import *
  2. from gui_TextureDescription import *
  3. from llm import *
  4. from memory_Context import *
  5. # Generate textures descriptions
  6. #
  7. # Conditions:
  8. # 1. tileImage or tileImageCount or tileImageHeight or tileImageWidth has just changed
  9. # 2. tileImage, tileImageCount, tileImageHeight, tileImageWidth are not empty
  10. @llm_by_value
  11. def gui_generateTextureDescriptions(
  12. c: memory_Context
  13. ) -> memory_Context:
  14. if (
  15. c.recentField == "tileImage" or
  16. c.recentField == "tileImageCount" or
  17. c.recentField == "tileImageHeight" or
  18. c.recentField == "tileImageWidth"
  19. ):
  20. tds: list[gui_TextureDescription] = []
  21. for id in range(0, c.tileImageCount):
  22. td = gui_createTextureDescription()
  23. td.fileName = c.tileImage
  24. td.height = c.tileImageHeight
  25. td.width = c.tileImageWidth
  26. td.x = id * c.tileImageWidth
  27. td.y = 0
  28. tds.append(td)
  29. #}
  30. c.textureDescriptions = tds
  31. c.recentField = "textureDescriptions"
  32. return c
  33. #}
  34. c.recentField = "none"
  35. return c
  36. #}
  37. # Generate tile positions
  38. #
  39. # Conditions:
  40. # 1. cellSize, playField, windowHeight, or windowWidth has changed and none of them is zero
  41. @llm_by_value
  42. def gui_generateTilePositions(
  43. c: memory_Context
  44. ) -> memory_Context:
  45. if (
  46. (
  47. c.recentField != "cellSize" and
  48. c.recentField != "playfieldSize" and
  49. c.recentField != "windowHeight" and
  50. c.recentField != "windowWidth"
  51. ) or
  52. (
  53. c.cellSize == 0 or
  54. c.playfieldSize == 0 or
  55. c.windowHeight == 0 or
  56. c.windowWidth == 0
  57. )
  58. ):
  59. c.recentField = "none"
  60. return c
  61. #}
  62. # Assume window size is an integer multiple of cell size.
  63. widthInCells = c.windowWidth / c.cellSize
  64. heightInCells = c.windowHeight / c.cellSize
  65. positions = gui_aux_cellPositions(c.playfieldSize)
  66. poss = []
  67. for i in range(0, len(positions)):
  68. p = positions[i]
  69. pos = [p[0] * c.cellSize, p[1] * c.cellSize]
  70. poss.append(pos)
  71. #}
  72. #tile.center_x = CELL * 2 + p[0] * CELL
  73. #tile.center_y = HEIGHT - CELL * 2 - p[1] * CELL
  74. c.tilePositions = poss
  75. c.recentField = "tilePositions"
  76. return c
  77. #}