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.
I know typically you use the Window layer as a HUD and put it at the bottom or right.
With Hblank interrupts (and turning it off after a specific scan line) you might put it at the top.
Now I’m wondering if there is any trickery to put the HUD at the left ? Maybe only turn it on for certain columns ?
Using GBDK2020. But every tip is appreciated.
Offline
I don't remember how I implemented this, but I set aside this code in a separate .txt file after I switched to a vertical right-side HUD in case I ever wanted to reference it again for a future project.
// STAT_REG = 0x45; // Unused interrupt code, no longer needed with the change to a vertical HUD. Keeping it on hand for future projects.
// LYC_REG = 0x10; //LCD interrupt 16th scan line
// disable_interrupts();
// add_LCD(interruptLCD);
// add_VBL(interruptVBL);
// enable_interrupts();
// set_interrupts(VBL_IFLAG | LCD_IFLAG); // Don't think I need these anymore with a vertical UI
This was the thread where I was getting help troubleshooting my own top-side HUD before I decided that I wanted a vertical HUD.
https://gbdev.gg8.se/forums/viewtopic.php?id=615
I hope something here helps with understanding interrupts as I forgot how they worked...
Last edited by Ardis (2021-10-30 08:30:39)
Offline
The problem with disabling window in the middle of line which is being drawn, is that the timing is not constant, it depends on many things.
Offline
M2m wrote:
Now I’m wondering if there is any trickery to put the HUD at the left ?
To my knowledge, there isn't.
Depending on your game, you might think out of the box. If your main playfield only scrolls vertically (or doesn't scroll at all), you could paint the leftmost part of the screen in white (or some other color) and put sprites on it to draw the HUD. In some games it may be possible to put the main playfield on the window and use the background as a HUD. But both ideas won't fit for all games.
Offline