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.

main-gui.py 3.5KB

6 months ago
6 months ago
5 months ago
6 months ago
6 months ago
5 months ago
6 months ago
6 months ago
5 months ago
6 months ago
5 months ago
6 months ago
6 months ago
6 months ago
6 months ago
5 months ago
6 months ago
5 months ago
6 months ago
6 months ago
5 months ago
5 months ago
5 months ago
6 months ago
5 months ago
5 months ago
5 months ago
6 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
6 months ago
6 months ago
5 months ago
5 months ago
5 months ago
6 months ago
5 months ago
6 months ago
6 months ago
5 months ago
5 months ago
6 months ago
6 months ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. import arcade
  2. from cli import *
  3. from cli_test import *
  4. from ctx import *
  5. from ctx_test2 import *
  6. from desktop import *
  7. from desktop_Platform import *
  8. from desktop_SequentialTimer import *
  9. from desktop_Window import *
  10. from gui import *
  11. from gui_aux_test import *
  12. from gui_test import *
  13. from llm_test import *
  14. from llm_test_Python import *
  15. from memory_test import *
  16. import sys
  17. print(ctx_test_Controller_executeFunctions_registerFunction_set())
  18. print(ctx_test_Controller_processQueue())
  19. print(ctx_test_Controller_registerFieldCallback_match())
  20. print(ctx_test_Controller_registerFieldCallback_mismatch())
  21. print(ctx_test_memoryContext_field())
  22. print(ctx_test_memoryContext_setField())
  23. print(llm_test_Python_copyByValue())
  24. print(llm_test_isDigit_digit())
  25. print(llm_test_isDigit_notDigit())
  26. print(llm_test_strToInt())
  27. print(memory_test_detectMismatchedItems())
  28. print(memory_test_detectMismatchedItems_itemTwice())
  29. print(memory_test_detectVictory())
  30. print(memory_test_generateConstPlayfield())
  31. print(memory_test_hideMatchingItems())
  32. print(memory_test_selectItem_1x())
  33. print(memory_test_selectItem_2x())
  34. print(memory_test_selectItem_3x())
  35. print(cli_test_exit_e())
  36. print(cli_test_exit_exit())
  37. print(cli_test_exit_victory())
  38. print(cli_test_exit_q())
  39. print(cli_test_exit_quit())
  40. print(cli_test_goOn())
  41. print(cli_test_greetUser())
  42. print(cli_test_showHelp_h())
  43. print(cli_test_showHelp_help())
  44. print(cli_test_selectItem())
  45. print(cli_test_promptSecondItemSelection())
  46. print(cli_test_reportMatchedItems())
  47. print(cli_test_reportMismatchedItems())
  48. print(cli_test_reportVictory())
  49. print(test_gui_aux_cellPositions())
  50. print(test_gui_generateTextureDescriptions())
  51. print(test_gui_generateTilePositions())
  52. ctrl = ctx_Controller(memory_createContext())
  53. ctrl.registerFunctions([
  54. # cli_exit,
  55. # cli_goOn,
  56. # cli_greetUser,
  57. # cli_promptSecondItemSelection,
  58. # cli_reportMatchedItems,
  59. # cli_reportMismatchedItems,
  60. # cli_reportVictory,
  61. # cli_selectItem,
  62. # cli_showHelp,
  63. gui_generateTextureDescriptions,
  64. gui_generateTilePositions,
  65. memory_detectMismatchedItems,
  66. memory_detectVictory,
  67. memory_generateConstPlayfield,
  68. memory_hideMatchingItems,
  69. memory_selectItem,
  70. ])
  71. def printDbg(c):
  72. print(f"Dbg key/value: '{c.recentField}'/'{c.field(c.recentField)}'")
  73. ctrl.registerCallback(printDbg)
  74. ctrl.registerFieldCallback("exit", lambda c: sys.exit(0))
  75. p = desktop_Platform()
  76. p.ctrl = ctrl
  77. p.sequentialTimer = desktop_SequentialTimer()
  78. p.sequentialTimer.callback = lambda key, value: ctrl.set(key, value)
  79. # Bind platform to context changes.
  80. def process(c):
  81. # Copy context to platform.
  82. p.c = c
  83. # Perform context dependent calls of desktop functions.
  84. # Similar to context functions, but no platform is returned.
  85. desktop_deselectMismatchedTiles(p)
  86. desktop_displaySelectedTile(p)
  87. desktop_hideMatchingTiles(p)
  88. desktop_scheduleHidingOfMatchingTiles(p)
  89. desktop_scheduleDeselectionOfMismatchedTiles(p)
  90. ctrl.registerCallback(process)
  91. ctrl.set("didLaunch", True)
  92. ctrl.set("playfieldSize", 2)
  93. ctrl.set("cellSize", 25)
  94. ctrl.set("deselectMismatchedTilesDelay", 500)
  95. ctrl.set("hideMatchingTilesDelay", 500)
  96. ctrl.set("tileImage", "res/tiles.png")
  97. ctrl.set("tileImageCount", 3)
  98. ctrl.set("tileImageHeight", 100)
  99. ctrl.set("tileImageWidth", 75)
  100. ctrl.set("windowWidth", 900)
  101. ctrl.set("windowHeight", 600)
  102. ctrl.set("windowAntialiasing", False)
  103. ctrl.set("windowBackgroundColor", "#ffffff")
  104. ctrl.set("windowTitle", "OGS Memory")
  105. desktop_loadTextures(p)
  106. desktop_createDeselectedTiles(p)
  107. desktop_createSelectedTiles(p)
  108. wnd = desktop_Window(p)
  109. arcade.run()