-
Notifications
You must be signed in to change notification settings - Fork 0
/
main copy.cpp
executable file
·75 lines (59 loc) · 1.65 KB
/
main copy.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
#include <string>
#include <3ds.h>
#include <sf2d.h>
#include <sfil.h>
#include "button_png.h"
#include "pressedButton_png.h"
#include "topscr_png.h"
using namespace std;
int main() {
sf2d_init();
sf2d_texture* pressedButton = sfil_load_PNG_buffer(pressedButton_png, SF2D_PLACE_RAM);
sf2d_texture* unpressedButton = sfil_load_PNG_buffer(button_png, SF2D_PLACE_RAM);
sf2d_texture* topScreen = sfil_load_PNG_buffer(topscr_png, SF2D_PLACE_RAM);
int posx = (320 / 2);
int posy = (240 / 2);
int score = 0;
bool pressed = false;
// Main loop
while (aptMainLoop()) {
hidScanInput();
u32 kDown = hidKeysDown();
u32 kHeld = hidKeysHeld();
u32 kUp = hidKeysUp();
if (kDown & KEY_TOUCH) {
pressed=true;
score=score+1;
}
if (kHeld & KEY_TOUCH){
pressed=true;
}
if (kUp & KEY_TOUCH){
pressed=false;
}
if (kDown & KEY_START) {
break;
}
// draw instructions
sf2d_start_frame(GFX_TOP, GFX_LEFT);
sf2d_draw_texture(topScreen, 0, 0);
sf2d_end_frame();
// draw the spidget finner
if (pressed){
sf2d_start_frame(GFX_BOTTOM, GFX_LEFT);
sf2d_draw_texture_rotate(pressedButton, posx, posy, 0.0f);
sf2d_end_frame();
}
if (!pressed){
sf2d_start_frame(GFX_BOTTOM, GFX_LEFT);
sf2d_draw_texture_rotate(unpressedButton, posx, posy, 0.0f);
sf2d_end_frame();
}
sf2d_swapbuffers();
}
sf2d_free_texture(topScreen);
sf2d_free_texture(unpressedButton);
sf2d_free_texture(pressedButton);
sf2d_fini();
return 0;
}