diff --git a/include/ReWindow/types/Window.h b/include/ReWindow/types/Window.h index a728d36..46a7735 100644 --- a/include/ReWindow/types/Window.h +++ b/include/ReWindow/types/Window.h @@ -201,9 +201,14 @@ public: void ForceClose(); void ForceCloseAndTerminateProgram(); - /// Displays a small window with some text and an "OK" button. + /** Display a small window with some text and an "OK" button. + * I tried un-defining the macro, Calling it in a lambda, + * Calling MessageBoxA, Putting the call to the MessageBox + * function in its own namespace and then calling that. + * It just wouldn't let me name it MessageBox - Redacted. */ + /// @note Execution of the parent window is stopped while the message box is up. - void MessageBox(const std::string& title, const std::string& message); + void UniqueFunctionNameForMessageBoxBecauseMicrosoftUsesMacros(const std::string& title, const std::string& message); /// Sets whether or not to make the window fullscreen. /// @note This is implemented per-OS, and as such, it simply requests the OS to do what we want. No guarantee about follow-through can be given. diff --git a/main.cpp b/main.cpp index 375720e..3d69427 100644 --- a/main.cpp +++ b/main.cpp @@ -75,7 +75,7 @@ int main() { window->SetVsyncEnabled(true); window->SetResizable(true); window->SetCursorVisible(false); - window->MessageBox("MessageBox", "Generic message from a ReWindow MessageBox."); + window->UniqueFunctionNameForMessageBoxBecauseMicrosoftUsesMacros("MessageBox", "Generic message from a ReWindow MessageBox."); Logger::Debug(std::format("Window '{}' flags: IN_FOCUS={} FULLSCREEN={} RESIZEABLE={} VSYNC={} QUIT={}", diff --git a/src/platform/linux/Window.cpp b/src/platform/linux/Window.cpp index c556d2d..895a140 100644 --- a/src/platform/linux/Window.cpp +++ b/src/platform/linux/Window.cpp @@ -58,7 +58,7 @@ void RWindow::Raise() { XRaiseWindow(platform->display, platform->window); } -void RWindow::MessageBox(const std::string& window_title, const std::string& message) { +void RWindow::UniqueFunctionNameForMessageBoxBecauseMicrosoftUsesMacros(const std::string& window_title, const std::string& message) { int padding = 10; XFontStruct* font = XLoadQueryFont(platform->display, "6x13"); diff --git a/src/platform/windows/Window.cpp b/src/platform/windows/Window.cpp index faaf9db..8b075e5 100644 --- a/src/platform/windows/Window.cpp +++ b/src/platform/windows/Window.cpp @@ -1,6 +1,7 @@ #include #include #include + class ReWindow::RWindow::Platform { public: HINSTANCE hInstance; @@ -9,7 +10,6 @@ public: }; using namespace ReWindow; - bool fullscreenmode = false; bool open = false; @@ -122,3 +122,6 @@ vsync(wVsync), flags{false,wFullscreen,wResizable,wVsync} { platform = new Platform(); } +void RWindow::UniqueFunctionNameForMessageBoxBecauseMicrosoftUsesMacros(const std::string& title, const std::string& message_box_text) { + MessageBox(nullptr, message_box_text.c_str(), title.c_str(), MB_OK); +} \ No newline at end of file