MCPcopy Create free account
hub / github.com/chrxh/alien / processTpsRestriction

Method processTpsRestriction

source/Gui/TemporalControlWindow.cpp:102–129  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

100}
101
102void TemporalControlWindow::processTpsRestriction()
103{
104 AlienImGui::ToggleButton(AlienImGui::ToggleButtonParameters().name("Slow down"), _slowDown);
105 ImGui::SameLine(scale(LeftColumnWidth) - (ImGui::GetWindowWidth() - ImGui::GetContentRegionAvail().x));
106 ImGui::BeginDisabled(!_slowDown);
107 ImGui::PushItemWidth(ImGui::GetContentRegionAvail().x);
108 ImGui::SliderInt("##TPSRestriction", &_tpsRestriction, 1, 1000, "%d TPS", ImGuiSliderFlags_Logarithmic);
109 if (_slowDown) {
110 _simulationFacade->setTpsRestriction(_tpsRestriction);
111 } else {
112 _simulationFacade->setTpsRestriction(std::nullopt);
113 }
114 ImGui::PopItemWidth();
115 ImGui::EndDisabled();
116
117 auto syncSimulationWithRendering = _simulationFacade->isSyncSimulationWithRendering();
118 if (AlienImGui::ToggleButton(AlienImGui::ToggleButtonParameters().name("Sync with rendering"), syncSimulationWithRendering)) {
119 _simulationFacade->setSyncSimulationWithRendering(syncSimulationWithRendering);
120 }
121
122 ImGui::BeginDisabled(!syncSimulationWithRendering);
123 ImGui::SameLine(scale(LeftColumnWidth) - (ImGui::GetWindowWidth() - ImGui::GetContentRegionAvail().x));
124 auto syncSimulationWithRenderingRatio = _simulationFacade->getSyncSimulationWithRenderingRatio();
125 if (AlienImGui::SliderInt(AlienImGui::SliderIntParameters().textWidth(0).min(1).max(40).logarithmic(true).format("%d TPS : FPS"), &syncSimulationWithRenderingRatio)) {
126 _simulationFacade->setSyncSimulationWithRenderingRatio(syncSimulationWithRenderingRatio);
127 }
128 ImGui::EndDisabled();
129}
130
131void TemporalControlWindow::processRunButton()
132{

Callers

nothing calls this directly

Calls 9

scaleFunction · 0.85
SliderIntParametersClass · 0.85
formatMethod · 0.80
setTpsRestrictionMethod · 0.45

Tested by

no test coverage detected