aboutsummaryrefslogtreecommitdiff
path: root/libpsn00b/psxgpu/fntsort.c
diff options
context:
space:
mode:
authorJohn Wilbert M. Villamor <lameguy64@gmail.com>2020-09-19 20:43:05 +0800
committerJohn Wilbert M. Villamor <lameguy64@gmail.com>2020-09-19 20:43:05 +0800
commit9f4891f95070c66ea9f1aba99d72724d4ab24e5a (patch)
tree723e3ef2118a3d1a9e6dafa811ed1b8b1bc9196e /libpsn00b/psxgpu/fntsort.c
parent6762c39551ded059450d17d8bb0cb80642c8aaab (diff)
downloadpsn00bsdk-9f4891f95070c66ea9f1aba99d72724d4ab24e5a.tar.gz
Revised makefiles, added strtok(), command line arguments, SetHeapSize(), moved ISR and callback system to psxetc, moved debug font to psxgpu, fixed CD-ROM library crashing on PSIO, fixed interrupt callback setup to fix crashing on ResetGraph()
Diffstat (limited to 'libpsn00b/psxgpu/fntsort.c')
-rw-r--r--libpsn00b/psxgpu/fntsort.c47
1 files changed, 47 insertions, 0 deletions
diff --git a/libpsn00b/psxgpu/fntsort.c b/libpsn00b/psxgpu/fntsort.c
new file mode 100644
index 0000000..3890ebb
--- /dev/null
+++ b/libpsn00b/psxgpu/fntsort.c
@@ -0,0 +1,47 @@
+#include <stdio.h>
+#include <ctype.h>
+#include <psxgpu.h>
+
+extern unsigned short _font_tpage;
+extern unsigned short _font_clut;
+
+char *FntSort(unsigned int *ot, char *pri, int x, int y, const char *text) {
+
+ DR_TPAGE *tpage;
+ SPRT_8 *sprt = (SPRT_8*)pri;
+ int i;
+
+ while( *text != 0 ) {
+
+ i = toupper( *text )-32;
+
+ if( i > 0 ) {
+
+ i--;
+ setSprt8( sprt );
+ setRGB0( sprt, 128, 128, 128 );
+ setXY0( sprt, x, y );
+ setUV0( sprt, (i%16)<<3, (i>>4)<<3 );
+ sprt->clut = _font_clut;
+ addPrim( ot, sprt );
+ sprt++;
+
+ }
+
+ x += 8;
+ text++;
+
+ }
+
+ pri = (char*)sprt;
+
+ tpage = (DR_TPAGE*)pri;
+ tpage->code[0] = _font_tpage;
+ setlen( tpage, 1 );
+ setcode( tpage, 0xe1 );
+ addPrim( ot, pri );
+ pri += sizeof(DR_TPAGE);
+
+ return pri;
+
+} \ No newline at end of file