New prototype mouse input system...
This commit is contained in:
parent
3c6c3fac33
commit
24f3a047d0
@ -31,7 +31,7 @@ package body attribute is
|
|||||||
for index in enumeration loop
|
for index in enumeration loop
|
||||||
sprite (index) := core.import_sprite ("./sprite/attribute/" & core.lowercase (enumeration'image (index)) & ".png", 1, 1);
|
sprite (index) := core.import_sprite ("./sprite/attribute/" & core.lowercase (enumeration'image (index)) & ".png", 1, 1);
|
||||||
--
|
--
|
||||||
ui.add_structure_button (sprite (index), trait (index).name);
|
ui.add_structure_button (sprite (index), trait (index).name, trait (index).text);
|
||||||
end loop;
|
end loop;
|
||||||
end configure;
|
end configure;
|
||||||
|
|
||||||
|
@ -337,6 +337,18 @@ package body core is
|
|||||||
when others => signal_mode := signal_code'pos (signal_none);
|
when others => signal_mode := signal_code'pos (signal_none);
|
||||||
end case;
|
end case;
|
||||||
--
|
--
|
||||||
|
for index in reverse 0 .. block_count - 1 loop
|
||||||
|
if core.cursor.x > block_array (index).x and core.cursor.x < block_array (index).width
|
||||||
|
and core.cursor.y > block_array (index).y and core.cursor.y < block_array (index).height
|
||||||
|
and core.cursor_mode = block_array (index).mode then
|
||||||
|
block_array (index).action.all;
|
||||||
|
core.cursor_mode := 0;
|
||||||
|
exit;
|
||||||
|
end if;
|
||||||
|
end loop;
|
||||||
|
--
|
||||||
|
block_count := 0;
|
||||||
|
--
|
||||||
ray.begin_drawing;
|
ray.begin_drawing;
|
||||||
--
|
--
|
||||||
ray.clear_background ((50, 60, 70, 255));
|
ray.clear_background ((50, 60, 70, 255));
|
||||||
@ -356,6 +368,19 @@ package body core is
|
|||||||
|
|
||||||
------------------------------------------------------------------------------------------
|
------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
procedure block_queue (data : in block) is
|
||||||
|
begin
|
||||||
|
if block_count = block_limit - 1 then
|
||||||
|
return;
|
||||||
|
end if;
|
||||||
|
--
|
||||||
|
block_array (block_count) := data;
|
||||||
|
--
|
||||||
|
increment (block_count);
|
||||||
|
end block_queue;
|
||||||
|
|
||||||
|
------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
procedure increment (value : in out integer) is begin value := value + 1; end increment;
|
procedure increment (value : in out integer) is begin value := value + 1; end increment;
|
||||||
procedure decrement (value : in out integer) is begin value := value - 1; end decrement;
|
procedure decrement (value : in out integer) is begin value := value - 1; end decrement;
|
||||||
|
|
||||||
|
@ -37,6 +37,15 @@ package core is
|
|||||||
type font is record index, scale, space : integer; end record;
|
type font is record index, scale, space : integer; end record;
|
||||||
type song is record index : integer; end record;
|
type song is record index : integer; end record;
|
||||||
|
|
||||||
|
type block is record
|
||||||
|
x : integer := 0;
|
||||||
|
y : integer := 0;
|
||||||
|
width : integer := 0;
|
||||||
|
height : integer := 0;
|
||||||
|
mode : integer := 0;
|
||||||
|
action : access procedure := null;
|
||||||
|
end record;
|
||||||
|
|
||||||
type text_box_data is record
|
type text_box_data is record
|
||||||
data : unbounded_string := null_unbounded_string;
|
data : unbounded_string := null_unbounded_string;
|
||||||
size : vector := (0, 0);
|
size : vector := (0, 0);
|
||||||
@ -70,6 +79,11 @@ package core is
|
|||||||
animation_time : natural := 0;
|
animation_time : natural := 0;
|
||||||
zoom : natural := 1;
|
zoom : natural := 1;
|
||||||
|
|
||||||
|
block_limit : constant natural := 40;
|
||||||
|
block_count : natural := 0;
|
||||||
|
|
||||||
|
block_array : array (0 .. block_limit - 1) of block := (others => (0, 0, 0, 0, 0, null));
|
||||||
|
|
||||||
text_box : text_box_data;
|
text_box : text_box_data;
|
||||||
|
|
||||||
------------------------------------------------------------------------------------------
|
------------------------------------------------------------------------------------------
|
||||||
@ -116,6 +130,8 @@ package core is
|
|||||||
|
|
||||||
procedure overlay;
|
procedure overlay;
|
||||||
|
|
||||||
|
procedure block_queue (data : in block);
|
||||||
|
|
||||||
function read_text_box return string;
|
function read_text_box return string;
|
||||||
|
|
||||||
procedure write_text_box (text : in string);
|
procedure write_text_box (text : in string);
|
||||||
|
@ -31,7 +31,7 @@ package body resource is
|
|||||||
for index in enumeration loop
|
for index in enumeration loop
|
||||||
sprite (index) := core.import_sprite ("./sprite/resource/" & core.lowercase (enumeration'image (index)) & ".png", 1, 1);
|
sprite (index) := core.import_sprite ("./sprite/resource/" & core.lowercase (enumeration'image (index)) & ".png", 1, 1);
|
||||||
--
|
--
|
||||||
ui.add_structure_button (sprite (index), trait (index).name);
|
ui.add_structure_button (sprite (index), trait (index).name, trait (index).text);
|
||||||
end loop;
|
end loop;
|
||||||
end configure;
|
end configure;
|
||||||
|
|
||||||
|
@ -31,7 +31,7 @@ package body skill is
|
|||||||
for index in enumeration loop
|
for index in enumeration loop
|
||||||
sprite (index) := core.import_sprite ("./sprite/skill/" & core.lowercase (enumeration'image (index)) & ".png", 1, 1);
|
sprite (index) := core.import_sprite ("./sprite/skill/" & core.lowercase (enumeration'image (index)) & ".png", 1, 1);
|
||||||
--
|
--
|
||||||
ui.add_structure_button (sprite (index), trait (index).name);
|
ui.add_structure_button (sprite (index), trait (index).name, trait (index).text);
|
||||||
end loop;
|
end loop;
|
||||||
end configure;
|
end configure;
|
||||||
|
|
||||||
|
@ -165,8 +165,8 @@ 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_icon (data.gui_list (x).image, "", at_x, at_y);
|
draw_icon (data.gui_list (x).image, data.gui_list (x).info, at_x, at_y);
|
||||||
draw_frame ("", at_x + core.icon + 2, at_y, new_width - 2 * offset - core.icon - 2, core.icon);
|
draw_frame (data.gui_list (x).info, at_x + core.icon + 2, at_y, new_width - 2 * offset - core.icon - 2, core.icon);
|
||||||
write (data.gui_list (x).text, at_x + core.icon + 6, at_y + 2);
|
write (data.gui_list (x).text, at_x + core.icon + 6, at_y + 2);
|
||||||
at_y := at_y + core.icon;
|
at_y := at_y + core.icon;
|
||||||
when others => null;
|
when others => null;
|
||||||
@ -276,6 +276,7 @@ package body ui is
|
|||||||
|
|
||||||
------------------------------------------------------------------------------------------
|
------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
procedure a is begin core.echo (core.warning, "Heyo world!"); end a;
|
||||||
procedure draw_help_box (x, y, width, height : in integer; action : core.pointer := core.idle'access) is
|
procedure draw_help_box (x, y, width, height : in integer; action : core.pointer := core.idle'access) is
|
||||||
offset : constant integer := sprite (active, text_middle).width;
|
offset : constant integer := sprite (active, text_middle).width;
|
||||||
begin
|
begin
|
||||||
@ -293,6 +294,8 @@ package body ui is
|
|||||||
--
|
--
|
||||||
core.write (core.read_text_box, x, y, font (active));
|
core.write (core.read_text_box, x, y, font (active));
|
||||||
--
|
--
|
||||||
|
core.block_queue ((x, y, width, height, 2, a'access));
|
||||||
|
--
|
||||||
select_text_box ("", x, y, width, height);
|
select_text_box ("", x, y, width, height);
|
||||||
end draw_help_box;
|
end draw_help_box;
|
||||||
|
|
||||||
@ -438,7 +441,7 @@ package body ui is
|
|||||||
|
|
||||||
------------------------------------------------------------------------------------------
|
------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
procedure draw_state_box (x, y : in integer) is -- TODO: Delete this at some point.
|
procedure draw_state_box (x, y : in integer) is
|
||||||
begin
|
begin
|
||||||
ui.write ("Cursor X:" & core.cursor.x'image, x, y + 0);
|
ui.write ("Cursor X:" & core.cursor.x'image, x, y + 0);
|
||||||
ui.write ("Cursor Y:" & core.cursor.y'image, x, y + 32);
|
ui.write ("Cursor Y:" & core.cursor.y'image, x, y + 32);
|
||||||
@ -453,7 +456,7 @@ package body ui is
|
|||||||
|
|
||||||
------------------------------------------------------------------------------------------
|
------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
procedure add_structure (data : in structure := no_structure) is -- TODO: This is dumb, tho less error-prone...
|
procedure add_structure (data : in structure) is
|
||||||
begin
|
begin
|
||||||
structure_array (structure_count) := data;
|
structure_array (structure_count) := data;
|
||||||
structure_array (structure_count).gui_list := new gui_array (0 .. structure_array (structure_count).gui_n - 1);
|
structure_array (structure_count).gui_list := new gui_array (0 .. structure_array (structure_count).gui_n - 1);
|
||||||
@ -464,10 +467,11 @@ package body ui is
|
|||||||
|
|
||||||
------------------------------------------------------------------------------------------
|
------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
procedure add_structure_button (icon : in core.sprite; text : in core.short_string) is
|
procedure add_structure_button (icon : in core.sprite; text : in core.short_string; description : in core.long_string := "") is
|
||||||
begin
|
begin
|
||||||
structure_array (structure_count - 1).gui_list (structure_array (structure_count - 1).gui_n).kind := gui_button;
|
structure_array (structure_count - 1).gui_list (structure_array (structure_count - 1).gui_n).kind := gui_button;
|
||||||
structure_array (structure_count - 1).gui_list (structure_array (structure_count - 1).gui_n).text := text;
|
structure_array (structure_count - 1).gui_list (structure_array (structure_count - 1).gui_n).text := text;
|
||||||
|
structure_array (structure_count - 1).gui_list (structure_array (structure_count - 1).gui_n).info := description;
|
||||||
structure_array (structure_count - 1).gui_list (structure_array (structure_count - 1).gui_n).number := 0;
|
structure_array (structure_count - 1).gui_list (structure_array (structure_count - 1).gui_n).number := 0;
|
||||||
structure_array (structure_count - 1).gui_list (structure_array (structure_count - 1).gui_n).image := icon;
|
structure_array (structure_count - 1).gui_list (structure_array (structure_count - 1).gui_n).image := icon;
|
||||||
--
|
--
|
||||||
|
@ -22,6 +22,7 @@ package ui is
|
|||||||
type gui_data is record
|
type gui_data is record
|
||||||
kind : enumeration := gui_none;
|
kind : enumeration := gui_none;
|
||||||
text : core.short_string := "- ";
|
text : core.short_string := "- ";
|
||||||
|
info : core.long_string := "- ";
|
||||||
number : integer := 0;
|
number : integer := 0;
|
||||||
image : core.sprite := (others => 0);
|
image : core.sprite := (others => 0);
|
||||||
end record;
|
end record;
|
||||||
@ -44,8 +45,6 @@ package ui is
|
|||||||
gui_list : access gui_array := null;
|
gui_list : access gui_array := null;
|
||||||
end record;
|
end record;
|
||||||
|
|
||||||
no_structure : structure;
|
|
||||||
|
|
||||||
------------------------------------------------------------------------------------------
|
------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
active : style := main;
|
active : style := main;
|
||||||
@ -77,9 +76,9 @@ package ui is
|
|||||||
|
|
||||||
procedure draw_state_box (x, y : in integer);
|
procedure draw_state_box (x, y : in integer);
|
||||||
|
|
||||||
procedure add_structure (data : in structure := no_structure);
|
procedure add_structure (data : in structure);
|
||||||
|
|
||||||
procedure add_structure_button (icon : in core.sprite; text : in core.short_string);
|
procedure add_structure_button (icon : in core.sprite; text : in core.short_string; description : in core.long_string := "");
|
||||||
|
|
||||||
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user