Fonts

General Programming help in C, C++ or ASM, Compiling / Debugging, and R3000A Central Processing Unit (CPU) information
Post Reply
danhans42
BANNED
BANNED
Posts: 329
Joined: Nov 28, 2012

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

User avatar
LameGuy64
Verified
Psy-Q Enthusiast
Psy-Q Enthusiast
Posts: 388
Joined: Apr 10, 2013
I am a: Hobbyist Game Developer
Motto: Commercial or not, play it!
PlayStation Model: H2000/7000
Location: Philippines
Contact:

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