Little modif

main
anulax1225 ago%!(EXTRA string=6 months)
parent 7a6c7d58c6
commit fffa1b81e9
  1. 4
      src/bakara/renderer/cameras/ortho_camera.cpp
  2. 2
      src/bakara/renderer/cameras/ortho_camera_controller.h
  3. 5
      src/platforms/glfw/glfw_mouse.cpp

@ -8,14 +8,14 @@
namespace Bk namespace Bk
{ {
OrthoCamera::OrthoCamera(float left, float right, float bottom, float top) OrthoCamera::OrthoCamera(float left, float right, float bottom, float top)
: projection(Math::ortho(left, right, bottom, top, -1.0f, 1.0f)) : projection(Math::ortho(left, right, bottom, top, -10.0f, 10.0f))
{ {
RecalculateView(); RecalculateView();
} }
void OrthoCamera::SetProjection(float left, float right, float bottom, float top) void OrthoCamera::SetProjection(float left, float right, float bottom, float top)
{ {
projection = Math::ortho(left, right, bottom, top, -1.0f, 1.0f); projection = Math::ortho(left, right, bottom, top, -10.0f, 10.0f);
viewProjection = projection * view; viewProjection = projection * view;
} }

@ -20,6 +20,8 @@ namespace Bk
void SetMoveSpeed(float moveSpeed) { this->moveSpeed = moveSpeed; } void SetMoveSpeed(float moveSpeed) { this->moveSpeed = moveSpeed; }
void SetRotationSpeed(float rotationSpeed) { this->rotationSpeed = rotationSpeed; } void SetRotationSpeed(float rotationSpeed) { this->rotationSpeed = rotationSpeed; }
void SetZoomLevel(float level) { zoomLevel = level; }
void SetPosition(Vec3 cameraPosition) { this->cameraPosition = cameraPosition; }
private: private:
float aspectRatio; float aspectRatio;

@ -6,10 +6,11 @@ namespace Bk
{ {
Vec2 Mouse::GetPosition() Vec2 Mouse::GetPosition()
{ {
auto* window = static_cast<GLFWwindow*>(Application::Get().GetWindow().GetNativeWindow()); auto& window_handle = Application::Get().GetWindow();
auto* window = static_cast<GLFWwindow*>(window_handle.GetNativeWindow());
double xpos, ypos; double xpos, ypos;
glfwGetCursorPos(window, &xpos, &ypos); glfwGetCursorPos(window, &xpos, &ypos);
return { (float)xpos, (float)ypos }; return { (float)xpos - (float)window_handle.GetWidth()/2, (float)ypos - (float)window_handle.GetHeight()/2 };
} }
bool Mouse::ButtonUp(Code button) bool Mouse::ButtonUp(Code button)

Loading…
Cancel
Save