From 80672dafb7c0ffd4361bec501a15b7d2d17e658e Mon Sep 17 00:00:00 2001 From: farisawan-2000 Date: Tue, 15 Dec 2020 23:06:09 -0500 Subject: [PATCH] added newlines --- config.h | 11 ++++++++++- s2d_parse.c | 8 +++++++- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/config.h b/config.h index 7b119b91..8fb41c65 100644 --- a/config.h +++ b/config.h @@ -15,7 +15,10 @@ #define gdl_head gDisplayListHead extern Gfx *gdl_head; -// Other games: change this to the appropriate alloc function + +// Other games/Homebrew users: change these values + +// an allocator function of the format void *alloc(size_t bytes) #define alloc alloc_display_list // The frame timer that is used to time s2d_type_print @@ -24,4 +27,10 @@ extern Gfx *gdl_head; // The equivalent vsprintf in your game (defaults to libultra _Printf) #define vsprintf _Printf + +// texture glyph width and height +#define TEX_WIDTH 16 +#define TEX_HEIGHT 16 + + #endif \ No newline at end of file diff --git a/s2d_parse.c b/s2d_parse.c index 7d2456ec..66cb9d0c 100644 --- a/s2d_parse.c +++ b/s2d_parse.c @@ -19,6 +19,8 @@ void s2d_snprint(int x, int y, char *str, uObjMtx *buf, int len) { char *p = str; int tx = 0, ty = 0; int tmp_len = 0; + int orig_x = x; + int orig_y = y; // int r = 0, g = 0, b = 0, a = 0; if (*p == '\0') return; do { @@ -59,6 +61,10 @@ void s2d_snprint(int x, int y, char *str, uObjMtx *buf, int len) { s2d_alpha = s2d_atoi(p, &p); break; + case '\n': + x = orig_x; + y += TEX_HEIGHT; + break; default: // if (s2d_colorFrames > 2) { // s2d_colorFrames = 0; @@ -102,7 +108,7 @@ void s2d_type_print(int x, int y, char *str, uObjMtx *buf, int *pos) { void s2d_vsprint(int x, int y, uObjMtx *buf, char *str, ...) { va_list args; va_start(args, str); - vsprintf(str, ) + // vsprintf(str, ) }