From 474b096337c08b97100dd090602748e54977b84e Mon Sep 17 00:00:00 2001 From: Grayson Riffe Date: Sun, 2 Feb 2025 15:10:13 -0600 Subject: [PATCH] Set window title --- NothinFancy/src/client/Client.cpp | 2 +- NothinFancy/src/client/Window.cpp | 6 ++++-- NothinFancy/src/client/Window.h | 2 +- TestGame/src/TestGame.cpp | 1 + 4 files changed, 7 insertions(+), 4 deletions(-) diff --git a/NothinFancy/src/client/Client.cpp b/NothinFancy/src/client/Client.cpp index bc23fc7..cdb06d3 100644 --- a/NothinFancy/src/client/Client.cpp +++ b/NothinFancy/src/client/Client.cpp @@ -6,7 +6,7 @@ namespace nf::cli { Client::Client(ClientConfig config) : m_config(config) - , m_window(m_config.display) + , m_window(m_config.appName, m_config.display) { // Setup window and renderer } diff --git a/NothinFancy/src/client/Window.cpp b/NothinFancy/src/client/Window.cpp index 8eb0946..6e6df25 100644 --- a/NothinFancy/src/client/Window.cpp +++ b/NothinFancy/src/client/Window.cpp @@ -5,7 +5,7 @@ #include "util.h" namespace nf::cli { - Window::Window(DisplayConfig config) + Window::Window(const char* windowTitle, DisplayConfig config) : m_handle(nullptr) , m_wndClassName("NothinFancyWindow") , m_windowedStyle(WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX) @@ -24,11 +24,12 @@ namespace nf::cli { wc.lpfnWndProc = wndProc; RegisterClass(&wc); - m_handle = CreateWindow(m_wndClassName, "NF Window", NULL, 0, 0, 0, 0, nullptr, nullptr, nullptr, this); + m_handle = CreateWindow(m_wndClassName, windowTitle, NULL, 0, 0, 0, 0, nullptr, nullptr, nullptr, this); setDisplay(config); } void Window::setDisplay(DisplayConfig config) { + NFLog("Setting window display"); m_config = config; bool wasShown = IsWindowVisible(m_handle); show(false); @@ -99,6 +100,7 @@ namespace nf::cli { case WM_CLOSE: DestroyWindow(hWnd); + NFLog("Window destroyed"); return 0; case WM_DESTROY: diff --git a/NothinFancy/src/client/Window.h b/NothinFancy/src/client/Window.h index 07bf33e..47b2ba1 100644 --- a/NothinFancy/src/client/Window.h +++ b/NothinFancy/src/client/Window.h @@ -8,7 +8,7 @@ namespace nf::cli { class Window { public: - Window(DisplayConfig config); + Window(const char* windowTitle, DisplayConfig config); void setDisplay(DisplayConfig config); void runLoop(); diff --git a/TestGame/src/TestGame.cpp b/TestGame/src/TestGame.cpp index bd90431..558bb06 100644 --- a/TestGame/src/TestGame.cpp +++ b/TestGame/src/TestGame.cpp @@ -5,6 +5,7 @@ namespace nf { ClientConfig configureEngine(CommandLineArguments cmdArgs) { ClientConfig config; + config.appName = "TestGame"; //config.display.mode = DisplayMode::Fullscreen; return config; }