Support for stacked menubars. May still be incomplete...
TODO : add a way to hide and show them... git-svn-id: svn://pulkomandy.tk/GrafX2/trunk@1178 416bcca6-2ee7-4201-b75f-2eb2f807beb1
This commit is contained in:
parent
3008540998
commit
6a4ba08343
9
global.h
9
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
|
||||
|
||||
|
||||
26
init.c
26
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; i<NB_EFFECTS_SPRITES; i++)
|
||||
@ -2498,4 +2513,9 @@ void Set_current_skin(const char *skinfile, T_Gui_skin *gfx)
|
||||
MC_Light = gfx->Color_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);
|
||||
}
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 14 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 16 KiB After Width: | Height: | Size: 16 KiB |
19
struct.h
19
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
|
||||
|
||||
16
windows.c
16
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_pos<MENU_HEIGHT;y_pos++)
|
||||
for (x_pos=0;x_pos<MENU_WIDTH;x_pos++)
|
||||
Pixel_in_menu(x_pos,y_pos,Gfx->Menu_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<Menu_bars[current_menu].height;y_pos++)
|
||||
for (x_pos=0;x_pos<Menu_bars[current_menu].width;x_pos++)
|
||||
Pixel_in_menu(x_pos, y_pos + y_off, Menu_bars[current_menu].skin[y_pos * Menu_bars[current_menu].width + x_pos]);
|
||||
y_off += Menu_bars[current_menu].height;
|
||||
}
|
||||
}
|
||||
// Grey area for filename below palette
|
||||
Block(MENU_WIDTH*Menu_factor_X,Menu_status_Y-Menu_factor_Y,Screen_width-(MENU_WIDTH*Menu_factor_X),9*Menu_factor_Y,MC_Light);
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user