Fonts

General Programming help in C, C++ or ASM, Compiling / Debugging, and R3000A Central Processing Unit (CPU) information
Post Reply
User avatar
danhans42
/// PSXDEV | ELITE ///
/// PSXDEV | ELITE ///
Posts: 250
Joined: November 28th, 2012, 11:51 pm
IRC: danhans42
PlayStation Model: SCPH-7502
Want to Find: Inspiration
Location: West Yorkshire, UK
Contact:

Fonts

Post by danhans42 » April 11th, 2019, 6:38 pm

Does anyone have an example of how to use different fonts in your PsyQ projects?

I wanted to look at using other fonts but all the examples I can find just use the built in stuff.

Thanks
♥ PSX - http://psx0.wordpress.com

My collection - SCPH-102/SCPH-7502, Yaroze Modded PSone, PocketStation (Clear), 2x Xplorer Carts, 2x Xplorer Pro, 2x AR Carts (1 with Ezoray), GS Pro 3, ISA Comms Link Card. Various USB serial devices, Gameshark Sharklink, Kentai Eddy, iMode Cable & other bits and bobs.

User avatar
LameGuy64
Psy-Q Enthusiast
Psy-Q Enthusiast
Posts: 343
Joined: April 10th, 2013, 3:47 pm
I am a: Hobbyist Game Developer
Motto: Commercial or not, play it!
PlayStation Model: H2000/7000
Skype: lameguy64
Location: Philippines

Re: Fonts

Post by LameGuy64 » April 13th, 2019, 1:02 am

You're going to have to write your own text drawing functions but it shouldn't be too difficult if you're familiar enough with doing 2D graphics on the PS1. You essentially have to composite together a sheet of characters arranged in tile grid format (ie. 8x8 or 8x16) and you select the characters by adjusting the UV coordinates of the sprite primitive based on the character to be drawn.

Here's a snippet that should hopefully get you started with writing such a routine:

Code: Select all

int i,j;
SPRT_8 *cspr = (SPRT_8*)GsOUT_PACKET_P; // (assuming you're working with libgs)
short sx,sy; // These will be the coords where the characters will be drawn at

i = 0;
while(text[i] != 0) {
   j = text[i]-32;
   if( j>0 ) {
      setSprt8(cspr);
      setXY0(cspr, sx, sy);
      setUV0(cspr, (j%16)<<3, (j>>4)<<3); // This is tuned for 8x8 characters arranged in 16 character rows
      setRGB0(cspr, 128, 128, 128);
      addPrim(myOT[myActiveBuff].ot, cspr);
   }
   sx += 8;
   i++;
}
Please don't forget to include my name if you share my work around. Credit where it is due.

Dev. Console: SCPH-7000 with SCPH-7501 ROM, MM3, PAL color fix, Direct AV ports, DB-9 port for Serial I/O, and a Xplorer FX with Caetla 0.35.

DTL-H2000 PC: Dell Optiplex GX110, Windows 98SE & Windows XP, Pentium III 933MHz, 384MB SDRAM, ATI Radeon 7000 VE 64MB, Soundblaster Audigy, 40GB Seagate HDD, Hitachi Lite-on CD-RW Drive, ZIP 250 and 3.5" Floppy.

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest