|
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596 |
- #ifndef __MY_BUTTON__
- #define __MY_BUTTON__
-
- #module \
- MyButton
-
- #const SIZE_X 240
- #const SIZE_Y 120
-
- #const ZOOM 0.8
-
- #defcfunc local \
- New \
- int p_posX,\
- int p_posY,\
- int p_bufferId,\
- label p_onClicked
- posX.insNum = p_posX
- posY.insNum = p_posY
- bufferId.insNum = p_bufferId
- onClicked.insNum = p_onClicked
- touching.insNum = False
-
- exists.insNum = True
-
- insNum++
-
- Return insNum - 1
-
- #deffunc local \
- Destroy \
- int p_insId
- exists.p_insId = False
-
- Return
-
- #deffunc local \
- Interval \
- int p_insId,\
- local l_id,\
- local l_touchInfo
- MTList l_id
-
- If stat = 0 {
- touching.p_insId = False
-
- Return
- }
-
- If touching.p_insId {
- Return
- }
-
- MTInfo l_touchInfo, l_id.0
-
- touching.p_insId = True
-
- If l_touchInfo.1 < posX.p_insId - ZOOM * SIZE_X / 2 {
- Return
- }
-
- If l_touchInfo.1 >= posX.p_insId + ZOOM * SIZE_X / 2 {
- Return
- }
-
- If l_touchInfo.2 < posY.p_insId - ZOOM * SIZE_Y / 2 {
- Return
- }
-
- If l_touchInfo.2 >= posY.p_insId + ZOOM * SIZE_Y / 2 {
- Return
- }
-
- GoSub onClicked.p_insId
-
- Return
-
- #deffunc local \
- Draw
- Repeat insNum
- If exists.cnt = False {
- Continue
- }
-
- Pos posX.cnt, posY.cnt
- CelPut bufferId.cnt, 0, ZOOM, ZOOM
- Loop
-
- Interval
-
- Return
-
- #global
-
- #endif ; not __MY_BUTTON__
-
|