MCPcopy Create free account
hub / github.com/carbonengine/trinity / GatherSprites

Method GatherSprites

trinity/Sprite2d/Tr2Sprite2dTextObject.cpp:28–70  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

26}
27
28void Tr2Sprite2dTextObject::GatherSprites( Tr2Sprite2dScene* renderer )
29{
30 if( !m_display || ( m_textWidth <= 0.0f ) || ( m_textHeight <= 0.0f ) )
31 {
32 return;
33 }
34
35 if( m_fontMeasurer )
36 {
37 auto dropShadow = m_shadowOffset.x != 0 || m_shadowOffset.y != 0;
38 if( m_isDirty )
39 {
40 m_fontMeasurer->PrepareSprites(
41 renderer,
42 m_translation,
43 m_color,
44 m_spriteEffect,
45 m_blendMode,
46 m_target,
47 m_glowBrightness,
48 dropShadow,
49 m_shadowOffset,
50 m_shadowColor,
51 m_useShadowSpriteEffect ? m_shadowSpriteEffect : m_spriteEffect );
52 m_isDirty = false;
53 }
54
55 auto left = m_translation.x + std::min( m_shadowOffset.x, 0.f );
56 auto top = m_translation.y + std::min( m_shadowOffset.y, 0.f );
57 auto width = m_textWidth + abs( m_shadowOffset.x );
58 auto height = m_textHeight + abs( m_shadowOffset.x );
59 if( ( m_spriteEffect == TR2_SFX_BLUR ) || ( m_spriteEffect == TR2_SFX_GLOW ) )
60 {
61 renderer->PushClipRectangle( m_translation.x - 1 + std::min( m_shadowOffset.x, 0.f ), m_translation.y - 1 + std::min( m_shadowOffset.y, 0.f ), m_textWidth + 2 + abs( m_shadowOffset.x ), m_textHeight + 2 + abs( m_shadowOffset.y ) );
62 }
63 else
64 {
65 renderer->PushClipRectangle( m_translation.x + std::min( m_shadowOffset.x, 0.f ), m_translation.y + std::min( m_shadowOffset.y, 0.f ), m_textWidth + abs( m_shadowOffset.x ), m_textHeight + abs( m_shadowOffset.y ) );
66 }
67 m_fontMeasurer->SubmitSprites( renderer );
68 renderer->PopClipRectangle();
69 }
70}
71
72ITr2SpriteObject* Tr2Sprite2dTextObject::PickPoint( float x, float y, Tr2Sprite2dScene* renderer )
73{

Callers

nothing calls this directly

Calls 4

PrepareSpritesMethod · 0.80
PushClipRectangleMethod · 0.80
SubmitSpritesMethod · 0.80
PopClipRectangleMethod · 0.80

Tested by

no test coverage detected