55#include " PhysicsManager.h"
66#include " CarnageGame.h"
77#include " Pedestrian.h"
8+ #include " TimeManager.h"
89
910namespace ImGui
1011{
@@ -71,9 +72,11 @@ void GameCheatsWindow::DoUI(ImGuiIO& imguiContext)
7172 }
7273 ImGui::EndMenuBar ();
7374 }
74-
75+
76+ ImGui::HorzSpacing ();
7577 ImGui::TextColored (ImVec4 (1 .0f , 1 .0f , 0 .0f , 1 .0f ), " Frame Time: %.3f ms (%.1f FPS)" , 1000 .0f / io.Framerate , io.Framerate );
76- ImGui::Text (" Block chunks drawn: %d" , gRenderManager .mMapRenderer .mRenderStats .mBlockChunksDrawnCount );
78+ ImGui::Text (" Map chunks drawn: %d" , gRenderManager .mMapRenderer .mRenderStats .mBlockChunksDrawnCount );
79+ ImGui::Text (" Sprites drawn: %d" , gRenderManager .mMapRenderer .mRenderStats .mSpritesDrawnCount );
7780
7881 // pedestrian stats
7982 if (Pedestrian* pedestrian = gCarnageGame .mHumanSlot [0 ].mCharPedestrian )
@@ -109,40 +112,44 @@ void GameCheatsWindow::DoUI(ImGuiIO& imguiContext)
109112 }
110113 }
111114
112- const char * modeStrings[] = { " Follow" , " Free Look" };
113- CameraController* modeControllers[] =
114- {
115- &gCarnageGame .mHumanSlot [0 ].mCharView .mFollowCameraController ,
116- &gCarnageGame .mHumanSlot [0 ].mCharView .mFreeLookCameraController ,
117- };
118- int currentCameraMode = 0 ;
119- for (int i = 0 ; i < IM_ARRAYSIZE (modeControllers); ++i)
120- {
121- if (gCarnageGame .mHumanSlot [0 ].mCharView .mCameraController == modeControllers[i])
115+ { // choose camera modes
116+ const char * modeStrings[] = { " Follow" , " Free Look" };
117+ CameraController* modeControllers[] =
122118 {
123- currentCameraMode = i;
124- break ;
125- }
126- }
127- const char * item_current = modeStrings[currentCameraMode];
128- if (ImGui::BeginCombo (" Camera mode" , item_current))
129- {
130- for (int n = 0 ; n < IM_ARRAYSIZE (modeStrings); n++)
119+ &gCarnageGame .mHumanSlot [0 ].mCharView .mFollowCameraController ,
120+ &gCarnageGame .mHumanSlot [0 ].mCharView .mFreeLookCameraController ,
121+ };
122+ int currentCameraMode = 0 ;
123+ for (int i = 0 ; i < IM_ARRAYSIZE (modeControllers); ++i)
131124 {
132- bool is_selected = (item_current == modeStrings[n]);
133- if (ImGui::Selectable (modeStrings[n], is_selected))
125+ if (gCarnageGame .mHumanSlot [0 ].mCharView .mCameraController == modeControllers[i])
134126 {
135- item_current = modeStrings[n] ;
136- gCarnageGame . mHumanSlot [ 0 ]. mCharView . SetCameraController (modeControllers[n]) ;
127+ currentCameraMode = i ;
128+ break ;
137129 }
138- if (is_selected)
130+ }
131+ const char * item_current = modeStrings[currentCameraMode];
132+ if (ImGui::BeginCombo (" Camera mode" , item_current))
133+ {
134+ for (int n = 0 ; n < IM_ARRAYSIZE (modeStrings); n++)
139135 {
140- ImGui::SetItemDefaultFocus ();
136+ bool is_selected = (currentCameraMode == n);
137+ if (ImGui::Selectable (modeStrings[n], is_selected))
138+ {
139+ currentCameraMode = n;
140+ gCarnageGame .mHumanSlot [0 ].mCharView .SetCameraController (modeControllers[n]);
141+ }
142+ if (is_selected)
143+ {
144+ ImGui::SetItemDefaultFocus ();
145+ }
141146 }
142- }
143- ImGui::EndCombo ();
147+ ImGui::EndCombo ();
148+ }
144149 }
145150
151+ ImGui::HorzSpacing ();
152+
146153 // if (ImGui::CollapsingHeader("Physics"))
147154 // {
148155 // ImGui::Checkbox("Enable map collisions", &mEnableMapCollisions);
@@ -153,7 +160,6 @@ void GameCheatsWindow::DoUI(ImGuiIO& imguiContext)
153160 {
154161 ImGui::Checkbox (" Enable blocks animation" , &mEnableBlocksAnimation );
155162 ImGui::Checkbox (" Enable debug draw" , &mEnableDebugDraw );
156-
157163 ImGui::Checkbox (" Draw decorations" , &mEnableDrawDecorations );
158164 ImGui::Checkbox (" Draw obstacles" , &mEnableDrawObstacles );
159165 ImGui::Checkbox (" Draw pedestrians" , &mEnableDrawPedestrians );
@@ -215,6 +221,31 @@ void GameCheatsWindow::DoUI(ImGuiIO& imguiContext)
215221 gGraphicsDevice .EnableFullscreen (gSystem .mConfig .mFullscreen );
216222 gGraphicsDevice .EnableVSync (gSystem .mConfig .mEnableVSync ); // set vsync param as fullcreen mode changes
217223 }
224+
225+ ImGui::HorzSpacing ();
226+
227+ { // choose desired framerate
228+ static const char * framerates_str[] = {" 24" , " 30" , " 60" , " 120" , " 240" };
229+ static int framerates[] = {24 , 30 , 60 , 120 , 240 };
230+ static int framerate_index = 3 ;
231+ if (ImGui::BeginCombo (" Framerate" , framerates_str[framerate_index]))
232+ {
233+ for (int n = 0 ; n < IM_ARRAYSIZE (framerates_str); ++n)
234+ {
235+ bool is_selected = (n == framerate_index);
236+ if (ImGui::Selectable (framerates_str[n], is_selected))
237+ {
238+ framerate_index = n;
239+ gTimeManager .SetMaxFramerate (framerates[framerate_index] * 1 .0f );
240+ }
241+ if (is_selected)
242+ {
243+ ImGui::SetItemDefaultFocus ();
244+ }
245+ }
246+ ImGui::EndCombo ();
247+ }
248+ }
218249 }
219250
220251 ImGui::End ();
0 commit comments