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.

58 lines
799B

  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. # Convert cell position to screen position
  44. def gui_aux_cellScreenPosition(
  45. c: memory_Context,
  46. pos: [int]
  47. ) -> [int]:
  48. x = pos[0] * c.cellSize
  49. y = c.windowHeight - pos[1] * c.cellSize
  50. return [x, y]
  51. #}