GIGA REFACTOR
This commit is contained in:
@@ -35,14 +35,14 @@ static float aspectRatio;
|
||||
|
||||
static bool shouldClose = false;
|
||||
|
||||
void windowResizeEvent(int width, int height) {
|
||||
void WindowResizeEvent(int width, int height) {
|
||||
aspectRatio = (float)width / height;
|
||||
renderer->resize(width, height);
|
||||
renderer->Resize(width, height);
|
||||
lastWidth = width;
|
||||
lastHeight = height;
|
||||
}
|
||||
|
||||
bool create() {
|
||||
bool Create() {
|
||||
window = SDL_CreateWindow(WindowName, SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, WindowWidth, WindowHeight, SDL_WINDOW_OPENGL | SDL_WINDOW_RESIZABLE);
|
||||
// Prepare and create context
|
||||
#ifdef __ANDROID__
|
||||
@@ -99,24 +99,24 @@ bool create() {
|
||||
|
||||
SDL_GL_MakeCurrent(window, glContext);
|
||||
|
||||
if (!renderer->init()) {
|
||||
if (!renderer->Init()) {
|
||||
exit(1);
|
||||
}
|
||||
towerGui = std::make_unique<td::render::TowerGui>(window, glContext, renderer.get());
|
||||
windowResizeEvent(WindowWidth, WindowHeight);
|
||||
WindowResizeEvent(WindowWidth, WindowHeight);
|
||||
return true;
|
||||
}
|
||||
|
||||
void render() {
|
||||
renderer->prepare();
|
||||
towerGui->render();
|
||||
void Render() {
|
||||
renderer->Prepare();
|
||||
towerGui->Render();
|
||||
}
|
||||
|
||||
void update() {
|
||||
void Update() {
|
||||
SDL_GL_SwapWindow(window);
|
||||
}
|
||||
|
||||
void destroy() {
|
||||
void Destroy() {
|
||||
renderer.reset(0);
|
||||
towerGui.reset(0);
|
||||
SDL_GL_DeleteContext(glContext);
|
||||
@@ -125,7 +125,7 @@ void destroy() {
|
||||
window = NULL;
|
||||
}
|
||||
|
||||
void pollEvents() {
|
||||
void PollEvents() {
|
||||
SDL_Event event;
|
||||
while (SDL_PollEvent(&event)) {
|
||||
if (event.type == SDL_WINDOWEVENT) {
|
||||
@@ -137,7 +137,7 @@ void pollEvents() {
|
||||
case SDL_WINDOWEVENT_RESIZED: {
|
||||
int windowWidth, windowHeight;
|
||||
SDL_GetWindowSize(window, &windowWidth, &windowHeight);
|
||||
windowResizeEvent(windowWidth, windowHeight);
|
||||
WindowResizeEvent(windowWidth, windowHeight);
|
||||
}
|
||||
|
||||
default:
|
||||
@@ -148,22 +148,22 @@ void pollEvents() {
|
||||
}
|
||||
}
|
||||
|
||||
bool isCloseRequested() {
|
||||
bool IsCloseRequested() {
|
||||
return shouldClose;
|
||||
}
|
||||
|
||||
bool isMouseDown(int button) {
|
||||
bool IsMouseDown(int button) {
|
||||
return ImGui::GetIO().MouseDown[button];
|
||||
}
|
||||
|
||||
float getAspectRatio() {
|
||||
float GetAspectRatio() {
|
||||
return aspectRatio;
|
||||
}
|
||||
|
||||
int getWindowWidth() {
|
||||
int GetWindowWidth() {
|
||||
return lastWidth;
|
||||
}
|
||||
int getWindowHeight() {
|
||||
int GetWindowHeight() {
|
||||
return lastHeight;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user