From 44922d1819e268ac413d4ab0ec5449ea2193585e Mon Sep 17 00:00:00 2001 From: Persson-dev Date: Sun, 14 Nov 2021 12:04:11 +0100 Subject: [PATCH] refactor: format --- src/window/Display.cpp | 39 +++++++++++++++++++-------------------- 1 file changed, 19 insertions(+), 20 deletions(-) diff --git a/src/window/Display.cpp b/src/window/Display.cpp index 7b97fda..1a528c7 100644 --- a/src/window/Display.cpp +++ b/src/window/Display.cpp @@ -24,7 +24,7 @@ static SDL_Window* window; static SDL_GLContext glContext; static constexpr int WindowWidth = 800; -static constexpr int WindowHeight= 600; +static constexpr int WindowHeight = 600; static constexpr const char WindowName[] = "Tower Defense"; std::unique_ptr renderer = std::make_unique(); @@ -64,9 +64,8 @@ bool create() { glContext = SDL_GL_CreateContext(window); - if (!glContext) - { - std::cerr << "Could not create context! SDL reports error: " << SDL_GetError() << std::endl; + if (!glContext) { + std::cerr << "Could not create context! SDL error: " << SDL_GetError() << std::endl; return false; } @@ -76,9 +75,9 @@ bool create() { SDL_GL_GetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, &major); SDL_GL_GetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, &minor); - SDL_GL_GetAttribute(SDL_GL_RED_SIZE, &r); + SDL_GL_GetAttribute(SDL_GL_RED_SIZE, &r); SDL_GL_GetAttribute(SDL_GL_GREEN_SIZE, &g); - SDL_GL_GetAttribute(SDL_GL_BLUE_SIZE, &b); + SDL_GL_GetAttribute(SDL_GL_BLUE_SIZE, &b); SDL_GL_GetAttribute(SDL_GL_ALPHA_SIZE, &a); SDL_GL_GetAttribute(SDL_GL_DEPTH_SIZE, &depth); @@ -96,7 +95,7 @@ bool create() { } std::cout << "GL Context: " << major << "." << minor << " " << mask_desc - << ", Color : R" << r << "G" << g << "B" << b << "A" << a << ", Depth bits: " << depth << std::endl; + << ", Color : R" << r << "G" << g << "B" << b << "A" << a << ", Depth bits: " << depth << std::endl; SDL_GL_MakeCurrent(window, glContext); @@ -128,21 +127,21 @@ void destroy() { void pollEvents() { SDL_Event event; - while(SDL_PollEvent(&event)){ - if(event.type == SDL_WINDOWEVENT){ - switch(event.window.event){ - case SDL_WINDOWEVENT_CLOSE:{ - shouldClose = true; - } + while (SDL_PollEvent(&event)) { + if (event.type == SDL_WINDOWEVENT) { + switch (event.window.event) { + case SDL_WINDOWEVENT_CLOSE: { + shouldClose = true; + } - case SDL_WINDOWEVENT_RESIZED:{ - int windowWidth, windowHeight; - SDL_GetWindowSize(window, &windowWidth, &windowHeight); - windowResizeEvent(windowWidth, windowHeight); - } + case SDL_WINDOWEVENT_RESIZED: { + int windowWidth, windowHeight; + SDL_GetWindowSize(window, &windowWidth, &windowHeight); + windowResizeEvent(windowWidth, windowHeight); + } - default: - break; + default: + break; } } ImGui_ImplSDL2_ProcessEvent(&event);