Веб-сайт самохостера Lotigara

summaryrefslogtreecommitdiff
path: root/source/frontend/StarChatBubbleManager.cpp
diff options
context:
space:
mode:
authorKae <80987908+Novaenia@users.noreply.github.com>2023-07-21 00:58:49 +1000
committerKae <80987908+Novaenia@users.noreply.github.com>2023-07-21 00:58:49 +1000
commit4b0bc220e4da1173f742a4973939b139bef562db (patch)
tree0ff66d5957575fa814fc10b8cd93e3dd378f45dc /source/frontend/StarChatBubbleManager.cpp
parent607be749451aa40e3619e7ceab0927d1fcec8233 (diff)
Support for changing the game's timescale
Context-specific (like per-world) timescales can also be added later
Diffstat (limited to 'source/frontend/StarChatBubbleManager.cpp')
-rw-r--r--source/frontend/StarChatBubbleManager.cpp10
1 files changed, 5 insertions, 5 deletions
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<Bubble>& bubbleState, Bubble& bubble) {
- bubble.age += WorldTimestep;
+void ChatBubbleManager::update(float dt, WorldClientPtr world) {
+ m_bubbles.forEach([this, dt, &world](BubbleState<Bubble>& bubbleState, Bubble& bubble) {
+ bubble.age += dt;
if (auto entity = world->get<ChattyEntity>(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<ChattyEntity>(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 {