SGDK Noob Question

SGDK only sub forum

Moderator: Stef

Post Reply
Jony
Interested
Posts: 12
Joined: Tue Jul 26, 2011 3:16 pm
Location: Portugal

SGDK Noob Question

Post by Jony » Sun Aug 14, 2011 1:34 am

I'm working on a little port of Snake to the MD in order to improve my knowledge of SGDK but i've got a little question

How would i be able to change the font used when drawing text?

Also, are there any size restrictions to be aware of when creating fonts?

Image

This is the little intro screen where i want to change the font.

The Snake is probably not supposed to look that evil... but... it's a snake goddamit!!
"I'm looking for some alien toilet to park my bricks, who's first?"

sega16
Very interested
Posts: 251
Joined: Sat Jan 29, 2011 3:16 pm
Location: U.S.A.

Post by sega16 » Sun Aug 14, 2011 3:05 am

if you want to use the VDP_drawText then each character must use only one tile or 8x8 pixels (it can be smaller but you have to center it and make it 8x8) and then you just load the tiles were the old font was.
If you want to use a font bigger than 8x8 then you would have to write your own code
If you just want the font changed for the title screen then you can just make a fancy font in photoshop or whatever just make a 320x224 image
look at this game I programed in sgdk it says it was a sonic hack but it relay was a rick roll (I was testing my fmv player which is also written in c using sgdk)
http://www.youtube.com/watch?v=fNjJu0FjP84

haroldoop
Very interested
Posts: 160
Joined: Sun Apr 29, 2007 10:04 pm
Location: Belo Horizonte, MG, Brazil

Post by haroldoop » Sun Aug 14, 2011 9:33 am

The Snake is probably not supposed to look that evil... but... it's a snake goddamit!!
Don't worry, we understand. Good programmers aren't always good artists, leading to the so-called "programmer's art"; see the ducks... I mean... dragons on the Atari 2600 Adventure for a classic example of that. :P

oofwill
Very interested
Posts: 173
Joined: Mon May 03, 2010 6:12 pm
Location: France - Niort

Post by oofwill » Mon Feb 27, 2012 5:44 pm

Hi,

i've ripped original font included in SGDK.

http://www.toofiles.com/fr/oip/documents/bmp/font.html

Modify this image, replace the letters by yours (it's possible to find nice font on the web)

Be sure your font is 8*8 pixels!

Then convert your image with genitile (for example)

Call it with :

Code: Select all

VDP_doVRamDMA((u32) font_tiles, 41984, 3072);
Then you could be able to draw text with your new font simply by using VDP_drawText function.

When replacing color, be carreful. I'm working with photsop and i used color 15 and 14 to make a 2-colors font.
When working with photoshop, if using color 1 (check the palette) will result VDP_drawText command line will use color 1 of the textpalette.

I d'ont know if i'm very clear, but if i can help ;)

Moon-Watcher
Very interested
Posts: 117
Joined: Sun Jan 02, 2011 9:14 pm
Contact:

Post by Moon-Watcher » Mon Feb 27, 2012 7:33 pm

Load that bmp provided by oofwill in a .rc file as BITMAP and write some code like


extern const u32 *my_font;

VDP_loadFont ( my_font, 1 );


The result -->http://twitpic.com/8p3ikk

Post Reply