Game Development Reference
In-Depth Information
14. We just need to render a textured rectangle in every frame:
LVector4 Color( 0.741f, 0.616f, 0.384f, 1.0f );
Canvas->TexturedRect2D( 0.19f, 0.012f, 0.82f, 0.07f,Color,
g_ScoreTexture );
15. Render the game-over message if needed, as shown in the following screenshot:
16. This is similar to text rendering, however, we can avoid caching here since this
message box is shown infrequently:
if ( g_GS.FGameOver )
{
DrawBorder( 0.05f, 0.25f, 0.95f, 0.51f, 0.19f );
std::string ScoreStr = Str_GetPadLeft(
Str_ToStr( g_GS.FScore ), 6, '0' );
Canvas->TextStr( 0.20f, 0.33f, 0.84f, 0.37f,
LocalizeString("Your score:"), 32,
LVector4( 0.796f, 0.086f,0.086f, 1.0f ),
g_TextRenderer, g_Font );
Canvas->TextStr( 0.20f, 0.38f, 0.84f, 0.44f,ScoreStr,
32, LVector4( 0.8f, 0.0f, 0.0f,1.0f ),
g_TextRenderer, g_Font );
}
17. Canvas does everything required to render the text and update the texture. However,
it is a bit slow for anything more frequent. Check out the full implementation in the
graphics/Canvas.cpp ile.
 
Search WWH ::




Custom Search