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.

Coding > Text tiles and text font questions

#54402 - blacksun - Mon Sep 19, 2005 12:52 am

I am currently developing a tiled puzzle game. Each block has a number associated to it. I think I am going to use either a text background to place the numbers on the sprites or use text fonts to draw the numbers on the blocks.

I have a couple of questions to decide which method I will be attempting. My first question has to deal with a text background. Currently I need the font size to be 3x7. I know the min tile size is 8x8 and you can use transparency to just draw the number. But I also want just a 1 pixel space between any double or triple digit number. Is there a way to squish the tiles closer together to get that one pixel space instead of 5+ pixels between the tiles?

The next question is regarding drawing text using fonts in mode 0-2. Is there anyway to actually draw these fonts and have them overlap the sprites? In mode 3 I just draw straight to the video buffer to draw my text. Is there anyway to do this other than using text backgrounds and tiles?

#54413 - gauauu - Mon Sep 19, 2005 3:01 am

For question #1:

no, you can't smoosh the tiles together, but you can either:
1. use sprites instead of tiles, and smoosh them together.
2. you can redraw your text into the video memory for the tiles each time you want to display text, and draw the text so that it's not 1 character for 1 tile.

<disclaimer>I could be totally wrong. I'm a perpetual noob.</disclaimer>

#54417 - tepples - Mon Sep 19, 2005 4:10 am

I love to see new homebrew puzzle games. Photochop up a mock-up of what you want the graphics to look like, and I'll give some suggestions as to how to implement them.
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.

#54462 - blacksun - Mon Sep 19, 2005 6:06 pm

Is there something special I have to do to write to the video buffer? Like do I draw to the background I want the text on? Mode 3 is easy for me, but if I just draw to the video buffer in mode 0-2 nothing happens.

And this game is actually going to be a port from a game me and my team made couple years ago for the PC. I will find some pics to upload. I'm pretty sure how I want my design. Since the playfield is 7x12, thats 84 sprites. So I'm going to use sprites for the 1 player's blocks. For 2nd player I will use a text background to show the blocks then when the blocks clear adjust the background and maybe use sprites while they are falling. This way I should be under my 128 limit without using voodoo magic.

Me and my friend are really excited about making this and hopefully I will get it done soon to show everyone.

#54491 - tepples - Mon Sep 19, 2005 11:40 pm

You can use two backgrounds with HDMA for a 7x12 block playfield without sprites.
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.

#54595 - blacksun - Tue Sep 20, 2005 6:45 pm

What is HDMA?

And I was thinking of using sprites for player 1's playfield because I will be doing some special effects. Also, my playfield will be moving from bottom to top, not having pieces fall down.

Also, just thought of this. Is there a way to partialy draw a sprite? Or would i just figure a way to make it transparent while it moves into the playfield?

#54616 - tepples - Tue Sep 20, 2005 9:50 pm

HDMA is DMA, or hardware assisted memory copies, triggered at horizontal blank time. Many GBA puzzle games use HDMA from a memory array to the vertical scrolling register in order to cut off the bottom of each tile, resulting in a display that's effectively 12 pixels of height per tile.

You could partially draw a sprite by hiding all sprites outside of the window that contains the playfield, or you could make a background with higher priority than the sprite.

By playfield moving from bottom to top, are you thinking of making something like Tetris Attack?
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.

#54626 - cosmic4z - Wed Sep 21, 2005 12:37 am

You could also use a rotational / scaling BG ...

Just set up the affine transformation paramaters, so that one 8*8 pixel tile on the BG is displayed as a 5*8 pixel tile on the LCD.

I'm pretty sure you could work out with 100% precision, which of the 8 (horizontal) pixels in the BG, correspond to the 5 displayed pixels on the LCD.

That make sense to you?
_________________
Qwak - www.qwak.co.uk | Forum - www.qwak.co.uk/forum/

#54628 - blacksun - Wed Sep 21, 2005 1:09 am

Ya the play field is set up and acts like Tetris Attacks.

I like the idea of having a background cover up the blocks as they come into play. I am planning on having a background for the border around the grid. Either that or have a higher priority sprite. Not sure yet.

And it sounds like i will be looking at HDMA or performing some affine transformation on the tiles, except if I use backgrounds for the borders because then I would have 4 backgrounds and then Id be in mode 0.

#54630 - tepples - Wed Sep 21, 2005 1:22 am

Or you could have sprites cover up part of the bottom row and then draw the rest of the background on one BG layer so that you don't waste a layer.
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.

#54631 - blacksun - Wed Sep 21, 2005 1:27 am

Thats sorta what I was thinking. It would be really easy to just have one background that consists of the borders and the game background. Unfortunently the borders will be different depending on the character that was chosen.

So I would have to make half backgrounds and contain all the different borders and then put them together. That would save me one background. Hmm, decisions decisions...