diff options
Diffstat (limited to 'inc/lzy.h')
-rw-r--r-- | inc/lzy.h | 20 |
1 files changed, 17 insertions, 3 deletions
@@ -96,7 +96,8 @@ int LZY_DrawTile(unsigned int id, int x, int y); int LZY_DrawTileEx(unsigned int id, int x, int y, unsigned int w, unsigned int h); int LZY_DrawChar(unsigned char chr, int x, int y); -int LZY_DrawText(const char *text, int x, int y); +int LZY_DrawText(int x, int y, const char *text); +int LZY_DrawTextF(int x, int y, const char *fmt, ...); LZY_Music *LZY_MusicLoad(const char *path); int LZY_MusicDestroy(LZY_Music *music); int LZY_MusicPlay(LZY_Music *music, int loops); @@ -146,6 +147,7 @@ const char *LZY_GetError(void); #ifndef LZY_FIRST_CHR #define LZY_FIRST_CHR ' ' #endif +#include <stdio.h> int LZY_DrawLine(int x0, int y0, int x1, int y1) { int dx, dy, sx, sy, err, e2; @@ -180,6 +182,17 @@ int LZY_DrawLine(int x0, int y0, int x1, int y1) { return rc; } +int LZY_DrawTextF(int x, int y, const char *fmt, ...) { + char buf[256] = {0}; + + va_list args; + va_start(args, fmt); + vsnprintf(buf, sizeof(buf) - 1, fmt, args); + va_end(args); + + return LZY_DrawText(x, y, buf); +} + #ifdef FXCG50 #include <gint/cpu.h> #include <gint/display.h> @@ -373,7 +386,7 @@ int LZY_DrawChar(unsigned char chr, int x, int y) { #endif } -int LZY_DrawText(const char *text, int x, int y) { +int LZY_DrawText(int x, int y, const char *text) { #ifndef LZY_GINT_FONT LZY_UNUSED(text); LZY_UNUSED(x); @@ -483,6 +496,7 @@ const char *LZY_GetError(void) { #include LZY_SDL_MIXER_INCLUDE #include <libgen.h> #include <stdint.h> +#include <stdio.h> #include <stdlib.h> #include <string.h> @@ -882,7 +896,7 @@ int LZY_DrawChar(unsigned char chr, int x, int y) { return 0; } -int LZY_DrawText(const char *text, int x, int y) { +int LZY_DrawText(int x, int y, const char *text) { int err = 0; if (text == NULL) { |