Sa marche putain!
This commit is contained in:
+8
-3
@@ -1,5 +1,6 @@
|
||||
#include <SDL2/SDL_error.h>
|
||||
#include <unistd.h>
|
||||
#include "renderer.h"
|
||||
#include "text.h"
|
||||
#include <SDL2/SDL_log.h>
|
||||
|
||||
@@ -22,7 +23,7 @@ void text_freeFontCache(void){
|
||||
}
|
||||
}
|
||||
|
||||
int text_renderText(RenderObject_t* renderObject, float x, float y, int z, SDL_Color color, const char* fontFilename, int fontSize, char* format, ...){
|
||||
int text_renderText(RenderObject_t* renderObject, float x, float y, int z, float scale, SDL_Color color, const char* fontFilename, int fontSize, char* format, ...){
|
||||
if(access(fontFilename, F_OK) != 0) {
|
||||
fprintf(stderr, "Font file not found: %s\n", fontFilename);
|
||||
return -1;
|
||||
@@ -62,12 +63,16 @@ int text_renderText(RenderObject_t* renderObject, float x, float y, int z, SDL_C
|
||||
|
||||
SDL_Surface* surface = TTF_RenderText_Blended(font, text, color);
|
||||
|
||||
int h, w;
|
||||
|
||||
TTF_SizeText(font, text, &w, &h);
|
||||
MonitorSize_t monitor = renderer_getMonitorSize();
|
||||
|
||||
renderObject->x = x;
|
||||
renderObject->y = y;
|
||||
renderObject->z = z;
|
||||
renderObject->width = strlen(text) * fontSize;
|
||||
renderObject->height = fontSize;
|
||||
renderObject->width = w * scale / 500;
|
||||
renderObject->height = h * scale / 500;
|
||||
renderObject->angle_degre = 0;
|
||||
renderObject->surface = surface;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user