Various experiments...

This commit is contained in:
Ognjen Milan Robovic 2024-06-01 20:42:12 -04:00
parent 6bfc1b9372
commit b8e398b712
6 changed files with 67 additions and 56 deletions

View File

@ -3,7 +3,7 @@
set -xe
cd source
gnatmake -O3 -fstack-check -c main.adb
gnatmake -gnato -O3 -fstack-check -fno-exceptions -c main.adb
gnatbind main.ali
gnatlink -o xhads main.ali -lraylib
mv xhads ../xhads

View File

@ -449,22 +449,22 @@ package body core is
procedure initialize is
begin
echo (comment, "Initializing core components...");
--~echo (comment, "Initializing core components...");
--
engine_active := true;
texture_array := new texture_data_array (0 .. 1600);
sound_array := new sound_data_array (0 .. 4);
font_array := new font_data_array (0 .. 16);
--
echo (comment, "-- Setting trace log level to none (ignoring all default Raylib logs).");
--~echo (comment, "-- Setting trace log level to none (ignoring all default Raylib logs).");
ray.set_trace_log_level (ray.log_none);
--
ray.set_window_flags (ray.flag_window_resizable);
--
echo (comment, "-- Initializing Raylib window data...");
echo (comment, "-- -- Window title : Xorana");
echo (comment, "-- -- Window width : 1800");
echo (comment, "-- -- Window height : 900");
--~echo (comment, "-- Initializing Raylib window data...");
--~echo (comment, "-- -- Window title : Xorana");
--~echo (comment, "-- -- Window width : 1800");
--~echo (comment, "-- -- Window height : 900");
--
ray.open_window (1800, 900, c_string ("Xorana"));
ray.hide_cursor;
@ -482,20 +482,20 @@ package body core is
--ray.randomization (19970725);
ray.set_target_fps (60);
--
echo (success, "Initialized core components.");
--~echo (success, "Initialized core components.");
end initialize;
------------------------------------------------------------------------------------------
procedure deinitialize is
begin
echo (comment, "Deinitializing core components...");
--~echo (comment, "Deinitializing core components...");
--
engine_active := false;
--
echo (comment, "-- -- Unloading Raylib" & texture_count'image & " textures.");
echo (comment, "-- -- Unloading Raylib" & sound_count'image & " sounds.");
echo (comment, "-- -- Unloading Raylib" & font_count'image & " fonts.");
--~echo (comment, "-- -- Unloading Raylib" & texture_count'image & " textures.");
--~echo (comment, "-- -- Unloading Raylib" & sound_count'image & " sounds.");
--~echo (comment, "-- -- Unloading Raylib" & font_count'image & " fonts.");
--
for index in 0 .. texture_count - 1 loop ray.unload_texture (texture_array (index)); end loop;
for index in 0 .. sound_count - 1 loop ray.unload_sound (sound_array (index)); end loop;
@ -506,11 +506,11 @@ package body core is
--
ray.unload_image (game_icon);
--
echo (comment, "-- Deinitializing Raylib window data...");
--~echo (comment, "-- Deinitializing Raylib window data...");
ray.close_window;
ray.show_cursor;
--
echo (success, "Deinitialized core components.");
--~echo (success, "Deinitialized core components.");
end deinitialize;
------------------------------------------------------------------------------------------

View File

@ -318,10 +318,6 @@ begin
end if;
--
for index in view loop
--~ui.draw_icon (view_icon (index), view_text (index),
--~core.window_width - core.icon * (view'pos (view'last) + 1) + core.icon * view'pos (index),
--~core.window_height - text_box_height,
--~view_show (index));
ui.draw_frame (description => view_text (index),
x => core.window_width - core.icon * (view'pos (view'last) + 1) + core.icon * view'pos (index),
y => core.window_height - core.icon,
@ -330,7 +326,9 @@ begin
action => view_show (index));
--
core.draw (view_icon (index), core.window_width - core.icon * (view'pos (view'last) + 1) + core.icon * view'pos (index), core.window_height - core.icon,
boolean'pos (view_list (index)) * core.icon);
ignore => true,
u => 0,
v => boolean'pos (view_list (index)) * core.icon);
end loop;
--
resource.draw_points (world.map.chads (1).resources, (preview_width - 5 * core.icon * resource.count) / 2, core.base);
@ -338,26 +336,11 @@ begin
--
signal_list (core.signal_mode).all;
--
--~ui.write ("draw_tiles_timer :" & world.draw_tiles_timer'image, 1440, 700 - 40, size => 15, code => true);
--~ui.write ("draw_views_timer :" & world.draw_views_timer'image, 1440, 720 - 40, size => 15, code => true);
--~ui.write ("draw_landmarks_timer :" & world.draw_landmarks_timer'image, 1440, 740 - 40, size => 15, code => true);
--~ui.write ("draw_locations_timer :" & world.draw_locations_timer'image, 1440, 760 - 40, size => 15, code => true);
--~ui.write ("draw_constructions_timer :" & world.draw_constructions_timer'image, 1440, 780 - 40, size => 15, code => true);
--~ui.write ("draw_equipments_timer :" & world.draw_equipments_timer'image, 1440, 800 - 40, size => 15, code => true);
--~ui.write ("draw_units_timer :" & world.draw_units_timer'image, 1440, 820 - 40, size => 15, code => true);
--~ui.write ("draw_world_timer :" & world.draw_world_timer'image, 1440, 840 - 40, size => 15, code => true);
--
--~ui.write (world.drawn_tiles'image, 1380, 700 - 40, size => 15, code => true, tint => (255, 0, 0, 255));
--~ui.write (world.drawn_views'image, 1380, 720 - 40, size => 15, code => true, tint => (255, 0, 0, 255));
--~ui.write (world.drawn_landmarks'image, 1380, 740 - 40, size => 15, code => true, tint => (255, 0, 0, 255));
--~ui.write (world.drawn_locations'image, 1380, 760 - 40, size => 15, code => true, tint => (255, 0, 0, 255));
--~ui.write (world.drawn_constructions'image, 1380, 780 - 40, size => 15, code => true, tint => (255, 0, 0, 255));
--~ui.write (world.drawn_equipments'image, 1380, 800 - 40, size => 15, code => true, tint => (255, 0, 0, 255));
--~ui.write (world.drawn_units'image, 1380, 820 - 40, size => 15, code => true, tint => (255, 0, 0, 255));
--
core.camera.x := world.map.chads (1).x;
core.camera.y := world.map.chads (1).y;
--
world.draw_performance_box;
--
ui.synchronize;
end loop gameplay_loop;

View File

@ -187,7 +187,7 @@ package ray is
--~void OpenURL(const char *url);
--~procedure unload_file (data : in access string) with import => true, convention => c, external_name => "UnloadFileText";
--~procedure unload_file (data : in access string) with import => true, convention => c, external_name => "UnloadFileText";
--~bool SaveFileText(const char *fileName, char *text);
--~FilePathList LoadDirectoryFilesEx(const char *basePath, const char *filter, bool scanSubdirs);
--~void UnloadDirectoryFiles(FilePathList files);
@ -195,9 +195,7 @@ package ray is
function compress (data : in pointer; size : in integer; used : out integer) return pointer with import => true, convention => c, external_name => "CompressData";
function decompress (data : in pointer; size : in integer; used : out integer) return pointer with import => true, convention => c, external_name => "DecompressData";
--~void SetTextLineSpacing(int spacing);
--~Vector2 MeasureTextEx(Font font, const char *text, float fontSize, float spacing);
--~bool CheckCollisionBoxes(BoundingBox box1, BoundingBox box2);
--~void SetMasterVolume(float volume);
--~Music LoadMusicStream(const char *fileName);
--~void UnloadMusicStream(Music music);

View File

@ -33,6 +33,23 @@ package body world is
corner_lower_left : core.sprite;
corner_lower_right : core.sprite;
draw_tiles_timer : natural := 0;
draw_views_timer : natural := 0;
draw_landmarks_timer : natural := 0;
draw_locations_timer : natural := 0;
draw_constructions_timer : natural := 0;
draw_equipments_timer : natural := 0;
draw_units_timer : natural := 0;
draw_world_timer : natural := 0;
drawn_tiles : natural := 0;
drawn_views : natural := 0;
drawn_landmarks : natural := 0;
drawn_locations : natural := 0;
drawn_constructions : natural := 0;
drawn_equipments : natural := 0;
drawn_units : natural := 0;
------------------------------------------------------------------------------------------
procedure generate_lake (x, y : in integer; size : in natural) is
@ -663,6 +680,34 @@ package body world is
------------------------------------------------------------------------------------------
procedure draw_performance_box is
width : constant integer := 640;
height : constant integer := 8 * 15 + 2 * core.icon;
x : constant integer := core.center_x (width);
y : constant integer := core.center_y (height);
begin
ui.draw_text_box (x, y, width, height);
--
ui.write ("draw_tiles_timer :" & draw_tiles_timer'image, x + 3 * core.icon, y + core.icon + 0 * 15, size => 15, code => true);
ui.write ("draw_views_timer :" & draw_views_timer'image, x + 3 * core.icon, y + core.icon + 1 * 15, size => 15, code => true);
ui.write ("draw_landmarks_timer :" & draw_landmarks_timer'image, x + 3 * core.icon, y + core.icon + 2 * 15, size => 15, code => true);
ui.write ("draw_locations_timer :" & draw_locations_timer'image, x + 3 * core.icon, y + core.icon + 3 * 15, size => 15, code => true);
ui.write ("draw_constructions_timer :" & draw_constructions_timer'image, x + 3 * core.icon, y + core.icon + 4 * 15, size => 15, code => true);
ui.write ("draw_equipments_timer :" & draw_equipments_timer'image, x + 3 * core.icon, y + core.icon + 5 * 15, size => 15, code => true);
ui.write ("draw_units_timer :" & draw_units_timer'image, x + 3 * core.icon, y + core.icon + 6 * 15, size => 15, code => true);
ui.write ("draw_world_timer :" & draw_world_timer'image, x + 3 * core.icon, y + core.icon + 7 * 15, size => 15, code => true);
--
ui.write (drawn_tiles'image, x + core.icon, y + core.icon + 0 * 15, size => 15, code => true, tint => (255, 0, 0, 255));
ui.write (drawn_views'image, x + core.icon, y + core.icon + 1 * 15, size => 15, code => true, tint => (255, 0, 0, 255));
ui.write (drawn_landmarks'image, x + core.icon, y + core.icon + 2 * 15, size => 15, code => true, tint => (255, 0, 0, 255));
ui.write (drawn_locations'image, x + core.icon, y + core.icon + 3 * 15, size => 15, code => true, tint => (255, 0, 0, 255));
ui.write (drawn_constructions'image, x + core.icon, y + core.icon + 4 * 15, size => 15, code => true, tint => (255, 0, 0, 255));
ui.write (drawn_equipments'image, x + core.icon, y + core.icon + 5 * 15, size => 15, code => true, tint => (255, 0, 0, 255));
ui.write (drawn_units'image, x + core.icon, y + core.icon + 6 * 15, size => 15, code => true, tint => (255, 0, 0, 255));
end draw_performance_box;
------------------------------------------------------------------------------------------
procedure mapshot (file_path : in string) is
begin
if not map_is_revealed then

View File

@ -209,23 +209,6 @@ package world is
map : definition;
draw_tiles_timer : natural := 0;
draw_views_timer : natural := 0;
draw_landmarks_timer : natural := 0;
draw_locations_timer : natural := 0;
draw_constructions_timer : natural := 0;
draw_equipments_timer : natural := 0;
draw_units_timer : natural := 0;
draw_world_timer : natural := 0;
drawn_tiles : natural := 0;
drawn_views : natural := 0;
drawn_landmarks : natural := 0;
drawn_locations : natural := 0;
drawn_constructions : natural := 0;
drawn_equipments : natural := 0;
drawn_units : natural := 0;
------------------------------------------------------------------------------------------
procedure configure;
@ -237,6 +220,8 @@ package world is
procedure draw;
procedure draw_performance_box;
procedure mapshot (file_path : in string);
function map_is_revealed return boolean;