Skip to content

Commit

Permalink
Renamed windowManager namespace to window for consistency
Browse files Browse the repository at this point in the history
  • Loading branch information
stuarthayhurst committed Jul 18, 2023
1 parent 3d26c8d commit d41c9bd
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 18 deletions.
2 changes: 1 addition & 1 deletion src/ammonite/graphics/renderInterface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions src/ammonite/utils/controls.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
10 changes: 5 additions & 5 deletions src/ammonite/windowManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
#include "internal/internalDebug.hpp"

namespace ammonite {
namespace windowManager {
namespace window {
namespace {
//Window pointer
GLFWwindow* window;
Expand Down Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/ammonite/windowManager.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#include "constants.hpp"

namespace ammonite {
namespace windowManager {
namespace window {
namespace setup {
bool setupGlfw(int antialiasing);
bool setupGlew(GLFWwindow* window);
Expand Down
16 changes: 8 additions & 8 deletions src/demo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ void cleanUp(int modelCount, std::vector<int> 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[]) {
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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;
}

Expand All @@ -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;
}
}
Expand Down Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/demos/object-field.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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] = {
Expand Down

0 comments on commit d41c9bd

Please sign in to comment.