A lot of refactoring and pixelbug fixing, still WIP...

This commit is contained in:
Ognjen Milan Robovic 2024-05-08 19:30:00 -04:00
parent 0e3a14ccab
commit 394ee1f98e
14 changed files with 28 additions and 24 deletions

View File

@ -184,21 +184,22 @@ package body core is
------------------------------------------------------------------------------------------ ------------------------------------------------------------------------------------------
procedure draw (data : in sprite; procedure draw (data : in sprite;
x : in integer := 0; x : in integer := 0;
y : in integer := 0; y : in integer := 0;
u : in integer := 0; u : in integer := 0;
v : in integer := 0; v : in integer := 0;
width : in integer := 0; width : in integer := 0;
height : in integer := 0; height : in integer := 0;
state : in integer := 0) is state : in integer := 0;
resize : vector := (0, 0); factor : in integer := zoom;
tint : in ray.colour := (others => 255)) is
new_width : constant float := float ((if width = 0 then data.width else width));
new_height : constant float := float ((if height = 0 then data.height else height));
begin begin
resize.x := (if width = 0 then data.width else width);
resize.y := (if height = 0 then data.height else height);
--
ray.draw_texture (data => texture_array (data.index), ray.draw_texture (data => texture_array (data.index),
uv => (float (if u = 0 then (animation_time mod data.frames) * data.width else u), float (v), float (resize.x), float (resize.y)), uv => (float (if u = 0 then (animation_time mod data.frames) * data.width else u), float (v), new_width, new_height),
view => (float (x), float (y), float (resize.x) * float (zoom), float (resize.y) * float (zoom))); view => (float (x), float (y), new_width * float (factor), new_height * float (factor)),
tint => tint);
end draw; end draw;
------------------------------------------------------------------------------------------ ------------------------------------------------------------------------------------------

View File

@ -2,8 +2,8 @@
-- --
-- GNU General Public Licence (version 3 or later) -- GNU General Public Licence (version 3 or later)
with ada.text_io, ada.strings.unbounded; with ada.text_io, ada.strings.unbounded, ray;
use ada.text_io, ada.strings.unbounded; use ada.text_io, ada.strings.unbounded, ray;
package core is package core is
@ -77,7 +77,8 @@ package core is
global_time : natural := 0; global_time : natural := 0;
gameplay_time : natural := 0; gameplay_time : natural := 0;
animation_time : natural := 0; animation_time : natural := 0;
zoom : natural := 1;
zoom : natural := 1;
block_limit : constant natural := 40; block_limit : constant natural := 40;
block_count : natural := 0; block_count : natural := 0;
@ -108,13 +109,15 @@ package core is
function import_song (file_path : in string) return song; function import_song (file_path : in string) return song;
procedure draw (data : in sprite; procedure draw (data : in sprite;
x : in integer := 0; x : in integer := 0;
y : in integer := 0; y : in integer := 0;
u : in integer := 0; u : in integer := 0;
v : in integer := 0; v : in integer := 0;
width : in integer := 0; width : in integer := 0;
height : in integer := 0; height : in integer := 0;
state : in integer := 0); state : in integer := 0;
factor : in integer := zoom;
tint : in ray.colour := (others => 255));
procedure write (text : in string := ""; procedure write (text : in string := "";
x : in integer := 0; x : in integer := 0;

View File

@ -347,7 +347,7 @@ package body ui is
-- --
draw_horizontally (title_bar_middle, x + sprite (active, title_bar_left).width, y - sprite (active, title_bar_middle).height, middle_width); draw_horizontally (title_bar_middle, x + sprite (active, title_bar_left).width, y - sprite (active, title_bar_middle).height, middle_width);
-- --
core.write (title, x + sprite (active, title_bar_left).width / 2 + 20, y - sprite (active, title_bar_middle).height / 2 - 6, font (active)); write (title, x + sprite (active, title_bar_left).width, y - sprite (active, title_bar_middle).height / 2 - 12); -- 12 = font.height / 2
end draw_title_bar; end draw_title_bar;
------------------------------------------------------------------------------------------ ------------------------------------------------------------------------------------------

Binary file not shown.

Before

Width:  |  Height:  |  Size: 569 B

After

Width:  |  Height:  |  Size: 511 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 154 B

After

Width:  |  Height:  |  Size: 155 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 425 B

After

Width:  |  Height:  |  Size: 403 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 180 B

After

Width:  |  Height:  |  Size: 180 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 154 B

After

Width:  |  Height:  |  Size: 151 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 950 B

After

Width:  |  Height:  |  Size: 972 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 211 B

After

Width:  |  Height:  |  Size: 215 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 616 B

After

Width:  |  Height:  |  Size: 687 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 713 B

After

Width:  |  Height:  |  Size: 718 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 143 B

After

Width:  |  Height:  |  Size: 143 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 223 B

After

Width:  |  Height:  |  Size: 225 B