change WorldRenderer to class

This commit is contained in:
2021-08-21 13:49:23 +02:00
parent 1bb487d7b0
commit 1b5fd2f66f
12 changed files with 97 additions and 71 deletions

View File

@@ -37,11 +37,6 @@ void keyboard_event(GLFWwindow* window, int key, int scancode, int actions, int
void mouseCursorEvent(GLFWwindow* window, double xPos, double yPos){
static double lastX = xPos;
static double lastY = yPos;
if(isMouseDown(0)){
const float relativeX = (float) (xPos - lastX) / (float) lastWidth * 2;
const float relativeY = (float) (yPos - lastY) / (float) lastHeight * 2;
td::render::WorldRenderer::moveCam(relativeX, relativeY, aspectRatio);
}
lastX = xPos;
lastY = yPos;
}
@@ -54,7 +49,7 @@ void windowResizeEvent(GLFWwindow* window, int width, int height){
}
void mouseScroll(GLFWwindow* window, double x, double y){
td::render::WorldRenderer::changeZoom(y);
}
void registerCallbacks(){
@@ -84,7 +79,6 @@ void create() {
void render() {
td::render::Renderer::prepare();
td::render::WorldRenderer::render();
TowerGui::render();
}
@@ -99,7 +93,6 @@ void update() {
void destroy() {
td::render::Renderer::destroy();
td::render::WorldRenderer::destroy();
TowerGui::destroy();
glfwDestroyWindow(window);
window = NULL;
@@ -108,7 +101,6 @@ void destroy() {
void pollEvents() {
glfwPollEvents();
td::render::WorldRenderer::update();
}
bool isCloseRequested() {