Cambios en Camera.
Ahora la cámara hereda de Transformable. Preparando la "proyección" de Rects respecto a Camera. Probablemente requiera crear la clase Window para ello.
This commit is contained in:
+8
-8
@@ -150,27 +150,27 @@ void Loop()
|
||||
UE::Camera* cam = UE_Renderer->GetCamera();
|
||||
if (keyStates[SDL_SCANCODE_W])
|
||||
{
|
||||
glm::ivec2 camPos = cam->GetCamPosition();
|
||||
glm::ivec2 camPos = cam->GetPosition();
|
||||
camPos.y -= 5;
|
||||
cam->SetCamPosition(camPos.x, camPos.y);
|
||||
cam->SetPosition(camPos.x, camPos.y);
|
||||
}
|
||||
if (keyStates[SDL_SCANCODE_S])
|
||||
{
|
||||
glm::ivec2 camPos = cam->GetCamPosition();
|
||||
glm::ivec2 camPos = cam->GetPosition();
|
||||
camPos.y += 5;
|
||||
cam->SetCamPosition(camPos.x, camPos.y);
|
||||
cam->SetPosition(camPos.x, camPos.y);
|
||||
}
|
||||
if (keyStates[SDL_SCANCODE_D])
|
||||
{
|
||||
glm::ivec2 camPos = cam->GetCamPosition();
|
||||
glm::ivec2 camPos = cam->GetPosition();
|
||||
camPos.x += 5;
|
||||
cam->SetCamPosition(camPos.x, camPos.y);
|
||||
cam->SetPosition(camPos.x, camPos.y);
|
||||
}
|
||||
if (keyStates[SDL_SCANCODE_A])
|
||||
{
|
||||
glm::ivec2 camPos = cam->GetCamPosition();
|
||||
glm::ivec2 camPos = cam->GetPosition();
|
||||
camPos.x -= 5;
|
||||
cam->SetCamPosition(camPos.x, camPos.y);
|
||||
cam->SetPosition(camPos.x, camPos.y);
|
||||
}
|
||||
|
||||
currentScene->SceneUpdate();
|
||||
|
||||
@@ -90,7 +90,7 @@ public:
|
||||
{
|
||||
UE::Renderer* rend = UE::Engine::GetRenderer();
|
||||
glm::ivec2 mPos(event->button.x, event->button.y);
|
||||
glm::ivec2 wPos = rend->ScreenToWorldCoords(mPos);
|
||||
glm::ivec2 wPos = rend->GetCamera()->ScreenToWorldCoords(mPos);
|
||||
GAME_LOG_TRACE("Posicion del raton: \n\tPantalla: {0}x{1}, Mundo: {2}x{3}: ", mPos.x, mPos.y, wPos.x, wPos.y);
|
||||
ModificarSprite(wPos);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user