すくすくゴートうちゃん Android 版(黒歴史)
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.

my_button.mod.hsp 1.2 KiB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. #ifndef __MY_BUTTON__
  2. #define __MY_BUTTON__
  3. #module \
  4. MyButton
  5. #const SIZE_X 240
  6. #const SIZE_Y 120
  7. #const ZOOM 0.8
  8. #defcfunc local \
  9. New \
  10. int p_posX,\
  11. int p_posY,\
  12. int p_bufferId,\
  13. label p_onClicked
  14. posX.insNum = p_posX
  15. posY.insNum = p_posY
  16. bufferId.insNum = p_bufferId
  17. onClicked.insNum = p_onClicked
  18. touching.insNum = False
  19. exists.insNum = True
  20. insNum++
  21. Return insNum - 1
  22. #deffunc local \
  23. Destroy \
  24. int p_insId
  25. exists.p_insId = False
  26. Return
  27. #deffunc local \
  28. Interval \
  29. int p_insId,\
  30. local l_id,\
  31. local l_touchInfo
  32. MTList l_id
  33. If stat = 0 {
  34. touching.p_insId = False
  35. Return
  36. }
  37. If touching.p_insId {
  38. Return
  39. }
  40. MTInfo l_touchInfo, l_id.0
  41. touching.p_insId = True
  42. If l_touchInfo.1 < posX.p_insId - ZOOM * SIZE_X / 2 {
  43. Return
  44. }
  45. If l_touchInfo.1 >= posX.p_insId + ZOOM * SIZE_X / 2 {
  46. Return
  47. }
  48. If l_touchInfo.2 < posY.p_insId - ZOOM * SIZE_Y / 2 {
  49. Return
  50. }
  51. If l_touchInfo.2 >= posY.p_insId + ZOOM * SIZE_Y / 2 {
  52. Return
  53. }
  54. GoSub onClicked.p_insId
  55. Return
  56. #deffunc local \
  57. Draw
  58. Repeat insNum
  59. If exists.cnt = False {
  60. Continue
  61. }
  62. Pos posX.cnt, posY.cnt
  63. CelPut bufferId.cnt, 0, ZOOM, ZOOM
  64. Loop
  65. Interval
  66. Return
  67. #global
  68. #endif ; not __MY_BUTTON__