diff --git a/source/core.adb b/source/core.adb index ff5bad8..0794070 100644 --- a/source/core.adb +++ b/source/core.adb @@ -527,6 +527,7 @@ package body core is cursor.x := ray.get_mouse_x; cursor.y := ray.get_mouse_y; wheel := wheel + ray.mouse_wheel_move; + end_turn := false; -- ray.end_drawing; -- diff --git a/source/core.ads b/source/core.ads index 5c8c16a..5ea1c34 100644 --- a/source/core.ads +++ b/source/core.ads @@ -113,6 +113,8 @@ package core is global_image : ray.image; + end_turn : boolean := false; + ------------------------------------------------------------------------------------------ function "=" (a, b : in signal_code) return boolean; diff --git a/source/main.adb b/source/main.adb index f2de561..8d9697e 100644 --- a/source/main.adb +++ b/source/main.adb @@ -295,6 +295,9 @@ begin ui.draw_tiny_menu (preview_width, 0, side_panel, preview_height); chad.draw_data (world.map.chads (1), preview_width + 32, 32); -- + ui.draw_end_turn_button (x => core.window_width - side_panel + side_panel / 2 - core.icon, + y => core.window_height - core.icon - text_box_height - 106 - 2 * core.icon); + -- ui.draw_console_box (x => core.window_width - core.icon - (side_panel - 2 * core.icon), y => core.window_height - core.icon - text_box_height - 106, width => side_panel - 2 * core.icon, diff --git a/source/ui.adb b/source/ui.adb index 6cf73d6..1fa7bee 100644 --- a/source/ui.adb +++ b/source/ui.adb @@ -46,7 +46,9 @@ package body ui is -- title_bar_left, title_bar_middle, title_bar_right, -- - check_box_on, check_box_off + check_box_on, check_box_off, + -- + end_turn_button ); ------------------------------------------------------------------------------------------ @@ -585,6 +587,20 @@ package body ui is ------------------------------------------------------------------------------------------ + procedure draw_end_turn_button (x, y : in integer) is + begin + draw (end_turn_button, x, y); + -- + if core.cursor_inside (x, y, sprite (active, end_turn_button).width, sprite (active, end_turn_button).height) and core.cursor_mode = core.cursor_left then + core.end_turn := true; + core.cursor_mode := core.cursor_none; + -- + echo ("-- Turn --"); + end if; + end draw_end_turn_button; + + ------------------------------------------------------------------------------------------ + procedure draw_state_box (x, y : in integer) is begin ui.write ("Cursor X:" & core.cursor.x'image, x, y + 0); diff --git a/source/ui.ads b/source/ui.ads index 26ceb9c..6178004 100644 --- a/source/ui.ads +++ b/source/ui.ads @@ -84,6 +84,8 @@ package ui is procedure draw_tiny_menu (x, y, width, height : in integer); procedure draw_icon_menu (x, y, width, height : in integer); + procedure draw_end_turn_button (x, y : in integer); + procedure draw_state_box (x, y : in integer); procedure draw_console_box (x, y, width, height : in integer); diff --git a/source/world.adb b/source/world.adb index 241ef11..7f7bebe 100644 --- a/source/world.adb +++ b/source/world.adb @@ -75,16 +75,16 @@ package body world is -- core.increment (drawn_tiles); -- - if core.cursor.x > offset.x + (horizontal - core.camera.x ) * core.base * core.zoom - 6 - and core.cursor.x < offset.x + (horizontal - core.camera.x + 1) * core.base * core.zoom + 6 - and core.cursor.y > offset.y + (vertical - core.camera.y ) * core.base * core.zoom - 6 - and core.cursor.y < offset.y + (vertical - core.camera.y + 1) * core.base * core.zoom + 6 - and core.cursor_mode = core.cursor_left - and not ui.prioritize then - map.chads (1).x := horizontal; - map.chads (1).y := vertical; - core.cursor_mode := core.cursor_none; - end if; + --~if core.cursor.x > offset.x + (horizontal - core.camera.x ) * core.base * core.zoom - 6 + --~and core.cursor.x < offset.x + (horizontal - core.camera.x + 1) * core.base * core.zoom + 6 + --~and core.cursor.y > offset.y + (vertical - core.camera.y ) * core.base * core.zoom - 6 + --~and core.cursor.y < offset.y + (vertical - core.camera.y + 1) * core.base * core.zoom + 6 + --~and core.cursor_mode = core.cursor_left + --~and not ui.prioritize then + --~map.chads (1).x := horizontal; + --~map.chads (1).y := vertical; + --~core.cursor_mode := core.cursor_none; + --~end if; end if; end loop; end loop; @@ -790,6 +790,7 @@ package body world is procedure player_up is begin + if map.chads (1).movement.value = 0 then return; end if; core.decrement (map.chads (1).y); core.clip (map.chads (1).y, 0, map.height - 1); map.chads (1).movement := map.chads (1).movement - 1; @@ -805,6 +806,7 @@ package body world is procedure player_down is begin + if map.chads (1).movement.value = 0 then return; end if; core.increment (map.chads (1).y); core.clip (map.chads (1).y, 0, map.height - 1); map.chads (1).movement := map.chads (1).movement - 1; @@ -820,6 +822,7 @@ package body world is procedure player_left is begin + if map.chads (1).movement.value = 0 then return; end if; core.decrement (map.chads (1).x); core.clip (map.chads (1).x, 0, map.width - 1); map.chads (1).movement := map.chads (1).movement - 1; @@ -835,6 +838,7 @@ package body world is procedure player_right is begin + if map.chads (1).movement.value = 0 then return; end if; core.increment (map.chads (1).x); core.clip (map.chads (1).x, 0, map.width - 1); map.chads (1).movement := map.chads (1).movement - 1; diff --git a/ui/dwarf/end_turn_button.png b/ui/dwarf/end_turn_button.png new file mode 100644 index 0000000..b89b15c Binary files /dev/null and b/ui/dwarf/end_turn_button.png differ diff --git a/ui/fairy/end_turn_button.png b/ui/fairy/end_turn_button.png new file mode 100644 index 0000000..4e25d42 Binary files /dev/null and b/ui/fairy/end_turn_button.png differ diff --git a/ui/gnoll/end_turn_button.png b/ui/gnoll/end_turn_button.png new file mode 100644 index 0000000..34efbcc Binary files /dev/null and b/ui/gnoll/end_turn_button.png differ diff --git a/ui/goblin/end_turn_button.png b/ui/goblin/end_turn_button.png new file mode 100644 index 0000000..3cae1ee Binary files /dev/null and b/ui/goblin/end_turn_button.png differ diff --git a/ui/imp/end_turn_button.png b/ui/imp/end_turn_button.png new file mode 100644 index 0000000..57cdd80 Binary files /dev/null and b/ui/imp/end_turn_button.png differ diff --git a/ui/kobold/end_turn_button.png b/ui/kobold/end_turn_button.png new file mode 100644 index 0000000..d758401 Binary files /dev/null and b/ui/kobold/end_turn_button.png differ diff --git a/ui/main/end_turn_button.png b/ui/main/end_turn_button.png new file mode 100644 index 0000000..62e857b Binary files /dev/null and b/ui/main/end_turn_button.png differ