Browse Source

Adding water slowly but surely...

master
parent
commit
24203e0992
6 changed files with 14 additions and 24 deletions
  1. +0
    -0
      game/world/terrain/earth.png
  2. BIN
      game/world/terrain/water.png
  3. +2
    -2
      source/core.adb
  4. +2
    -6
      source/main.adb
  5. +9
    -15
      source/world.adb
  6. +1
    -1
      source/world.ads

game/world/terrain/terrain.png → game/world/terrain/earth.png View File


BIN
game/world/terrain/water.png View File

Before After
Width: 384  |  Height: 256  |  Size: 5.0KB

+ 2
- 2
source/core.adb View File

@@ -292,8 +292,8 @@ package body core is
new_tint : ray.colour := (ray.colour_range (tint.r), ray.colour_range (tint.g), ray.colour_range (tint.b), ray.colour_range (tint.a));
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),
uv => (x => float (if u > 0 then u else (animation_time mod data.frames) * data.width),
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),


+ 2
- 6
source/main.adb 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));

@@ -314,11 +314,7 @@ begin
view_show (index));
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));
resource.draw_points (player.resources, (preview_width - 4 * icon * resource.count) / 2, (if view_list (map_preview_panel) then icon else 0));
--
signal_list (signal_mode).all;
--


+ 9
- 15
source/world.adb 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;


+ 1
- 1
source/world.ads 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;


Loading…
Cancel
Save