update to latest libt for 5.x

This commit is contained in:
vgmoose 2018-07-22 01:28:37 -04:00
parent dbcb63a93f
commit 6ff952a3fe
6 changed files with 27 additions and 28 deletions

View File

@ -16,7 +16,7 @@ all: $(PROGRAM).nro
$(AS) $(AS_FLAGS) $< -filetype=obj -o $@ $(AS) $(AS_FLAGS) $< -filetype=obj -o $@
$(PROGRAM).nro.so: ${OBJ} $(LIBTRANSITOR_NRO_LIB) $(LIBTRANSISTOR_COMMON_LIBS) $(PROGRAM).nro.so: ${OBJ} $(LIBTRANSITOR_NRO_LIB) $(LIBTRANSISTOR_COMMON_LIBS)
$(LD) $(LD_FLAGS) -o $@ ${OBJ} $(LIBTRANSISTOR_NRO_LDFLAGS) $(LD) $(LD_FLAGS) -lSDL2 -o $@ ${OBJ} $(LIBTRANSISTOR_NRO_LDFLAGS)
clean: clean:
rm -rf *.o *.nso *.nro *.so rm -rf *.o *.nso *.nro *.so

3
draw.c
View File

@ -30,8 +30,7 @@ Graphics* init()
void deinit(struct Graphics* g) void deinit(struct Graphics* g)
{ {
SDL_Delay(1); SDL_VideoQuit();
SDL_DestroyWindow(g->window);
SDL_Quit(); SDL_Quit();
free(g); free(g);

16
hello.c
View File

@ -36,16 +36,16 @@ int main(){
buttons_r = (last_buttons & (~pad_data.btns_h)); buttons_r = (last_buttons & (~pad_data.btns_h));
/*if(pad_data.btns_h & BUTTON_LEFT){ /*if(pad_data.btns_h & PAD_BUTTON_LEFT){
x--; x--;
} }
if(pad_data.btns_h & BUTTON_RIGHT){ if(pad_data.btns_h & PAD_BUTTON_RIGHT){
x++; x++;
} }
if(pad_data.btns_h & BUTTON_DOWN){ if(pad_data.btns_h & PAD_BUTTON_DOWN){
y++; y++;
} }
if(pad_data.btns_h & BUTTON_UP){ if(pad_data.btns_h & PAD_BUTTON_UP){
y--; y--;
}*/ }*/
@ -57,12 +57,12 @@ int main(){
if(game_state == IDLE){ if(game_state == IDLE){
drawStringf(g, x, y, "Press MINUS to start!"); drawStringf(g, x, y, "Press MINUS to start!");
if(pad_data.btns_h & BUTTON_MINUS){ if(pad_data.btns_h & PAD_BUTTON_MINUS){
game_state = IN_GAME; game_state = IN_GAME;
} }
}else if(game_state == IN_GAME){ }else if(game_state == IN_GAME){
frame_counter++; frame_counter++;
if(buttons_r & BUTTON_A){ if(buttons_r & PAD_BUTTON_A){
button_count++; button_count++;
} }
float secLeft = (round_duration - frame_counter) /60.0f; float secLeft = (round_duration - frame_counter) /60.0f;
@ -85,13 +85,13 @@ int main(){
if(isHighscore){ if(isHighscore){
drawStringf(g, x, y+4,"NEW HIGHSCORE!"); drawStringf(g, x, y+4,"NEW HIGHSCORE!");
} }
if(pad_data.btns_h & BUTTON_MINUS){ if(pad_data.btns_h & PAD_BUTTON_MINUS){
game_state = IN_GAME; game_state = IN_GAME;
isHighscore = 0; isHighscore = 0;
} }
} }
if(pad_data.btns_h & BUTTON_PLUS){ if(pad_data.btns_h & PAD_BUTTON_PLUS){
break; break;
} }
update(g); update(g);

BIN
hello.nro

Binary file not shown.

16
input.c
View File

@ -10,14 +10,14 @@ void PADDestroy(){
} }
static void readInputInternal(struct PADData* data,hid_controller_state_entry_t ent ){ static void readInputInternal(struct PADData* data,hid_controller_state_entry_t ent ){
data->btns_h |= ((ent.button_state & JOYPAD_A)? BUTTON_A : 0); data->btns_h |= ((ent.button_state & JOYPAD_A)? PAD_BUTTON_A : 0);
data->btns_h |= ((ent.button_state & JOYPAD_B)? BUTTON_B : 0); data->btns_h |= ((ent.button_state & JOYPAD_B)? PAD_BUTTON_B : 0);
data->btns_h |= ((ent.button_state & JOYPAD_UP)? BUTTON_UP : 0); data->btns_h |= ((ent.button_state & JOYPAD_UP)? PAD_BUTTON_UP : 0);
data->btns_h |= ((ent.button_state & JOYPAD_DOWN)? BUTTON_DOWN : 0); data->btns_h |= ((ent.button_state & JOYPAD_DOWN)? PAD_BUTTON_DOWN : 0);
data->btns_h |= ((ent.button_state & JOYPAD_LEFT)? BUTTON_LEFT : 0); data->btns_h |= ((ent.button_state & JOYPAD_LEFT)? PAD_BUTTON_LEFT : 0);
data->btns_h |= ((ent.button_state & JOYPAD_RIGHT)? BUTTON_RIGHT : 0); data->btns_h |= ((ent.button_state & JOYPAD_RIGHT)? PAD_BUTTON_RIGHT : 0);
data->btns_h |= ((ent.button_state & JOYPAD_START)? BUTTON_PLUS : 0); data->btns_h |= ((ent.button_state & JOYPAD_START)? PAD_BUTTON_PLUS : 0);
data->btns_h |= ((ent.button_state & JOYPAD_SELECT)? BUTTON_MINUS : 0); data->btns_h |= ((ent.button_state & JOYPAD_SELECT)? PAD_BUTTON_MINUS : 0);
} }
void PADRead(struct PADData* data){ void PADRead(struct PADData* data){

16
input.h
View File

@ -1,14 +1,14 @@
// "PAD" controls (unique to us) // "PAD" controls (unique to us)
#define BUTTON_LEFT 0b00000001 #define PAD_BUTTON_LEFT 0b00000001
#define BUTTON_RIGHT 0b00000010 #define PAD_BUTTON_RIGHT 0b00000010
#define BUTTON_UP 0b00000100 #define PAD_BUTTON_UP 0b00000100
#define BUTTON_DOWN 0b00001000 #define PAD_BUTTON_DOWN 0b00001000
#define BUTTON_MINUS 0b00010000 #define PAD_BUTTON_MINUS 0b00010000
#define BUTTON_PLUS 0b00100000 #define PAD_BUTTON_PLUS 0b00100000
#define BUTTON_A 0b01000000 #define PAD_BUTTON_A 0b01000000
#define BUTTON_B 0b10000000 #define PAD_BUTTON_B 0b10000000
// switch controls // switch controls
#define JOYPAD_LEFT 0x1000 #define JOYPAD_LEFT 0x1000