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

Method render

source/game/objects/StarContainerObject.cpp:111–146  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

109}
110
111void ContainerObject::render(RenderCallback* renderCallback) {
112 auto assets = Root::singleton().assets();
113
114 if (m_animationFrameCooldown <= 0) {
115 if (m_opened.get() != m_currentState) {
116 if (m_currentState == 0) {
117 // opening, or flipping to the other side
118 if (!configValue("openSounds").isNull()) {
119 auto audio = make_shared<AudioInstance>(*assets->audio(Random::randValueFrom(configValue("openSounds").toArray()).toString()));
120 audio->setPosition(position());
121 audio->setRangeMultiplier(config()->soundEffectRangeMultiplier);
122 renderCallback->addAudio(std::move(audio));
123 }
124 }
125 if (m_currentState == configValue("openFrameIndex", 2).toInt()) {
126 // closing
127 if (!configValue("closeSounds").isNull()) {
128 auto audio = make_shared<AudioInstance>(*assets->audio(Random::randValueFrom(configValue("closeSounds").toArray()).toString()));
129 audio->setPosition(position());
130 audio->setRangeMultiplier(config()->soundEffectRangeMultiplier);
131 renderCallback->addAudio(std::move(audio));
132 }
133 }
134 if (m_opened.get() < m_currentState) {
135 m_currentState -= 1;
136 } else {
137 m_currentState += 1;
138 }
139 m_animationFrameCooldown = configValue("frameCooldown").toInt();
140 } else {
141 m_animationFrameCooldown = 0;
142 }
143 }
144
145 Object::render(renderCallback);
146}
147
148void ContainerObject::destroy(RenderCallback* renderCallback) {
149 Object::destroy(renderCallback);

Callers

nothing calls this directly

Calls 11

singletonClass · 0.85
assetsMethod · 0.80
audioMethod · 0.80
toArrayMethod · 0.80
setRangeMultiplierMethod · 0.80
addAudioMethod · 0.80
toIntMethod · 0.80
getMethod · 0.45
isNullMethod · 0.45
toStringMethod · 0.45
setPositionMethod · 0.45

Tested by

no test coverage detected