Page 1 of 1

IMAGE Font load section

Posted: Thu Apr 20, 2017 10:36 pm
by matteus
I've an image of 416x16 which contains 16x16 letters of a font.

IMAGE font "Images/font.png" NONE

I want to load a series of 16x16 sections of this IMAGE onto plan A? What functions would I use?

Re: IMAGE Font load section

Posted: Fri Apr 21, 2017 5:19 am
by MrTamk1s
TMK, the easiest thing to do would be to just resize your letters to single 8x8 px tiles (like SGDK's normal default font), and upload to VRAM the image's tiles to overwrite the default SGDK font. Take a look at VRAM in the debuggers of Gens KMod/your emulator to get the base VRAM addr offset to use for the upload addr.

After overwriting the font, any of the string printing functions would use the new font's tiles. (VDP_drawText, VDP_drawTextBG, etc). To restore the old font, just do the same upload thing but using an image with the default SGDK font.

Re: IMAGE Font load section

Posted: Fri Apr 21, 2017 7:57 am
by matteus
Thanks for the response :) I know this trick already! But wanting a bigger font set too, so need to work this out :D

Re: IMAGE Font load section

Posted: Fri Apr 21, 2017 8:47 am
by Stef
If you want to use bigger font then you have to rewrite your own drawText(..) methods to take care of the 2x2 tiles letters, a big deal honestly !

Re: IMAGE Font load section

Posted: Sat Apr 22, 2017 10:48 am
by matteus
I know stef :) I'm not really explaining myself properly here! All I want to do is take a number of tiles from an image and load them to a plan :)

So for example say image1 has 8 tiles. I'd like to load tiles 1 and 8 to the screen next to each other :)

1 2 3
6 7 8

Would it be easier to just have a number of individual images of 16x16?

IMAGE letterA
IMAGE letterB

Re: IMAGE Font load section

Posted: Sat Apr 22, 2017 8:20 pm
by Stef
Do you had a look on the VDP_setMapEx(..) method ? I think that's what you need :)

Re: IMAGE Font load section

Posted: Sun Apr 23, 2017 10:07 am
by matteus
I'll take a look at it :) Thanks Stef!

Re: IMAGE Font load section

Posted: Mon Apr 24, 2017 2:51 pm
by matteus
Stef wrote:Do you had a look on the VDP_setMapEx(..) method ? I think that's what you need :)
I can't get this to work! I declare the image as a map in my resources and it says "map" not yet supported?

Re: IMAGE Font load section

Posted: Mon Apr 24, 2017 6:12 pm
by Stef
Declare it as an IMAGE, internally the image contains a map : image->map
:)

Re: IMAGE Font load section

Posted: Tue Apr 25, 2017 8:55 pm
by matteus
Sorry I'm still struggling could you write me an example? :)

Re: IMAGE Font load section

Posted: Tue Apr 25, 2017 9:30 pm
by matteus
okay worked it out :)

Re: IMAGE Font load section

Posted: Wed Apr 26, 2017 9:15 am
by Stef
Well done ;)