Work in progress on source code preview...

This commit is contained in:
Ognjen Milan Robovic 2024-05-12 20:45:26 -04:00
parent b4e01ceba2
commit f8c75a8be5
5 changed files with 23 additions and 4 deletions

View File

@ -197,6 +197,16 @@ package body core is
------------------------------------------------------------------------------------------
function import_text (file_path : in string) return string_box_data is
this : string_box_data;
begin
this.text := to_unbounded_string (to_ada (ray.load_text (c_string (file_path))));
--
return this;
end import_text;
------------------------------------------------------------------------------------------
procedure create_image (width, height : in integer) is
begin
global_mapshot := ray.image_colour (width * base, height * base, (0, 0, 0, 255));

View File

@ -2,8 +2,8 @@
--
-- GNU General Public Licence (version 3 or later)
with ada.text_io, ada.strings.unbounded, ray;
use ada.text_io, ada.strings.unbounded, ray;
with ada.text_io, ada.strings.unbounded, interfaces.c, ray;
use ada.text_io, ada.strings.unbounded, interfaces.c, ray;
package core is
@ -128,6 +128,7 @@ package core is
function import_sprite (file_path : in string; frames, states : in integer) return sprite;
function import_font (file_path : in string; scale, space : in integer) return font;
function import_song (file_path : in string) return song;
function import_text (file_path : in string) return string_box_data;
procedure create_image (width, height : in integer);
procedure render_image (data : in sprite; x, y, u, v, width, height : in integer);

View File

@ -9,6 +9,9 @@ with core, ui, effect, attribute, skill, resource, faction, material, equipment,
use core;
with ada.strings.unbounded;
use ada.strings.unbounded;
procedure main is
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
@ -127,6 +130,8 @@ procedure main is
ui.draw_check_box (0, 96, view_list (text_box_panel), "text_box_panel");
end main_menu;
xxx : string_box_data;
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
begin
@ -197,11 +202,15 @@ begin
cursor_mode := 0;
xxx := import_text ("./source/material.ads");
main_menu_loop: loop
synchronize;
--
exit when signal_mode = signal_space or cursor_mode = 2;
--
ui.write (to_string (xxx.text), 0, 0, code => true);
--
main_menu;
end loop main_menu_loop;

View File

@ -24,7 +24,6 @@ package material is
count : constant natural := enumeration'pos (enumeration'last) + 1;
trait : constant array (enumeration) of information := (
("-- ", 0),
("Sulphur ", 7),
("Mercury ", 13),
("Mint ", 3),

View File

@ -176,7 +176,7 @@ package ray is
--~void HideCursor(void);
--~double GetTime(void);
--~void OpenURL(const char *url);
--~function load_text (file : in string) return access string with import => true, convention => c, external_name => "LoadFileText";
function load_text (file : in string) return char_array with import => true, convention => c, external_name => "LoadFileText";
--~procedure unload_file (data : in access string) with import => true, convention => c, external_name => "UnloadFileText";
--~bool SaveFileText(const char *fileName, char *text);
--~FilePathList LoadDirectoryFilesEx(const char *basePath, const char *filter, bool scanSubdirs);