12
src/main.c
12
src/main.c
@@ -100,6 +100,7 @@ menu_window_state menu_active_window;
|
|||||||
uint8_t menu_selected_window; // 0 is how to play, 1 is ship color select, 2 is game
|
uint8_t menu_selected_window; // 0 is how to play, 1 is ship color select, 2 is game
|
||||||
uint8_t menu_left_right_pressed; // 0 is none, 1 is left, 2 is right
|
uint8_t menu_left_right_pressed; // 0 is none, 1 is left, 2 is right
|
||||||
uint8_t last_menu_left_right_pressed; // what we pressed last update loop
|
uint8_t last_menu_left_right_pressed; // what we pressed last update loop
|
||||||
|
uint8_t menu_needs_to_switch;
|
||||||
timing_timer menu_selected_window_input_delay_timer = {0, 300, 0}; // 0 as starting time, 300 ms timeout, not elapsed
|
timing_timer menu_selected_window_input_delay_timer = {0, 300, 0}; // 0 as starting time, 300 ms timeout, not elapsed
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -140,6 +141,7 @@ void init_variables()
|
|||||||
menu_selected_window = MENU_WINDOW_TUTORIAL;
|
menu_selected_window = MENU_WINDOW_TUTORIAL;
|
||||||
menu_left_right_pressed = MENU_LEFT_RIGHT_NONE;
|
menu_left_right_pressed = MENU_LEFT_RIGHT_NONE;
|
||||||
last_menu_left_right_pressed = MENU_LEFT_RIGHT_NONE;
|
last_menu_left_right_pressed = MENU_LEFT_RIGHT_NONE;
|
||||||
|
menu_needs_to_switch = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ################################################################
|
// ################################################################
|
||||||
@@ -439,6 +441,9 @@ void update_menu()
|
|||||||
if (menu_selected_window_input_delay_timer.elapsed)
|
if (menu_selected_window_input_delay_timer.elapsed)
|
||||||
{
|
{
|
||||||
if (menu_left_right_pressed == MENU_LEFT_RIGHT_LEFT) // left
|
if (menu_left_right_pressed == MENU_LEFT_RIGHT_LEFT) // left
|
||||||
|
{
|
||||||
|
menu_needs_to_switch = !menu_needs_to_switch;
|
||||||
|
if (menu_needs_to_switch)
|
||||||
{
|
{
|
||||||
menu_selected_window -= 1;
|
menu_selected_window -= 1;
|
||||||
if (menu_selected_window == 255)
|
if (menu_selected_window == 255)
|
||||||
@@ -446,8 +451,12 @@ void update_menu()
|
|||||||
menu_left_right_pressed = MENU_LEFT_RIGHT_NONE;
|
menu_left_right_pressed = MENU_LEFT_RIGHT_NONE;
|
||||||
menu_selected_window_input_delay_timer.elapsed = 0;
|
menu_selected_window_input_delay_timer.elapsed = 0;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (menu_left_right_pressed == MENU_LEFT_RIGHT_RIGHT) // right
|
if (menu_left_right_pressed == MENU_LEFT_RIGHT_RIGHT) // right
|
||||||
|
{
|
||||||
|
menu_needs_to_switch = !menu_needs_to_switch;
|
||||||
|
if (menu_needs_to_switch)
|
||||||
{
|
{
|
||||||
menu_selected_window += 1;
|
menu_selected_window += 1;
|
||||||
if (menu_selected_window == 3)
|
if (menu_selected_window == 3)
|
||||||
@@ -457,6 +466,7 @@ void update_menu()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void update_game()
|
void update_game()
|
||||||
{
|
{
|
||||||
@@ -606,7 +616,6 @@ void update()
|
|||||||
if (pad.buttons & SCE_CTRL_RIGHT)
|
if (pad.buttons & SCE_CTRL_RIGHT)
|
||||||
menu_left_right_pressed = MENU_LEFT_RIGHT_RIGHT;
|
menu_left_right_pressed = MENU_LEFT_RIGHT_RIGHT;
|
||||||
|
|
||||||
|
|
||||||
ctrl_input_get_leftstick(&pad, &left_stick);
|
ctrl_input_get_leftstick(&pad, &left_stick);
|
||||||
|
|
||||||
// ctrl_input_get_rightstick(&pad, &right_stick);
|
// ctrl_input_get_rightstick(&pad, &right_stick);
|
||||||
@@ -638,7 +647,6 @@ void update()
|
|||||||
// ------------------------ DRAW FUNCTIONS ------------------
|
// ------------------------ DRAW FUNCTIONS ------------------
|
||||||
// ################################################################
|
// ################################################################
|
||||||
|
|
||||||
|
|
||||||
void draw_start()
|
void draw_start()
|
||||||
{
|
{
|
||||||
unsigned int text_color;
|
unsigned int text_color;
|
||||||
|
|||||||
Reference in New Issue
Block a user