Reverting smaller changes due to serious FPS drop...
This commit is contained in:
parent
fd581b20e0
commit
1ef03fec66
111
source/ui.adb
111
source/ui.adb
@ -62,20 +62,12 @@ package body ui is
|
|||||||
x : in integer := 0;
|
x : in integer := 0;
|
||||||
y : in integer := 0;
|
y : in integer := 0;
|
||||||
width : in integer := 0;
|
width : in integer := 0;
|
||||||
height : in integer := 0;
|
height : in integer := 0) is
|
||||||
action : core.pointer := core.idle'access) is
|
|
||||||
save_zoom : natural := core.zoom;
|
save_zoom : natural := core.zoom;
|
||||||
begin
|
begin
|
||||||
core.zoom := 1;
|
core.zoom := 1;
|
||||||
core.draw (sprite (active, index), x, y, 0, 0, width, height);
|
core.draw (sprite (active, index), x, y, 0, 0, width, height);
|
||||||
core.zoom := save_zoom;
|
core.zoom := save_zoom;
|
||||||
--
|
|
||||||
if core.cursor.x > x and core.cursor.x < x + width
|
|
||||||
and core.cursor.y > y and core.cursor.y < y + height
|
|
||||||
and core.cursor_mode = 1 then
|
|
||||||
action.all;
|
|
||||||
core.cursor_mode := 0;
|
|
||||||
end if;
|
|
||||||
end draw;
|
end draw;
|
||||||
|
|
||||||
------------------------------------------------------------------------------------------
|
------------------------------------------------------------------------------------------
|
||||||
@ -84,11 +76,18 @@ package body ui is
|
|||||||
step : constant integer := sprite (active, index).width;
|
step : constant integer := sprite (active, index).width;
|
||||||
begin
|
begin
|
||||||
for move in 0 .. width / step - 1 loop
|
for move in 0 .. width / step - 1 loop
|
||||||
draw (index, x + move * step,y, action => action);
|
draw (index, x + move * step,y);
|
||||||
end loop;
|
end loop;
|
||||||
--
|
--
|
||||||
if width mod step > 0 then
|
if width mod step > 0 then
|
||||||
draw (index, x + (width / step) * step, y, width mod step, sprite (active, index).height, action);
|
draw (index, x + (width / step) * step, y, width mod step, sprite (active, index).height);
|
||||||
|
end if;
|
||||||
|
--
|
||||||
|
if core.cursor.x > x and core.cursor.x < x + width
|
||||||
|
and core.cursor.y > y and core.cursor.y < y + sprite (active, index).height
|
||||||
|
and core.cursor_mode = 1 then
|
||||||
|
action.all;
|
||||||
|
core.cursor_mode := 0;
|
||||||
end if;
|
end if;
|
||||||
end draw_horizontally;
|
end draw_horizontally;
|
||||||
|
|
||||||
@ -98,11 +97,18 @@ package body ui is
|
|||||||
step : constant integer := sprite (active, index).height;
|
step : constant integer := sprite (active, index).height;
|
||||||
begin
|
begin
|
||||||
for move in 0 .. height / step - 1 loop
|
for move in 0 .. height / step - 1 loop
|
||||||
draw (index, x, y + move * step, action => action);
|
draw (index, x, y + move * step);
|
||||||
end loop;
|
end loop;
|
||||||
--
|
--
|
||||||
if height mod step > 0 then
|
if height mod step > 0 then
|
||||||
draw (index, x, y + (height / step) * step, sprite (active, index).width, height mod step, action);
|
draw (index, x, y + (height / step) * step, sprite (active, index).width, height mod step);
|
||||||
|
end if;
|
||||||
|
--
|
||||||
|
if core.cursor.x > x and core.cursor.x < x + sprite (active, index).width
|
||||||
|
and core.cursor.y > y and core.cursor.y < y + height
|
||||||
|
and core.cursor_mode = 1 then
|
||||||
|
action.all;
|
||||||
|
core.cursor_mode := 0;
|
||||||
end if;
|
end if;
|
||||||
end draw_vertically;
|
end draw_vertically;
|
||||||
|
|
||||||
@ -116,22 +122,22 @@ package body ui is
|
|||||||
begin
|
begin
|
||||||
for move_y in 0 .. height / base_height - 1 loop
|
for move_y in 0 .. height / base_height - 1 loop
|
||||||
for move_x in 0 .. width / base_width - 1 loop
|
for move_x in 0 .. width / base_width - 1 loop
|
||||||
draw (index, x + move_x * base_width, y + move_y * base_height, action => action);
|
draw (index, x + move_x * base_width, y + move_y * base_height);
|
||||||
end loop;
|
end loop;
|
||||||
--
|
--
|
||||||
if width mod base_width > 0 then
|
if width mod base_width > 0 then
|
||||||
draw (index, x + width - crop_width, y + move_y * base_height, crop_width, base_height, action => action);
|
draw (index, x + width - crop_width, y + move_y * base_height, crop_width, base_height);
|
||||||
end if;
|
end if;
|
||||||
end loop;
|
end loop;
|
||||||
--
|
--
|
||||||
for move_x in 0 .. width / base_width - 1 loop
|
for move_x in 0 .. width / base_width - 1 loop
|
||||||
if height mod base_height > 0 then
|
if height mod base_height > 0 then
|
||||||
draw (index, x + move_x * base_width, y + height - crop_height, base_width, crop_height, action => action);
|
draw (index, x + move_x * base_width, y + height - crop_height, base_width, crop_height);
|
||||||
end if;
|
end if;
|
||||||
end loop;
|
end loop;
|
||||||
--
|
--
|
||||||
if width mod base_width > 0 and height mod base_height > 0 then
|
if width mod base_width > 0 and height mod base_height > 0 then
|
||||||
draw (index, x + width - crop_width, y + height - crop_height, crop_width, crop_height, action => action);
|
draw (index, x + width - crop_width, y + height - crop_height, crop_width, crop_height);
|
||||||
end if;
|
end if;
|
||||||
end draw_background;
|
end draw_background;
|
||||||
|
|
||||||
@ -161,11 +167,19 @@ package body ui is
|
|||||||
begin
|
begin
|
||||||
select_text_box (description, x, y, core.icon, core.icon);
|
select_text_box (description, x, y, core.icon, core.icon);
|
||||||
--
|
--
|
||||||
draw (icon, x, y, action => action);
|
--~draw (icon, x, y);
|
||||||
|
draw (icon, x, y);
|
||||||
--
|
--
|
||||||
core.zoom := 1;
|
core.zoom := 1;
|
||||||
core.draw (data, x, y);
|
core.draw (data, x, y);
|
||||||
core.zoom := save_zoom;
|
core.zoom := save_zoom;
|
||||||
|
--
|
||||||
|
if core.cursor.x > x and core.cursor.x < x + core.icon
|
||||||
|
and core.cursor.y > y and core.cursor.y < y + core.icon
|
||||||
|
and core.cursor_mode = 1 then
|
||||||
|
action.all;
|
||||||
|
core.cursor_mode := 0;
|
||||||
|
end if;
|
||||||
end draw_icon;
|
end draw_icon;
|
||||||
|
|
||||||
------------------------------------------------------------------------------------------
|
------------------------------------------------------------------------------------------
|
||||||
@ -179,7 +193,7 @@ package body ui is
|
|||||||
core.draw (data, x, y);
|
core.draw (data, x, y);
|
||||||
core.zoom := save_zoom;
|
core.zoom := save_zoom;
|
||||||
--
|
--
|
||||||
draw (overicon, x, y, action => action);
|
draw (overicon, x, y);
|
||||||
end draw_overicon;
|
end draw_overicon;
|
||||||
|
|
||||||
------------------------------------------------------------------------------------------
|
------------------------------------------------------------------------------------------
|
||||||
@ -187,17 +201,17 @@ package body ui is
|
|||||||
procedure draw_text_box (x, y, width, height : in integer; action : core.pointer := core.idle'access) is
|
procedure draw_text_box (x, y, width, height : in integer; action : core.pointer := core.idle'access) is
|
||||||
offset : constant integer := sprite (active, text_middle).width;
|
offset : constant integer := sprite (active, text_middle).width;
|
||||||
begin
|
begin
|
||||||
draw_background (text_middle, x + offset, y + offset, width - 2 * offset, height - 2 * offset, action => action);
|
draw_background (text_middle, x + offset, y + offset, width - 2 * offset, height - 2 * offset);
|
||||||
--
|
--
|
||||||
draw_horizontally (text_upper, x + offset, y, width - 2 * offset, action => action);
|
draw_horizontally (text_upper, x + offset, y, width - 2 * offset);
|
||||||
draw_horizontally (text_lower, x + offset, y + height - offset, width - 2 * offset, action => action);
|
draw_horizontally (text_lower, x + offset, y + height - offset, width - 2 * offset);
|
||||||
draw_vertically (text_left, x, y + offset, height - 2 * offset, action => action);
|
draw_vertically (text_left, x, y + offset, height - 2 * offset);
|
||||||
draw_vertically (text_right, x + width - offset, y + offset, height - 2 * offset, action => action);
|
draw_vertically (text_right, x + width - offset, y + offset, height - 2 * offset);
|
||||||
--
|
--
|
||||||
draw (text_upper_left, x, y, action => action);
|
draw (text_upper_left, x, y);
|
||||||
draw (text_upper_right, x + width - offset, y, action => action);
|
draw (text_upper_right, x + width - offset, y);
|
||||||
draw (text_lower_left, x, y + height - offset, action => action);
|
draw (text_lower_left, x, y + height - offset);
|
||||||
draw (text_lower_right, x + width - offset, y + height - offset, action => action);
|
draw (text_lower_right, x + width - offset, y + height - offset);
|
||||||
--
|
--
|
||||||
core.write (core.read_text_box, x, y, font (active));
|
core.write (core.read_text_box, x, y, font (active));
|
||||||
--
|
--
|
||||||
@ -214,17 +228,17 @@ package body ui is
|
|||||||
return;
|
return;
|
||||||
end if;
|
end if;
|
||||||
--
|
--
|
||||||
draw_background (frame_middle, x + offset_x, y + offset_y, width - 2 * offset_x, height - 2 * offset_y, action => action);
|
draw_background (frame_middle, x + offset_x, y + offset_y, width - 2 * offset_x, height - 2 * offset_y);
|
||||||
--
|
--
|
||||||
draw_horizontally (frame_upper, x + offset_x, y, width - 2 * offset_x, action => action);
|
draw_horizontally (frame_upper, x + offset_x, y, width - 2 * offset_x);
|
||||||
draw_horizontally (frame_lower, x + offset_x, y + height - offset_y, width - 2 * offset_x, action => action);
|
draw_horizontally (frame_lower, x + offset_x, y + height - offset_y, width - 2 * offset_x);
|
||||||
draw_vertically (frame_left, x, y + offset_y, height - 2 * offset_y, action => action);
|
draw_vertically (frame_left, x, y + offset_y, height - 2 * offset_y);
|
||||||
draw_vertically (frame_right, x + width - offset_x, y + offset_y, height - 2 * offset_y, action => action);
|
draw_vertically (frame_right, x + width - offset_x, y + offset_y, height - 2 * offset_y);
|
||||||
--
|
--
|
||||||
draw (frame_upper_left, x, y, action => action);
|
draw (frame_upper_left, x, y);
|
||||||
draw (frame_upper_right, x + width - sprite (active, frame_upper_right).width, y, action => action);
|
draw (frame_upper_right, x + width - sprite (active, frame_upper_right).width, y);
|
||||||
draw (frame_lower_left, x, y + height - sprite (active, frame_lower_left).height, action => action);
|
draw (frame_lower_left, x, y + height - sprite (active, frame_lower_left).height);
|
||||||
draw (frame_lower_right, x + width - sprite (active, frame_lower_right).width, y + height - sprite (active, frame_lower_right).height, action => action);
|
draw (frame_lower_right, x + width - sprite (active, frame_lower_right).width, y + height - sprite (active, frame_lower_right).height);
|
||||||
--
|
--
|
||||||
select_text_box (description, x, y, width, height);
|
select_text_box (description, x, y, width, height);
|
||||||
end draw_frame;
|
end draw_frame;
|
||||||
@ -284,13 +298,6 @@ package body ui is
|
|||||||
procedure draw_tiny_menu (x, y, width, height : in integer) is
|
procedure draw_tiny_menu (x, y, width, height : in integer) is
|
||||||
offset : constant integer := sprite (active, none).width;
|
offset : constant integer := sprite (active, none).width;
|
||||||
begin
|
begin
|
||||||
--~if core.cursor.x > x and core.cursor.x < x + width
|
|
||||||
--~and core.cursor.y > y and core.cursor.y < y + height
|
|
||||||
--~and core.cursor_mode = 2 then
|
|
||||||
--~return;
|
|
||||||
--~core.cursor_mode := 0;
|
|
||||||
--~end if;
|
|
||||||
--
|
|
||||||
draw_background (main_background, x + offset, y + offset, width - 2 * offset, height - 2 * offset);
|
draw_background (main_background, x + offset, y + offset, width - 2 * offset, height - 2 * offset);
|
||||||
--
|
--
|
||||||
declare upper : constant integer := width - sprite (active, tiny_corner_upper_left).width - sprite (active, tiny_corner_upper_right).width;
|
declare upper : constant integer := width - sprite (active, tiny_corner_upper_left).width - sprite (active, tiny_corner_upper_right).width;
|
||||||
@ -323,15 +330,15 @@ package body ui is
|
|||||||
return;
|
return;
|
||||||
end if;
|
end if;
|
||||||
--
|
--
|
||||||
draw_horizontally (icon_upper, x + offset_x, y, width - 2 * offset_x, action => action);
|
draw_horizontally (icon_upper, x + offset_x, y, width - 2 * offset_x);
|
||||||
draw_horizontally (icon_lower, x + offset_x, y + height - offset_y, width - 2 * offset_x, action => action);
|
draw_horizontally (icon_lower, x + offset_x, y + height - offset_y, width - 2 * offset_x);
|
||||||
draw_vertically (icon_left, x, y + offset_y, height - 2 * offset_y, action => action);
|
draw_vertically (icon_left, x, y + offset_y, height - 2 * offset_y);
|
||||||
draw_vertically (icon_right, x + width - offset_x, y + offset_y, height - 2 * offset_y, action => action);
|
draw_vertically (icon_right, x + width - offset_x, y + offset_y, height - 2 * offset_y);
|
||||||
--
|
--
|
||||||
draw (icon_upper_left, x, y, action => action);
|
draw (icon_upper_left, x, y);
|
||||||
draw (icon_upper_right, x + width - sprite (active, icon_upper_right).width, y, action => action);
|
draw (icon_upper_right, x + width - sprite (active, icon_upper_right).width, y);
|
||||||
draw (icon_lower_left, x, y + height - sprite (active, icon_lower_left).height, action => action);
|
draw (icon_lower_left, x, y + height - sprite (active, icon_lower_left).height);
|
||||||
draw (icon_lower_right, x + width - sprite (active, icon_lower_right).width, y + height - sprite (active, icon_lower_right).height, action => action);
|
draw (icon_lower_right, x + width - sprite (active, icon_lower_right).width, y + height - sprite (active, icon_lower_right).height);
|
||||||
--
|
--
|
||||||
select_text_box (description, x, y, width, height);
|
select_text_box (description, x, y, width, height);
|
||||||
end draw_icon_menu;
|
end draw_icon_menu;
|
||||||
|
Loading…
Reference in New Issue
Block a user