MCPcopy Create free account
hub / github.com/OpenStarbound/OpenStarbound / update

Method update

source/frontend/StarRadioMessagePopup.cpp:47–73  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

45}
46
47void RadioMessagePopup::update(float dt) {
48 if (messageActive()) {
49 if (m_stageTimer.tick(dt))
50 nextPopupStage();
51
52 if (m_popupStage == PopupStage::AnimateIn) {
53 int frame = floor((1.0f - m_stageTimer.percent()) * m_animateInFrames);
54 setBG("", strf("{}:{}", m_animateInImage, frame), "");
55 } else if (m_popupStage == PopupStage::ScrollText) {
56 int frame =
57 int((m_stageTimer.timer / m_message.portraitSpeed) * m_message.portraitFrames) % m_message.portraitFrames;
58 m_portraitImage->setImage(m_message.portraitImage.replace("<frame>", toString(frame)));
59 int textLength = floor(Text::stripEscapeCodes(m_message.text).length() * (1.0f - m_stageTimer.percent()));
60 m_messageLabel->setTextCharLimit(textLength);
61 } else if (m_popupStage == PopupStage::Persist) {
62 // you're cool, just stay cool, cool person
63 } else if (m_popupStage == PopupStage::AnimateOut) {
64 int frame = floor((1.0f - m_stageTimer.percent()) * m_animateOutFrames);
65 setBG("", strf("{}:{}", m_animateOutImage, frame), "");
66 }
67
68 m_slideTimer = min(m_slideTimer + dt, m_slideTime);
69 updateAnchorOffset();
70 }
71
72 Pane::update(dt);
73}
74
75void RadioMessagePopup::dismissed() {
76 if (m_chatterSound)

Callers

nothing calls this directly

Calls 9

strfFunction · 0.85
toStringFunction · 0.85
stripEscapeCodesFunction · 0.85
percentMethod · 0.80
setImageMethod · 0.80
setTextCharLimitMethod · 0.80
tickMethod · 0.45
replaceMethod · 0.45
lengthMethod · 0.45

Tested by

no test coverage detected