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 0000000..645da69 Binary files /dev/null and b/icon/engine/fullscreen.png differ diff --git a/icon/engine/map_preview_panel.png b/icon/engine/map_preview_panel.png index 08dd569..8a623ed 100644 Binary files a/icon/engine/map_preview_panel.png and b/icon/engine/map_preview_panel.png differ diff --git a/icon/engine/status_preview_panel.png b/icon/engine/status_preview_panel.png index 530fc12..ff6d4a0 100644 Binary files a/icon/engine/status_preview_panel.png and b/icon/engine/status_preview_panel.png differ diff --git a/icon/engine/text_box_panel.png b/icon/engine/text_box_panel.png index 0576c96..4da3954 100644 Binary files a/icon/engine/text_box_panel.png and b/icon/engine/text_box_panel.png differ diff --git a/icon/engine/toggle_fullscreen_button.png b/icon/engine/toggle_fullscreen_button.png deleted file mode 100644 index 5d1c0b3..0000000 Binary files a/icon/engine/toggle_fullscreen_button.png and /dev/null differ 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; ------------------------------------------------------------------------------------------