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.
Hello!
I've stumbled upon a problem with displaying a window using set_win_tiles(). Here's an example code:
#include <gb/gb.h>
#include <gbdk/font.h>
uint8_t map[] = {
0x12,0x0f,0x16,0x16,0x19
};
void main(void) {
font_t min_font;
font_init();
min_font = font_load(font_min);
font_set(min_font);
set_win_tiles(0, 0, 5, 1, map);
SHOW_WIN;
DISPLAY_ON;
}When using the following build commands, the code is running correctly (i.e. it displays "HELLO").
c:\gbdk\bin\lcc -Wa-l -Wl-m -Wf--debug -Wl-y -Wl-w -c -o main.o main.c c:\gbdk\bin\lcc -Wa-l -Wl-m -Wf--debug -Wl-y -Wl-w -o main.gb main.o
But when I add '-Wm-yC' flag to build it for a Gameboy Color, the screen is empty.
Does anybody know what should I do to properly display window for a Gameboy Color?
Offline
Did you set a palette? Default palette on a GBC is all white.
Offline
I didn't. You're right, after setting a palette the text is displayed. Here's an updated code (for future reference). Thank you!
#include <gb/gb.h>
#include <gbdk/platform.h>
#include <gbdk/font.h>
uint8_t map[] = {
0x12,0x0f,0x16,0x16,0x19
};
const palette_color_t palette[] = {
RGB8(255, 255, 255), RGB8(255, 255, 255), RGB8(255, 255, 255), RGB8(0, 0, 0)
};
void main(void) {
font_t min_font;
font_init();
min_font = font_load(font_min);
font_set(min_font);
font_color(0, 0);
// As there is no set_win_palette() function I guess that
// palettes for bkg and win are common. Using set_default_palette()
// works too.
set_bkg_palette(0, 1, palette);
set_win_tiles(0, 0, 5, 1, map);
SHOW_WIN;
DISPLAY_ON;
}Offline
Glad I could help.
Offline