diff options
author | Kae <80987908+Novaenia@users.noreply.github.com> | 2024-04-08 14:22:22 +1000 |
---|---|---|
committer | Kae <80987908+Novaenia@users.noreply.github.com> | 2024-04-08 14:22:22 +1000 |
commit | 8a8a0501590e83cbc598c7491fca0b767094466f (patch) | |
tree | 4fd806e646179fa9a7e4027cc60e19492d003ade /source/rendering/StarWorldCamera.hpp | |
parent | 4458d2e85ed7f9e373af290dbe8063a52d2824b5 (diff) |
2 features: multi-sample anti-aliasing & Lua patches for images
Diffstat (limited to 'source/rendering/StarWorldCamera.hpp')
-rw-r--r-- | source/rendering/StarWorldCamera.hpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/source/rendering/StarWorldCamera.hpp b/source/rendering/StarWorldCamera.hpp index e022560..6354167 100644 --- a/source/rendering/StarWorldCamera.hpp +++ b/source/rendering/StarWorldCamera.hpp @@ -20,8 +20,8 @@ public: // Set the camera center position (in world space) to as close to the given // location as possible while keeping the screen within world bounds. + void setCenterWorldPosition(Vec2F const& position, bool force = false); // Returns the actual camera position. - void setCenterWorldPosition(Vec2F const& position); Vec2F centerWorldPosition() const; // Transforms world coordinates into one set of screen coordinates. Since @@ -121,7 +121,11 @@ inline Vec2F WorldCamera::tileMinScreen() const { } inline void WorldCamera::update(float dt) { - m_pixelRatio = lerp(exp(-20.0f * dt), m_targetPixelRatio, m_pixelRatio); + float newPixelRatio = lerp(exp(-20.0f * dt), m_targetPixelRatio, m_pixelRatio); + if (m_pixelRatio != newPixelRatio) { + m_pixelRatio = newPixelRatio; + setCenterWorldPosition(m_worldCenter, true); + } } } |