From 6bfc1b937204d612bea3550a0f0decd9d263a543 Mon Sep 17 00:00:00 2001 From: xolatile Date: Sat, 1 Jun 2024 18:59:37 -0400 Subject: [PATCH] Refactored view icons... --- compile.sh | 2 +- icon/engine/fullscreen.png | Bin 0 -> 298 bytes icon/engine/map_preview_panel.png | Bin 202 -> 280 bytes icon/engine/status_preview_panel.png | Bin 211 -> 294 bytes icon/engine/text_box_panel.png | Bin 180 -> 236 bytes icon/engine/toggle_fullscreen_button.png | Bin 219 -> 0 bytes source/main.adb | 59 +++++++++++++++++++------------ source/material.adb | 45 ++++++++++++++++++++++- source/material.ads | 39 ++++---------------- 9 files changed, 88 insertions(+), 57 deletions(-) create mode 100644 icon/engine/fullscreen.png delete mode 100644 icon/engine/toggle_fullscreen_button.png diff --git a/compile.sh b/compile.sh index a353192..27327e7 100644 --- a/compile.sh +++ b/compile.sh @@ -3,7 +3,7 @@ set -xe cd source -gnatmake -g -O3 -fstack-check -c main.adb +gnatmake -O3 -fstack-check -c main.adb gnatbind main.ali gnatlink -o xhads main.ali -lraylib mv xhads ../xhads diff --git a/icon/engine/fullscreen.png b/icon/engine/fullscreen.png new file mode 100644 index 0000000000000000000000000000000000000000..645da69c86788f812e50d2ae5331a7ce84c396cc GIT binary patch literal 298 zcmeAS@N?(olHy`uVBq!ia0vp^3P9|@!3HF&`%2dVDb50q$YKTtJ!KGPtXOJa1{A#G z>EalYaqn%!LBYccJj{KZ5|b86OcK4r-yd_!5!_$1IKCj3 z*I{pY=(nI#?)#q9vdpyHDN*i~#=5>m-LA;KNtb`qd^+I52?>TvNN3hUehF^`gzZ)Oc+^=hpPWhe3XntUlqUA5f+jS4#e3HBw`m1sA t$t6$ve>YCPocoLM?R3Fkj0_Qc`jczyitnu2_77+#gQu&X%Q~loCIJ4`c?kdj literal 0 HcmV?d00001 diff --git a/icon/engine/map_preview_panel.png b/icon/engine/map_preview_panel.png index 08dd569284cc2dfd49a289bbec82547e6cea65bc..8a623ed6966b13d3f77bbde07c9bed52b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_?42?KgrQL6zqB=7_YfS)y;bs6WAzamGQ$0M<7r*-e>mDMgoaZ($8%o0Ptc`PH*2 zjM{0da$oMb`*P>D8}AI8YIq{`cOGTbnAE4pw5Q(fvZ&zSU@49Z8yR2f%PwN>6x|DS O7=x#)pUXO@geCw+3Qw;9 diff --git a/source/main.adb b/source/main.adb index 8d9697e..480c326 100644 --- a/source/main.adb +++ b/source/main.adb @@ -18,7 +18,10 @@ procedure main is ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ type view is ( - map_preview_panel, status_preview_panel, text_box_panel + map_preview_panel, + status_preview_panel, + text_box_panel, + fullscreen ); ------------------------------------------------------------------------------------------ @@ -26,6 +29,7 @@ procedure main is procedure swap_map_preview_panel; procedure swap_status_preview_panel; procedure swap_text_box_panel; + procedure swap_fullscreen; procedure ui_main_style; procedure zoom_in; procedure zoom_out; @@ -48,23 +52,24 @@ procedure main is core.signal_f6 => world.resource_cheat_6'access, core.signal_f7 => world.reveal_map'access, core.signal_f8 => world.restore_points'access, - core.signal_f => core.toggle_fullscreen'access, others => core.idle_skip'access ); view_show : array (view) of access procedure := ( swap_map_preview_panel'access, swap_status_preview_panel'access, - swap_text_box_panel'access + swap_text_box_panel'access, + swap_fullscreen'access ); view_icon : array (view) of core.sprite := (others => (others => 0)); - view_list : array (view) of boolean := (others => true); + view_list : array (view) of boolean := (fullscreen => false, others => true); view_text : array (view) of core.long_string := ( "Toggle map preview panel. ", "Toggle status preview panel. ", - "Toggle text box panel. " + "Toggle text box panel. ", + "Toggle fullscreen or windowed mode. " ); game_title : core.sprite; @@ -146,6 +151,7 @@ procedure main is procedure swap_map_preview_panel is begin view_list (map_preview_panel) := not view_list (map_preview_panel); end swap_map_preview_panel; procedure swap_status_preview_panel is begin view_list (status_preview_panel) := not view_list (status_preview_panel); end swap_status_preview_panel; procedure swap_text_box_panel is begin view_list (text_box_panel) := not view_list (text_box_panel); end swap_text_box_panel; + procedure swap_fullscreen is begin view_list (fullscreen) := not view_list (fullscreen); end swap_fullscreen; ------------------------------------------------------------------------------------------ @@ -161,17 +167,17 @@ procedure main is ------------------------------------------------------------------------------------------ - procedure main_menu is - begin - core.draw (game_preview (world.ash), core.center_x (game_preview (world.ash).width * 2), core.center_y (game_preview (world.ash).height * 2), factor => 2); - core.draw (game_title, core.center_x (game_title.width * 2), core.center_y (game_title.height * 2), factor => 2); - -- - ui.write ("Main Menu", 0, 0); - -- - ui.draw_check_box (0, 32, view_list (map_preview_panel), "map_preview_panel"); - ui.draw_check_box (0, 64, view_list (status_preview_panel), "status_preview_panel"); - ui.draw_check_box (0, 96, view_list (text_box_panel), "text_box_panel"); - end main_menu; + --~procedure main_menu is + --~begin + --~core.draw (game_preview (world.ash), core.center_x (game_preview (world.ash).width * 2), core.center_y (game_preview (world.ash).height * 2), factor => 2); + --~core.draw (game_title, core.center_x (game_title.width * 2), core.center_y (game_title.height * 2), factor => 2); + --~-- + --~ui.write ("Main Menu", 0, 0); + --~-- + --~ui.draw_check_box (0, 32, view_list (map_preview_panel), "map_preview_panel"); + --~ui.draw_check_box (0, 64, view_list (status_preview_panel), "status_preview_panel"); + --~ui.draw_check_box (0, 96, view_list (text_box_panel), "text_box_panel"); + --~end main_menu; ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ @@ -214,7 +220,7 @@ begin core.dash; for index in view loop - view_icon (index) := core.import_sprite (core.folder & "/icon/engine/" & core.lowercase (view'image (index)) & ".png", 1, 1); + view_icon (index) := core.import_sprite (core.folder & "/icon/engine/" & core.lowercase (view'image (index)) & ".png", 1, 2); end loop; game_title := core.import_sprite (core.folder & "/ui/game_title.png", 1, 1); @@ -308,14 +314,23 @@ begin if view_list (text_box_panel) then ui.draw_help_box (0, core.window_height - text_box_height, core.window_width - core.icon * (view'pos (view'last) + 1), text_box_height); -- - ui.write (core.framerate'image, core.window_width - 5 * core.icon + 3, core.window_height - 27); + ui.write (core.framerate'image, core.window_width - core.icon * (view'pos (view'last) + 1) - 64, core.window_height - 27); 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_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, + width => core.icon, + height => core.icon, + 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); end loop; -- resource.draw_points (world.map.chads (1).resources, (preview_width - 5 * core.icon * resource.count) / 2, core.base); diff --git a/source/material.adb b/source/material.adb index c19dc94..eec4722 100644 --- a/source/material.adb +++ b/source/material.adb @@ -9,12 +9,55 @@ package body material is ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ procedure configure is + procedure define (index : in enumeration; name : in string; cost : in natural) is + begin + description (index).name := core.unbound (name); + description (index).cost := cost; + end define; + -- + time : float := 0.0; begin - core.echo (core.comment, "Configuring material components..."); + time := core.time; + -- + core.echo (core.comment, "Configuring" & count'image & " material components..."); + -- + description := new description_array (enumeration'range); + icon := new icon_array (enumeration'range); + -- + define (sulphur, "Sulphur", 11); + define (mercury, "Mercury", 13); + define (mint, "Mint", 3); + define (cinnamon, "Cinnamon", 5); + define (apple, "Apple", 2); + define (peach, "Peach", 2); + define (pear, "Pear", 2); + define (banana, "Banana", 3); + define (orange, "Orange", 3); + define (plum, "Plum", 3); + define (cherry, "Cherry", 3); + define (lemon, "Lemon", 2); + define (potato, "Potato", 1); + define (wheat, "Wheat", 1); + define (carrot, "Carrot", 2); + define (cucumber, "Cucumber", 3); + define (onion, "Onion", 2); + define (garlic, "Garlic", 2); + define (eggplant, "Eggplant", 3); + define (tomato, "Tomato", 2); + define (meat, "Meat", 3); + define (fish_meat, "Fish Meat", 2); + define (skull, "Skull", 1); + define (animal_skull, "Animal Skull", 1); + define (bone, "Bone", 1); + define (rib_cage, "Rib Cage", 1); + define (animal_skin, "Animal Skin", 5); + define (animal_fur, "Animal Fur", 7); -- for index in enumeration loop icon (index) := core.import_sprite (core.folder & "/icon/material/" & core.lowercase (enumeration'image (index)) & ".png", 1, 1); end loop; + -- + core.echo (core.success, "Successfully configured resource information in" & natural'image (natural (1_000_000.0 * (core.time - time))) & " microseconds."); end configure; ------------------------------------------------------------------------------------------ diff --git a/source/material.ads b/source/material.ads index be02645..4902368 100644 --- a/source/material.ads +++ b/source/material.ads @@ -25,44 +25,17 @@ package material is type points is array (enumeration) of core.point; + type description_array is array (enumeration range <>) of definition; + type icon_array is array (enumeration range <>) of core.sprite; + ------------------------------------------------------------------------------------------ count : constant natural := enumeration'pos (enumeration'last) + 1; - description : constant array (enumeration) of definition := ( - sulphur => (core.unbound ("Sulphur"), 7), - mercury => (core.unbound ("Mercury"), 13), - mint => (core.unbound ("Mint"), 3), - cinnamon => (core.unbound ("Cinnamon"), 5), - apple => (core.unbound ("Apple"), 2), - peach => (core.unbound ("Peach"), 2), - pear => (core.unbound ("Pear"), 2), - banana => (core.unbound ("Banana"), 3), - orange => (core.unbound ("Orange"), 3), - plum => (core.unbound ("Plum"), 3), - cherry => (core.unbound ("Cherry"), 3), - lemon => (core.unbound ("Lemon"), 2), - potato => (core.unbound ("Potato"), 1), - wheat => (core.unbound ("Wheat"), 1), - carrot => (core.unbound ("Carrot"), 2), - cucumber => (core.unbound ("Cucumber"), 3), - onion => (core.unbound ("Onion"), 2), - garlic => (core.unbound ("Garlic"), 2), - eggplant => (core.unbound ("Eggplant"), 3), - tomato => (core.unbound ("Tomato"), 2), - meat => (core.unbound ("Meat"), 3), - fish_meat => (core.unbound ("Fish Meat"), 2), - skull => (core.unbound ("Skull"), 1), - animal_skull => (core.unbound ("Animal Skull"), 1), - bone => (core.unbound ("Bone"), 1), - rib_cage => (core.unbound ("Rib Cage"), 1), - animal_skin => (core.unbound ("Animal Skin"), 5), - animal_fur => (core.unbound ("Animal Fur"), 7) - ); + default : constant points := (others => (1, 12)); - default : points := (others => (1, 12)); - - icon : array (enumeration) of core.sprite; + description : access description_array; + icon : access icon_array; ------------------------------------------------------------------------------------------