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_aux.py 1.0KB

3 kuukautta sitten
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. from memory_Context import *
  2. # Generate grid positions in cell dimensions
  3. #
  4. # Conditions:
  5. # 1. 2x2 grid
  6. # 2. 4x4 grid
  7. def gui_aux_cellGridPositions(
  8. size: int
  9. ) -> [[int]]:
  10. if (
  11. size == 2
  12. ):
  13. return [
  14. [14, 7],
  15. [19, 7],
  16. [14, 13],
  17. [19, 13],
  18. ]
  19. #}
  20. if (
  21. size == 4
  22. ):
  23. return [
  24. [9, 1],
  25. [14, 1],
  26. [19, 1],
  27. [24, 1],
  28. [9, 7],
  29. [14, 7],
  30. [19, 7],
  31. [24, 7],
  32. [9, 13],
  33. [14, 13],
  34. [19, 13],
  35. [24, 13],
  36. [9, 19],
  37. [14, 19],
  38. [19, 19],
  39. [24, 19],
  40. ]
  41. #}
  42. #}
  43. # Generate positions in cell dimensions for Harm game
  44. def gui_aux_cellHarmPositions(
  45. ) -> [[int]]:
  46. return [
  47. [4, 6],
  48. [9, 6],
  49. [14, 6],
  50. [19, 6],
  51. [24, 6],
  52. [29, 6],
  53. [4, 12],
  54. [9, 12],
  55. [14, 12],
  56. [4, 18],
  57. [9, 18],
  58. [14, 18],
  59. ]
  60. #}
  61. # Convert cell position to screen position
  62. def gui_aux_cellScreenPosition(
  63. c: memory_Context,
  64. pos: [int]
  65. ) -> [int]:
  66. x = pos[0] * c.cellSize
  67. y = c.windowHeight - pos[1] * c.cellSize
  68. return [x, y]
  69. #}