gbadev.org forum archive

This is a read-only mirror of the content originally found on forum.gbadev.org (now offline), salvaged from Wayback machine copies. A new forum can be found here.

DS development > Font Size

#158198 - sUPREz - Sat Jun 07, 2008 10:00 am

Hi guys !

As I was succesfully helped last time, I come to bother you once more time :)

I try to make a custum font for my game but I'd like to have a bigger font. The default character size is 8x8 but I'd like to have something bigger like 8x16 or (be crazy) 16x32. Is there an easy way to do this ?

I already thought to a way to do this, I can declare 2 different fonts, one for the 8x8 upper part of characters and one other for the 8x8 lower part. But this isn't a very optimized way to do I supposed.

Any ideas ? :)

#158200 - silent_code - Sat Jun 07, 2008 10:26 am

you need to write your own routines to do that (you can modify the existion ones.)

the on screen "map lines" would have to be divided by two and then you would set a pair of character tiles together, for every character.

the tile layout would consist of two tile sets, one upper part and one lower part, both arranged in the same way the 8x8 character tile sets are.

when indexing the tile sets with the character to be printed on screen, you need to index both of your sets with the same value and simply assign the tiles, upper to an even, lower to an odd "map line".

happy coding and please share your solution! :^)
_________________
July 5th 08: "Volumetric Shadow Demo" 1.6.0 (final) source released
June 5th 08: "Zombie NDS" WIP released!
It's all on my page, just click WWW below.

#158201 - Dwedit - Sat Jun 07, 2008 11:20 am

If I was doing this, I'd make a Sprite Routine to blit a character from a font into tile graphics memory. That way I could use any-sized fonts, or even proportional fonts.
_________________
"We are merely sprites that dance at the beck and call of our button pressing overlord."

#158202 - silent_code - Sat Jun 07, 2008 11:24 am

Yes, that's also a good approach. :^)
Didn't tepples have a library available for that purpose?
_________________
July 5th 08: "Volumetric Shadow Demo" 1.6.0 (final) source released
June 5th 08: "Zombie NDS" WIP released!
It's all on my page, just click WWW below.

#158203 - sUPREz - Sat Jun 07, 2008 11:27 am

Thanks for your help Dwedit but I'm too bad in 2D programming. I'll stick to my first idea but if you have some good 2D tutorials, I'd be happy to learn more about that.

#158205 - silent_code - Sat Jun 07, 2008 12:33 pm

Blitting (drawing images into other images) isn't that hard and if you don't need it to be super fast, it's even easier. ;^)

Give it a try. :^)

PS: By not "super fast" I don't mean it to be slow, but still interactive. 60 fps is possible, if you have relatively little / medium (which is a very subjective working, i know) overdraw.
_________________
July 5th 08: "Volumetric Shadow Demo" 1.6.0 (final) source released
June 5th 08: "Zombie NDS" WIP released!
It's all on my page, just click WWW below.

#158223 - sUPREz - Sat Jun 07, 2008 7:48 pm

Hmmm. I need some help ... again :)

I have a strange behaviour in my program. When i declare only one of my to fonts (there the UpFont and the DownFont) everything go well but when I declare the 2, it only display the last one.

Here is my code :
Code:

for(i = 0; i < fontUpDataSize; ++i) {
sub_tile[i] = fontUpData[i];
}
   
printf("PloufPlouf !!\n");

for(i = 0; i < fontDownDataSize; ++i) {
   sub_tile[i] = fontDownData[i];
}

printf("PloufPlouf !!\n");


sub_tile is a pointer to CHAR_BASE_BLOCK_SUB

This code diplays PloufPlouf twice but only with the DownFont.

Any ideas ? Anyone knows how to declare multiples fonts in the same time ?

#158227 - Maxxie - Sat Jun 07, 2008 8:27 pm

The text will be displayed allways with the active tileset. Thus exchanging it will be effective for all chars on the screen.

The fastest way (fastest to implement) would be to use two different BGs with different tileset, initialize both consoles and save a link to the devoptab entry for stdout after each console init.

When printing to the first, write back that link for the first console, so do for the second.


The cleaner way is to write an own multiple codepage devoptab "driver"

#158438 - silent_code - Wed Jun 11, 2008 3:00 pm

I haven't looked at it, but it sounds a lot like what you need:
http://www.dragonminded.com/?loc=ndsdev/LibFB :^)
_________________
July 5th 08: "Volumetric Shadow Demo" 1.6.0 (final) source released
June 5th 08: "Zombie NDS" WIP released!
It's all on my page, just click WWW below.

#158459 - sUPREz - Wed Jun 11, 2008 9:00 pm

Thanks for the info. I'll have a look at it tomorow. Seams to be very interesting ! :)