Prevent Mario from getting stuck outside of menu

This commit is contained in:
Llennpie 2023-04-03 21:13:12 -04:00
parent 1d4dc5546d
commit ef17e4619a
3 changed files with 28 additions and 21 deletions

View file

@ -238,12 +238,13 @@ void saturn_imgui_update() {
if (ImGui::BeginMenu("Menu")) {
windowCcEditor = false;
if (ImGui::MenuItem(ICON_FK_WINDOW_MAXIMIZE " Show UI", translate_bind_to_name(configKeyShowMenu[0]), showMenu)) showMenu = !showMenu;
if (ImGui::MenuItem(ICON_FK_WINDOW_MAXIMIZE " Show UI", translate_bind_to_name(configKeyShowMenu[0]), showMenu)) {
showMenu = !showMenu;
if (!showMenu) accept_text_input = true;
}
if (ImGui::MenuItem(ICON_FK_WINDOW_MINIMIZE " Show Status Bars", NULL, showStatusBars)) showStatusBars = !showStatusBars;
ImGui::Separator();
if (ImGui::MenuItem("Stats", NULL, windowStats == true)) {
windowStats = !windowStats;
}
if (ImGui::MenuItem("Stats", NULL, windowStats == true)) windowStats = !windowStats;
if (ImGui::MenuItem(ICON_FK_COG " Settings", NULL, windowSettings == true)) {
windowSettings = !windowSettings;
k_popout_open = false;
@ -431,7 +432,8 @@ uint32_t startFrame = 0;
uint32_t endFrame = 60;
int endFrameText = 60;
void saturn_keyframe_popout(float* edit_value, string value_name, string id) {
template <typename T>
void saturn_keyframe_popout(const T &edit_value, string value_name, string id) {
string buttonLabel = ICON_FK_LINK "###kb_" + id;
string windowLabel = "Timeline###kw_" + id;

View file

@ -11,7 +11,8 @@ extern void imgui_update_theme();
extern void imgui_bundled_tooltip(const char*);
extern void imgui_bundled_help_marker(const char*);
extern void imgui_bundled_space(float, const char*, const char*);
extern void saturn_keyframe_popout(float*, std::string, std::string);
template <typename T>
extern void saturn_keyframe_popout(const T &edit_value, std::string, std::string);
extern bool showMenu;
extern int currentMenu;

View file

@ -143,31 +143,35 @@ void saturn_update() {
// Keybinds
if (accept_text_input && mario_exists) {
if (gPlayer1Controller->buttonPressed & U_JPAD) camera_frozen = !camera_frozen;
if (gPlayer1Controller->buttonPressed & D_JPAD) showMenu = !showMenu;
if (gPlayer1Controller->buttonPressed & L_JPAD) {
if (!is_anim_playing) {
anim_play_button();
} else {
is_anim_paused = !is_anim_paused;
}
if (mario_exists) {
if (gPlayer1Controller->buttonPressed & D_JPAD) {
showMenu = !showMenu;
if (!showMenu) accept_text_input = true;
}
if (gPlayer1Controller->buttonPressed & R_JPAD) {
is_anim_looped = !is_anim_looped;
}
if (keyResetter == 6) {
if (SDL_GetKeyboardState(NULL)[SDL_SCANCODE_F2] & accept_text_input) {
if (SDL_GetKeyboardState(NULL)[SDL_SCANCODE_F2]) {
if (gMarioState->action == ACT_IDLE) set_mario_action(gMarioState, ACT_DEBUG_FREE_MOVE, 0);
else set_mario_action(gMarioState, ACT_IDLE, 0);
keyResetter = 0;
}
if (SDL_GetKeyboardState(NULL)[SDL_SCANCODE_F3] & accept_text_input) {
if (SDL_GetKeyboardState(NULL)[SDL_SCANCODE_F3]) {
saturn_play_keyframe(active_key_value);
keyResetter = 0;
}
}
if (accept_text_input) {
if (gPlayer1Controller->buttonPressed & U_JPAD) camera_frozen = !camera_frozen;
if (gPlayer1Controller->buttonPressed & L_JPAD) {
if (!is_anim_playing) {
anim_play_button();
} else {
is_anim_paused = !is_anim_paused;
}
}
if (gPlayer1Controller->buttonPressed & R_JPAD) {
is_anim_looped = !is_anim_looped;
}
}
}
if (keyResetter < 6)