From 4b0bc220e4da1173f742a4973939b139bef562db Mon Sep 17 00:00:00 2001 From: Kae <80987908+Novaenia@users.noreply.github.com> Date: Fri, 21 Jul 2023 00:58:49 +1000 Subject: Support for changing the game's timescale Context-specific (like per-world) timescales can also be added later --- source/frontend/StarChatBubbleManager.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'source/frontend/StarChatBubbleManager.cpp') diff --git a/source/frontend/StarChatBubbleManager.cpp b/source/frontend/StarChatBubbleManager.cpp index b9077fe..166eba0 100644 --- a/source/frontend/StarChatBubbleManager.cpp +++ b/source/frontend/StarChatBubbleManager.cpp @@ -86,9 +86,9 @@ void ChatBubbleManager::setCamera(WorldCamera const& camera) { } } -void ChatBubbleManager::update(WorldClientPtr world) { - m_bubbles.forEach([this, &world](BubbleState& bubbleState, Bubble& bubble) { - bubble.age += WorldTimestep; +void ChatBubbleManager::update(float dt, WorldClientPtr world) { + m_bubbles.forEach([this, dt, &world](BubbleState& bubbleState, Bubble& bubble) { + bubble.age += dt; if (auto entity = world->get(bubble.entity)) { bubble.onscreen = m_camera.worldGeometry().rectIntersectsRect( m_camera.worldScreenRect(), entity->metaBoundBox().translated(entity->position())); @@ -97,7 +97,7 @@ void ChatBubbleManager::update(WorldClientPtr world) { }); for (auto& portraitBubble : m_portraitBubbles) { - portraitBubble.age += WorldTimestep; + portraitBubble.age += dt; if (auto entity = world->entity(portraitBubble.entity)) { portraitBubble.onscreen = m_camera.worldGeometry().rectIntersectsRect(m_camera.worldScreenRect(), entity->metaBoundBox().translated(entity->position())); if (auto chatter = as(entity)) @@ -125,7 +125,7 @@ void ChatBubbleManager::update(WorldClientPtr world) { return false; }); - m_bubbles.update(); + m_bubbles.update(dt); } uint8_t ChatBubbleManager::calcDistanceFadeAlpha(Vec2F bubbleScreenPosition, StoredFunctionPtr fadeFunction) const { -- cgit v1.2.3