Added line drawing function and refactored squared grid.
This commit is contained in:
parent
fbb99ad4aa
commit
c05eafca94
@ -115,6 +115,13 @@ package body core is
|
|||||||
|
|
||||||
------------------------------------------------------------------------------------------
|
------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
procedure line (origin, offset : in vector_2) is
|
||||||
|
begin
|
||||||
|
render_vector (origin.x, origin.y, origin.x + offset.x, origin.y + offset.y);
|
||||||
|
end line;
|
||||||
|
|
||||||
|
------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
procedure write (text : in string; x, y : in integer; colour : in integer := 16#CCCCCC#) is
|
procedure write (text : in string; x, y : in integer; colour : in integer := 16#CCCCCC#) is
|
||||||
begin
|
begin
|
||||||
render_string (c_string (text), x, y, colour, false);
|
render_string (c_string (text), x, y, colour, false);
|
||||||
@ -203,7 +210,8 @@ package body core is
|
|||||||
begin
|
begin
|
||||||
for vertical in 0 .. line_v2
|
for vertical in 0 .. line_v2
|
||||||
loop
|
loop
|
||||||
render_vector (offset_x + vertical * base, y, offset_x + vertical * base, y + crop_height);
|
--~render_vector (offset_x + vertical * base, y, offset_x + vertical * base, y + crop_height);
|
||||||
|
line ((offset_x + vertical * base, y), (0, crop_height));
|
||||||
end loop;
|
end loop;
|
||||||
--
|
--
|
||||||
--~while horizontal < y + height - base - offset
|
--~while horizontal < y + height - base - offset
|
||||||
@ -224,13 +232,15 @@ package body core is
|
|||||||
--~end loop;
|
--~end loop;
|
||||||
for horizontal in 0 .. line_h
|
for horizontal in 0 .. line_h
|
||||||
loop
|
loop
|
||||||
render_vector (x, offset_y + horizontal * base, x + width, offset_y + horizontal * base);
|
--~render_vector (x, offset_y + horizontal * base, x + width, offset_y + horizontal * base);
|
||||||
|
line ((x, offset_y + horizontal * base), (width, 0));
|
||||||
--
|
--
|
||||||
for vertical in 0 .. line_v1
|
for vertical in 0 .. line_v1
|
||||||
loop
|
loop
|
||||||
full_vector := y + 2 * base * (horizontal / 2) - ((y + height) mod base) / 2;
|
full_vector := y + 2 * base * (horizontal / 2) - ((y + height) mod base) / 2;
|
||||||
--
|
--
|
||||||
render_vector (offset_x + vertical * base - base / 2, full_vector + base, offset_x + vertical * base - base / 2, full_vector + 2 * base);
|
--~render_vector (offset_x + vertical * base - base / 2, full_vector + base, offset_x + vertical * base - base / 2, full_vector + 2 * base);
|
||||||
|
line ((offset_x + vertical * base - base / 2, full_vector + base), (0, base));
|
||||||
end loop;
|
end loop;
|
||||||
--
|
--
|
||||||
if horizontal > 1 then
|
if horizontal > 1 then
|
||||||
@ -238,7 +248,8 @@ package body core is
|
|||||||
loop
|
loop
|
||||||
full_vector := y + 2 * base * (horizontal / 2) - ((y + height) mod base) / 2;
|
full_vector := y + 2 * base * (horizontal / 2) - ((y + height) mod base) / 2;
|
||||||
--
|
--
|
||||||
render_vector (offset_x + vertical * base, full_vector, offset_x + vertical * base, full_vector + base);
|
--~render_vector (offset_x + vertical * base, full_vector, offset_x + vertical * base, full_vector + base);
|
||||||
|
line ((offset_x + vertical * base, full_vector), (0, base));
|
||||||
end loop;
|
end loop;
|
||||||
end if;
|
end if;
|
||||||
end loop;
|
end loop;
|
||||||
@ -247,7 +258,8 @@ package body core is
|
|||||||
loop
|
loop
|
||||||
full_vector := y + 2 * base * ((height / base) / 2) - ((y + height) mod base) / 2;
|
full_vector := y + 2 * base * ((height / base) / 2) - ((y + height) mod base) / 2;
|
||||||
--
|
--
|
||||||
render_vector (offset_x + vertical * base, full_vector, offset_x + vertical * base, full_vector + crop_height);
|
--~render_vector (offset_x + vertical * base, full_vector, offset_x + vertical * base, full_vector + crop_height);
|
||||||
|
line ((offset_x + vertical * base, full_vector), (0, crop_height));
|
||||||
end loop;
|
end loop;
|
||||||
end draw_squared_grid;
|
end draw_squared_grid;
|
||||||
|
|
||||||
|
@ -99,9 +99,11 @@ package core is
|
|||||||
|
|
||||||
function load_sprite (file_path : in string; frames, states : in integer) return sprite;
|
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);
|
procedure crop (data : in sprite; x, y, u, v, width, height : in integer);
|
||||||
procedure draw (data : in sprite; x, y : in integer);
|
procedure draw (data : in sprite; x, y : in integer);
|
||||||
procedure move (data : in sprite; x, y, frame, state : in integer);
|
procedure move (data : in sprite; x, y, frame, state : in integer);
|
||||||
|
|
||||||
|
procedure line (origin, offset : in vector_2);
|
||||||
|
|
||||||
procedure write (text : in string; x, y : in integer; colour : in integer := 16#CCCCCC#);
|
procedure write (text : in string; x, y : in integer; colour : in integer := 16#CCCCCC#);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user