add text rendering
This commit is contained in:
+24
@@ -0,0 +1,24 @@
|
||||
#include "text.h"
|
||||
|
||||
RenderObject_t text_renderText(Position position, SDL_Color color, TTF_Font* font, char* format, ...){
|
||||
|
||||
char text[100];
|
||||
va_list args;
|
||||
|
||||
memset(&text, '\0', sizeof(text));
|
||||
|
||||
va_start(args, format);
|
||||
vsprintf(text, format, args);
|
||||
va_end(args);
|
||||
|
||||
|
||||
RenderObject_t renderObject;
|
||||
SDL_Surface* surface = TTF_RenderText_Blended(font, text, color);
|
||||
|
||||
|
||||
renderObject.x = position.x;
|
||||
renderObject.y = position.y;
|
||||
renderObject.z = position.z;
|
||||
renderObject.surface = surface;
|
||||
return renderObject;
|
||||
}
|
||||
Reference in New Issue
Block a user