Compare commits
	
		
			3 Commits
		
	
	
		
			719400068a
			...
			bde0f2c
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| bde0f2c7c3 | |||
| 83bbac2cd1 | |||
| d5dede5a61 | 
							
								
								
									
										18
									
								
								src/main.cpp
									
									
									
									
									
								
							
							
						
						
									
										18
									
								
								src/main.cpp
									
									
									
									
									
								
							@@ -10,7 +10,6 @@
 | 
			
		||||
#include "./start_screen.hpp"
 | 
			
		||||
 | 
			
		||||
#include <memory>
 | 
			
		||||
#include <future>
 | 
			
		||||
#include <iostream>
 | 
			
		||||
#include <thread>
 | 
			
		||||
#include <chrono>
 | 
			
		||||
@@ -29,8 +28,6 @@ int main(int argc, char** argv) {
 | 
			
		||||
		std::cerr << "SDL_Init failed (" << SDL_GetError() << ")\n";
 | 
			
		||||
		return 1;
 | 
			
		||||
	}
 | 
			
		||||
	// me just messing with RAII cleanup
 | 
			
		||||
	auto sdl_scope = std::async(std::launch::deferred, &SDL_Quit);
 | 
			
		||||
 | 
			
		||||
	// more RAII
 | 
			
		||||
	std::unique_ptr<SDL_Window, decltype(&SDL_DestroyWindow)> window {
 | 
			
		||||
@@ -86,9 +83,7 @@ int main(int argc, char** argv) {
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	ImGui_ImplSDL3_InitForSDLRenderer(window.get(), renderer.get());
 | 
			
		||||
	auto imgui_sdl_scope = std::async(std::launch::deferred, &ImGui_ImplSDL3_Shutdown);
 | 
			
		||||
	ImGui_ImplSDLRenderer3_Init(renderer.get());
 | 
			
		||||
	auto imgui_sdlrenderer_scope = std::async(std::launch::deferred, &ImGui_ImplSDLRenderer3_Shutdown);
 | 
			
		||||
 | 
			
		||||
	std::unique_ptr<Screen> screen = std::make_unique<StartScreen>(renderer.get());
 | 
			
		||||
 | 
			
		||||
@@ -213,6 +208,19 @@ int main(int argc, char** argv) {
 | 
			
		||||
#endif
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	// TODO: use scope for the unique ptrs
 | 
			
		||||
 | 
			
		||||
	screen.reset();
 | 
			
		||||
 | 
			
		||||
	ImGui_ImplSDLRenderer3_Shutdown();
 | 
			
		||||
	ImGui_ImplSDL3_Shutdown();
 | 
			
		||||
	ImGui::DestroyContext();
 | 
			
		||||
 | 
			
		||||
	renderer.reset();
 | 
			
		||||
	window.reset();
 | 
			
		||||
 | 
			
		||||
	SDL_Quit();
 | 
			
		||||
 | 
			
		||||
	return 0;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -215,9 +215,24 @@ Screen* MainScreen::render(float time_delta, bool&) {
 | 
			
		||||
					ImGui::EndMenu();
 | 
			
		||||
				}
 | 
			
		||||
				if (ImGui::BeginMenu("Settings")) {
 | 
			
		||||
					if (ImGui::MenuItem("ImGui Style Editor")) {
 | 
			
		||||
					ImGui::SeparatorText("ImGui");
 | 
			
		||||
 | 
			
		||||
					if (ImGui::MenuItem("Style Editor")) {
 | 
			
		||||
						_show_tool_style_editor = true;
 | 
			
		||||
					}
 | 
			
		||||
 | 
			
		||||
					if (ImGui::MenuItem("Metrics")) {
 | 
			
		||||
						_show_tool_metrics = true;
 | 
			
		||||
					}
 | 
			
		||||
 | 
			
		||||
					if (ImGui::MenuItem("Debug Log")) {
 | 
			
		||||
						_show_tool_debug_log = true;
 | 
			
		||||
					}
 | 
			
		||||
 | 
			
		||||
					if (ImGui::MenuItem("ID Stack Tool")) {
 | 
			
		||||
						_show_tool_id_stack = true;
 | 
			
		||||
					}
 | 
			
		||||
 | 
			
		||||
					ImGui::EndMenu();
 | 
			
		||||
				}
 | 
			
		||||
				ImGui::EndMenuBar();
 | 
			
		||||
@@ -234,6 +249,18 @@ Screen* MainScreen::render(float time_delta, bool&) {
 | 
			
		||||
		ImGui::End();
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if (_show_tool_metrics) {
 | 
			
		||||
		ImGui::ShowMetricsWindow(&_show_tool_metrics);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if (_show_tool_debug_log) {
 | 
			
		||||
		ImGui::ShowDebugLogWindow(&_show_tool_debug_log);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if (_show_tool_id_stack) {
 | 
			
		||||
		ImGui::ShowIDStackToolWindow(&_show_tool_id_stack);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if constexpr (false) {
 | 
			
		||||
		ImGui::ShowDemoWindow();
 | 
			
		||||
	}
 | 
			
		||||
 
 | 
			
		||||
@@ -76,6 +76,9 @@ struct MainScreen final : public Screen {
 | 
			
		||||
	ToxDHTCapHisto tdch;
 | 
			
		||||
 | 
			
		||||
	bool _show_tool_style_editor {false};
 | 
			
		||||
	bool _show_tool_metrics {false};
 | 
			
		||||
	bool _show_tool_debug_log {false};
 | 
			
		||||
	bool _show_tool_id_stack {false};
 | 
			
		||||
 | 
			
		||||
	bool _window_hidden {false};
 | 
			
		||||
	uint64_t _window_hidden_ts {0};
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user