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 constexpr int WindowWidth = 800;
static constexpr int WindowHeight= 600;
static constexpr int WindowHeight = 600;
static constexpr const char WindowName[] = "Tower Defense";
std::unique_ptr<td::render::Renderer> renderer = std::make_unique<td::render::Renderer>();
@@ -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;
}
@@ -128,14 +127,14 @@ void destroy() {
void pollEvents() {
SDL_Event event;
while(SDL_PollEvent(&event)){
if(event.type == SDL_WINDOWEVENT){
switch(event.window.event){
case SDL_WINDOWEVENT_CLOSE:{
while (SDL_PollEvent(&event)) {
if (event.type == SDL_WINDOWEVENT) {
switch (event.window.event) {
case SDL_WINDOWEVENT_CLOSE: {
shouldClose = true;
}
case SDL_WINDOWEVENT_RESIZED:{
case SDL_WINDOWEVENT_RESIZED: {
int windowWidth, windowHeight;
SDL_GetWindowSize(window, &windowWidth, &windowHeight);
windowResizeEvent(windowWidth, windowHeight);