|
| 1 | +%include inflator/assert |
| 2 | + |
| 3 | +costumes "inflator/button_detector/assets/add to studio.svg" as "button_detector.gs//add to studio"; |
| 4 | +costumes "inflator/button_detector/assets/cancel comment.svg" as "button_detector.gs//cancel comment"; |
| 5 | +costumes "inflator/button_detector/assets/copy link.svg" as "button_detector.gs//copy link"; |
| 6 | +costumes "inflator/button_detector/assets/fave.svg" as "button_detector.gs//fave"; |
| 7 | +costumes "inflator/button_detector/assets/fullscreen.svg" as "button_detector.gs//fullscreen"; |
| 8 | +costumes "inflator/button_detector/assets/green flag.svg" as "button_detector.gs//green flag"; |
| 9 | +costumes "inflator/button_detector/assets/love.svg" as "button_detector.gs//love"; |
| 10 | +costumes "inflator/button_detector/assets/pfp.svg" as "button_detector.gs//pfp"; |
| 11 | +costumes "inflator/button_detector/assets/post comment.svg" as "button_detector.gs//post comment"; |
| 12 | +costumes "inflator/button_detector/assets/remix.svg" as "button_detector.gs//remix"; |
| 13 | +costumes "inflator/button_detector/assets/see data.svg" as "button_detector.gs//see data"; |
| 14 | +costumes "inflator/button_detector/assets/see inside.svg" as "button_detector.gs//see inside"; |
| 15 | +costumes "inflator/button_detector/assets/stop button.svg" as "button_detector.gs//stop button"; |
| 16 | + |
| 17 | +enum ScratchButtons { |
| 18 | + add_to_studio= "add to studio", |
| 19 | + cancel_comment= "cancel comment", |
| 20 | + copy_link= "copy link", |
| 21 | + fave= "fave", |
| 22 | + fullscreen= "fullscreen", |
| 23 | + green_flag= "green flag", |
| 24 | + love= "love", |
| 25 | + pfp= "pfp", |
| 26 | + post_comment= "post comment", |
| 27 | + remix= "remix", |
| 28 | + see_data= "see data", |
| 29 | + see_inside= "see inside", |
| 30 | + stop_button= "stop button", |
| 31 | + none |
| 32 | +} |
| 33 | + |
| 34 | +%define DETECT_BUTTON(name) \ |
| 35 | + switch_costume "button_detector.gs//" & ScratchButtons.name; \ |
| 36 | + if touching("_mouse_") { \ |
| 37 | + switch_costume og_cos; \ |
| 38 | + return ScratchButtons.name; \ |
| 39 | + } |
| 40 | + |
| 41 | +func button_detector() { |
| 42 | + assert_eq x_position(), 0, "x_position(): "; |
| 43 | + assert_eq y_position(), 0, "y_position(): "; |
| 44 | + assert_eq size(), 100, "size(): "; |
| 45 | + assert_eq direction(), 90, "direction(): "; |
| 46 | + |
| 47 | + local og_cos = costume_number(); |
| 48 | + DETECT_BUTTON(add_to_studio); |
| 49 | + DETECT_BUTTON(cancel_comment); |
| 50 | + DETECT_BUTTON(copy_link); |
| 51 | + DETECT_BUTTON(fave); |
| 52 | + DETECT_BUTTON(fullscreen); |
| 53 | + DETECT_BUTTON(green_flag); |
| 54 | + DETECT_BUTTON(love); |
| 55 | + DETECT_BUTTON(pfp); |
| 56 | + DETECT_BUTTON(post_comment); |
| 57 | + DETECT_BUTTON(remix); |
| 58 | + DETECT_BUTTON(see_data); |
| 59 | + DETECT_BUTTON(see_inside); |
| 60 | + DETECT_BUTTON(stop_button); |
| 61 | + |
| 62 | + switch_costume og_cos; |
| 63 | + return ScratchButtons.none; |
| 64 | +} |
0 commit comments