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
For the rom that I've been working on, I want the menu (which is on the window layer) to appear in the top right hand corner of the screen. However, when I put the menu in the top right hand corner a section of the background beneath the menu is hidden due to it being covered by the window. How do I stop this? I know that part of the window layer hides the background and have been able to move the window to the bottom of the screen to stop it from hiding the background before, however for this I want the menu to be at the top of the screen and not the bottom. I know that I could also copy background data to the window so that this area isn't blank, however this seems very inefficient and makes it difficult (not impossible though) to have scrolling rooms.
Tl;dr how do I stop the window from hiding the background if the window is at the top of the screen?
This is the screen before the menu is shown:
And this is the screen after the menu is shown:
Offline
Check the current line and disable the window when it's finished displaying. Enable at start of vblank.
Offline
How do I check the current line it is drawing on? I'm looking through the functions that gbdk comes with, but with using the function set_win_tiles I don't think you can check the current line it is drawing on. Also how would you disable the window when it's finished? The only thing I can find that does anything like that is HIDE_WIN, but obviously that just hides the entire window layer.
Offline
set up an interrupt.. for example:
STAT_REG|=0x40;//enable LYC=LY interrupt
LYC_REG=64;//the scanline on which to trigger
disable_interrupts();
add_LCD(an_lcd_interrupt_func);
enable_interrupts();
set_interrupts(LCD_IFLAG|VBL_IFLAG);
and make your interrupt function
void an_lcd_interrupt_func(){HIDE_WIN;}//hide the window, triggers at the scanline LYC
at vsync (e.g. in your game loop), SHOW_WIN
on the specified scanline (LYC_REG), the interrupt occurs (in this case, running an_lcd_interrupt_func)
this is off the top of my head; maybe something is incorrect... but you get the idea
Offline
The same concept is explained here in some more detail: http://gbdev.gg8.se/forums/viewtopic.php?id=345
Offline
Thank you for helping, I have it working now.
Offline
Pages: 1