From d41c9bd33fb871151e788d6ceeb133027cfec276 Mon Sep 17 00:00:00 2001 From: Stuart Hayhurst Date: Tue, 18 Jul 2023 02:57:13 +0100 Subject: [PATCH] Renamed windowManager namespace to window for consistency --- src/ammonite/graphics/renderInterface.cpp | 2 +- src/ammonite/utils/controls.cpp | 4 ++-- src/ammonite/windowManager.cpp | 10 +++++----- src/ammonite/windowManager.hpp | 2 +- src/demo.cpp | 16 ++++++++-------- src/demos/object-field.cpp | 2 +- 6 files changed, 18 insertions(+), 18 deletions(-) diff --git a/src/ammonite/graphics/renderInterface.cpp b/src/ammonite/graphics/renderInterface.cpp index 25d3f66..9b4d4d6 100644 --- a/src/ammonite/graphics/renderInterface.cpp +++ b/src/ammonite/graphics/renderInterface.cpp @@ -25,7 +25,7 @@ namespace ammonite { //Start a timer to measure load time ammonite::utils::Timer loadTimer; - GLFWwindow* window = ammonite::windowManager::getWindowPtr(); + GLFWwindow* window = ammonite::window::getWindowPtr(); //Check GPU supported required extensions int failureCount = 0; diff --git a/src/ammonite/utils/controls.cpp b/src/ammonite/utils/controls.cpp index 49cdacb..1f09c35 100644 --- a/src/ammonite/utils/controls.cpp +++ b/src/ammonite/utils/controls.cpp @@ -142,8 +142,8 @@ namespace ammonite { } void setupControls() { - //Connect window and aspect ratio pointers - window = ammonite::windowManager::getWindowPtr(); + //Connect window pointer + window = ammonite::window::getWindowPtr(); //Set mouse callbacks glfwSetScrollCallback(window, scroll_callback); diff --git a/src/ammonite/windowManager.cpp b/src/ammonite/windowManager.cpp index bff2042..9887784 100644 --- a/src/ammonite/windowManager.cpp +++ b/src/ammonite/windowManager.cpp @@ -16,7 +16,7 @@ #include "internal/internalDebug.hpp" namespace ammonite { - namespace windowManager { + namespace window { namespace { //Window pointer GLFWwindow* window; @@ -185,22 +185,22 @@ namespace ammonite { //Wrapper to create and setup window GLFWwindow* setupWindow(int width, int height, const char* title) { //Setup GLFW - if (!windowManager::setup::setupGlfw()) { + if (!window::setup::setupGlfw()) { return nullptr; } - auto window = windowManager::createWindow(width, height, title); + auto window = window::createWindow(width, height, title); if (window == NULL) { return nullptr; } //Setup GLEW - if (!windowManager::setup::setupGlew(window)) { + if (!window::setup::setupGlew(window)) { return nullptr; } //Setup input for window - windowManager::setup::setupGlfwInput(window); + window::setup::setupGlfwInput(window); //Return same values as createWindow() return window; diff --git a/src/ammonite/windowManager.hpp b/src/ammonite/windowManager.hpp index 325f204..16ee4a4 100644 --- a/src/ammonite/windowManager.hpp +++ b/src/ammonite/windowManager.hpp @@ -6,7 +6,7 @@ #include "constants.hpp" namespace ammonite { - namespace windowManager { + namespace window { namespace setup { bool setupGlfw(int antialiasing); bool setupGlew(GLFWwindow* window); diff --git a/src/demo.cpp b/src/demo.cpp index 6a4061f..f0bebd6 100644 --- a/src/demo.cpp +++ b/src/demo.cpp @@ -52,7 +52,7 @@ void cleanUp(int modelCount, std::vector loadedModelIds) { for (int i = 0; i < modelCount; i++) { ammonite::models::deleteModel(loadedModelIds[i]); } - ammonite::windowManager::setup::destroyGlfw(); + ammonite::window::setup::destroyGlfw(); } int main(int argc, char* argv[]) { @@ -106,21 +106,21 @@ int main(int argc, char* argv[]) { ammonite::utils::Timer utilityTimer; #ifdef DEBUG - ammonite::windowManager::requestContextType(AMMONITE_DEBUG_CONTEXT); + ammonite::window::requestContextType(AMMONITE_DEBUG_CONTEXT); #else #ifdef FAST - ammonite::windowManager::requestContextType(AMMONITE_NO_ERROR_CONTEXT); + ammonite::window::requestContextType(AMMONITE_NO_ERROR_CONTEXT); #endif #endif //Create the window - auto window = ammonite::windowManager::setupWindow(1024, 768, "OpenGL Experiments"); + auto window = ammonite::window::setupWindow(1024, 768, "OpenGL Experiments"); if (window == NULL) { return EXIT_FAILURE; } //Set an icon - ammonite::windowManager::useIconDir("assets/icons/"); + ammonite::window::useIconDir("assets/icons/"); //Set vsync (disable if benchmarking) if (useVsync == "false" or useBenchmark) { @@ -153,7 +153,7 @@ int main(int argc, char* argv[]) { //Renderer failed to initialise, clean up and exit if (!success) { std::cerr << "ERROR: Failed to initialise renderer, exiting" << std::endl; - ammonite::windowManager::setup::destroyGlfw(); + ammonite::window::setup::destroyGlfw(); return EXIT_FAILURE; } @@ -167,7 +167,7 @@ int main(int argc, char* argv[]) { if (postRendererInit != nullptr) { if (postRendererInit() == -1) { std::cerr << "ERROR: Failed to set up demo, exiting" << std::endl; - ammonite::windowManager::setup::destroyGlfw(); + ammonite::window::setup::destroyGlfw(); return EXIT_FAILURE; } } @@ -275,7 +275,7 @@ int main(int argc, char* argv[]) { cleanExit = false; std::cerr << "ERROR: Failed to clean up, exiting" << std::endl; } - ammonite::windowManager::setup::destroyGlfw(); + ammonite::window::setup::destroyGlfw(); if (!cleanExit) { return EXIT_FAILURE; diff --git a/src/demos/object-field.cpp b/src/demos/object-field.cpp index a23a531..c10d74c 100644 --- a/src/demos/object-field.cpp +++ b/src/demos/object-field.cpp @@ -73,7 +73,7 @@ namespace objectFieldDemo { int postRendererInit() { int screenId = ammonite::interface::getActiveLoadingScreen(); - window = ammonite::windowManager::getWindowPtr(); + window = ammonite::window::getWindowPtr(); //Hold data for randomised cube positions glm::vec3 cubeData[cubeCount + 1][3] = {