Revised UI structure to use dynamic arrays, and revised menus.
This commit is contained in:
parent
5d0a29f15a
commit
16fbf216da
@ -13,19 +13,20 @@ package body attribute is
|
|||||||
------------------------------------------------------------------------------------------
|
------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
procedure configure is
|
procedure configure is
|
||||||
|
structure : ui.structure;
|
||||||
begin
|
begin
|
||||||
core.echo (core.comment, "Configuring attribute components...");
|
core.echo (core.comment, "Configuring attribute components...");
|
||||||
--
|
--
|
||||||
ui.add_structure ((title => "Attribute Menu ",
|
structure.title := "Attribute Menu ";
|
||||||
toggle => core.signal_a,
|
structure.toggle := core.signal_a;
|
||||||
show => false,
|
structure.show := false;
|
||||||
center => false,
|
structure.center := false;
|
||||||
resize => true,
|
structure.resize := true;
|
||||||
x => 880,
|
structure.x := 880;
|
||||||
y => (core.window_height - 320) / 2,
|
structure.y := (core.window_height - 320) / 2;
|
||||||
gui_n => 0,
|
structure.gui_n := count;
|
||||||
gui_list => (others => ui.empty),
|
--
|
||||||
others => 0));
|
ui.add_structure (structure);
|
||||||
--
|
--
|
||||||
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);
|
||||||
|
@ -356,6 +356,11 @@ package body core is
|
|||||||
|
|
||||||
------------------------------------------------------------------------------------------
|
------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
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 idle is begin null; end idle;
|
procedure idle is begin null; end idle;
|
||||||
|
|
||||||
procedure move_camera_up is begin core.camera.y := core.camera.y - 1; end move_camera_up;
|
procedure move_camera_up is begin core.camera.y := core.camera.y - 1; end move_camera_up;
|
||||||
|
@ -127,6 +127,9 @@ package core is
|
|||||||
procedure move_camera_left;
|
procedure move_camera_left;
|
||||||
procedure move_camera_right;
|
procedure move_camera_right;
|
||||||
|
|
||||||
|
procedure increment (value : in out integer);
|
||||||
|
procedure decrement (value : in out integer);
|
||||||
|
|
||||||
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
end core;
|
end core;
|
||||||
|
@ -13,19 +13,20 @@ package body resource is
|
|||||||
------------------------------------------------------------------------------------------
|
------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
procedure configure is
|
procedure configure is
|
||||||
|
structure : ui.structure;
|
||||||
begin
|
begin
|
||||||
core.echo (core.comment, "Configuring resource components...");
|
core.echo (core.comment, "Configuring resource components...");
|
||||||
--
|
--
|
||||||
ui.add_structure ((title => "Resource Menu ",
|
structure.title := "Resource Menu ";
|
||||||
toggle => core.signal_r,
|
structure.toggle := core.signal_r;
|
||||||
show => false,
|
structure.show := false;
|
||||||
center => false,
|
structure.center := false;
|
||||||
resize => true,
|
structure.resize := true;
|
||||||
x => 480,
|
structure.x := 480;
|
||||||
y => (core.window_height - 320) / 2,
|
structure.y := (core.window_height - 320) / 2;
|
||||||
gui_n => 0,
|
structure.gui_n := count;
|
||||||
gui_list => (others => ui.empty),
|
--
|
||||||
others => 0));
|
ui.add_structure (structure);
|
||||||
--
|
--
|
||||||
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);
|
||||||
|
@ -13,23 +13,20 @@ package body skill is
|
|||||||
------------------------------------------------------------------------------------------
|
------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
procedure configure is
|
procedure configure is
|
||||||
--~menu_data : ui.structure := (
|
structure : ui.structure;
|
||||||
--~"Skill Menu ", core.signal_s, false, true, true, 0, 0, 320, 160,
|
|
||||||
--~0, (others => (ui.gui_none, "- ", 0, (others => 0)))
|
|
||||||
--~);
|
|
||||||
begin
|
begin
|
||||||
core.echo (core.comment, "Configuring skill components...");
|
core.echo (core.comment, "Configuring skill components...");
|
||||||
--
|
--
|
||||||
ui.add_structure ((title => "Skill Menu ",
|
structure.title := "Skill Menu ";
|
||||||
toggle => core.signal_s,
|
structure.toggle := core.signal_s;
|
||||||
show => false,
|
structure.show := false;
|
||||||
center => false,
|
structure.center := false;
|
||||||
resize => true,
|
structure.resize := true;
|
||||||
x => 80,
|
structure.x := 80;
|
||||||
y => (core.window_height - 320) / 2,
|
structure.y := (core.window_height - 320) / 2;
|
||||||
gui_n => 0,
|
structure.gui_n := count;
|
||||||
gui_list => (others => ui.empty),
|
--
|
||||||
others => 0));
|
ui.add_structure (structure);
|
||||||
--
|
--
|
||||||
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);
|
||||||
|
@ -453,11 +453,13 @@ package body ui is
|
|||||||
|
|
||||||
------------------------------------------------------------------------------------------
|
------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
procedure add_structure (data : in structure) is -- TODO: This is dumb, tho less error-prone...
|
procedure add_structure (data : in structure := no_structure) is -- TODO: This is dumb, tho less error-prone...
|
||||||
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_n := 0;
|
||||||
--
|
--
|
||||||
structure_count := structure_count + 1;
|
core.increment (structure_count);
|
||||||
end add_structure;
|
end add_structure;
|
||||||
|
|
||||||
------------------------------------------------------------------------------------------
|
------------------------------------------------------------------------------------------
|
||||||
@ -469,7 +471,7 @@ package body ui is
|
|||||||
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;
|
||||||
--
|
--
|
||||||
structure_array (structure_count - 1).gui_n := structure_array (structure_count - 1).gui_n + 1;
|
core.increment (structure_array (structure_count - 1).gui_n);
|
||||||
end add_structure_button;
|
end add_structure_button;
|
||||||
|
|
||||||
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -19,8 +19,6 @@ package ui is
|
|||||||
|
|
||||||
------------------------------------------------------------------------------------------
|
------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
gui_size : constant := 24;
|
|
||||||
|
|
||||||
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 := "- ";
|
||||||
@ -30,26 +28,27 @@ package ui is
|
|||||||
|
|
||||||
empty : gui_data;
|
empty : gui_data;
|
||||||
|
|
||||||
type gui_array is array (0 .. gui_size) of gui_data;
|
type gui_array is array (natural range <>) of gui_data;
|
||||||
|
|
||||||
type structure is record
|
type structure is record
|
||||||
title : core.short_string := "- ";
|
title : core.short_string := "- ";
|
||||||
toggle : core.signal_code := core.signal_space;
|
toggle : core.signal_code := core.signal_space;
|
||||||
show : boolean := false;
|
show : boolean := false;
|
||||||
center : boolean := false;
|
center : boolean := false;
|
||||||
resize : boolean := false;
|
resize : boolean := false;
|
||||||
x : integer := 0;
|
x : integer := 0;
|
||||||
y : integer := 0;
|
y : integer := 0;
|
||||||
width : integer := 0;
|
width : integer := 0;
|
||||||
height : integer := 0;
|
height : integer := 0;
|
||||||
gui_n : natural := 0;
|
gui_n : natural := 0;
|
||||||
gui_list : gui_array := (others => empty);
|
gui_list : access gui_array := null;
|
||||||
end record;
|
end record;
|
||||||
|
|
||||||
|
no_structure : structure;
|
||||||
|
|
||||||
------------------------------------------------------------------------------------------
|
------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
active : style := main;
|
active : style := main;
|
||||||
prioritize : boolean := false;
|
|
||||||
|
|
||||||
------------------------------------------------------------------------------------------
|
------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
@ -78,7 +77,7 @@ 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);
|
procedure add_structure (data : in structure := no_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);
|
||||||
|
|
||||||
|
@ -71,7 +71,6 @@ package body world is
|
|||||||
exit when offset.x + (horizontal - core.camera.x) * core.base * core.zoom > core.window_width;
|
exit when offset.x + (horizontal - core.camera.x) * core.base * core.zoom > core.window_width;
|
||||||
--
|
--
|
||||||
u := core.base * biome'pos (map.kind) * 4;
|
u := core.base * biome'pos (map.kind) * 4;
|
||||||
--~v := core.base * map.tiles ((horizontal - core.camera.x) mod map.width, (vertical - core.camera.y) mod map.height);
|
|
||||||
v := core.base * map.tiles (horizontal, vertical);
|
v := core.base * map.tiles (horizontal, vertical);
|
||||||
--
|
--
|
||||||
core.draw (data => tiles,
|
core.draw (data => tiles,
|
||||||
@ -81,12 +80,12 @@ package body world is
|
|||||||
v => v,
|
v => v,
|
||||||
width => core.base,
|
width => core.base,
|
||||||
height => core.base);
|
height => core.base);
|
||||||
--
|
--~--MOVE PLAYER TO TILE WHERE YOU CLICKED
|
||||||
--~if core.cursor.x > offset.x + (horizontal - core.camera.x ) * core.base * core.zoom
|
--~if core.cursor.x > offset.x + (horizontal - core.camera.x ) * core.base * core.zoom
|
||||||
--~and core.cursor.x < offset.x + (horizontal - core.camera.x + 1) * core.base * core.zoom
|
--~and core.cursor.x < offset.x + (horizontal - core.camera.x + 1) * core.base * core.zoom
|
||||||
--~and core.cursor.y > offset.y + (vertical - core.camera.y ) * core.base * core.zoom
|
--~and core.cursor.y > offset.y + (vertical - core.camera.y ) * core.base * core.zoom
|
||||||
--~and core.cursor.y < offset.y + (vertical - core.camera.y + 1) * core.base * core.zoom
|
--~and core.cursor.y < offset.y + (vertical - core.camera.y + 1) * core.base * core.zoom
|
||||||
--~and core.cursor_mode = 1 and not ui.prioritize then
|
--~and core.cursor_mode = 1 then
|
||||||
--~core.camera.x := horizontal;
|
--~core.camera.x := horizontal;
|
||||||
--~core.camera.y := vertical;
|
--~core.camera.y := vertical;
|
||||||
--~core.cursor_mode := 0;
|
--~core.cursor_mode := 0;
|
||||||
@ -100,24 +99,6 @@ package body world is
|
|||||||
y => offset.y + (map.landmarks (index).y - core.camera.y) * core.base * core.zoom);
|
y => offset.y + (map.landmarks (index).y - core.camera.y) * core.base * core.zoom);
|
||||||
end loop;
|
end loop;
|
||||||
end draw;
|
end draw;
|
||||||
--~procedure draw is
|
|
||||||
--~u, v : integer;
|
|
||||||
--~begin
|
|
||||||
--~for move_y in 0 .. core.window_height / core.base / core.zoom + 1 loop
|
|
||||||
--~for move_x in 0 .. core.window_width / core.base / core.zoom + 1 loop
|
|
||||||
--~u := core.base * biome'pos (map.kind) * 4;
|
|
||||||
--~v := core.base * map.tiles (core.camera.x + move_x, core.camera.y + move_y);
|
|
||||||
--~--
|
|
||||||
--~core.draw (tiles, move_x * core.base * core.zoom, move_y * core.base * core.zoom, u, v, core.base, core.base);
|
|
||||||
--~end loop;
|
|
||||||
--~end loop;
|
|
||||||
--~--
|
|
||||||
--~for index in 1 .. landmark_limit loop
|
|
||||||
--~core.draw (data => landmarks (map.landmarks (index).index),
|
|
||||||
--~x => (map.landmarks (index).x - core.camera.x * core.base) * core.zoom,
|
|
||||||
--~y => (map.landmarks (index).y - core.camera.y * core.base) * core.zoom);
|
|
||||||
--~end loop;
|
|
||||||
--~end draw;
|
|
||||||
|
|
||||||
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user