diff lamertetris/sources/text.C @ 0:2787f5e749ae

INIT
author prymula <prymula76@outlook.com>
date Thu, 21 Sep 2023 22:33:57 +0200
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/lamertetris/sources/text.C	Thu Sep 21 22:33:57 2023 +0200
@@ -0,0 +1,20 @@
+#include "text.h"
+
+Text::Text(){}
+
+SDL_Surface* Text::loadFromRenderedText( std::string textureText, SDL_Color textColor, TTF_Font* font)
+{
+
+	SDL_Surface* textSurface = TTF_RenderText_Solid( font, textureText.c_str(), textColor);
+	if( textSurface != NULL )
+	{
+		mWidth = textSurface->w;
+		mHeight = textSurface->h;
+	}
+	else
+	{
+		printf( "Unable to render text surface! SDL_ttf Error: %s\n", TTF_GetError() );
+	}
+
+	return textSurface;
+}