refactor: changed defines to constexpr
This commit is contained in:
@@ -16,10 +16,6 @@
|
|||||||
#include "render/WorldRenderer.h"
|
#include "render/WorldRenderer.h"
|
||||||
#include "../render/gui/imgui/imgui_impl_sdl.h"
|
#include "../render/gui/imgui/imgui_impl_sdl.h"
|
||||||
|
|
||||||
#define WINDOW_NAME "Tower Defense"
|
|
||||||
#define WINDOW_WIDTH 800
|
|
||||||
#define WINDOW_HEIGHT 600
|
|
||||||
|
|
||||||
#include <SDL2/SDL_render.h>
|
#include <SDL2/SDL_render.h>
|
||||||
|
|
||||||
namespace Display {
|
namespace Display {
|
||||||
@@ -27,6 +23,10 @@ namespace Display {
|
|||||||
static SDL_Window* window;
|
static SDL_Window* window;
|
||||||
static SDL_GLContext glContext;
|
static SDL_GLContext glContext;
|
||||||
|
|
||||||
|
static constexpr int WindowWidth = 800;
|
||||||
|
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>();
|
std::unique_ptr<td::render::Renderer> renderer = std::make_unique<td::render::Renderer>();
|
||||||
std::unique_ptr<td::render::TowerGui> towerGui;
|
std::unique_ptr<td::render::TowerGui> towerGui;
|
||||||
|
|
||||||
@@ -43,7 +43,7 @@ void windowResizeEvent(int width, int height) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool create() {
|
bool create() {
|
||||||
window = SDL_CreateWindow(WINDOW_NAME, SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, WINDOW_WIDTH, WINDOW_HEIGHT, SDL_WINDOW_OPENGL | SDL_WINDOW_RESIZABLE);
|
window = SDL_CreateWindow(WindowName, SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, WindowWidth, WindowHeight, SDL_WINDOW_OPENGL | SDL_WINDOW_RESIZABLE);
|
||||||
// Prepare and create context
|
// Prepare and create context
|
||||||
#ifdef __ANDROID__
|
#ifdef __ANDROID__
|
||||||
SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_ES);
|
SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_ES);
|
||||||
@@ -104,7 +104,7 @@ bool create() {
|
|||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
towerGui = std::make_unique<td::render::TowerGui>(window, glContext, renderer.get());
|
towerGui = std::make_unique<td::render::TowerGui>(window, glContext, renderer.get());
|
||||||
windowResizeEvent(WINDOW_WIDTH, WINDOW_HEIGHT);
|
windowResizeEvent(WindowWidth, WindowHeight);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user