diff --git a/global.h b/global.h index 2b0927c1..2d33891d 100644 --- a/global.h +++ b/global.h @@ -476,6 +476,15 @@ GFX2_GLOBAL byte Menu_factor_Y; /// Size of a color cell in the menu's palette. GFX2_GLOBAL word Menu_palette_cell_width; +GFX2_GLOBAL T_Menu_Bar Menu_bars[MENUBARS_COUNT] +#ifdef GLOBAL_VARIABLES + = +{{MENU_WIDTH, 9, 1, NULL }, // Status + {MENU_WIDTH, 10, 0, NULL }, // Layers + {MENU_WIDTH, 35, 1, NULL }} // Main +#endif + ; + // -- Window data diff --git a/init.c b/init.c index 9a33e38a..61bb27b4 100644 --- a/init.c +++ b/init.c @@ -346,15 +346,30 @@ byte Parse_skin(SDL_Surface * gui, T_Gui_skin *gfx) // Menu if (GUI_seek_down(gui, &cursor_x, &cursor_y, neutral_color, "menu")) return 1; - if (Read_GUI_block(gfx, gui, cursor_x, cursor_y, gfx->Menu_block, MENU_WIDTH, MENU_HEIGHT,"menu",0)) + if (Read_GUI_block(gfx, gui, cursor_x, cursor_y, gfx->Menu_block, Menu_bars[main_bar].width, Menu_bars[main_bar].height,"menu",0)) return 1; - cursor_x += MENU_WIDTH; + // Preview + cursor_x += Menu_bars[main_bar].width; if (GUI_seek_right(gui, &cursor_x, cursor_y, neutral_color, "logo")) return 1; if (Read_GUI_block(gfx, gui, cursor_x, cursor_y, gfx->Preview, 173, 16, "logo", 0)) return 1; - cursor_y+=MENU_HEIGHT; + cursor_y+= Menu_bars[main_bar].height; + + // Layerbar + if (GUI_seek_down(gui, &cursor_x, &cursor_y, neutral_color, "layer bar")) + return 1; + if (Read_GUI_block(gfx, gui, cursor_x, cursor_y, gfx->Layerbar_block, Menu_bars[layers_bar].width, Menu_bars[layers_bar].height,"layer bar",0)) + return 1; + cursor_y+= Menu_bars[layers_bar].height; + + if (GUI_seek_down(gui, &cursor_x, &cursor_y, neutral_color, "status bar")) + return 1; + if (Read_GUI_block(gfx, gui, cursor_x, cursor_y, gfx->Statusbar_block, Menu_bars[status_bar].width, Menu_bars[status_bar].height,"status bar",0)) + return 1; + cursor_y+= Menu_bars[status_bar].height; + // Effets for (i=0; iColor_light; MC_White = gfx->Color_white; MC_Trans = gfx->Color_trans; + + // Set menubars to point to the new data + Menu_bars[2].skin = (byte*)&(gfx->Menu_block); + Menu_bars[1].skin = (byte*)&(gfx->Layerbar_block); + Menu_bars[0].skin = (byte*)&(gfx->Statusbar_block); } diff --git a/skins/skin_classic.png b/skins/skin_classic.png index be56612d..27511084 100644 Binary files a/skins/skin_classic.png and b/skins/skin_classic.png differ diff --git a/skins/skin_modern.png b/skins/skin_modern.png index dd680c29..4526d1b6 100644 Binary files a/skins/skin_modern.png and b/skins/skin_modern.png differ diff --git a/struct.h b/struct.h index 4a2c744a..f34a779d 100644 --- a/struct.h +++ b/struct.h @@ -416,7 +416,9 @@ typedef struct // Menu and other graphics /// Bitmap data for the menu, a single rectangle. - byte Menu_block[MENU_HEIGHT][MENU_WIDTH]; + byte Menu_block[35][MENU_WIDTH]; + byte Layerbar_block[10][MENU_WIDTH]; + byte Statusbar_block[9][MENU_WIDTH]; /// Bitmap data for the icons that are displayed over the menu. byte Menu_sprite[NB_MENU_SPRITES][MENU_SPRITE_HEIGHT][MENU_SPRITE_WIDTH]; /// Bitmap data for the different "effects" icons. @@ -460,4 +462,19 @@ typedef struct } T_Gui_skin; +// A menubar. +typedef struct { + word width; + word height; + byte visible; + byte* skin; +} T_Menu_Bar; + +typedef enum { + status_bar = 0, // MUST be 0 + layers_bar, + main_bar, + MENUBARS_COUNT +} T_Menubars; + #endif diff --git a/windows.c b/windows.c index 73e70b2d..3e60a017 100644 --- a/windows.c +++ b/windows.c @@ -419,16 +419,24 @@ int Pick_color_in_palette() void Display_menu(void) { word x_pos; - word y_pos; + word y_pos, y_off = 0; + int8_t current_menu; char str[4]; if (Menu_is_visible) { // display menu sprite - for (y_pos=0;y_posMenu_block[y_pos][x_pos]); + for (current_menu = MENUBARS_COUNT - 1; current_menu >= 0; current_menu --) + { + if(Menu_bars[current_menu].visible) + { + for (y_pos=0;y_pos