IMAGE Font load section
Moderator: Stef
IMAGE Font load section
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?
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?
-
- Very interested
- Posts: 75
- Joined: Sun Jan 04, 2015 10:27 pm
- Location: Pennsylvania
- Contact:
Re: IMAGE Font load section
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.
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.
- Attachments
-
- SGDK_DefaultFont.png (710 Bytes) Viewed 7912 times
SGDK homebrew dev and Unity3D Indie dev.
Sega does what Nintendont!
Sega does what Nintendont!
Re: IMAGE Font load section
Thanks for the response I know this trick already! But wanting a bigger font set too, so need to work this out
-
- Very interested
- Posts: 3131
- Joined: Thu Nov 30, 2006 9:46 pm
- Location: France - Sevres
- Contact:
Re: IMAGE Font load section
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
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
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
-
- Very interested
- Posts: 3131
- Joined: Thu Nov 30, 2006 9:46 pm
- Location: France - Sevres
- Contact:
Re: IMAGE Font load section
Do you had a look on the VDP_setMapEx(..) method ? I think that's what you need
Re: IMAGE Font load section
I'll take a look at it Thanks Stef!
Re: IMAGE Font load section
I can't get this to work! I declare the image as a map in my resources and it says "map" not yet supported?Stef wrote:Do you had a look on the VDP_setMapEx(..) method ? I think that's what you need
-
- Very interested
- Posts: 3131
- Joined: Thu Nov 30, 2006 9:46 pm
- Location: France - Sevres
- Contact:
Re: IMAGE Font load section
Declare it as an IMAGE, internally the image contains a map : image->map
Re: IMAGE Font load section
Sorry I'm still struggling could you write me an example?
Re: IMAGE Font load section
okay worked it out
-
- Very interested
- Posts: 3131
- Joined: Thu Nov 30, 2006 9:46 pm
- Location: France - Sevres
- Contact:
Re: IMAGE Font load section
Well done