Work in progress font and buttons...
This commit is contained in:
parent
16db1d8efd
commit
36358dc2c1
@ -116,6 +116,16 @@ procedure main is
|
|||||||
|
|
||||||
------------------------------------------------------------------------------------------
|
------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
procedure main_menu is
|
||||||
|
begin
|
||||||
|
draw (ashland_preview, center_x (ashland_preview.width * 2), center_y (ashland_preview.height * 2), factor => 2);
|
||||||
|
draw (game_title, center_x (game_title.width * 2), center_y (game_title.height * 2), factor => 2);
|
||||||
|
--
|
||||||
|
write ("Main Menu", 0, 0);
|
||||||
|
end main_menu;
|
||||||
|
|
||||||
|
------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
procedure gameplay is
|
procedure gameplay is
|
||||||
begin
|
begin
|
||||||
if not view_list (status_preview_panel) then
|
if not view_list (status_preview_panel) then
|
||||||
@ -216,6 +226,14 @@ begin
|
|||||||
introduction;
|
introduction;
|
||||||
end loop introduction_loop;
|
end loop introduction_loop;
|
||||||
|
|
||||||
|
main_menu_loop: loop
|
||||||
|
synchronize;
|
||||||
|
--
|
||||||
|
exit when signal_mode = signal_a;
|
||||||
|
--
|
||||||
|
main_menu;
|
||||||
|
end loop main_menu_loop;
|
||||||
|
|
||||||
gameplay_loop: loop
|
gameplay_loop: loop
|
||||||
synchronize;
|
synchronize;
|
||||||
--
|
--
|
||||||
|
@ -171,11 +171,18 @@ package body ui is
|
|||||||
for x in 0 .. data.gui_n - 1 loop
|
for x in 0 .. data.gui_n - 1 loop
|
||||||
case data.gui_list (x).kind is
|
case data.gui_list (x).kind is
|
||||||
when gui_button =>
|
when gui_button =>
|
||||||
draw_frame (data.gui_list (x).info, button_data.x, button_data.y, button_data.width, button_data.height);
|
--~draw_frame (data.gui_list (x).info, button_data.x, button_data.y, button_data.width, button_data.height);
|
||||||
draw_icon (data.gui_list (x).image, data.gui_list (x).info, button_data.x + offset, button_data.y + offset);
|
--~draw_icon (data.gui_list (x).image, data.gui_list (x).info, button_data.x + offset, button_data.y + offset);
|
||||||
write (data.gui_list (x).text,
|
--~write (data.gui_list (x).text,
|
||||||
button_data.x + offset + core.icon + (core.icon - font (active).scale) / 2,
|
--~button_data.x + offset + core.icon + (core.icon - font (active).scale) / 2,
|
||||||
button_data.y + offset + (core.icon - font (active).scale) / 2);
|
--~button_data.y + offset + (core.icon - font (active).scale) / 2);
|
||||||
|
draw_button (text => data.gui_list (x).text,
|
||||||
|
description => data.gui_list (x).info,
|
||||||
|
icon => data.gui_list (x).image,
|
||||||
|
x => button_data.x,
|
||||||
|
y => button_data.y,
|
||||||
|
width => button_data.width,
|
||||||
|
height => button_data.height);
|
||||||
--
|
--
|
||||||
button_data.y := button_data.y + button_data.height;
|
button_data.y := button_data.y + button_data.height;
|
||||||
when gui_orient =>
|
when gui_orient =>
|
||||||
@ -336,10 +343,42 @@ package body ui is
|
|||||||
draw (frame_upper_right, x + width - sprite (active, frame_upper_right).width, y);
|
draw (frame_upper_right, x + width - sprite (active, frame_upper_right).width, y);
|
||||||
draw (frame_lower_left, x, y + height - sprite (active, frame_lower_left).height);
|
draw (frame_lower_left, x, y + height - sprite (active, frame_lower_left).height);
|
||||||
draw (frame_lower_right, x + width - sprite (active, frame_lower_right).width, y + height - sprite (active, frame_lower_right).height);
|
draw (frame_lower_right, x + width - sprite (active, frame_lower_right).width, y + height - sprite (active, frame_lower_right).height);
|
||||||
|
--
|
||||||
|
if core.cursor_inside (x, y, width, height) then
|
||||||
|
core.write_text_box (description);
|
||||||
|
--
|
||||||
|
if core.cursor_mode = 1 then
|
||||||
|
action.all;
|
||||||
|
core.cursor_mode := 0;
|
||||||
|
end if;
|
||||||
|
end if;
|
||||||
end draw_frame;
|
end draw_frame;
|
||||||
|
|
||||||
------------------------------------------------------------------------------------------
|
------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
procedure draw_button (text, description : in string; icon : in core.sprite; x, y, width, height : in integer; action : core.pointer := core.idle_skip'access) is
|
||||||
|
offset : constant integer := core.icon / 4;
|
||||||
|
begin
|
||||||
|
draw_frame (description, x, y, width, height);
|
||||||
|
draw_icon (icon, description, x + offset, y + offset);
|
||||||
|
--
|
||||||
|
write (text,
|
||||||
|
x + offset + (core.icon - font (active).scale) / 2 + core.icon,
|
||||||
|
y + offset + (core.icon - font (active).scale) / 2,
|
||||||
|
(if core.cursor_inside (x, y, width, height) then font_tint (active) else (others => 255)));
|
||||||
|
--
|
||||||
|
if core.cursor_inside (x, y, width, height) then
|
||||||
|
core.write_text_box (description);
|
||||||
|
--
|
||||||
|
if core.cursor_mode = 1 then
|
||||||
|
action.all;
|
||||||
|
core.cursor_mode := 0;
|
||||||
|
end if;
|
||||||
|
end if;
|
||||||
|
end draw_button;
|
||||||
|
|
||||||
|
------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
procedure draw_title_bar (x, y, width : in integer; title : in string) is
|
procedure draw_title_bar (x, y, width : in integer; title : in string) is
|
||||||
middle_width : constant integer := width - sprite (active, title_bar_left).width - sprite (active, title_bar_right).width;
|
middle_width : constant integer := width - sprite (active, title_bar_left).width - sprite (active, title_bar_right).width;
|
||||||
offset : constant integer := (sprite (active, title_bar_middle).height - font (active).scale) / 2;
|
offset : constant integer := (sprite (active, title_bar_middle).height - font (active).scale) / 2;
|
||||||
|
@ -64,7 +64,8 @@ package ui is
|
|||||||
|
|
||||||
procedure draw_help_box (x, y, width, height : in integer; action : core.pointer := core.idle_skip'access);
|
procedure draw_help_box (x, y, width, height : in integer; action : core.pointer := core.idle_skip'access);
|
||||||
|
|
||||||
procedure draw_frame (description : in string; x, y, width, height : in integer; action : core.pointer := core.idle_skip'access);
|
procedure draw_frame (description : in string; x, y, width, height : in integer; action : core.pointer := core.idle_skip'access);
|
||||||
|
procedure draw_button (text, description : in string; icon : in core.sprite; x, y, width, height : in integer; action : core.pointer := core.idle_skip'access);
|
||||||
|
|
||||||
procedure draw_title_bar (x, y, width : in integer; title : in string);
|
procedure draw_title_bar (x, y, width : in integer; title : in string);
|
||||||
procedure draw_fill_bar (x, y, width : in integer; fill : in float);
|
procedure draw_fill_bar (x, y, width : in integer; fill : in float);
|
||||||
|
BIN
sprite/ui/monospace.png
Normal file
BIN
sprite/ui/monospace.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 950 B |
Loading…
Reference in New Issue
Block a user