Discussion about software development for the old-school Gameboys, ranging from the "Gray brick" to Gameboy Color
(Launched in 2008)
You are not logged in.
Pages: 1
Hello,
[Background/cute/useless story]
For the 40th birthday of my sister, i get an old gameboy, and bought an everdrive cardridge, and i filled it up with the good old games we played together when we where young. And i got an idea : Why don't I program some special rom for her birthday ? I am a developper, so, yesterday evening, i searched and tried to create my own rom.
[End of useless story ;-)]
So I have a made a rom which, for now :
- Display some text, wait for button to be pressed, and display again ...
- Display some full screen images (created with GB Tile Data Generator)
My question is : How to display some text after having displayed a full screen image ?
When I do that, the picture is scrolling up (like it was some text), and the text characters are replaced by some unknown char.
Maybe I need to do some clear/refresh screen before writing some text ?
Thank a lot in advance for the help, I need to finish that for tomorow evening, and i will try to go the further I can !
Code :
How I display Image :
-------------------------
void displayImg() { set_bkg_data(0,255,clem_tile_data); // Switch to VRAM VBK_REG = 1; // Switch out of VRAM VBK_REG = 0; // Set screen x,y pos to 0,0 and draw the map 20,18 (size of the screen) set_bkg_tiles(0,0,20,18,clem_map_data); // Show the background SHOW_BKG; // Turn the display on DISPLAY_ON; }
How I display text :
----------------------
printf("Some text\n\n");
Last edited by MattC (2015-08-27 03:35:32)
Offline
if i remember right you must turn the display off and hide the background before printing text again
so everything you did to set the display up but reverse
*been a while since i did gbdk
Offline
I had a tile for each letter/digit in my app. I updated tile data based on the numbers/letters that should be displayed. This is one solution. So your text is really part of your background tile data. If the text is going to be static, then that will be a lot easier to do.
Offline
Disclaimer: I do assembly coding, not C/GBDK.
It sounds like printf() is using leftover tile data from the images, rather than using letters. I'm not sure how printf() works in GBDK exactly, but try clearing out the vram before using printf(). Failing that, you could always create a letter tileset, and create the text like you did with the images (use GBMB with the letters to create the screens/map data).
It'd be possible to be a lot more specific if you uploaded the ROM so we could see it, but do to the personal data on the ROM I wouldn't fault you for not doing that. =]
Offline
Thanks everyone.
I wasn't able to clear completly the left over tile data from the image.
I tried things like (But with no real luck) :
HIDE_BKG; DISPLAY_OFF; VBK_REG = 0; set_bkg_data(0,255,NULL); set_bkg_tiles(0,0,20,18,NULL); etc
in any possible order.
But I was approaching with these two :
set_bkg_data(0,255,NULL); set_bkg_tiles(0,0,20,18,NULL);
The text was ok, but the backgnd was some wierd almost completly black artifacts.
So, because I have to finish that today, I created a 1x1 White background, and so, I apply it before to print text on the screen. (i know this is shit but i'm not proud
Oh and you need to init font again to be able to print correctly
font_init();
Last edited by MattC (2015-08-28 03:22:10)
Offline
Pages: 1