Adding water slowly but surely...

This commit is contained in:
Ognjen Milan Robovic 2024-05-19 06:43:46 -04:00
parent 907f117f41
commit 24203e0992
6 changed files with 14 additions and 24 deletions

View File

Before

Width:  |  Height:  |  Size: 7.3 KiB

After

Width:  |  Height:  |  Size: 7.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.0 KiB

View File

@ -293,7 +293,7 @@ package body core is
begin
ray.draw_texture (data => texture_array (data.index),
uv => (x => float (if u > 0 then u else (animation_time mod data.frames) * data.width),
y => float (animation'pos (state) * data.height),
y => float (if v > 0 then v else (animation'pos (state) mod data.states) * data.height),
width => new_width,
height => new_height),
view => (x => float (x),

View File

@ -217,7 +217,7 @@ begin
world.configure;
--~ai.configure;
world.make (world.grass, 240, 180);
world.make (world.swamp, 240, 180);
world.add_chad (player, (0, 0, 0));
@ -315,10 +315,6 @@ begin
end loop;
--
resource.draw_points (player.resources, (preview_width - 4 * icon * resource.count) / 2, (if view_list (map_preview_panel) then icon else 0));
ui.draw_fill_bar ((preview_width - 320) / 2, 4 * (if view_list (map_preview_panel) then icon else 0), 320, 0.0);
ui.draw_tiny_fill_bar ((preview_width - 160) / 2, 5 * (if view_list (map_preview_panel) then icon else 0), 160, 0.3, (255, 255, 0, 255));
ui.draw_fill_bar ((preview_width - 320) / 2 + 400, 4 * (if view_list (map_preview_panel) then icon else 0), 320, 0.6);
ui.draw_tiny_fill_bar ((preview_width - 160) / 2 + 400, 5 * (if view_list (map_preview_panel) then icon else 0), 160, 0.6, (255, 0, 255, 255));
--
signal_list (signal_mode).all;
--

View File

@ -15,7 +15,7 @@ package body world is
unit_limit : constant natural := 600;
chad_limit : constant natural := 8;
tiles : core.sprite;
earth : core.sprite;
dark : core.sprite;
border_upper : core.sprite;
border_lower : core.sprite;
@ -32,7 +32,7 @@ package body world is
begin
core.echo (core.comment, "Configuring world components...");
--
tiles := core.import_sprite (core.folder & "/game/world/terrain/terrain.png", 1, 1);
earth := core.import_sprite (core.folder & "/game/world/terrain/earth.png", 1, 1);
dark := core.import_sprite (core.folder & "/game/world/dark.png", 1, 1);
border_upper := core.import_sprite (core.folder & "/game/world/frame/border_upper.png", 1, 1);
border_lower := core.import_sprite (core.folder & "/game/world/frame/border_lower.png", 1, 1);
@ -66,7 +66,7 @@ package body world is
map.width := width;
map.height := height;
--
map.tiles := new tile_array (0 .. map.width - 1, 0 .. map.height - 1);
map.earth := new tile_array (0 .. map.width - 1, 0 .. map.height - 1);
map.clips := new clip_array (0 .. map.width - 1, 0 .. map.height - 1);
map.views := new view_array (0 .. map.width - 1, 0 .. map.height - 1);
map.landmarks := new entity_array (1 .. landmark_limit);
@ -78,7 +78,7 @@ package body world is
--
for x in 0 .. width - 1 loop
for y in 0 .. height - 1 loop
map.tiles (x, y) := (if core.random (0, 23) < 20 then 0 else core.random (0, 23));
map.earth (x, y) := (if core.random (0, 23) < 17 then 0 else core.random (0, 23));
map.clips (x, y) := false;
map.views (x, y) := false;
end loop;
@ -138,9 +138,6 @@ package body world is
------------------------------------------------------------------------------------------
procedure draw is
u : integer := 0;
v : integer := 0;
--
offset : core.vector := ((core.window_width - core.base) / 2,
(core.window_height - core.base) / 2);
begin
@ -180,14 +177,11 @@ package body world is
exit when offset.x + (horizontal - core.camera.x) * core.base * core.zoom > core.window_width;
--
if map.views (horizontal, vertical) then
u := core.base * biome'pos (map.kind) * 4;
v := core.base * map.tiles (horizontal, vertical);
--
core.draw (data => tiles,
core.draw (data => earth,
x => offset.x + (horizontal - core.camera.x) * core.base * core.zoom,
y => offset.y + (vertical - core.camera.y) * core.base * core.zoom,
u => u,
v => v,
u => core.base * biome'pos (map.kind) * 4,
v => core.base * map.earth (horizontal, vertical),
width => core.base,
height => core.base);
if core.cursor.x > offset.x + (horizontal - core.camera.x ) * core.base * core.zoom - 6
@ -281,11 +275,11 @@ package body world is
--
for vertical in 0 .. map.height - 1 loop
for horizontal in 0 .. map.width - 1 loop
core.render_image (data => tiles,
core.render_image (data => earth,
x => horizontal * core.base,
y => vertical * core.base,
u => core.base * biome'pos (map.kind) * 4,
v => core.base * map.tiles (horizontal, vertical),
v => core.base * map.earth (horizontal, vertical),
width => core.base,
height => core.base);
end loop;

View File

@ -42,7 +42,7 @@ package world is
kind : biome;
width : natural;
height : natural;
tiles : access tile_array;
earth : access tile_array;
clips : access clip_array;
views : access view_array;
landmarks : access entity_array;