refactor: format

This commit is contained in:
2021-11-14 12:04:11 +01:00
parent 004b9b714d
commit 44922d1819

View File

@@ -24,7 +24,7 @@ static SDL_Window* window;
static SDL_GLContext glContext; static SDL_GLContext glContext;
static constexpr int WindowWidth = 800; static constexpr int WindowWidth = 800;
static constexpr int WindowHeight= 600; static constexpr int WindowHeight = 600;
static constexpr const char WindowName[] = "Tower Defense"; static constexpr const char WindowName[] = "Tower Defense";
std::unique_ptr<td::render::Renderer> renderer = std::make_unique<td::render::Renderer>(); std::unique_ptr<td::render::Renderer> renderer = std::make_unique<td::render::Renderer>();
@@ -64,9 +64,8 @@ bool create() {
glContext = SDL_GL_CreateContext(window); glContext = SDL_GL_CreateContext(window);
if (!glContext) if (!glContext) {
{ std::cerr << "Could not create context! SDL error: " << SDL_GetError() << std::endl;
std::cerr << "Could not create context! SDL reports error: " << SDL_GetError() << std::endl;
return false; return false;
} }
@@ -128,14 +127,14 @@ void destroy() {
void pollEvents() { void pollEvents() {
SDL_Event event; SDL_Event event;
while(SDL_PollEvent(&event)){ while (SDL_PollEvent(&event)) {
if(event.type == SDL_WINDOWEVENT){ if (event.type == SDL_WINDOWEVENT) {
switch(event.window.event){ switch (event.window.event) {
case SDL_WINDOWEVENT_CLOSE:{ case SDL_WINDOWEVENT_CLOSE: {
shouldClose = true; shouldClose = true;
} }
case SDL_WINDOWEVENT_RESIZED:{ case SDL_WINDOWEVENT_RESIZED: {
int windowWidth, windowHeight; int windowWidth, windowHeight;
SDL_GetWindowSize(window, &windowWidth, &windowHeight); SDL_GetWindowSize(window, &windowWidth, &windowHeight);
windowResizeEvent(windowWidth, windowHeight); windowResizeEvent(windowWidth, windowHeight);