Character changes...

This commit is contained in:
Ognjen Milan Robovic 2024-06-09 18:39:01 -04:00
parent d48390bf22
commit d67826a8f4
4 changed files with 15 additions and 11 deletions

View File

@ -171,7 +171,7 @@ package body core is
function c_string (ada_string : string) return string is
begin
return (ada_string & character'val (0));
return (ada_string & terminator);
end c_string;
------------------------------------------------------------------------------------------
@ -183,7 +183,7 @@ package body core is
for index in data'range loop
width := width + 1;
--
if data (index) = character'val (10) then
if data (index) = line_feed then
maximum_width := (if width > maximum_width then width - 1 else maximum_width);
width := 0;
end if;
@ -200,7 +200,7 @@ package body core is
height : natural := 0;
begin
for index in data'range loop
if data (index) = character'val (10) then
if data (index) = line_feed then
height := height + 1;
end if;
end loop;
@ -309,7 +309,7 @@ package body core is
procedure import_text (data : in out string_box_data; file_path : in string) is
begin
data.text := to_unbounded_string (to_ada (ray.load_text (c_string (file_path)).all)) & character'val (0);
data.text := to_unbounded_string (to_ada (ray.load_text (c_string (file_path)).all)) & terminator;
end import_text;
------------------------------------------------------------------------------------------

View File

@ -74,6 +74,10 @@ package core is
------------------------------------------------------------------------------------------
terminator : constant character := character'val (0);
tabulator : constant character := character'val (9);
line_feed : constant character := character'val (10);
folder : constant string := ".";
icon : constant natural := 32;

View File

@ -580,11 +580,11 @@ package body ui is
--~buffer := (core.bound (text.text)) (length .. length);
--~offset.x := offset.x + width;
--~--
--~exit when buffer = character'val (0);
--~exit when buffer = core.terminator;
--~--
--~case buffer is
--~when character'val (9) => offset.x := offset.x + 2 * width;
--~when character'val (10) => offset.y := offset.y + 1 * height; offset.x := x;
--~when core.tabulator => offset.x := offset.x + 2 * width;
--~when core.line_feed => offset.y := offset.y + 1 * height; offset.x := x;
--~when ':' | ';' | '.' | ',' | '=' | '<' | '>' =>
--~ui.write (buffer & "", offset.x, offset.y, (63, 127, 255, 255), height, code => true);
--~when '+' | '*' | '/' | '|' | '&' =>
@ -611,7 +611,7 @@ package body ui is
--~buffer := ada.strings.unbounded.element (text.text, length);
--~ui.write (buffer & "", offset.x, offset.y, (127, 127, 127, 255), height, code => true);
--~offset.x := offset.x + width;
--~exit when buffer = character'val (10);
--~exit when buffer = core.line_feed;
--~end loop;
--~core.decrement (length);
--~else
@ -632,7 +632,7 @@ package body ui is
--~loop
--~buffer := ada.strings.unbounded.element (text.text, length + subset);
--~exit when buffer = ' ' or buffer = '.' or buffer = '(' or buffer = ')' or buffer = ',' or buffer = ';' or buffer = '''
--~or buffer = character'val (9) or buffer = character'val (10);
--~or buffer = core.tabulator or buffer = core.line_feed;
--~word := word & ada.strings.unbounded.to_unbounded_string (buffer & "");
--~core.increment (subset);
--~end loop;

View File

@ -1074,8 +1074,8 @@ package body world is
--
ui.draw_separator (core.center_x (width) + offset, core.center_y (height) + offset + unit.view_height, width - 2 * offset);
--
ui.draw_text (text => "Hiring fee:" & data.hiring_fee'image & character'val (10) &
"Weekly fee:" & data.weekly_fee'image & character'val (10) &
ui.draw_text (text => "Hiring fee:" & data.hiring_fee'image & core.line_feed &
"Weekly fee:" & data.weekly_fee'image & core.line_feed &
"Battle fee:" & data.battle_fee'image,
x => core.center_x (width) + offset,
y => core.center_y (height) + offset + unit.view_height + core.base,