fix: change render coordinates
This commit is contained in:
@@ -12,6 +12,7 @@
|
||||
#include <stdio.h>
|
||||
#include <glbinding/Binding.h>
|
||||
#include "misc/Time.h"
|
||||
#include "misc/Easing.h"
|
||||
|
||||
using namespace gl;
|
||||
|
||||
@@ -112,8 +113,8 @@ void setZoom(float zoom){
|
||||
}
|
||||
|
||||
void setCamMovement(const glm::vec2& mov){
|
||||
camPos.x += mov.x * (1 - isometricView) + (0.5 * mov.x + mov.y) * isometricView;
|
||||
camPos.y += -mov.y * (1 - isometricView) + (0.5 * mov.x - mov.y) * isometricView;
|
||||
camPos.x += mov.x * (1 - isometricView) + (0.5 * mov.x - mov.y) * isometricView;
|
||||
camPos.y += -mov.y * (1 - isometricView) + (-0.5 * mov.x - mov.y) * isometricView;
|
||||
setCamPos(camPos);
|
||||
}
|
||||
|
||||
@@ -136,8 +137,8 @@ glm::vec2 getCursorWorldPos(const glm::vec2& cursorPos, float aspectRatio, float
|
||||
float deltaX = relativeX * aspectRatio / zoom;
|
||||
float deltaY = relativeY / zoom;
|
||||
|
||||
float worldX = camPos.x + deltaX * (1 - isometricView) + (0.5 * deltaX - deltaY) * isometricView;
|
||||
float worldY = camPos.y + deltaY * (1 - isometricView) + (0.5 * deltaX + deltaY) * isometricView;
|
||||
float worldX = camPos.x + deltaX * (1 - isometricView) + (0.5 * deltaX + deltaY) * isometricView;
|
||||
float worldY = camPos.y + deltaY * (1 - isometricView) + (-0.5 * deltaX + deltaY) * isometricView;
|
||||
|
||||
return {worldX, worldY};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user