Random various things have been done...
This commit is contained in:
parent
fbb0c23895
commit
f6dc29d3ee
@ -80,6 +80,15 @@ package body core is
|
||||
|
||||
------------------------------------------------------------------------------------------
|
||||
|
||||
function clip (value, minimum, maximum : in integer) return integer is
|
||||
begin
|
||||
if value < minimum then return minimum; end if;
|
||||
if value > maximum then return maximum; end if;
|
||||
return value;
|
||||
end clip;
|
||||
|
||||
------------------------------------------------------------------------------------------
|
||||
|
||||
function load_sprite (file_path : in string; frames, states : in integer) return sprite is
|
||||
this : sprite;
|
||||
begin
|
||||
|
@ -97,6 +97,8 @@ package core is
|
||||
function sigmoid (value : in boolean) return integer;
|
||||
function c_string (ada_string : in string) return string;
|
||||
|
||||
function clip (value, minimum, maximum : in integer) return integer;
|
||||
|
||||
function load_sprite (file_path : in string; frames, states : in integer) return sprite;
|
||||
|
||||
procedure crop (data : in sprite; x, y, u, v, width, height : in integer);
|
||||
|
@ -58,12 +58,17 @@ begin
|
||||
if core.signal_mode = core.signal_code'pos (core.signal_a) then side_panel := side_panel + 60; end if;
|
||||
if core.signal_mode = core.signal_code'pos (core.signal_d) then side_panel := side_panel - 60; end if;
|
||||
preview_width := 1800 - side_panel;
|
||||
world.draw (preview_x, preview_y, preview_width - 2 * preview_x, preview_height - 2 * preview_y, core.cursor_mode = 2);
|
||||
--
|
||||
if core.signal_mode = core.signal_code'pos (core.signal_left) then core.camera.x := core.camera.x - 1; end if;
|
||||
if core.signal_mode = core.signal_code'pos (core.signal_right) then core.camera.x := core.camera.x + 1; end if;
|
||||
if core.signal_mode = core.signal_code'pos (core.signal_up) then core.camera.y := core.camera.y - 1; end if;
|
||||
if core.signal_mode = core.signal_code'pos (core.signal_down) then core.camera.y := core.camera.y + 1; end if;
|
||||
--
|
||||
core.camera.x := core.clip (core.camera.x, 0, 80 - 1);
|
||||
core.camera.y := core.clip (core.camera.y, 0, 40 - 1);
|
||||
--
|
||||
world.draw (preview_x, preview_y, preview_width - 2 * preview_x, preview_height - 2 * preview_y, core.cursor_mode = 2);
|
||||
--
|
||||
ui.active := ui.steam;
|
||||
if core.cursor_mode = 3 then
|
||||
--~ui.active := ui.style'val (ui.style'pos (ui.active) mod 4);
|
||||
@ -94,8 +99,8 @@ begin
|
||||
--~core.draw_central_grid (preview_x, preview_y, preview_width - 2 * preview_x, preview_height - 2 * preview_y);
|
||||
--~core.draw_squared_grid (preview_x, preview_y, preview_width - 2 * preview_x, preview_height - 2 * preview_y);
|
||||
--
|
||||
ui.draw_menu (0, 0, preview_width, preview_height, false);
|
||||
ui.draw_tiny_menu (preview_width, 0, side_panel, preview_height, true);
|
||||
--~ui.draw_menu (0, 0, preview_width, preview_height, false);
|
||||
--~ui.draw_tiny_menu (preview_width, 0, side_panel, preview_height, true);
|
||||
--
|
||||
--~for this in magic.blow_away .. magic.thunderclap loop magic.draw (this, 112 * (magic.codex'pos (this) - magic.codex'pos (magic.chain_magic_arrow)) - 60, 112 * 0 + 64); end loop;
|
||||
--~for this in magic.agony_mass .. magic.weakness loop magic.draw (this, 112 * (magic.codex'pos (this) - magic.codex'pos (magic.thunderclap)) - 60, 112 * 1 + 64); end loop;
|
||||
@ -112,9 +117,9 @@ begin
|
||||
--
|
||||
core.draw_state_box (preview_width + 32, 32);
|
||||
--
|
||||
menu.draw (menu.attribute_information, 100, 100, false);
|
||||
menu.draw (menu.skill_information, 700, 100, false);
|
||||
menu.draw (menu.resource_information, 400, 100, true);
|
||||
--~menu.draw (menu.attribute_information, 100, 100, false);
|
||||
--~menu.draw (menu.skill_information, 700, 100, false);
|
||||
--~menu.draw (menu.resource_information, 400, 100, true);
|
||||
--
|
||||
core.write ("Menu :" & menu.trait (menu.mouse_over_menu).title, preview_width + 32, 32 + 320, 16#CCCCCC#);
|
||||
if menu.mouse_over_menu_element = -1 then
|
||||
|
@ -25,10 +25,10 @@ package body menu is
|
||||
|
||||
procedure configure is
|
||||
begin
|
||||
trait (attribute_information) := ("Attribute Information ", attribute.count, 10, 100, 64, new element_array (0 .. attribute.count - 1));
|
||||
trait (skill_information) := ("Skill Information ", skill.count, 10, 700, 64, new element_array (0 .. skill.count - 1));
|
||||
trait (resource_information) := ("Resource Information ", resource.count, 10, 400, 64, new element_array (0 .. resource.count - 1));
|
||||
trait (none) := ("-- ", 2, 10, 0, 0, new element_array (0 .. 1));
|
||||
trait (attribute_information) := ("Attribute Information ", true, attribute.count, 10, 100, 64, new element_array (0 .. attribute.count - 1));
|
||||
trait (skill_information) := ("Skill Information ", true, skill.count, 10, 700, 64, new element_array (0 .. skill.count - 1));
|
||||
trait (resource_information) := ("Resource Information ", true, resource.count, 10, 400, 64, new element_array (0 .. resource.count - 1));
|
||||
trait (none) := ("-- ", true, 2, 10, 0, 0, new element_array (0 .. 1));
|
||||
--
|
||||
for index in 0 .. attribute.count - 1
|
||||
loop
|
||||
@ -61,6 +61,9 @@ package body menu is
|
||||
--
|
||||
for index in codex
|
||||
loop
|
||||
if trait (index).hide then
|
||||
goto next;
|
||||
end if;
|
||||
limitation := (if trait (index).length < trait (index).height then trait (index).length else trait (index).height);
|
||||
--
|
||||
if core.cursor_x > trait (index).x
|
||||
@ -82,6 +85,7 @@ package body menu is
|
||||
end loop;
|
||||
return;
|
||||
end if;
|
||||
<<next>>
|
||||
end loop;
|
||||
end synchronize;
|
||||
|
||||
@ -97,8 +101,9 @@ package body menu is
|
||||
return;
|
||||
end if;
|
||||
--
|
||||
trait (index).x := (if center then (core.window_width - width) / 2 else x);
|
||||
trait (index).y := (if center then (core.window_height - height) / 2 else y);
|
||||
trait (index).hide := false;
|
||||
trait (index).x := (if center then (core.window_width - width) / 2 else x);
|
||||
trait (index).y := (if center then (core.window_height - height) / 2 else y);
|
||||
--
|
||||
ui.draw_title_bar (trait (index).x, trait (index).y, width, trait (index).title);
|
||||
ui.draw_tiny_menu (trait (index).x, trait (index).y, width, height, true);
|
||||
|
@ -31,6 +31,7 @@ package menu is
|
||||
type information is
|
||||
record
|
||||
title : core.short_string;
|
||||
hide : boolean;
|
||||
length : integer;
|
||||
height : integer;
|
||||
x : integer;
|
||||
|
@ -101,6 +101,29 @@ package body world is
|
||||
|
||||
------------------------------------------------------------------------------------------
|
||||
|
||||
procedure crop (data : in core.sprite; x, y, view_x, view_y, view_width, view_height : in integer) is
|
||||
crop_u, crop_v, crop_width, crop_height : integer;
|
||||
begin
|
||||
if x > view_x + view_width
|
||||
or y > view_y + view_height
|
||||
or x < view_x - data.width
|
||||
or y < view_y - data.height then
|
||||
return;
|
||||
end if;
|
||||
--
|
||||
--~if x + data.width < view_x + view_width then crop_width := data.width - (view_x + data.width) mod view_width; end if;
|
||||
--~if y + data.height < view_y + view_height then crop_height := data.height - (view_y + data.height) mod view_height; end if;
|
||||
--
|
||||
--~core.crop (data, x, y, 0, 0, crop_width, crop_height);
|
||||
--
|
||||
if (x + data.width) > view_width then crop_width := data.width - (x + data.width) mod view_width; end if;
|
||||
if (y + data.height) > view_height then crop_height := data.height - (y + data.height) mod view_height; end if;
|
||||
--
|
||||
core.crop (data, x + view_x, y + view_y, 0, 0, crop_width, crop_height);
|
||||
end crop;
|
||||
|
||||
------------------------------------------------------------------------------------------
|
||||
|
||||
procedure draw (x, y, width, height : in integer; show_grid : in boolean) is
|
||||
crop_width : integer := width mod core.base;
|
||||
crop_height : integer := height mod core.base;
|
||||
@ -108,16 +131,16 @@ package body world is
|
||||
begin
|
||||
for move_y in 0 .. height / core.base - 1
|
||||
loop
|
||||
for move_x in 0 .. width / core.base - 1
|
||||
for move_x in 0 .. + width / core.base - 1
|
||||
loop
|
||||
u := core.base * codex'pos (map.terrain) * 4;
|
||||
v := core.base * map.block (move_x, move_y);
|
||||
v := core.base * map.block (core.camera.x + move_x, core.camera.y + move_y);
|
||||
--
|
||||
core.crop (blocks, x + move_x * core.base, y + move_y * core.base, u, v, core.base, core.base);
|
||||
end loop;
|
||||
--
|
||||
u := core.base * codex'pos (map.terrain) * 4;
|
||||
v := core.base * map.block (width / core.base, move_y);
|
||||
v := core.base * map.block (width / core.base, core.camera.y + move_y);
|
||||
--
|
||||
core.crop (blocks, x + width - crop_width, y + move_y * core.base, u, v, crop_width, core.base);
|
||||
end loop;
|
||||
@ -125,7 +148,7 @@ package body world is
|
||||
for move_x in 0 .. width / core.base - 1
|
||||
loop
|
||||
u := core.base * codex'pos (map.terrain) * 4;
|
||||
v := core.base * map.block (move_x, height / core.base);
|
||||
v := core.base * map.block (core.camera.x + move_x, height / core.base);
|
||||
--
|
||||
core.crop (blocks, x + move_x * core.base, y + height - crop_height, u, v, core.base, crop_height);
|
||||
end loop;
|
||||
@ -137,25 +160,26 @@ package body world is
|
||||
--
|
||||
for object in 0 .. landmark_limit
|
||||
loop
|
||||
if map.landmark (object).x > width
|
||||
or map.landmark (object).y > height then
|
||||
goto skip_drawing_out_of_view_landmark;
|
||||
end if;
|
||||
--
|
||||
crop_width := landmarks (map.terrain) (map.landmark (object).index).width;
|
||||
crop_height := landmarks (map.terrain) (map.landmark (object).index).height;
|
||||
--
|
||||
if (map.landmark (object).x + landmarks (map.terrain) (map.landmark (object).index).width) > width then
|
||||
crop_width := crop_width - (map.landmark (object).x + landmarks (map.terrain) (map.landmark (object).index).width) mod width;
|
||||
end if;
|
||||
--
|
||||
if (map.landmark (object).y + landmarks (map.terrain) (map.landmark (object).index).height) > height then
|
||||
crop_height := crop_height - (map.landmark (object).y + landmarks (map.terrain) (map.landmark (object).index).height) mod height;
|
||||
end if;
|
||||
--
|
||||
core.crop (landmarks (map.terrain) (map.landmark (object).index), x + map.landmark (object).x, y + map.landmark (object).y, 0, 0, crop_width, crop_height);
|
||||
--
|
||||
<<skip_drawing_out_of_view_landmark>>
|
||||
--~if map.landmark (object).x > width
|
||||
--~or map.landmark (object).y > height then
|
||||
--~goto skip_drawing_out_of_view_landmark;
|
||||
--~end if;
|
||||
--~--
|
||||
--~crop_width := landmarks (map.terrain) (map.landmark (object).index).width;
|
||||
--~crop_height := landmarks (map.terrain) (map.landmark (object).index).height;
|
||||
--~--
|
||||
--~if (map.landmark (object).x + landmarks (map.terrain) (map.landmark (object).index).width) > width then
|
||||
--~crop_width := crop_width - (map.landmark (object).x + landmarks (map.terrain) (map.landmark (object).index).width) mod width;
|
||||
--~end if;
|
||||
--~--
|
||||
--~if (map.landmark (object).y + landmarks (map.terrain) (map.landmark (object).index).height) > height then
|
||||
--~crop_height := crop_height - (map.landmark (object).y + landmarks (map.terrain) (map.landmark (object).index).height) mod height;
|
||||
--~end if;
|
||||
--~--
|
||||
--~core.crop (landmarks (map.terrain) (map.landmark (object).index), x + map.landmark (object).x, y + map.landmark (object).y, 0, 0, crop_width, crop_height);
|
||||
--~--
|
||||
--~<<skip_drawing_out_of_view_landmark>>
|
||||
crop (landmarks (map.terrain) (map.landmark (object).index), map.landmark (object).x, map.landmark (object).y, x, y, width, height);
|
||||
end loop;
|
||||
--
|
||||
if show_grid then
|
||||
|
Loading…
Reference in New Issue
Block a user