mirror of
https://github.com/k4zmu2a/SpaceCadetPinball.git
synced 2024-11-23 17:30:18 +01:00
Compare commits
No commits in common. "1749a2ba09ac8e9bbe63d1e17f4765d4b1ba902a" and "215599684ce9baf383de039f25687cb94038e7c3" have entirely different histories.
1749a2ba09
...
215599684c
8 changed files with 123 additions and 82 deletions
|
@ -35,7 +35,7 @@ void font_selection::RenderDialog()
|
||||||
ImGui::SameLine();
|
ImGui::SameLine();
|
||||||
ImGui::InputText("##Font", DialogInputBuffer, IM_ARRAYSIZE(DialogInputBuffer));
|
ImGui::InputText("##Font", DialogInputBuffer, IM_ARRAYSIZE(DialogInputBuffer));
|
||||||
|
|
||||||
if (ImGui::Button(pb::get_rc_string(Msg::GenericOk)))
|
if (ImGui::Button(pb::get_rc_string(Msg::HIGHSCORES_Ok)))
|
||||||
{
|
{
|
||||||
options::Options.FontFileName.V = DialogInputBuffer;
|
options::Options.FontFileName.V = DialogInputBuffer;
|
||||||
ImGui::CloseCurrentPopup();
|
ImGui::CloseCurrentPopup();
|
||||||
|
@ -43,7 +43,7 @@ void font_selection::RenderDialog()
|
||||||
}
|
}
|
||||||
|
|
||||||
ImGui::SameLine();
|
ImGui::SameLine();
|
||||||
if (ImGui::Button(pb::get_rc_string(Msg::GenericCancel)))
|
if (ImGui::Button(pb::get_rc_string(Msg::HIGHSCORES_Cancel)))
|
||||||
ImGui::CloseCurrentPopup();
|
ImGui::CloseCurrentPopup();
|
||||||
|
|
||||||
ImGui::EndPopup();
|
ImGui::EndPopup();
|
||||||
|
|
|
@ -172,9 +172,12 @@ void high_score::RenderHighScoreDialog()
|
||||||
score = DlgData.Entry.Score;
|
score = DlgData.Entry.Score;
|
||||||
ImGui::PushItemWidth(200);
|
ImGui::PushItemWidth(200);
|
||||||
|
|
||||||
if (ImGui::IsWindowAppearing())
|
static bool doubleFocus = false;
|
||||||
|
if (ImGui::IsWindowAppearing() || doubleFocus)
|
||||||
{
|
{
|
||||||
|
// Hack - set focus only works on the second time.
|
||||||
ImGui::SetKeyboardFocusHere(0);
|
ImGui::SetKeyboardFocusHere(0);
|
||||||
|
doubleFocus ^= true;
|
||||||
}
|
}
|
||||||
if (ImGui::InputText("", DlgData.Entry.Name, IM_ARRAYSIZE(DlgData.Entry.Name),
|
if (ImGui::InputText("", DlgData.Entry.Name, IM_ARRAYSIZE(DlgData.Entry.Name),
|
||||||
ImGuiInputTextFlags_EnterReturnsTrue | ImGuiInputTextFlags_AutoSelectAll))
|
ImGuiInputTextFlags_EnterReturnsTrue | ImGuiInputTextFlags_AutoSelectAll))
|
||||||
|
@ -194,7 +197,7 @@ void high_score::RenderHighScoreDialog()
|
||||||
ImGui::EndTable();
|
ImGui::EndTable();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ImGui::Button(pb::get_rc_string(Msg::GenericOk)) || textBoxSubmit)
|
if (ImGui::Button(pb::get_rc_string(Msg::HIGHSCORES_Ok)) || textBoxSubmit)
|
||||||
{
|
{
|
||||||
if (dlg_enter_name)
|
if (dlg_enter_name)
|
||||||
{
|
{
|
||||||
|
@ -204,7 +207,7 @@ void high_score::RenderHighScoreDialog()
|
||||||
}
|
}
|
||||||
|
|
||||||
ImGui::SameLine();
|
ImGui::SameLine();
|
||||||
if (ImGui::Button(pb::get_rc_string(Msg::GenericCancel)))
|
if (ImGui::Button(pb::get_rc_string(Msg::HIGHSCORES_Cancel)))
|
||||||
ImGui::CloseCurrentPopup();
|
ImGui::CloseCurrentPopup();
|
||||||
|
|
||||||
ImGui::SameLine();
|
ImGui::SameLine();
|
||||||
|
@ -213,14 +216,14 @@ void high_score::RenderHighScoreDialog()
|
||||||
if (ImGui::BeginPopupModal("Confirm", nullptr, ImGuiWindowFlags_MenuBar))
|
if (ImGui::BeginPopupModal("Confirm", nullptr, ImGuiWindowFlags_MenuBar))
|
||||||
{
|
{
|
||||||
ImGui::TextUnformatted(pb::get_rc_string(Msg::STRING141));
|
ImGui::TextUnformatted(pb::get_rc_string(Msg::STRING141));
|
||||||
if (ImGui::Button(pb::get_rc_string(Msg::GenericOk), ImVec2(120, 0)))
|
if (ImGui::Button(pb::get_rc_string(Msg::HIGHSCORES_Ok), ImVec2(120, 0)))
|
||||||
{
|
{
|
||||||
clear_table();
|
clear_table();
|
||||||
ImGui::CloseCurrentPopup();
|
ImGui::CloseCurrentPopup();
|
||||||
}
|
}
|
||||||
ImGui::SetItemDefaultFocus();
|
ImGui::SetItemDefaultFocus();
|
||||||
ImGui::SameLine();
|
ImGui::SameLine();
|
||||||
if (ImGui::Button(pb::get_rc_string(Msg::GenericCancel), ImVec2(120, 0)))
|
if (ImGui::Button(pb::get_rc_string(Msg::HIGHSCORES_Cancel), ImVec2(120, 0)))
|
||||||
{
|
{
|
||||||
ImGui::CloseCurrentPopup();
|
ImGui::CloseCurrentPopup();
|
||||||
}
|
}
|
||||||
|
|
|
@ -67,58 +67,51 @@ optionsStruct options::Options
|
||||||
"New Game",
|
"New Game",
|
||||||
Msg::Menu1_New_Game,
|
Msg::Menu1_New_Game,
|
||||||
{InputTypes::Keyboard, SDLK_F2},
|
{InputTypes::Keyboard, SDLK_F2},
|
||||||
{InputTypes::None, -1},
|
{InputTypes::None,-1},
|
||||||
{InputTypes::None, -1}
|
{InputTypes::None, -1}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"Toggle Pause",
|
"Toggle Pause",
|
||||||
Msg::Menu1_Pause_Resume_Game,
|
Msg::Menu1_Pause_Resume_Game,
|
||||||
{InputTypes::Keyboard, SDLK_F3},
|
{InputTypes::Keyboard, SDLK_F3},
|
||||||
{InputTypes::None, -1},
|
{InputTypes::None,-1},
|
||||||
{InputTypes::GameController, SDL_CONTROLLER_BUTTON_START}
|
{InputTypes::GameController, SDL_CONTROLLER_BUTTON_START}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"Toggle FullScreen",
|
"Toggle FullScreen",
|
||||||
Msg::Menu1_Full_Screen,
|
Msg::Menu1_Full_Screen,
|
||||||
{InputTypes::Keyboard, SDLK_F4},
|
{InputTypes::Keyboard, SDLK_F4},
|
||||||
{InputTypes::None, -1},
|
{InputTypes::None,-1},
|
||||||
{InputTypes::None, -1}
|
{InputTypes::None, -1}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"Toggle Sounds",
|
"Toggle Sounds",
|
||||||
Msg::Menu1_Sounds,
|
Msg::Menu1_Sounds,
|
||||||
{InputTypes::Keyboard, SDLK_F5},
|
{InputTypes::Keyboard, SDLK_F5},
|
||||||
{InputTypes::None, -1},
|
{InputTypes::None,-1},
|
||||||
{InputTypes::None, -1}
|
{InputTypes::None, -1}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"Toggle Music",
|
"Toggle Music",
|
||||||
Msg::Menu1_Music,
|
Msg::Menu1_Music,
|
||||||
{InputTypes::Keyboard, SDLK_F6},
|
{InputTypes::Keyboard, SDLK_F6},
|
||||||
{InputTypes::None, -1},
|
{InputTypes::None,-1},
|
||||||
{InputTypes::None, -1}
|
{InputTypes::None, -1}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"Show Control Dialog",
|
"Show Control Dialog",
|
||||||
Msg::Menu1_Player_Controls,
|
Msg::Menu1_Player_Controls,
|
||||||
{InputTypes::Keyboard, SDLK_F8},
|
{InputTypes::Keyboard, SDLK_F8},
|
||||||
{InputTypes::None, -1},
|
{InputTypes::None,-1},
|
||||||
{InputTypes::None, -1}
|
{InputTypes::None, -1}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"Toggle Menu Display",
|
"Toggle Menu Display",
|
||||||
Msg::Menu1_ToggleShowMenu,
|
Msg::Menu1_ToggleShowMenu,
|
||||||
{InputTypes::Keyboard, SDLK_F9},
|
{InputTypes::Keyboard, SDLK_F9},
|
||||||
{InputTypes::None, -1},
|
{InputTypes::None,-1},
|
||||||
{InputTypes::None, -1}
|
{InputTypes::None, -1}
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"Exit",
|
|
||||||
Msg::Menu1_Exit,
|
|
||||||
{InputTypes::Keyboard, SDLK_ESCAPE},
|
|
||||||
{InputTypes::None, -1},
|
|
||||||
{InputTypes::GameController, SDL_CONTROLLER_BUTTON_BACK}
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
{"Sounds", true},
|
{"Sounds", true},
|
||||||
{"Music", false},
|
{"Music", false},
|
||||||
|
@ -418,13 +411,13 @@ void options::RenderControlDialog()
|
||||||
ImGui::PopStyleVar();
|
ImGui::PopStyleVar();
|
||||||
ImGui::Spacing();
|
ImGui::Spacing();
|
||||||
|
|
||||||
if (ImGui::Button(pb::get_rc_string(Msg::GenericOk)))
|
if (ImGui::Button(pb::get_rc_string(Msg::KEYMAPPER_Ok)))
|
||||||
{
|
{
|
||||||
ShowDialog = false;
|
ShowDialog = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
ImGui::SameLine();
|
ImGui::SameLine();
|
||||||
if (ImGui::Button(pb::get_rc_string(Msg::GenericCancel)))
|
if (ImGui::Button(pb::get_rc_string(Msg::KEYMAPPER_Cancel)))
|
||||||
{
|
{
|
||||||
for (auto& control : Options.Key)
|
for (auto& control : Options.Key)
|
||||||
{
|
{
|
||||||
|
@ -569,7 +562,7 @@ std::string GameInput::GetShortInputDescription() const
|
||||||
keyName = std::to_string(Value);
|
keyName = std::to_string(Value);
|
||||||
break;
|
break;
|
||||||
case InputTypes::GameController:
|
case InputTypes::GameController:
|
||||||
if (Value >= SDL_CONTROLLER_BUTTON_A && Value < std::min(static_cast<int>(SDL_CONTROLLER_BUTTON_MAX), 21))
|
if (Value >= SDL_CONTROLLER_BUTTON_A && Value <= SDL_CONTROLLER_BUTTON_TOUCHPAD)
|
||||||
keyName = controllerButtons[Value];
|
keyName = controllerButtons[Value];
|
||||||
else
|
else
|
||||||
keyName = std::to_string(Value);
|
keyName = std::to_string(Value);
|
||||||
|
|
|
@ -72,7 +72,6 @@ enum class GameBindings
|
||||||
ToggleMusic,
|
ToggleMusic,
|
||||||
ShowControlDialog,
|
ShowControlDialog,
|
||||||
ToggleMenuDisplay,
|
ToggleMenuDisplay,
|
||||||
Exit,
|
|
||||||
Max
|
Max
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -5056,7 +5056,7 @@ const TextArray translations::Translations =
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Msg::GenericOk,
|
Msg::HIGHSCORES_Ok,
|
||||||
{
|
{
|
||||||
{ Lang::Arabic, "موافق" },
|
{ Lang::Arabic, "موافق" },
|
||||||
{ Lang::Czech, "OK" },
|
{ Lang::Czech, "OK" },
|
||||||
|
@ -5085,7 +5085,7 @@ const TextArray translations::Translations =
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Msg::GenericCancel,
|
Msg::HIGHSCORES_Cancel,
|
||||||
{
|
{
|
||||||
{ Lang::Arabic, "إلغاء الأمر" },
|
{ Lang::Arabic, "إلغاء الأمر" },
|
||||||
{ Lang::Czech, "Storno" },
|
{ Lang::Czech, "Storno" },
|
||||||
|
@ -5258,6 +5258,64 @@ const TextArray translations::Translations =
|
||||||
{ Lang::TraditionalChinese, "立體彈珠台:玩家控制" },
|
{ Lang::TraditionalChinese, "立體彈珠台:玩家控制" },
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
Msg::KEYMAPPER_Ok,
|
||||||
|
{
|
||||||
|
{ Lang::Arabic, "موافق" },
|
||||||
|
{ Lang::Czech, "OK" },
|
||||||
|
{ Lang::Danish, "OK" },
|
||||||
|
{ Lang::German, "OK" },
|
||||||
|
{ Lang::Greek, "OK" },
|
||||||
|
{ Lang::English, "OK" },
|
||||||
|
{ Lang::Spanish, "Aceptar" },
|
||||||
|
{ Lang::Finnish, "OK" },
|
||||||
|
{ Lang::French, "OK" },
|
||||||
|
{ Lang::Hebrew, "אישור" },
|
||||||
|
{ Lang::Hungarian, "OK" },
|
||||||
|
{ Lang::Italian, "OK" },
|
||||||
|
{ Lang::Japanese, "OK" },
|
||||||
|
{ Lang::Korean, "확인" },
|
||||||
|
{ Lang::Norwegian, "OK" },
|
||||||
|
{ Lang::Dutch, "OK" },
|
||||||
|
{ Lang::Polish, "OK" },
|
||||||
|
{ Lang::BrazilianPortuguese, "OK" },
|
||||||
|
{ Lang::Portuguese, "OK" },
|
||||||
|
{ Lang::Russian, "ОК" },
|
||||||
|
{ Lang::Swedish, "OK" },
|
||||||
|
{ Lang::Turkish, "Tamam" },
|
||||||
|
{ Lang::SimplifiedChinese, "确定" },
|
||||||
|
{ Lang::TraditionalChinese, "確定" },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
Msg::KEYMAPPER_Cancel,
|
||||||
|
{
|
||||||
|
{ Lang::Arabic, "إلغاء الأمر" },
|
||||||
|
{ Lang::Czech, "Storno" },
|
||||||
|
{ Lang::Danish, "Annuller" },
|
||||||
|
{ Lang::German, "Abbrechen" },
|
||||||
|
{ Lang::Greek, "Άκυρο" },
|
||||||
|
{ Lang::English, "Cancel" },
|
||||||
|
{ Lang::Spanish, "Cancelar" },
|
||||||
|
{ Lang::Finnish, "Peruuta" },
|
||||||
|
{ Lang::French, "Annuler" },
|
||||||
|
{ Lang::Hebrew, "ביטול" },
|
||||||
|
{ Lang::Hungarian, "Mégse" },
|
||||||
|
{ Lang::Italian, "Annulla" },
|
||||||
|
{ Lang::Japanese, "キャンセル" },
|
||||||
|
{ Lang::Korean, "취소" },
|
||||||
|
{ Lang::Norwegian, "Avbryt" },
|
||||||
|
{ Lang::Dutch, "Annuleren" },
|
||||||
|
{ Lang::Polish, "Anuluj" },
|
||||||
|
{ Lang::BrazilianPortuguese, "Cancelar" },
|
||||||
|
{ Lang::Portuguese, "Cancelar" },
|
||||||
|
{ Lang::Russian, "Отмена" },
|
||||||
|
{ Lang::Swedish, "Avbryt" },
|
||||||
|
{ Lang::Turkish, "İptal" },
|
||||||
|
{ Lang::SimplifiedChinese, "取消" },
|
||||||
|
{ Lang::TraditionalChinese, "取消" },
|
||||||
|
},
|
||||||
|
},
|
||||||
{
|
{
|
||||||
Msg::KEYMAPPER_FlipperL,
|
Msg::KEYMAPPER_FlipperL,
|
||||||
{
|
{
|
||||||
|
|
|
@ -175,13 +175,15 @@ enum class Msg : int
|
||||||
TextBoxColor,
|
TextBoxColor,
|
||||||
|
|
||||||
HIGHSCORES_Caption,
|
HIGHSCORES_Caption,
|
||||||
GenericOk,
|
HIGHSCORES_Ok,
|
||||||
GenericCancel,
|
HIGHSCORES_Cancel,
|
||||||
HIGHSCORES_Clear,
|
HIGHSCORES_Clear,
|
||||||
HIGHSCORES_Name,
|
HIGHSCORES_Name,
|
||||||
HIGHSCORES_Score,
|
HIGHSCORES_Score,
|
||||||
HIGHSCORES_Rank,
|
HIGHSCORES_Rank,
|
||||||
KEYMAPPER_Caption,
|
KEYMAPPER_Caption,
|
||||||
|
KEYMAPPER_Ok,
|
||||||
|
KEYMAPPER_Cancel,
|
||||||
KEYMAPPER_FlipperL,
|
KEYMAPPER_FlipperL,
|
||||||
KEYMAPPER_FlipperR,
|
KEYMAPPER_FlipperR,
|
||||||
KEYMAPPER_Plunger,
|
KEYMAPPER_Plunger,
|
||||||
|
|
|
@ -20,7 +20,7 @@ ImGuiIO* winmain::ImIO = nullptr;
|
||||||
int winmain::return_value = 0;
|
int winmain::return_value = 0;
|
||||||
bool winmain::bQuit = false;
|
bool winmain::bQuit = false;
|
||||||
bool winmain::activated = false;
|
bool winmain::activated = false;
|
||||||
bool winmain::DispFrameRate = false;
|
int winmain::DispFrameRate = 0;
|
||||||
bool winmain::DispGRhistory = false;
|
bool winmain::DispGRhistory = false;
|
||||||
bool winmain::single_step = false;
|
bool winmain::single_step = false;
|
||||||
bool winmain::has_focus = true;
|
bool winmain::has_focus = true;
|
||||||
|
@ -31,13 +31,12 @@ bool winmain::no_time_loss = false;
|
||||||
|
|
||||||
bool winmain::restart = false;
|
bool winmain::restart = false;
|
||||||
|
|
||||||
std::vector<float> winmain::gfrDisplay{};
|
std::vector<float> winmain::gfrDisplay {};
|
||||||
unsigned winmain::gfrOffset = 0;
|
unsigned winmain::gfrOffset = 0;
|
||||||
float winmain::gfrWindow = 5.0f;
|
float winmain::gfrWindow = 5.0f;
|
||||||
bool winmain::ShowAboutDialog = false;
|
bool winmain::ShowAboutDialog = false;
|
||||||
bool winmain::ShowImGuiDemo = false;
|
bool winmain::ShowImGuiDemo = false;
|
||||||
bool winmain::ShowSpriteViewer = false;
|
bool winmain::ShowSpriteViewer = false;
|
||||||
bool winmain::ShowExitPopup = false;
|
|
||||||
bool winmain::LaunchBallEnabled = true;
|
bool winmain::LaunchBallEnabled = true;
|
||||||
bool winmain::HighScoresEnabled = true;
|
bool winmain::HighScoresEnabled = true;
|
||||||
bool winmain::DemoActive = false;
|
bool winmain::DemoActive = false;
|
||||||
|
@ -489,7 +488,11 @@ void winmain::RenderUi()
|
||||||
end_pause();
|
end_pause();
|
||||||
pb::toggle_demo();
|
pb::toggle_demo();
|
||||||
}
|
}
|
||||||
ImGuiMenuItemWShortcut(GameBindings::Exit);
|
if (ImGui::MenuItem(pb::get_rc_string(Msg::Menu1_Exit)))
|
||||||
|
{
|
||||||
|
SDL_Event event{SDL_QUIT};
|
||||||
|
SDL_PushEvent(&event);
|
||||||
|
}
|
||||||
ImGui::EndMenu();
|
ImGui::EndMenu();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -591,8 +594,8 @@ void winmain::RenderUi()
|
||||||
{
|
{
|
||||||
options::toggle(Menu1::WindowIntegerScale);
|
options::toggle(Menu1::WindowIntegerScale);
|
||||||
}
|
}
|
||||||
if (ImGui::DragFloat("UI Scale", &Options.UIScale.V, 0.005f, 0.8f, 5,
|
if(ImGui::DragFloat("UI Scale", &Options.UIScale.V, 0.005f, 0.8f, 5,
|
||||||
"%.2f", ImGuiSliderFlags_AlwaysClamp))
|
"%.2f", ImGuiSliderFlags_AlwaysClamp))
|
||||||
{
|
{
|
||||||
ImIO->FontGlobalScale = Options.UIScale;
|
ImIO->FontGlobalScale = Options.UIScale;
|
||||||
}
|
}
|
||||||
|
@ -768,38 +771,6 @@ void winmain::RenderUi()
|
||||||
if (DispGRhistory)
|
if (DispGRhistory)
|
||||||
RenderFrameTimeDialog();
|
RenderFrameTimeDialog();
|
||||||
|
|
||||||
const auto exitText = translations::GetTranslation(Msg::Menu1_Exit);
|
|
||||||
if (ShowExitPopup)
|
|
||||||
{
|
|
||||||
ShowExitPopup = false;
|
|
||||||
pause(false);
|
|
||||||
ImGui::OpenPopup(exitText);
|
|
||||||
}
|
|
||||||
if (ImGui::BeginPopupModal(exitText, nullptr, ImGuiWindowFlags_AlwaysAutoResize))
|
|
||||||
{
|
|
||||||
ImGui::Text("Exit the game?");
|
|
||||||
ImGui::Separator();
|
|
||||||
|
|
||||||
if (ImGui::Button(pb::get_rc_string(Msg::GenericOk), ImVec2(120, 0)))
|
|
||||||
{
|
|
||||||
SDL_Event event{SDL_QUIT};
|
|
||||||
SDL_PushEvent(&event);
|
|
||||||
ImGui::CloseCurrentPopup();
|
|
||||||
}
|
|
||||||
ImGui::SameLine();
|
|
||||||
if (ImGui::IsWindowAppearing())
|
|
||||||
{
|
|
||||||
ImGui::SetKeyboardFocusHere(0);
|
|
||||||
}
|
|
||||||
if (ImGui::Button(pb::get_rc_string(Msg::GenericCancel), ImVec2(120, 0)))
|
|
||||||
{
|
|
||||||
end_pause();
|
|
||||||
ImGui::CloseCurrentPopup();
|
|
||||||
}
|
|
||||||
ImGui::SetItemDefaultFocus();
|
|
||||||
ImGui::EndPopup();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Print game texts on the sidebar
|
// Print game texts on the sidebar
|
||||||
gdrv::grtext_draw_ttext_in_box();
|
gdrv::grtext_draw_ttext_in_box();
|
||||||
}
|
}
|
||||||
|
@ -850,10 +821,19 @@ int winmain::event_handler(const SDL_Event* event)
|
||||||
pb::InputUp({InputTypes::Keyboard, event->key.keysym.sym});
|
pb::InputUp({InputTypes::Keyboard, event->key.keysym.sym});
|
||||||
break;
|
break;
|
||||||
case SDL_KEYDOWN:
|
case SDL_KEYDOWN:
|
||||||
if (event->key.repeat)
|
if (!event->key.repeat)
|
||||||
|
pb::InputDown({InputTypes::Keyboard, event->key.keysym.sym});
|
||||||
|
switch (event->key.keysym.sym)
|
||||||
|
{
|
||||||
|
case SDLK_ESCAPE:
|
||||||
|
if (Options.FullScreen)
|
||||||
|
options::toggle(Menu1::Full_Screen);
|
||||||
|
SDL_MinimizeWindow(MainWindow);
|
||||||
break;
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
pb::InputDown({InputTypes::Keyboard, event->key.keysym.sym});
|
|
||||||
if (!pb::cheat_mode)
|
if (!pb::cheat_mode)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -883,7 +863,7 @@ int winmain::event_handler(const SDL_Event* event)
|
||||||
break;
|
break;
|
||||||
case SDLK_y:
|
case SDLK_y:
|
||||||
SDL_SetWindowTitle(MainWindow, "Pinball");
|
SDL_SetWindowTitle(MainWindow, "Pinball");
|
||||||
DispFrameRate ^= true;
|
DispFrameRate = DispFrameRate == 0;
|
||||||
break;
|
break;
|
||||||
case SDLK_F1:
|
case SDLK_F1:
|
||||||
pb::frame(10);
|
pb::frame(10);
|
||||||
|
@ -988,6 +968,17 @@ int winmain::event_handler(const SDL_Event* event)
|
||||||
break;
|
break;
|
||||||
case SDL_CONTROLLERBUTTONDOWN:
|
case SDL_CONTROLLERBUTTONDOWN:
|
||||||
pb::InputDown({InputTypes::GameController, event->cbutton.button});
|
pb::InputDown({InputTypes::GameController, event->cbutton.button});
|
||||||
|
switch (event->cbutton.button)
|
||||||
|
{
|
||||||
|
case SDL_CONTROLLER_BUTTON_BACK:
|
||||||
|
if (single_step)
|
||||||
|
{
|
||||||
|
SDL_Event event{SDL_QUIT};
|
||||||
|
SDL_PushEvent(&event);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default: ;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case SDL_CONTROLLERBUTTONUP:
|
case SDL_CONTROLLERBUTTONUP:
|
||||||
pb::InputUp({InputTypes::GameController, event->cbutton.button});
|
pb::InputUp({InputTypes::GameController, event->cbutton.button});
|
||||||
|
@ -1133,11 +1124,6 @@ void winmain::HandleGameBinding(GameBindings binding)
|
||||||
case GameBindings::ToggleMenuDisplay:
|
case GameBindings::ToggleMenuDisplay:
|
||||||
options::toggle(Menu1::Show_Menu);
|
options::toggle(Menu1::Show_Menu);
|
||||||
break;
|
break;
|
||||||
case GameBindings::Exit:
|
|
||||||
{
|
|
||||||
ShowExitPopup = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -1175,7 +1161,7 @@ void winmain::RenderFrameTimeDialog()
|
||||||
|
|
||||||
auto region = ImGui::GetContentRegionAvail();
|
auto region = ImGui::GetContentRegionAvail();
|
||||||
ImGui::PlotLines("Lines", gfrDisplay.data(), gfrDisplay.size(),
|
ImGui::PlotLines("Lines", gfrDisplay.data(), gfrDisplay.size(),
|
||||||
scrollPlot ? gfrOffset : 0, overlay, 0, yMax, region);
|
scrollPlot ? gfrOffset : 0, overlay, 0, yMax, region);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ImGui::End();
|
ImGui::End();
|
||||||
|
|
|
@ -43,6 +43,7 @@ struct WelfordState
|
||||||
|
|
||||||
WelfordState() : mean(0.005), M2(0), count(1)
|
WelfordState() : mean(0.005), M2(0), count(1)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Advance(double newValue)
|
void Advance(double newValue)
|
||||||
|
@ -88,16 +89,15 @@ public:
|
||||||
static void UpdateFrameRate();
|
static void UpdateFrameRate();
|
||||||
static void HandleGameBinding(GameBindings binding);
|
static void HandleGameBinding(GameBindings binding);
|
||||||
private:
|
private:
|
||||||
static int return_value;
|
static int return_value, DispFrameRate;
|
||||||
static int mouse_down, last_mouse_x, last_mouse_y;
|
static int mouse_down, last_mouse_x, last_mouse_y;
|
||||||
static bool no_time_loss, activated, bQuit, has_focus, DispGRhistory, DispFrameRate;
|
static bool no_time_loss, activated, bQuit, has_focus, DispGRhistory;
|
||||||
static std::vector<float> gfrDisplay;
|
static std::vector<float> gfrDisplay;
|
||||||
static std::string FpsDetails, PrevSdlError;
|
static std::string FpsDetails, PrevSdlError;
|
||||||
static bool restart;
|
static bool restart;
|
||||||
static bool ShowAboutDialog;
|
static bool ShowAboutDialog;
|
||||||
static bool ShowImGuiDemo;
|
static bool ShowImGuiDemo;
|
||||||
static bool ShowSpriteViewer;
|
static bool ShowSpriteViewer;
|
||||||
static bool ShowExitPopup;
|
|
||||||
static double UpdateToFrameRatio;
|
static double UpdateToFrameRatio;
|
||||||
static DurationMs TargetFrameTime;
|
static DurationMs TargetFrameTime;
|
||||||
static struct optionsStruct& Options;
|
static struct optionsStruct& Options;
|
||||||
|
|
Loading…
Reference in a new issue