MCPcopy Create free account
hub / github.com/TombEngine/TombEngine / DrawAllStrings

Method DrawAllStrings

TombEngine/Renderer/RendererString.cpp:192–227  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

190 }
191
192 void Renderer::DrawAllStrings()
193 {
194 if (_stringsToDraw.empty())
195 return;
196
197 SetBlendMode(BlendMode::AlphaBlend);
198
199 float shadowOffset = 1.5f / (REFERENCE_FONT_SIZE / _gameFont->GetLineSpacing());
200 auto shadowColor = (Vector4)g_GameFlow->GetSettings()->UI.ShadowTextColor;
201
202 _spriteBatch->Begin();
203
204 for (const auto& rString : _stringsToDraw)
205 {
206 auto drawPos = Vector2::Lerp(rString.PrevPosition, rString.Position, GetInterpolationFactor());
207
208 // Draw shadow.
209 if (rString.Flags & (int)PrintStringFlags::Outline)
210 {
211 _gameFont->DrawString(
212 _spriteBatch.get(), rString.String.c_str(),
213 Vector2(drawPos.x + shadowOffset * rString.Scale, drawPos.y + shadowOffset * rString.Scale),
214 (shadowColor * rString.Color.w * shadowColor.w) * ScreenFadeCurrent,
215 0.0f, Vector4::Zero, rString.Scale);
216 }
217
218 // Draw string.
219 _gameFont->DrawString(
220 _spriteBatch.get(), rString.String.c_str(),
221 Vector2(drawPos.x, drawPos.y),
222 (rString.Color * rString.Color.w) * ScreenFadeCurrent,
223 0.0f, Vector4::Zero, rString.Scale);
224 }
225
226 _spriteBatch->End();
227 }
228}

Callers

nothing calls this directly

Calls 6

LerpFunction · 0.85
GetSettingsMethod · 0.80
Vector2Function · 0.50
emptyMethod · 0.45
getMethod · 0.45
c_strMethod · 0.45

Tested by

no test coverage detected