diff --git a/source/main.adb b/source/main.adb index d17c857..d92a7a9 100644 --- a/source/main.adb +++ b/source/main.adb @@ -19,6 +19,32 @@ procedure main is ------------------------------------------------------------------------------------------ + type screen_view is ( + map_preview_panel, status_preview_panel, text_box_panel + ); + + screen_view_icon : array (screen_view) of core.sprite; + + screen_view_list : array (screen_view) of boolean := (others => true); + + screen_view_text : array (screen_view) of core.long_string := ( + "Toggle map preview panel. ", + "Toggle status preview panel. ", + "Toggle text box panel. " + ); + + procedure toggle_map_preview_panel is begin screen_view_list (map_preview_panel) := (if screen_view_list (map_preview_panel) then false else true); end toggle_map_preview_panel; + procedure toggle_status_preview_panel is begin screen_view_list (status_preview_panel) := (if screen_view_list (status_preview_panel) then false else true); end toggle_status_preview_panel; + procedure toggle_text_box_panel is begin screen_view_list (text_box_panel) := (if screen_view_list (text_box_panel) then false else true); end toggle_text_box_panel; + + screen_view_show : array (screen_view) of access procedure := ( + toggle_map_preview_panel'access, + toggle_status_preview_panel'access, + toggle_text_box_panel'access + ); + + ------------------------------------------------------------------------------------------ + -- TODO: This menu code is now useless due to new UI code. type menu_index is ( @@ -137,6 +163,10 @@ begin core.echo (core.success, "Successfully initialized game data, entering main gameplay loop."); core.dash; + for index in screen_view loop + screen_view_icon (index) := core.import_sprite ("./sprite/ui/icon/" & core.lowercase (screen_view'image (index)) & ".png", 1, 1); + end loop; + ------------------------------------------------------------------------------------------ gameplay: loop @@ -154,10 +184,16 @@ begin -- world.draw; -- - ui.draw_menu (0, 0, preview_width, preview_height); - ui.draw_tiny_menu (preview_width, 0, side_panel, preview_height); - -- - ui.draw_state_box (preview_width + 32, 32); + if screen_view_list (map_preview_panel) then ui.draw_menu (0, 0, preview_width, preview_height); end if; + if screen_view_list (status_preview_panel) then ui.draw_tiny_menu (preview_width, 0, side_panel, preview_height); end if; + if screen_view_list (status_preview_panel) then ui.draw_state_box (preview_width + 32, 32); end if; + if screen_view_list (text_box_panel) then ui.draw_help_box (0, core.window_height - text_box_height, core.window_width - core.icon * (screen_view'pos (screen_view'last) + 1), text_box_height); end if; + for index in screen_view loop + ui.draw_icon (screen_view_icon (index), screen_view_text (index), + core.window_width - core.icon * (screen_view'pos (screen_view'last) + 1) + core.icon * screen_view'pos (index), + core.window_height - text_box_height, + screen_view_show (index)); + end loop; -- signal_list (core.signal_code'val (core.signal_mode)).all; -- @@ -174,8 +210,6 @@ begin chad.draw_alice; -- ui.synchronize; - -- - ui.draw_help_box (0, core.window_height - text_box_height, core.window_width, text_box_height); end loop gameplay; ------------------------------------------------------------------------------------------ diff --git a/source/world.adb b/source/world.adb index 017570a..3c88de3 100644 --- a/source/world.adb +++ b/source/world.adb @@ -82,15 +82,15 @@ package body world is width => core.base, height => core.base); -- - if core.cursor.x > offset.x + (horizontal - core.camera.x ) * core.base * core.zoom - and core.cursor.x < offset.x + (horizontal - core.camera.x + 1) * core.base * core.zoom - and core.cursor.y > offset.y + (vertical - core.camera.y ) * core.base * core.zoom - and core.cursor.y < offset.y + (vertical - core.camera.y + 1) * core.base * core.zoom - and core.cursor_mode = 1 and not ui.prioritize then - core.camera.x := horizontal; - core.camera.y := vertical; - core.cursor_mode := 0; - end if; + --~if core.cursor.x > offset.x + (horizontal - core.camera.x ) * core.base * core.zoom + --~and core.cursor.x < offset.x + (horizontal - core.camera.x + 1) * core.base * core.zoom + --~and core.cursor.y > offset.y + (vertical - core.camera.y ) * core.base * core.zoom + --~and core.cursor.y < offset.y + (vertical - core.camera.y + 1) * core.base * core.zoom + --~and core.cursor_mode = 1 and not ui.prioritize then + --~core.camera.x := horizontal; + --~core.camera.y := vertical; + --~core.cursor_mode := 0; + --~end if; end loop; end loop; -- diff --git a/sprite/ui/icon/map_preview_panel.png b/sprite/ui/icon/map_preview_panel.png new file mode 100644 index 0000000..caa812f Binary files /dev/null and b/sprite/ui/icon/map_preview_panel.png differ diff --git a/sprite/ui/icon/status_preview_panel.png b/sprite/ui/icon/status_preview_panel.png new file mode 100644 index 0000000..8b05015 Binary files /dev/null and b/sprite/ui/icon/status_preview_panel.png differ diff --git a/sprite/ui/icon/text_box_panel.png b/sprite/ui/icon/text_box_panel.png new file mode 100644 index 0000000..c6f3c65 Binary files /dev/null and b/sprite/ui/icon/text_box_panel.png differ