From 4b274bf2e563fc9b250c359bc1b353b2d6598d9a Mon Sep 17 00:00:00 2001 From: xolatile Date: Sat, 25 May 2024 04:39:07 -0400 Subject: [PATCH] Added window size limits and cursor rendering... --- source/core.adb | 6 ++++++ source/main.adb | 4 ++-- source/ray.ads | 12 +++++++----- source/ui.adb | 2 ++ 4 files changed, 17 insertions(+), 7 deletions(-) diff --git a/source/core.adb b/source/core.adb index cd93162..71adf00 100644 --- a/source/core.adb +++ b/source/core.adb @@ -445,7 +445,12 @@ package body core is 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; + -- + ray.set_window_minimal_size (640, 480); + ray.set_window_maximal_size (3840, 2160); -- --~echo (comment, "-- Initializing Raylib audio device data..."); --~ray.open_audio_device; @@ -483,6 +488,7 @@ package body core is -- echo (comment, "-- Deinitializing Raylib window data..."); ray.close_window; + ray.show_cursor; -- echo (success, "Deinitialized core components."); end deinitialize; diff --git a/source/main.adb b/source/main.adb index 124de85..13d4aae 100644 --- a/source/main.adb +++ b/source/main.adb @@ -264,10 +264,10 @@ begin core.cursor_mode := core.cursor_none; - ui.active := ui.style'val (faction.enumeration'pos (chad.trait (player.index).kind) + 1); - world.load ("heyo"); + ui.active := ui.style'val (faction.enumeration'pos (chad.trait (player.index).kind) + 1); + gameplay_loop: loop core.synchronize; -- diff --git a/source/ray.ads b/source/ray.ads index 00448c4..65ebb48 100644 --- a/source/ray.ads +++ b/source/ray.ads @@ -172,11 +172,13 @@ package ray is procedure window_icon (icon : in image) with import => true, convention => c, external_name => "SetWindowIcon"; - --~void SetWindowMinSize(int width, int height); - --~void SetWindowMaxSize(int width, int height); - --~void SetWindowSize(int width, int height); - --~void ShowCursor(void); - --~void HideCursor(void); + procedure show_cursor with import => true, convention => c, external_name => "ShowCursor"; + procedure hide_cursor with import => true, convention => c, external_name => "HideCursor"; + + procedure set_window_minimal_size (width, height : in integer) with import => true, convention => c, external_name => "SetWindowMinSize"; + procedure set_window_maximal_size (width, height : in integer) with import => true, convention => c, external_name => "SetWindowMaxSize"; + procedure set_window_size (width, height : in integer) with import => true, convention => c, external_name => "SetWindowSize"; + --~double GetTime(void); --~void OpenURL(const char *url); function load_text (file : in string) return char_array with import => true, convention => c, external_name => "LoadFileText"; diff --git a/source/ui.adb b/source/ui.adb index 39542fe..4c17240 100644 --- a/source/ui.adb +++ b/source/ui.adb @@ -256,6 +256,8 @@ package body ui is end if; end loop; -- + draw (cursor, core.cursor.x, core.cursor.y); + -- if read_text_box /= "--" then draw_popup_box; end if;