diff options
| author | John Wilbert M. Villamor <lameguy64@gmail.com> | 2019-04-06 10:11:07 +0800 |
|---|---|---|
| committer | John Wilbert M. Villamor <lameguy64@gmail.com> | 2019-04-06 10:11:07 +0800 |
| commit | f3e040230772f978540a71aea43dfde200992922 (patch) | |
| tree | bd8ca31b72dd01e24980b073854e263589530f56 /libpsn00b/psxetc/fntsort.c | |
| download | psn00bsdk-f3e040230772f978540a71aea43dfde200992922.tar.gz | |
First commit
Diffstat (limited to 'libpsn00b/psxetc/fntsort.c')
| -rw-r--r-- | libpsn00b/psxetc/fntsort.c | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/libpsn00b/psxetc/fntsort.c b/libpsn00b/psxetc/fntsort.c new file mode 100644 index 0000000..29e7de5 --- /dev/null +++ b/libpsn00b/psxetc/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; + setlen( tpage, 1 ); + tpage->code[0] = _font_tpage; + setcode( tpage, 0xe1 ); + addPrim( ot, pri ); + pri += sizeof(DR_TPAGE); + + return pri; + +}
\ No newline at end of file |
