Preview skins.
git-svn-id: svn://pulkomandy.tk/GrafX2/trunk@1108 416bcca6-2ee7-4201-b75f-2eb2f807beb1
This commit is contained in:
parent
f4defe7e75
commit
0661e59e1c
65
buttons.c
65
buttons.c
@ -1021,9 +1021,12 @@ void Button_Skins(void)
|
|||||||
byte separatecolors = Config.Separate_colors;
|
byte separatecolors = Config.Separate_colors;
|
||||||
byte showlimits = Config.Display_image_limits;
|
byte showlimits = Config.Display_image_limits;
|
||||||
|
|
||||||
char * cursors[] = { "Solid", "Transparent", "Thin" };
|
word x,y, x_pos, offs_y;
|
||||||
|
|
||||||
#define FILESEL_Y 52
|
char * cursors[] = { "Solid", "Transparent", "Thin" };
|
||||||
|
T_Gui_skin * gfx = NULL;
|
||||||
|
|
||||||
|
#define FILESEL_Y 34
|
||||||
|
|
||||||
// --- Read the contents of skins/ directory ------------------
|
// --- Read the contents of skins/ directory ------------------
|
||||||
|
|
||||||
@ -1050,11 +1053,11 @@ void Button_Skins(void)
|
|||||||
Window_display_frame_in(6, FILESEL_Y - 2, 148, 84); // File selector
|
Window_display_frame_in(6, FILESEL_Y - 2, 148, 84); // File selector
|
||||||
|
|
||||||
// Texts
|
// Texts
|
||||||
Print_in_window( 6, 21,"Font" ,MC_Black,MC_Light);
|
Print_in_window( 172, 33,"Font:" ,MC_Black,MC_Light);
|
||||||
Print_in_window( 6, 36,"Cursor" ,MC_Black,MC_Light);
|
Print_in_window( 172, 59,"Cursor:" ,MC_Black,MC_Light);
|
||||||
|
|
||||||
// Ok button
|
// Ok button
|
||||||
Window_set_normal_button(172, 120, 51, 14, "OK", 0, 1, SDLK_RETURN); // 1
|
Window_set_normal_button(6, 120, 51, 14, "OK", 0, 1, SDLK_RETURN); // 1
|
||||||
|
|
||||||
// List of skins
|
// List of skins
|
||||||
skin_list = Window_set_list_button(
|
skin_list = Window_set_list_button(
|
||||||
@ -1068,31 +1071,35 @@ void Button_Skins(void)
|
|||||||
skin_list->Cursor_position = Find_file_in_fileselector(&Skin_files_list, Config.Skin_file);
|
skin_list->Cursor_position = Find_file_in_fileselector(&Skin_files_list, Config.Skin_file);
|
||||||
|
|
||||||
// Buttons to choose a font
|
// Buttons to choose a font
|
||||||
font_dropdown = Window_set_dropdown_button(60,19,104,11,0, Get_item_by_index(&Font_files_list,selected_font)->Short_name,1,0,1,RIGHT_SIDE|LEFT_SIDE); // 5
|
font_dropdown = Window_set_dropdown_button(172, 43, 104, 11, 0, Get_item_by_index(&Font_files_list,selected_font)->Short_name,1,0,1,RIGHT_SIDE|LEFT_SIDE); // 5
|
||||||
for (temp=0; temp<Font_files_list.Nb_files; temp++)
|
for (temp=0; temp<Font_files_list.Nb_files; temp++)
|
||||||
Window_dropdown_add_item(font_dropdown,temp,Get_item_by_index(&Font_files_list,temp)->Short_name);
|
Window_dropdown_add_item(font_dropdown,temp,Get_item_by_index(&Font_files_list,temp)->Short_name);
|
||||||
|
|
||||||
// Cancel
|
// Cancel
|
||||||
Window_set_normal_button(227, 120, 51,14,"Cancel",0,1,SDLK_ESCAPE); // 6
|
Window_set_normal_button(61, 120, 51,14,"Cancel",0,1,SDLK_ESCAPE); // 6
|
||||||
|
|
||||||
// Dropdown list to choose cursor type
|
// Dropdown list to choose cursor type
|
||||||
cursor_dropdown = Window_set_dropdown_button(60, 34, 104, 11, 0,
|
cursor_dropdown = Window_set_dropdown_button(172, 69, 104, 11, 0,
|
||||||
cursors[selected_cursor], 1, 0, 1, RIGHT_SIDE|LEFT_SIDE); // 7
|
cursors[selected_cursor], 1, 0, 1, RIGHT_SIDE|LEFT_SIDE); // 7
|
||||||
for (temp = 0; temp<3; temp++)
|
for (temp = 0; temp<3; temp++)
|
||||||
Window_dropdown_add_item(cursor_dropdown, temp, cursors[temp]);
|
Window_dropdown_add_item(cursor_dropdown, temp, cursors[temp]);
|
||||||
|
|
||||||
Window_set_normal_button(172, 23, 14, 14,
|
Window_set_normal_button(172, 87, 14, 14,
|
||||||
(Config.Display_image_limits)?"X":" ", -1, 1, SDLK_LAST); // 8
|
(Config.Display_image_limits)?"X":" ", -1, 1, SDLK_LAST); // 8
|
||||||
Print_in_window( 190, 21,"Draw picture", MC_Dark, MC_Light);
|
Print_in_window( 190, 85,"Draw picture", MC_Dark, MC_Light);
|
||||||
Print_in_window( 190, 30,"limits", MC_Dark, MC_Light);
|
Print_in_window( 190, 94,"limits", MC_Dark, MC_Light);
|
||||||
|
|
||||||
Window_set_normal_button(172, 52, 14, 14,
|
Window_set_normal_button(172, 111, 14, 14,
|
||||||
(Config.Separate_colors)?"X":" ", -1, 1, SDLK_LAST); // 9
|
(Config.Separate_colors)?"X":" ", -1, 1, SDLK_LAST); // 9
|
||||||
Print_in_window( 190, 50,"Separate", MC_Dark, MC_Light);
|
Print_in_window( 190, 109,"Separate", MC_Dark, MC_Light);
|
||||||
Print_in_window( 190, 59,"colors", MC_Dark, MC_Light);
|
Print_in_window( 190, 118,"colors", MC_Dark, MC_Light);
|
||||||
|
|
||||||
Window_redraw_list(skin_list);
|
Window_redraw_list(skin_list);
|
||||||
|
|
||||||
|
for (y = 14, offs_y = 0; offs_y < 16; offs_y++, y++)
|
||||||
|
for (x = 6, x_pos = 0; x_pos<173; x_pos++, x++)
|
||||||
|
Pixel_in_window(x, y, skin_logo[offs_y][x_pos]);
|
||||||
|
|
||||||
Update_window_area(0,0,Window_width, Window_height);
|
Update_window_area(0,0,Window_width, Window_height);
|
||||||
|
|
||||||
Display_cursor();
|
Display_cursor();
|
||||||
@ -1110,6 +1117,22 @@ void Button_Skins(void)
|
|||||||
case 3 : // doesn't happen
|
case 3 : // doesn't happen
|
||||||
break;
|
break;
|
||||||
case 4 : // a file is selected
|
case 4 : // a file is selected
|
||||||
|
|
||||||
|
// (Re-)load GUI graphics from selected skins
|
||||||
|
strcpy(skinsdir, Get_item_by_index(&Skin_files_list,
|
||||||
|
skin_list->List_start + skin_list->Cursor_position)->Full_name);
|
||||||
|
gfx = Load_graphics(skinsdir);
|
||||||
|
if (gfx == NULL) // Error
|
||||||
|
{
|
||||||
|
Verbose_error_message(Gui_loading_error_message);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Update preview
|
||||||
|
for (y = 14, offs_y = 0; offs_y < 16; offs_y++, y++)
|
||||||
|
for (x = 6, x_pos = 0; x_pos<173; x_pos++, x++)
|
||||||
|
Pixel_in_window(x, y, skin_logo[offs_y][x_pos]);
|
||||||
|
Update_window_area(4, 14, 174, 16);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case 5 : // Font dropdown
|
case 5 : // Font dropdown
|
||||||
selected_font = Window_attribute2; // Get the index of the chosen font.
|
selected_font = Window_attribute2; // Get the index of the chosen font.
|
||||||
@ -1121,13 +1144,13 @@ void Button_Skins(void)
|
|||||||
case 8: // Display limits
|
case 8: // Display limits
|
||||||
showlimits = !showlimits;
|
showlimits = !showlimits;
|
||||||
Hide_cursor();
|
Hide_cursor();
|
||||||
Print_in_window(175, 26, (showlimits)?"X":" ", MC_Black, MC_Light);
|
Print_in_window(175, 90, (showlimits)?"X":" ", MC_Black, MC_Light);
|
||||||
Display_cursor();
|
Display_cursor();
|
||||||
break;
|
break;
|
||||||
case 9: // Separate colors
|
case 9: // Separate colors
|
||||||
separatecolors = !separatecolors;
|
separatecolors = !separatecolors;
|
||||||
Hide_cursor();
|
Hide_cursor();
|
||||||
Print_in_window(175, 55, (separatecolors)?"X":" ", MC_Black, MC_Light);
|
Print_in_window(175, 114, (separatecolors)?"X":" ", MC_Black, MC_Light);
|
||||||
Display_cursor();
|
Display_cursor();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -1136,17 +1159,9 @@ void Button_Skins(void)
|
|||||||
|
|
||||||
if(clicked_button == 1)
|
if(clicked_button == 1)
|
||||||
{
|
{
|
||||||
T_Gui_skin * gfx;
|
|
||||||
byte * new_font;
|
byte * new_font;
|
||||||
|
|
||||||
// (Re-)load GUI graphics from selected skins
|
if (gfx != NULL)
|
||||||
strcpy(skinsdir, Get_item_by_index(&Skin_files_list, skin_list->List_start+skin_list->Cursor_position)->Full_name);
|
|
||||||
gfx=Load_graphics(skinsdir);
|
|
||||||
if (gfx == NULL) // Error
|
|
||||||
{
|
|
||||||
Verbose_error_message(Gui_loading_error_message);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
free(Gfx);
|
free(Gfx);
|
||||||
Gfx = gfx;
|
Gfx = gfx;
|
||||||
|
|||||||
3
global.h
3
global.h
@ -805,6 +805,9 @@ GFX2_GLOBAL byte * Menu_font;
|
|||||||
/// Pointer to the current active skin.
|
/// Pointer to the current active skin.
|
||||||
GFX2_GLOBAL T_Gui_skin * Gfx;
|
GFX2_GLOBAL T_Gui_skin * Gfx;
|
||||||
|
|
||||||
|
/// Logo of skin
|
||||||
|
byte skin_logo[16][173];
|
||||||
|
|
||||||
// -- Help data
|
// -- Help data
|
||||||
|
|
||||||
/// Index of the ::Help_section shown by the Help screen.
|
/// Index of the ::Help_section shown by the Help screen.
|
||||||
|
|||||||
6
init.c
6
init.c
@ -346,6 +346,12 @@ byte Parse_skin(SDL_Surface * gui, T_Gui_skin *gfx)
|
|||||||
return 1;
|
return 1;
|
||||||
if (Read_GUI_block(gui, cursor_x, cursor_y, gfx->Menu_block, MENU_WIDTH, MENU_HEIGHT,"menu",0))
|
if (Read_GUI_block(gui, cursor_x, cursor_y, gfx->Menu_block, MENU_WIDTH, MENU_HEIGHT,"menu",0))
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
|
cursor_x += MENU_WIDTH;
|
||||||
|
if (GUI_seek_right(gui, &cursor_x, cursor_y, neutral_color, "logo"))
|
||||||
|
return 1;
|
||||||
|
if (Read_GUI_block(gui, cursor_x, cursor_y, skin_logo, 173, 16, "logo", 0))
|
||||||
|
return 1;
|
||||||
cursor_y+=MENU_HEIGHT;
|
cursor_y+=MENU_HEIGHT;
|
||||||
|
|
||||||
// Effets
|
// Effets
|
||||||
|
|||||||
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 |
Loading…
x
Reference in New Issue
Block a user