mirror of
https://github.com/k4zmu2a/SpaceCadetPinball.git
synced 2024-11-24 01:40:18 +01:00
Compare commits
No commits in common. "e2f3ae66f83a8f19f479bf697f48a0929125b1e3" and "93d8e12782c9b4b1cc0bf85c70b3d2e64d1e6b54" have entirely different histories.
e2f3ae66f8
...
93d8e12782
6 changed files with 13 additions and 36 deletions
Binary file not shown.
Before Width: | Height: | Size: 86 KiB After Width: | Height: | Size: 25 KiB |
|
@ -60,8 +60,7 @@ int TPlunger::Message(MessageCode code, float value)
|
||||||
switch (code)
|
switch (code)
|
||||||
{
|
{
|
||||||
case MessageCode::PlungerInputPressed:
|
case MessageCode::PlungerInputPressed:
|
||||||
if (!PullbackStartedFlag && (!pb::FullTiltMode || PinballTable->MultiballCount > 0 && !PinballTable->
|
if (!PullbackStartedFlag && PinballTable->MultiballCount > 0 && !PinballTable->TiltLockFlag)
|
||||||
TiltLockFlag))
|
|
||||||
{
|
{
|
||||||
PullbackStartedFlag = true;
|
PullbackStartedFlag = true;
|
||||||
Boost = 0.0;
|
Boost = 0.0;
|
||||||
|
|
|
@ -151,7 +151,6 @@ optionsStruct options::Options
|
||||||
{"Debug Overlay AABB", true},
|
{"Debug Overlay AABB", true},
|
||||||
{"FontFileName", ""},
|
{"FontFileName", ""},
|
||||||
{"Language", translations::GetCurrentLanguage()->ShortName},
|
{"Language", translations::GetCurrentLanguage()->ShortName},
|
||||||
{"Hide Cursor", false},
|
|
||||||
};
|
};
|
||||||
|
|
||||||
void options::InitPrimary()
|
void options::InitPrimary()
|
||||||
|
|
|
@ -288,5 +288,4 @@ struct optionsStruct
|
||||||
BoolOption DebugOverlayAabb;
|
BoolOption DebugOverlayAabb;
|
||||||
StringOption FontFileName;
|
StringOption FontFileName;
|
||||||
StringOption Language;
|
StringOption Language;
|
||||||
BoolOption HideCursor;
|
|
||||||
};
|
};
|
||||||
|
|
|
@ -49,7 +49,6 @@ winmain::DurationMs winmain::TargetFrameTime;
|
||||||
optionsStruct& winmain::Options = options::Options;
|
optionsStruct& winmain::Options = options::Options;
|
||||||
winmain::DurationMs winmain::SpinThreshold = DurationMs(0.005);
|
winmain::DurationMs winmain::SpinThreshold = DurationMs(0.005);
|
||||||
WelfordState winmain::SleepState{};
|
WelfordState winmain::SleepState{};
|
||||||
int winmain::CursorIdleCounter = 0;
|
|
||||||
|
|
||||||
int winmain::WinMain(LPCSTR lpCmdLine)
|
int winmain::WinMain(LPCSTR lpCmdLine)
|
||||||
{
|
{
|
||||||
|
@ -354,8 +353,6 @@ void winmain::MainLoop()
|
||||||
|
|
||||||
if (UpdateToFrameCounter >= UpdateToFrameRatio)
|
if (UpdateToFrameCounter >= UpdateToFrameRatio)
|
||||||
{
|
{
|
||||||
if (Options.HideCursor && CursorIdleCounter <= 0)
|
|
||||||
ImGui::SetMouseCursor(ImGuiMouseCursor_None);
|
|
||||||
ImGui_ImplSDL2_NewFrame();
|
ImGui_ImplSDL2_NewFrame();
|
||||||
ImGui_Render_NewFrame();
|
ImGui_Render_NewFrame();
|
||||||
ImGui::NewFrame();
|
ImGui::NewFrame();
|
||||||
|
@ -423,8 +420,6 @@ void winmain::MainLoop()
|
||||||
frameDuration = std::min<DurationMs>(DurationMs(frameEnd - frameStart), 2 * TargetFrameTime);
|
frameDuration = std::min<DurationMs>(DurationMs(frameEnd - frameStart), 2 * TargetFrameTime);
|
||||||
frameStart = frameEnd;
|
frameStart = frameEnd;
|
||||||
UpdateToFrameCounter++;
|
UpdateToFrameCounter++;
|
||||||
|
|
||||||
CursorIdleCounter = std::max(CursorIdleCounter - static_cast<int>(frameDuration.count()), 0);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -586,6 +581,10 @@ void winmain::RenderUi()
|
||||||
|
|
||||||
if (ImGui::BeginMenu("Graphics"))
|
if (ImGui::BeginMenu("Graphics"))
|
||||||
{
|
{
|
||||||
|
if (ImGui::MenuItem("Change Font"))
|
||||||
|
{
|
||||||
|
font_selection::ShowDialog();
|
||||||
|
}
|
||||||
if (ImGui::MenuItem(pb::get_rc_string(Msg::Menu1_WindowUniformScale), nullptr, Options.UniformScaling))
|
if (ImGui::MenuItem(pb::get_rc_string(Msg::Menu1_WindowUniformScale), nullptr, Options.UniformScaling))
|
||||||
{
|
{
|
||||||
options::toggle(Menu1::WindowUniformScale);
|
options::toggle(Menu1::WindowUniformScale);
|
||||||
|
@ -641,16 +640,6 @@ void winmain::RenderUi()
|
||||||
{
|
{
|
||||||
UpdateFrameRate();
|
UpdateFrameRate();
|
||||||
}
|
}
|
||||||
ImGui::Separator();
|
|
||||||
|
|
||||||
if (ImGui::MenuItem("Hide Cursor", nullptr, Options.HideCursor))
|
|
||||||
{
|
|
||||||
Options.HideCursor ^= true;
|
|
||||||
}
|
|
||||||
if (ImGui::MenuItem("Change Font..."))
|
|
||||||
{
|
|
||||||
font_selection::ShowDialog();
|
|
||||||
}
|
|
||||||
|
|
||||||
ImGui::EndMenu();
|
ImGui::EndMenu();
|
||||||
}
|
}
|
||||||
|
@ -843,21 +832,6 @@ int winmain::event_handler(const SDL_Event* event)
|
||||||
if (!options::WaitingForInput() || !inputDown)
|
if (!options::WaitingForInput() || !inputDown)
|
||||||
ImGui_ImplSDL2_ProcessEvent(event);
|
ImGui_ImplSDL2_ProcessEvent(event);
|
||||||
|
|
||||||
bool mouseEvent;
|
|
||||||
switch (event->type)
|
|
||||||
{
|
|
||||||
case SDL_MOUSEMOTION:
|
|
||||||
case SDL_MOUSEBUTTONDOWN:
|
|
||||||
case SDL_MOUSEBUTTONUP:
|
|
||||||
case SDL_MOUSEWHEEL:
|
|
||||||
CursorIdleCounter = 1000;
|
|
||||||
mouseEvent = true;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
mouseEvent = false;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (ImIO->WantCaptureMouse && !options::WaitingForInput())
|
if (ImIO->WantCaptureMouse && !options::WaitingForInput())
|
||||||
{
|
{
|
||||||
if (mouse_down)
|
if (mouse_down)
|
||||||
|
@ -865,8 +839,15 @@ int winmain::event_handler(const SDL_Event* event)
|
||||||
mouse_down = 0;
|
mouse_down = 0;
|
||||||
SDL_SetWindowGrab(MainWindow, SDL_FALSE);
|
SDL_SetWindowGrab(MainWindow, SDL_FALSE);
|
||||||
}
|
}
|
||||||
if (mouseEvent)
|
switch (event->type)
|
||||||
|
{
|
||||||
|
case SDL_MOUSEMOTION:
|
||||||
|
case SDL_MOUSEBUTTONDOWN:
|
||||||
|
case SDL_MOUSEBUTTONUP:
|
||||||
|
case SDL_MOUSEWHEEL:
|
||||||
return 1;
|
return 1;
|
||||||
|
default: ;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (ImIO->WantCaptureKeyboard && !options::WaitingForInput())
|
if (ImIO->WantCaptureKeyboard && !options::WaitingForInput())
|
||||||
{
|
{
|
||||||
|
|
|
@ -106,7 +106,6 @@ private:
|
||||||
static unsigned PrevSdlErrorCount;
|
static unsigned PrevSdlErrorCount;
|
||||||
static unsigned gfrOffset;
|
static unsigned gfrOffset;
|
||||||
static float gfrWindow;
|
static float gfrWindow;
|
||||||
static int CursorIdleCounter;
|
|
||||||
|
|
||||||
static void RenderUi();
|
static void RenderUi();
|
||||||
static void RenderFrameTimeDialog();
|
static void RenderFrameTimeDialog();
|
||||||
|
|
Loading…
Reference in a new issue