Unfinished hexagonal grid...

This commit is contained in:
Ognjen Milan Robovic 2024-02-24 09:12:50 -05:00
parent d5a92f5de5
commit 3c528c784e
2 changed files with 45 additions and 5 deletions

View File

@ -275,9 +275,48 @@ package body core is
------------------------------------------------------------------------------------------
procedure draw_hexagon_grid (x, y, width, height : in integer) is
offset : constant vector_2 := (((width - base) / 2) mod base, ((height - base) / 2) mod base);
repeat : constant vector_2 := (2 * (((width - base) / 2) / base) + 1, 2 * (((height - base) / 2) / base) + 1);
begin
render_vector (width / 2 + x, y, width / 2 + x, height + y);
render_vector ( x, height / 2 + y, width + x, height / 2 + y);
for step in 0 .. repeat.y
loop
if step mod 2 = 1 then
for next in 0 .. repeat.x
loop
line ((x + offset.x + base / 2 + next * base, y + offset.y + step * base + base / 4), (-base / 2, -base / 2));
line ((x + offset.x + base / 2 + next * base, y + offset.y + step * base + base / 4), ( base / 2, -base / 2));
end loop;
else
for next in 0 .. repeat.x
loop
line ((x + offset.x + base + next * base, y + offset.y + step * base + base / 4), (-base / 2, -base / 2));
line ((x + offset.x + base + next * base, y + offset.y + step * base + base / 4), ( base / 2, -base / 2));
end loop;
end if;
--~line ((x + offset.x + 3 * base / 2, y + offset.y + next * base + base / 4), (-base / 2, -base / 2));
end loop;
--
if repeat.y mod 4 = 1 then
for next in 0 .. repeat.x - 1 loop line ((x + offset.x + base / 2 + next * base, y ), (0, offset.y - base / 4)); end loop;
for next in 0 .. repeat.x - 1 loop line ((x + offset.x + base / 2 + next * base, y + base / 4 + height - offset.y), (0, offset.y - base / 4)); end loop;
--
for step in 0 .. repeat.y / 2 - 1 loop
for next in 0 .. repeat.x - 1 loop line ((x + offset.x + base / 2 + next * base, y + 5 * base / 4 + offset.y + 2 * step * base), (0, base / 2)); end loop;
end loop;
for step in 0 .. repeat.y / 2 loop
for next in 0 .. repeat.x loop line ((x + offset.x + next * base, y + base / 4 + offset.y + 2 * step * base), (0, base / 2)); end loop;
end loop;
else
for next in 0 .. repeat.x - 1 loop line ((x + offset.x + next * base, y ), (0, offset.y)); end loop;
for next in 0 .. repeat.x - 1 loop line ((x + offset.x + next * base, y + height - offset.y), (0, offset.y)); end loop;
--
for step in 0 .. repeat.y / 2 - 1 loop
for next in 0 .. repeat.x loop line ((x + offset.x + next * base, y + 5 * base / 4 + offset.y + 2 * step * base), (0, base / 2)); end loop;
end loop;
for step in 0 .. repeat.y / 2 loop
for next in 0 .. repeat.x - 1 loop line ((x + offset.x + base / 2 + next * base, y + base / 4 + offset.y + 2 * step * base), (0, base / 2)); end loop;
end loop;
end if;
end draw_hexagon_grid;
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

View File

@ -98,10 +98,11 @@ begin
--~end loop;
--
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);
--~core.draw_squared_grid (preview_x, preview_y, preview_width - 2 * preview_x, preview_height - 2 * preview_y);
core.draw_hexagon_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;