overlayButtons.dd 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. (include "overlayButtons.ddh")
  2. (class_function OverlayButtons void create (group)
  3. (group
  4. (dd_matrix_identity this.previousLoc)
  5. (= this.cardToShow 0)
  6. (= this.isLookingAtCard 0)
  7. (= this.hasConfirmed 0)
  8. (this.bgMesh.load (asset "assets/overlay_background.asset" DD_PLY))
  9. (= this.bg_rotation 0)
  10. )
  11. )
  12. (class_function OverlayButtons void update (group)
  13. (group
  14. (= this.bg_rotation (+ this.bg_rotation 0.3))
  15. )
  16. )
  17. # draw the card with its transformation matrix
  18. (class_function OverlayButtons void draw (group)
  19. (group
  20. (if this.cardToShow
  21. (group
  22. (dd_matrix_push)
  23. (this.cardToShow.applyMatrix)
  24. (dd_translatef 0 0 -0.1)
  25. (dd_rotatef this.bg_rotation 0 0 1)
  26. (this.bgMesh.draw)
  27. (dd_matrix_pop)
  28. )
  29. )
  30. )
  31. )
  32. (class_function OverlayButtons void clean (group)
  33. (group
  34. )
  35. )
  36. (class_function OverlayButtons void lookAt (group int x int y)
  37. (group
  38. (if (&& (> x -6) (< x 6)
  39. (> y -3) (< y 14)
  40. )
  41. (group
  42. (= this.isLookingAtCard 1)
  43. (dd_matrix_identity this.cardToShow.target)
  44. (dd_matrix_translate this.cardToShow.target 0 4.2 3)
  45. (dd_matrix_scale this.cardToShow.target 1.1 1.1 1.1)
  46. )
  47. (group
  48. (= this.isLookingAtCard 0)
  49. (dd_matrix_identity this.cardToShow.target)
  50. (dd_matrix_translate this.cardToShow.target 0 4.2 3)
  51. )
  52. )
  53. )
  54. )
  55. (class_function OverlayButtons void click (group)
  56. (group
  57. (if this.isLookingAtCard
  58. (group
  59. (= this.isLookingAtCard 0)
  60. (dd_matrix_copy this.cardToShow.target this.previousLoc)
  61. (= this.cardToShow 0)
  62. )
  63. )
  64. )
  65. )
  66. (class_function OverlayButtons void setCard (group Card c)
  67. (group
  68. (= this.isLookingAtCard 0)
  69. (dd_matrix_copy this.previousLoc c.target)
  70. (dd_matrix_identity c.target)
  71. (dd_matrix_translate c.target 0 4.2 3)
  72. (= this.cardToShow c)
  73. )
  74. )