Prototyping mapshot functionality...

This commit is contained in:
Ognjen Milan Robovic 2024-05-09 14:52:19 -04:00
parent 339da3e318
commit 62dc7a81d6
10 changed files with 25 additions and 0 deletions

View File

@ -195,6 +195,17 @@ package body core is
------------------------------------------------------------------------------------------
procedure mapshot (file_path : in string) is
data : ray.image;
test : integer;
begin
data := ray.image_colour (16, 16, (255, 255, 0, 255));
ray.image_clear_background (data, (255, 0, 0, 255));
test := ray.dump_image (data, c_string (file_path));
end mapshot;
------------------------------------------------------------------------------------------
procedure draw (data : in sprite := (others => 0);
x : in integer := 0;
y : in integer := 0;

View File

@ -125,6 +125,8 @@ package core is
function import_font (file_path : in string; scale, space : in integer) return font;
function import_song (file_path : in string) return song;
procedure mapshot (file_path : in string);
procedure draw (data : in sprite := (others => 0);
x : in integer := 0;
y : in integer := 0;

View File

@ -263,6 +263,8 @@ begin
gameplay;
end loop gameplay_loop;
mapshot ("./test.png");
------------------------------------------------------------------------------------------
deinitialize;

View File

@ -17,6 +17,8 @@ package ray is
for logical'size use 32;
for colour_range'size use 8;
type pixels is array (natural range <>) of colour_range;
type window_flag is (
flag_none,
flag_fullscreen_mode,
@ -71,6 +73,7 @@ package ray is
type colour is record r, g, b, a : colour_range; end record with convention => c_pass_by_copy;
type rectangle is record x ,y, width, height : float; end record with convention => c_pass_by_copy;
type texture is record id : natural; width, height, mipmaps, format : integer; end record with convention => c_pass_by_copy;
type image is record data : access pixels; width, height, mipmaps : integer; format : integer := 7; end record with convention => c_pass_by_copy;
type font is record base, count, pad : integer; data : texture; squares : pointer; glyphs : pointer; end record with convention => c_pass_by_copy;
type stream is record buffer, processor : pointer; rate, size, channels : natural; end record with convention => c_pass_by_copy;
type sound is record data : stream; frame : natural; end record with convention => c_pass_by_copy;
@ -120,6 +123,13 @@ package ray is
procedure unload_sound (data : in sound) with import => true, convention => c, external_name => "UnloadSound";
procedure unload_font (data : in font) with import => true, convention => c, external_name => "UnloadFont";
function image_colour (width, height : in integer; tint : in colour) return image with import => true, convention => c, external_name => "GenImageColor";
procedure image_clear_background (data : in out image; tint : in colour) with import => true, convention => c, external_name => "ImageClearBackground";
function dump_image (data : in image; file_path : in string) return integer with import => true, convention => c, external_name => "ExportImage";
procedure draw_line (x0, y0, x1, y1 : in integer; tint : in colour) with import => true, convention => c, external_name => "DrawLine";
procedure draw_rectangle (x, y, width, height : in integer; tint : in colour) with import => true, convention => c, external_name => "DrawRectangle";

Binary file not shown.

After

Width:  |  Height:  |  Size: 520 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 534 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 558 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 545 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 547 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB