annotate lamertetris/sources/text.C @ 11:78390e0e674f

remove DPF
author prymula <prymula76@outlook.com>
date Thu, 08 Feb 2024 20:21:56 +0100
parents 2787f5e749ae
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
prymula <prymula76@outlook.com>
parents:
diff changeset
1 #include "text.h"
prymula <prymula76@outlook.com>
parents:
diff changeset
2
prymula <prymula76@outlook.com>
parents:
diff changeset
3 Text::Text(){}
prymula <prymula76@outlook.com>
parents:
diff changeset
4
prymula <prymula76@outlook.com>
parents:
diff changeset
5 SDL_Surface* Text::loadFromRenderedText( std::string textureText, SDL_Color textColor, TTF_Font* font)
prymula <prymula76@outlook.com>
parents:
diff changeset
6 {
prymula <prymula76@outlook.com>
parents:
diff changeset
7
prymula <prymula76@outlook.com>
parents:
diff changeset
8 SDL_Surface* textSurface = TTF_RenderText_Solid( font, textureText.c_str(), textColor);
prymula <prymula76@outlook.com>
parents:
diff changeset
9 if( textSurface != NULL )
prymula <prymula76@outlook.com>
parents:
diff changeset
10 {
prymula <prymula76@outlook.com>
parents:
diff changeset
11 mWidth = textSurface->w;
prymula <prymula76@outlook.com>
parents:
diff changeset
12 mHeight = textSurface->h;
prymula <prymula76@outlook.com>
parents:
diff changeset
13 }
prymula <prymula76@outlook.com>
parents:
diff changeset
14 else
prymula <prymula76@outlook.com>
parents:
diff changeset
15 {
prymula <prymula76@outlook.com>
parents:
diff changeset
16 printf( "Unable to render text surface! SDL_ttf Error: %s\n", TTF_GetError() );
prymula <prymula76@outlook.com>
parents:
diff changeset
17 }
prymula <prymula76@outlook.com>
parents:
diff changeset
18
prymula <prymula76@outlook.com>
parents:
diff changeset
19 return textSurface;
prymula <prymula76@outlook.com>
parents:
diff changeset
20 }