Fixed camera movement and zooming tiny bug, added zoom in/out on keypad.

This commit is contained in:
Ognjen Milan Robovic 2024-04-27 14:38:16 -04:00
parent d14d5f719f
commit 2c21fb6b55
3 changed files with 22 additions and 18 deletions

View File

@ -297,7 +297,7 @@ package body core is
cursor.x := ray.get_mouse_x;
cursor.y := ray.get_mouse_y;
--
--~ray.draw_fps (0, 0);
ray.draw_fps (0, 0);
--
ray.end_drawing;
--

View File

@ -83,22 +83,26 @@ procedure main is
procedure ui_default_style is begin ui.active := ui.default; end ui_default_style;
procedure ui_steam_style is begin ui.active := ui.steam; end ui_steam_style;
procedure hide_top_menu is begin menu_remove; end hide_top_menu;
procedure zoom_in is begin core.zoom := 2; end zoom_in;
procedure zoom_out is begin core.zoom := 1; end zoom_out;
signal_list : constant array (core.signal_code) of access procedure := (
core.signal_up => move_camera_up'access,
core.signal_down => move_camera_down'access,
core.signal_left => move_camera_left'access,
core.signal_right => move_camera_right'access,
core.signal_a => show_attribute_menu'access,
core.signal_s => show_skill_menu'access,
core.signal_r => show_resource_menu'access,
core.signal_u => show_unit_menu'access,
core.signal_m => show_might_menu'access,
core.signal_n => show_magic_menu'access,
core.signal_d => ui_default_style'access,
core.signal_f => ui_steam_style'access,
core.signal_grave => hide_top_menu'access,
others => idle'access
core.signal_up => move_camera_up'access,
core.signal_down => move_camera_down'access,
core.signal_left => move_camera_left'access,
core.signal_right => move_camera_right'access,
core.signal_a => show_attribute_menu'access,
core.signal_s => show_skill_menu'access,
core.signal_r => show_resource_menu'access,
core.signal_u => show_unit_menu'access,
core.signal_m => show_might_menu'access,
core.signal_n => show_magic_menu'access,
core.signal_d => ui_default_style'access,
core.signal_f => ui_steam_style'access,
core.signal_grave => hide_top_menu'access,
core.signal_kp_add => zoom_in'access,
core.signal_kp_subtract => zoom_out'access,
others => idle'access
);
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

View File

@ -113,14 +113,14 @@ package body world is
u := core.base * biome'pos (map.kind) * 4;
v := core.base * map.tiles (core.camera.x + move_x, core.camera.y + move_y);
--
core.draw (tiles, (move_x - 1) * core.base * core.zoom, (move_y - 1) * core.base * core.zoom, u, v, core.base, core.base);
core.draw (tiles, move_x * core.base * core.zoom, move_y * core.base * core.zoom, u, v, core.base, core.base);
end loop;
end loop;
--
for index in 1 .. landmark_limit loop
core.draw (data => landmarks (map.landmarks (index).index),
x => map.landmarks (index).x - core.camera.x * core.base,
y => map.landmarks (index).y - core.camera.y * core.base);
x => (map.landmarks (index).x - core.camera.x * core.base) * core.zoom,
y => (map.landmarks (index).y - core.camera.y * core.base) * core.zoom);
end loop;
end draw;