mirror of
				https://github.com/ocornut/imgui.git
				synced 2025-10-26 12:27:30 +00:00 
			
		
		
		
	Minor formatting tweaks, comments
This commit is contained in:
		| @@ -570,14 +570,14 @@ int WINAPI wWinMain(HINSTANCE hInst, HINSTANCE, LPWSTR, int) | |||||||
|             if (ImGui::Button("Another Window")) show_another_window ^= 1; |             if (ImGui::Button("Another Window")) show_another_window ^= 1; | ||||||
|  |  | ||||||
|             // Calculate and show frame rate |             // Calculate and show frame rate | ||||||
|             static float ms_per_frame[120] = { 0 }; |             static int   ms_per_frame_idx = 0; | ||||||
|             static int ms_per_frame_idx = 0; |             static float ms_per_frame[60] = { 0 }; | ||||||
|             static float ms_per_frame_accum = 0.0f; |             static float ms_per_frame_accum = 0.0f; | ||||||
|             ms_per_frame_accum -= ms_per_frame[ms_per_frame_idx]; |             ms_per_frame_accum -= ms_per_frame[ms_per_frame_idx]; | ||||||
|             ms_per_frame[ms_per_frame_idx] = ImGui::GetIO().DeltaTime * 1000.0f; |             ms_per_frame[ms_per_frame_idx] = ImGui::GetIO().DeltaTime * 1000.0f; | ||||||
|             ms_per_frame_accum += ms_per_frame[ms_per_frame_idx]; |             ms_per_frame_accum += ms_per_frame[ms_per_frame_idx]; | ||||||
|             ms_per_frame_idx = (ms_per_frame_idx + 1) % 120; |             ms_per_frame_idx = (ms_per_frame_idx + 1) % 60; | ||||||
|             const float ms_per_frame_avg = ms_per_frame_accum / 120; |             const float ms_per_frame_avg = ms_per_frame_accum / 60; | ||||||
|             ImGui::Text("Application average %.3f ms/frame (%.1f FPS)", ms_per_frame_avg, 1000.0f / ms_per_frame_avg); |             ImGui::Text("Application average %.3f ms/frame (%.1f FPS)", ms_per_frame_avg, 1000.0f / ms_per_frame_avg); | ||||||
|         } |         } | ||||||
|  |  | ||||||
|   | |||||||
| @@ -336,14 +336,14 @@ int WINAPI wWinMain(HINSTANCE hInst, HINSTANCE, LPWSTR, int) | |||||||
|             if (ImGui::Button("Another Window")) show_another_window ^= 1; |             if (ImGui::Button("Another Window")) show_another_window ^= 1; | ||||||
|  |  | ||||||
|             // Calculate and show frame rate |             // Calculate and show frame rate | ||||||
|             static float ms_per_frame[120] = { 0 }; |             static int   ms_per_frame_idx = 0; | ||||||
|             static int ms_per_frame_idx = 0; |             static float ms_per_frame[60] = { 0 }; | ||||||
|             static float ms_per_frame_accum = 0.0f; |             static float ms_per_frame_accum = 0.0f; | ||||||
|             ms_per_frame_accum -= ms_per_frame[ms_per_frame_idx]; |             ms_per_frame_accum -= ms_per_frame[ms_per_frame_idx]; | ||||||
|             ms_per_frame[ms_per_frame_idx] = ImGui::GetIO().DeltaTime * 1000.0f; |             ms_per_frame[ms_per_frame_idx] = ImGui::GetIO().DeltaTime * 1000.0f; | ||||||
|             ms_per_frame_accum += ms_per_frame[ms_per_frame_idx]; |             ms_per_frame_accum += ms_per_frame[ms_per_frame_idx]; | ||||||
|             ms_per_frame_idx = (ms_per_frame_idx + 1) % 120; |             ms_per_frame_idx = (ms_per_frame_idx + 1) % 60; | ||||||
|             const float ms_per_frame_avg = ms_per_frame_accum / 120; |             const float ms_per_frame_avg = ms_per_frame_accum / 60; | ||||||
|             ImGui::Text("Application average %.3f ms/frame (%.1f FPS)", ms_per_frame_avg, 1000.0f / ms_per_frame_avg); |             ImGui::Text("Application average %.3f ms/frame (%.1f FPS)", ms_per_frame_avg, 1000.0f / ms_per_frame_avg); | ||||||
|         } |         } | ||||||
|  |  | ||||||
|   | |||||||
| @@ -348,14 +348,14 @@ int main(int argc, char** argv) | |||||||
|             if (ImGui::Button("Another Window")) show_another_window ^= 1; |             if (ImGui::Button("Another Window")) show_another_window ^= 1; | ||||||
|  |  | ||||||
|             // Calculate and show frame rate |             // Calculate and show frame rate | ||||||
|             static float ms_per_frame[120] = { 0 }; |             static int   ms_per_frame_idx = 0; | ||||||
|             static int ms_per_frame_idx = 0; |             static float ms_per_frame[60] = { 0 }; | ||||||
|             static float ms_per_frame_accum = 0.0f; |             static float ms_per_frame_accum = 0.0f; | ||||||
|             ms_per_frame_accum -= ms_per_frame[ms_per_frame_idx]; |             ms_per_frame_accum -= ms_per_frame[ms_per_frame_idx]; | ||||||
|             ms_per_frame[ms_per_frame_idx] = ImGui::GetIO().DeltaTime * 1000.0f; |             ms_per_frame[ms_per_frame_idx] = ImGui::GetIO().DeltaTime * 1000.0f; | ||||||
|             ms_per_frame_accum += ms_per_frame[ms_per_frame_idx]; |             ms_per_frame_accum += ms_per_frame[ms_per_frame_idx]; | ||||||
|             ms_per_frame_idx = (ms_per_frame_idx + 1) % 120; |             ms_per_frame_idx = (ms_per_frame_idx + 1) % 60; | ||||||
|             const float ms_per_frame_avg = ms_per_frame_accum / 120; |             const float ms_per_frame_avg = ms_per_frame_accum / 60; | ||||||
|             ImGui::Text("Application average %.3f ms/frame (%.1f FPS)", ms_per_frame_avg, 1000.0f / ms_per_frame_avg); |             ImGui::Text("Application average %.3f ms/frame (%.1f FPS)", ms_per_frame_avg, 1000.0f / ms_per_frame_avg); | ||||||
|         } |         } | ||||||
|  |  | ||||||
|   | |||||||
| @@ -257,14 +257,14 @@ int main(int argc, char** argv) | |||||||
|             if (ImGui::Button("Another Window")) show_another_window ^= 1; |             if (ImGui::Button("Another Window")) show_another_window ^= 1; | ||||||
|  |  | ||||||
|             // Calculate and show frame rate |             // Calculate and show frame rate | ||||||
|             static float ms_per_frame[120] = { 0 }; |             static int   ms_per_frame_idx = 0; | ||||||
|             static int ms_per_frame_idx = 0; |             static float ms_per_frame[60] = { 0 }; | ||||||
|             static float ms_per_frame_accum = 0.0f; |             static float ms_per_frame_accum = 0.0f; | ||||||
|             ms_per_frame_accum -= ms_per_frame[ms_per_frame_idx]; |             ms_per_frame_accum -= ms_per_frame[ms_per_frame_idx]; | ||||||
|             ms_per_frame[ms_per_frame_idx] = ImGui::GetIO().DeltaTime * 1000.0f; |             ms_per_frame[ms_per_frame_idx] = ImGui::GetIO().DeltaTime * 1000.0f; | ||||||
|             ms_per_frame_accum += ms_per_frame[ms_per_frame_idx]; |             ms_per_frame_accum += ms_per_frame[ms_per_frame_idx]; | ||||||
|             ms_per_frame_idx = (ms_per_frame_idx + 1) % 120; |             ms_per_frame_idx = (ms_per_frame_idx + 1) % 60; | ||||||
|             const float ms_per_frame_avg = ms_per_frame_accum / 120; |             const float ms_per_frame_avg = ms_per_frame_accum / 60; | ||||||
|             ImGui::Text("Application average %.3f ms/frame (%.1f FPS)", ms_per_frame_avg, 1000.0f / ms_per_frame_avg); |             ImGui::Text("Application average %.3f ms/frame (%.1f FPS)", ms_per_frame_avg, 1000.0f / ms_per_frame_avg); | ||||||
|         } |         } | ||||||
|  |  | ||||||
|   | |||||||
| @@ -956,6 +956,7 @@ struct ImGuiTextEditState | |||||||
|     static void             RenderTextScrolledClipped(ImFont* font, float font_size, const char* text, ImVec2 pos_base, float width, float scroll_x); |     static void             RenderTextScrolledClipped(ImFont* font, float font_size, const char* text, ImVec2 pos_base, float width, float scroll_x); | ||||||
| }; | }; | ||||||
|  |  | ||||||
|  | // Data saved in imgui.ini file | ||||||
| struct ImGuiIniData | struct ImGuiIniData | ||||||
| { | { | ||||||
|     char*   Name; |     char*   Name; | ||||||
| @@ -967,6 +968,7 @@ struct ImGuiIniData | |||||||
|     ~ImGuiIniData() { if (Name) { ImGui::MemFree(Name); Name = NULL; } } |     ~ImGuiIniData() { if (Name) { ImGui::MemFree(Name); Name = NULL; } } | ||||||
| }; | }; | ||||||
|  |  | ||||||
|  | // Main state for ImGui | ||||||
| struct ImGuiState | struct ImGuiState | ||||||
| { | { | ||||||
|     bool                    Initialized; |     bool                    Initialized; | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 ocornut
					ocornut