Fixed small stupid bug...
This commit is contained in:
parent
788c821605
commit
19d3e1efa2
@ -184,6 +184,8 @@ package body core is
|
|||||||
end if;
|
end if;
|
||||||
end loop;
|
end loop;
|
||||||
--
|
--
|
||||||
|
maximum_width := (if width > maximum_width then width else maximum_width);
|
||||||
|
--
|
||||||
return maximum_width;
|
return maximum_width;
|
||||||
end string_width;
|
end string_width;
|
||||||
|
|
||||||
|
@ -260,7 +260,7 @@ procedure main is
|
|||||||
end loop;
|
end loop;
|
||||||
end loop;
|
end loop;
|
||||||
--
|
--
|
||||||
ui.draw_text ("Heyo world!" & character'val (10) & "Goodcyaa world!", 600, 600);
|
ui.draw_text ("Heyo world!" & character'val (10) & "Goodcyaa world!", 600, 600, 0, 0);
|
||||||
end player_information;
|
end player_information;
|
||||||
|
|
||||||
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -72,7 +72,10 @@ package body ui is
|
|||||||
|
|
||||||
sprite : array (style, element) of core.sprite;
|
sprite : array (style, element) of core.sprite;
|
||||||
|
|
||||||
monospace : core.font;
|
monospace : core.font;
|
||||||
|
--
|
||||||
|
monowidth : constant natural := 9;
|
||||||
|
monoheight : constant natural := 15;
|
||||||
|
|
||||||
console_message_limit : constant natural := 6;
|
console_message_limit : constant natural := 6;
|
||||||
console_message_count : natural := 0;
|
console_message_count : natural := 0;
|
||||||
@ -106,7 +109,7 @@ package body ui is
|
|||||||
end loop;
|
end loop;
|
||||||
end load_ui;
|
end load_ui;
|
||||||
begin
|
begin
|
||||||
monospace := core.import_font (core.folder & "/ui/monospace.png", 15, 0);
|
monospace := core.import_font (core.folder & "/ui/monospace.png", monoheight, 0);
|
||||||
--
|
--
|
||||||
core.echo (core.comment, "Configuring UI components...");
|
core.echo (core.comment, "Configuring UI components...");
|
||||||
--
|
--
|
||||||
@ -143,7 +146,7 @@ package body ui is
|
|||||||
|
|
||||||
procedure write (text : in string; x, y : in integer; tint : in core.colour := (others => 255); size : in natural := font (active).scale; code : in boolean := false) is
|
procedure write (text : in string; x, y : in integer; tint : in core.colour := (others => 255); size : in natural := font (active).scale; code : in boolean := false) is
|
||||||
begin
|
begin
|
||||||
core.write (text, x, y, tint, (if code then 15 else size), (if code then monospace else font (active)));
|
core.write (text, x, y, tint, (if code then monoheight else size), (if code then monospace else font (active)));
|
||||||
end write;
|
end write;
|
||||||
|
|
||||||
------------------------------------------------------------------------------------------
|
------------------------------------------------------------------------------------------
|
||||||
@ -324,12 +327,14 @@ package body ui is
|
|||||||
|
|
||||||
------------------------------------------------------------------------------------------
|
------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
procedure draw_text (text : in string; x, y : in integer; tint : in core.colour := (others => 255)) is
|
procedure draw_text (text : in string; x, y, width, height : in integer; tint : in core.colour := (others => 255)) is
|
||||||
offset : constant integer := 10;
|
offset : constant integer := 8;
|
||||||
|
--
|
||||||
|
new_width : constant natural := (if width < core.base then monowidth * core.string_width (text) else width);
|
||||||
|
new_height : constant natural := (if height < core.base then monoheight * core.string_height (text) else height);
|
||||||
begin
|
begin
|
||||||
draw_text_box (x, y, 9 * core.string_width (text) + 2 * offset, 15 * core.string_height (text) + 2 * offset);
|
draw_text_box (x, y, new_width + 2 * offset, new_height + 2 * offset);
|
||||||
write (text, x + offset, y + offset, tint, code => true);
|
write (text, x + offset, y + offset, tint, code => true);
|
||||||
write (natural'image (core.string_width (text)) & natural'image (core.string_height (text)), x-20, y-20, tint, code => true);
|
|
||||||
end draw_text;
|
end draw_text;
|
||||||
|
|
||||||
------------------------------------------------------------------------------------------
|
------------------------------------------------------------------------------------------
|
||||||
@ -520,19 +525,18 @@ package body ui is
|
|||||||
|
|
||||||
procedure draw_console_box (x, y, width, height : in integer) is
|
procedure draw_console_box (x, y, width, height : in integer) is
|
||||||
offset : constant integer := 8;
|
offset : constant integer := 8;
|
||||||
font_width : constant integer := 9;
|
font_width : constant integer := monowidth;
|
||||||
font_height : constant integer := 15;
|
font_height : constant integer := monoheight;
|
||||||
characters_per_width : constant integer := width / font_width;
|
characters_per_width : constant integer := width / font_width;
|
||||||
characters_per_height : constant integer := height / font_height;
|
characters_per_height : constant integer := height / font_height;
|
||||||
begin
|
begin
|
||||||
draw_text_box (x, y, width, height);
|
draw_text_box (x, y, width, height);
|
||||||
--
|
--
|
||||||
for index in 0 .. console_message_limit - 1 loop
|
for index in 0 .. console_message_limit - 1 loop
|
||||||
ui.write (text => core.bound (console_message_array ((index + console_message_count) mod console_message_limit)),
|
write (text => core.bound (console_message_array ((index + console_message_count) mod console_message_limit)),
|
||||||
x => x + offset,
|
x => x + offset,
|
||||||
y => y + offset + index * font_height,
|
y => y + offset + index * font_height,
|
||||||
size => 15,
|
code => true);
|
||||||
code => true);
|
|
||||||
end loop;
|
end loop;
|
||||||
end draw_console_box;
|
end draw_console_box;
|
||||||
|
|
||||||
|
@ -44,7 +44,7 @@ package ui is
|
|||||||
procedure draw_frame (description : in string; x, y, width, height : in integer; action : core.pointer := core.idle_skip'access);
|
procedure draw_frame (description : in string; x, y, width, height : in integer; action : core.pointer := core.idle_skip'access);
|
||||||
procedure draw_button (text, description : in string; icon : in core.sprite; x, y, width, height : in integer; action : core.pointer := core.idle_skip'access);
|
procedure draw_button (text, description : in string; icon : in core.sprite; x, y, width, height : in integer; action : core.pointer := core.idle_skip'access);
|
||||||
|
|
||||||
procedure draw_text (text : in string; x, y : in integer; tint : in core.colour := (others => 255));
|
procedure draw_text (text : in string; x, y, width, height : in integer; tint : in core.colour := (others => 255));
|
||||||
|
|
||||||
procedure draw_check_box (x, y : in integer; on : in out boolean; text : in string);
|
procedure draw_check_box (x, y : in integer; on : in out boolean; text : in string);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user