Bläddra i källkod

Gameplay UI toggle icons...

master
Ognjen Milan Robovic 2 veckor sedan
förälder
incheckning
0ae392dbd3
5 ändrade filer med 49 tillägg och 15 borttagningar
  1. +40
    -6
      source/main.adb
  2. +9
    -9
      source/world.adb
  3. Binär
      sprite/ui/icon/map_preview_panel.png
  4. Binär
      sprite/ui/icon/status_preview_panel.png
  5. Binär
      sprite/ui/icon/text_box_panel.png

+ 40
- 6
source/main.adb Visa fil

@@ -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;

------------------------------------------------------------------------------------------


+ 9
- 9
source/world.adb Visa fil

@@ -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;
--


Binär
sprite/ui/icon/map_preview_panel.png Visa fil

Before After
Width: 32  |  Height: 32  |  Size: 208B

Binär
sprite/ui/icon/status_preview_panel.png Visa fil

Before After
Width: 32  |  Height: 32  |  Size: 213B

Binär
sprite/ui/icon/text_box_panel.png Visa fil

Before After
Width: 32  |  Height: 32  |  Size: 156B

Laddar…
Avbryt
Spara