Prototype map saving, PNG based, probably will be removed...
This commit is contained in:
parent
cfb053bb9c
commit
32d41d7669
BIN
map/heyo.png
Normal file
BIN
map/heyo.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.9 KiB |
@ -262,11 +262,19 @@ package body core is
|
||||
|
||||
procedure create_image (width, height : in integer) is
|
||||
begin
|
||||
global_image := ray.image_colour (width * base, height * base, (0, 0, 0, 255));
|
||||
global_image := ray.image_colour (width, height, (0, 0, 0, 255));
|
||||
end create_image;
|
||||
|
||||
------------------------------------------------------------------------------------------
|
||||
|
||||
procedure draw_pixel (x, y : in integer; tint : in colour) 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.image_pixel (global_image, x, y, new_tint);
|
||||
end draw_pixel;
|
||||
|
||||
------------------------------------------------------------------------------------------
|
||||
|
||||
procedure render_image (data : in sprite; x, y, u, v, width, height : in integer) is
|
||||
temporary : ray.image;
|
||||
begin
|
||||
|
@ -144,6 +144,7 @@ package core is
|
||||
|
||||
procedure create_image (width, height : in integer);
|
||||
procedure render_image (data : in sprite; x, y, u, v, width, height : in integer);
|
||||
procedure draw_pixel (x, y : in integer; tint : in colour);
|
||||
procedure export_image (file_path : in string);
|
||||
|
||||
procedure draw (data : in sprite := (others => 0);
|
||||
|
@ -348,6 +348,8 @@ begin
|
||||
ui.synchronize;
|
||||
end loop gameplay_loop;
|
||||
|
||||
world.save ("heyo");
|
||||
|
||||
--~world.mapshot (folder & "/mapshot.png");
|
||||
|
||||
------------------------------------------------------------------------------------------
|
||||
|
@ -171,6 +171,25 @@ package body world is
|
||||
|
||||
------------------------------------------------------------------------------------------
|
||||
|
||||
procedure save (file_name : in string) is
|
||||
begin
|
||||
core.create_image (map.width, map.height);
|
||||
--
|
||||
for vertical in 0 .. map.height - 1 loop
|
||||
for horizontal in 0 .. map.width - 1 loop
|
||||
core.draw_pixel (horizontal, vertical, (140, 140, 140, 255));
|
||||
end loop;
|
||||
end loop;
|
||||
--
|
||||
core.export_image (core.folder & "/map/" & file_name & ".png");
|
||||
--
|
||||
core.echo (core.success, "Saved current map as '" & file_name & "'.");
|
||||
--
|
||||
core.dash;
|
||||
end save;
|
||||
|
||||
------------------------------------------------------------------------------------------
|
||||
|
||||
procedure draw is
|
||||
offset : core.vector := ((core.window_width - core.base) / 2,
|
||||
(core.window_height - core.base) / 2);
|
||||
@ -350,7 +369,7 @@ package body world is
|
||||
return;
|
||||
end if;
|
||||
--
|
||||
core.create_image (map.width, map.height);
|
||||
core.create_image (map.width * core.base, map.height * core.base);
|
||||
--
|
||||
for vertical in 0 .. map.height - 1 loop
|
||||
for horizontal in 0 .. map.width - 1 loop
|
||||
|
@ -120,6 +120,8 @@ package world is
|
||||
|
||||
procedure make (index : in biome; width, height, chad_limit : in natural);
|
||||
|
||||
procedure save (file_name : in string);
|
||||
|
||||
procedure draw;
|
||||
|
||||
procedure mapshot (file_path : in string);
|
||||
|
Loading…
Reference in New Issue
Block a user