summaryrefslogtreecommitdiff
path: root/src/font.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/font.c')
-rw-r--r--src/font.c32
1 files changed, 25 insertions, 7 deletions
diff --git a/src/font.c b/src/font.c
index 17c62ad..b04c0df 100644
--- a/src/font.c
+++ b/src/font.c
@@ -326,12 +326,13 @@ bool load_sprite_font(SDL_Renderer* renderer, const char* filename, sprite_font*
return true;
}
-void draw_text_with_spritefont
+void draw_text_with_spritefont_extended
(
SDL_Renderer* renderer,
sprite_font* font,
const unsigned char* text,
- float x_position, float y_position
+ float x_position, float y_position,
+ float scale
) {
while (*text) {
const font_char* fc = &font->characters[*text-font->smallest_character];
@@ -349,12 +350,29 @@ void draw_text_with_spritefont
.h = fc->height
},
&(SDL_FRect){
- .x = x_position + fc->x_offset,
- .y = y_position + fc->y_offset,
- .w = fc->width,
- .h = fc->height
+ .x = x_position + fc->x_offset*scale,
+ .y = (y_position + fc->y_offset) * scale,
+ .w = fc->width * scale,
+ .h = fc->height * scale
});
- x_position += fc->x_advance;
+ x_position += fc->x_advance * scale;
text++;
}
}
+
+
+void draw_text_with_spritefont
+(
+ SDL_Renderer* renderer,
+ sprite_font* font,
+ const unsigned char* text,
+ float x_position, float y_position
+) {
+ draw_text_with_spritefont_extended(renderer,
+ font,
+ text,
+ x_position,
+ y_position,
+ 1.0
+ );
+}