Finished squared grid...
This commit is contained in:
parent
2978693b9d
commit
d5a92f5de5
@ -241,55 +241,35 @@ package body core is
|
||||
------------------------------------------------------------------------------------------
|
||||
|
||||
procedure draw_squared_grid (x, y, width, height : in integer) is
|
||||
--~offset_x : constant integer := x + base / 2 + (width mod base) / 2;
|
||||
--~offset_y : constant integer := y + base / 2 + (height mod base) / 2;
|
||||
--~crop_height : constant integer := ((height + base) / 2) mod base;
|
||||
--~crop_offset : constant integer := y - ((y + height) mod base) / 2;
|
||||
--~middle : constant vector_2 := (width / 2 + x, height / 2 + y);
|
||||
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);
|
||||
--~blabla : constant integer := y + height - ((height - base) / 2) mod base;
|
||||
--~next : integer;
|
||||
begin
|
||||
--~for vertical in 0 .. width / base - 1
|
||||
--~loop
|
||||
--~line ((offset_x + vertical * base, y), (0, crop_height));
|
||||
--~end loop;
|
||||
--~--
|
||||
--~for horizontal in 0 .. height / base - 1
|
||||
--~loop
|
||||
--~line ((x, offset_y + horizontal * base), (width, 0));
|
||||
--~--
|
||||
--~for vertical in 0 .. width / base - 1
|
||||
--~loop
|
||||
--~line ((offset_x + vertical * base - base / 2, crop_offset + 2 * base * (horizontal / 2) + base), (0, base));
|
||||
--~line ((offset_x + vertical * base, crop_offset + 2 * base * (horizontal / 2)), (0, base));
|
||||
--~end loop;
|
||||
--~end loop;
|
||||
--~--
|
||||
--~for vertical in 0 .. width / base - 1
|
||||
--~loop
|
||||
--~line ((offset_x + vertical * base, crop_offset + 2 * base * ((height / base) / 2)), (0, crop_height));
|
||||
--~end loop;
|
||||
--~--
|
||||
--~--
|
||||
--~--
|
||||
-- upper crop
|
||||
--~next := middle.x - base / 2; while next > x loop line ((next, y ), (0, ((height + base) / 2) mod base)); next := next - base; end loop;
|
||||
--~next := middle.x + base / 2; while next < x + width loop line ((next, y ), (0, ((height + base) / 2) mod base)); next := next + base; end loop;
|
||||
-- horizontal full
|
||||
for txen in 0 .. repeat.y loop line ((x, y + offset.y + txen * base), (width, 0)); end loop;
|
||||
for txen in 0 .. repeat.x loop line ((x + offset.x + txen * base, y), (0, height)); end loop;
|
||||
--~next := middle.y - base / 2; while next > y loop line ((x, next ), (width, 0 )); next := next - base; end loop;
|
||||
--~next := middle.y + base / 2; while next < y + height loop line ((x, next ), (width, 0 )); next := next + base; end loop;
|
||||
-- middle side
|
||||
--~next := middle.x - base / 2; while next > x loop line ((next, (height - base) / 2 + y), (0, base )); next := next - base; end loop;
|
||||
--~next := middle.x + base / 2; while next < x + width loop line ((next, (height - base) / 2 + y), (0, base )); next := next + base; end loop;
|
||||
-- lower crop
|
||||
--~next := (width - base) / 2 + x; while next > x loop line ((next, blabla ), (0, ((height + base) / 2) mod base)); next := next - base; end loop;
|
||||
--~next := (width + base) / 2 + x; while next < x + width loop line ((next, blabla ), (0, ((height + base) / 2) mod base)); next := next + base; end loop;
|
||||
--~next := (width - base) / 2 + x; while next > x loop line ((x, next), (width, 0)); next := next - base; end loop;
|
||||
--~next := (width + base) / 2 + x; while next < width loop line ((x, next), (width, 0)); next := next + base; end loop;
|
||||
for next in 0 .. repeat.y
|
||||
loop
|
||||
line ((x, y + offset.y + next * base), (width, 0));
|
||||
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)); end loop;
|
||||
for next in 0 .. repeat.x - 1 loop line ((x + offset.x + base / 2 + 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 - 1 loop line ((x + offset.x + base / 2 + next * base, y + base + offset.y + 2 * step * base), (0, base)); 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 + offset.y + 2 * step * base), (0, base)); 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 + base + offset.y + 2 * step * base), (0, base)); 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 + offset.y + 2 * step * base), (0, base)); end loop;
|
||||
end loop;
|
||||
end if;
|
||||
end draw_squared_grid;
|
||||
|
||||
------------------------------------------------------------------------------------------
|
||||
|
@ -42,6 +42,9 @@ begin
|
||||
|
||||
world.make (world.swamp, 80, 40);
|
||||
|
||||
preview_width := core.window_width - side_panel;
|
||||
preview_height := core.window_height;
|
||||
|
||||
gameplay: loop
|
||||
exit when core.engine_active = false;
|
||||
--
|
||||
@ -52,11 +55,10 @@ begin
|
||||
--~delay duration (0.333);
|
||||
--~end if;
|
||||
--
|
||||
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 := core.window_width - side_panel;
|
||||
preview_height := core.window_height;
|
||||
if core.signal_mode = core.signal_code'pos (core.signal_a) then preview_width := preview_width - 60; end if;
|
||||
if core.signal_mode = core.signal_code'pos (core.signal_d) then preview_width := preview_width + 60; end if;
|
||||
if core.signal_mode = core.signal_code'pos (core.signal_w) then preview_height := preview_height - 60; end if;
|
||||
if core.signal_mode = core.signal_code'pos (core.signal_s) then preview_height := preview_height + 60; end if;
|
||||
--
|
||||
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;
|
||||
@ -98,8 +100,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;
|
||||
|
Loading…
Reference in New Issue
Block a user