diff --git a/font/alagard.png b/font/alagard.png deleted file mode 100644 index a309a40..0000000 Binary files a/font/alagard.png and /dev/null differ diff --git a/font/courier.ttf b/font/courier.ttf deleted file mode 100644 index 5a2cf3c..0000000 Binary files a/font/courier.ttf and /dev/null differ diff --git a/font/ferrum.ttf b/font/ferrum.ttf deleted file mode 100644 index 9b0a0e7..0000000 Binary files a/font/ferrum.ttf and /dev/null differ diff --git a/font/font.png b/font/font.png deleted file mode 100755 index 2db35f3..0000000 Binary files a/font/font.png and /dev/null differ diff --git a/font/gothic.ttf b/font/gothic.ttf deleted file mode 100644 index 4533a4e..0000000 Binary files a/font/gothic.ttf and /dev/null differ diff --git a/font/gothica.png b/font/gothica.png deleted file mode 100644 index dc00fa6..0000000 Binary files a/font/gothica.png and /dev/null differ diff --git a/font/mono.png b/font/mono.png deleted file mode 100644 index c3a4a4e..0000000 Binary files a/font/mono.png and /dev/null differ diff --git a/font/pixel.ttf b/font/pixel.ttf deleted file mode 100644 index 618e5bb..0000000 Binary files a/font/pixel.ttf and /dev/null differ diff --git a/font/tenderness.ttf b/font/tenderness.ttf deleted file mode 100644 index 2f83221..0000000 Binary files a/font/tenderness.ttf and /dev/null differ diff --git a/font/unitblock.ttf b/font/unitblock.ttf deleted file mode 100644 index 33716f7..0000000 Binary files a/font/unitblock.ttf and /dev/null differ diff --git a/source/attribute.adb b/source/attribute.adb index 90f98ad..746fbe7 100644 --- a/source/attribute.adb +++ b/source/attribute.adb @@ -39,7 +39,7 @@ package body attribute is loop ui.draw_icon (trait (index).text, move_x + offset, move_y + offset + codex'pos (index) * core.icon); draw (index, move_x + offset, move_y + offset + codex'pos (index) * core.icon); - core.write (trait (index).name, move_x + offset + core.icon, move_y + offset + codex'pos (index) * core.icon); + core.write (trait (index).name, move_x + offset + core.icon, move_y + offset + codex'pos (index) * core.icon, ui.font (ui.active)); end loop; end menu; diff --git a/source/core.adb b/source/core.adb index 2ee45a7..da9f78c 100644 --- a/source/core.adb +++ b/source/core.adb @@ -84,22 +84,6 @@ package body core is ------------------------------------------------------------------------------------------ - procedure draw_state_box (x, y : in integer) is - begin - write ("Cursor X :" & integer'image (cursor_x), x, y + 0); - write ("Cursor Y :" & integer'image (cursor_y), x, y + 32); - write ("Cursor Mode :" & integer'image (cursor_mode), x, y + 64); - write ("Signal Code : " & signal_code'image (signal_code'val (signal_mode)), x, y + 96); - write ("Camera X :" & integer'image (camera.x), x, y + 128); - write ("Camera Y :" & integer'image (camera.y), x, y + 160); - write ("Global Time :" & integer'image (global_time), x, y + 192); - write ("Gameplay Time :" & integer'image (gameplay_time), x, y + 224); - write ("Animation Time :" & integer'image (animation_time), x, y + 256); - write ("Framerate :" & integer'image (framerate), x, y + 288); - end draw_state_box; - - ------------------------------------------------------------------------------------------ - function flip_coin return integer is begin return (random_integer (0, 1)); @@ -219,7 +203,7 @@ package body core is ------------------------------------------------------------------------------------------ - procedure write (text : in string; x, y : in integer; colour : in integer := 16#FFFFFF#; data : in font := fonts (1)) is + procedure write (text : in string; x, y : in integer; data : in font; colour : in integer := 16#FFFFFF#) is begin render_string (c_string (text), x, y, colour, data.index, data.size, data.pad); end write; diff --git a/source/core.ads b/source/core.ads index 96bd610..33f82a5 100644 --- a/source/core.ads +++ b/source/core.ads @@ -86,8 +86,6 @@ package core is text_box : volatile; - fonts : array (0 .. 5) of font; - ------------------------------------------------------------------------------------------ -- C @@ -135,8 +133,6 @@ package core is procedure configure; procedure synchronize; - procedure draw_state_box (x, y : in integer); - function flip_coin return integer; function roll_dice return integer; function by_chance (chance : in integer) return integer; @@ -155,7 +151,7 @@ package core is procedure line (origin, offset : in vector_2); - procedure write (text : in string; x, y : in integer; colour : in integer := 16#FFFFFF#; data : in font := fonts (1)); + procedure write (text : in string; x, y : in integer; data : in font; colour : in integer := 16#FFFFFF#); procedure debug (text : in string); procedure hexagonal_grid (x, y, width, height : in integer; fill : in boolean); diff --git a/source/magic.adb b/source/magic.adb index 53a23dd..c4e00e5 100644 --- a/source/magic.adb +++ b/source/magic.adb @@ -68,7 +68,7 @@ package body magic is for index in codex loop icon (index, move_x + offset + school'pos (trait (index).kind) * 168, move_y + offset + next (school'pos (trait (index).kind)) * core.icon); - core.write (trait (index).name, move_x + offset + school'pos (trait (index).kind) * 168 + core.icon, move_y + offset + next (school'pos (trait (index).kind)) * core.icon); + core.write (trait (index).name, move_x + offset + school'pos (trait (index).kind) * 168 + core.icon, move_y + offset + next (school'pos (trait (index).kind)) * core.icon, ui.font (ui.active)); -- next (school'pos (trait (index).kind)) := next (school'pos (trait (index).kind)) + 1; end loop; diff --git a/source/main.adb b/source/main.adb index 48c7ac9..8ef04c4 100644 --- a/source/main.adb +++ b/source/main.adb @@ -29,9 +29,6 @@ begin core.configure; ui.configure; - core.fonts (1) := core.load_font ("./font/alagard.png", 24, 0); - --~core.fonts (1) := core.load_font ("./font/gothica.png", 24, 0); - core.play_sound (core.import_sound (core.c_string ("./song/main_menu.ogg"))); attribute.configure; @@ -96,7 +93,7 @@ begin --~for index in resource.codex loop resource.draw (index, 32 * resource.codex'pos (index) + 64, 96); end loop; --~for index in skill.codex loop skill.draw (index, 32 * skill.codex'pos (index) + 64, 128); end loop; -- - core.draw_state_box (preview_width + 32, 32); + ui.draw_state_box (preview_width + 32, 32); -- attribute.menu (300, 200, false); skill.menu (600, 300, true); diff --git a/source/might.adb b/source/might.adb index 8fe7dbd..84aa395 100644 --- a/source/might.adb +++ b/source/might.adb @@ -68,7 +68,7 @@ package body might is for index in codex loop icon (index, move_x + offset + school'pos (trait (index).kind) * 168, move_y + offset + next (school'pos (trait (index).kind)) * core.icon); - core.write (trait (index).name, move_x + offset + school'pos (trait (index).kind) * 168 + core.icon, move_y + offset + next (school'pos (trait (index).kind)) * core.icon); + core.write (trait (index).name, move_x + offset + school'pos (trait (index).kind) * 168 + core.icon, move_y + offset + next (school'pos (trait (index).kind)) * core.icon, ui.font (ui.active)); -- next (school'pos (trait (index).kind)) := next (school'pos (trait (index).kind)) + 1; end loop; diff --git a/source/resource.adb b/source/resource.adb index fa844ca..69a02f3 100644 --- a/source/resource.adb +++ b/source/resource.adb @@ -39,7 +39,7 @@ package body resource is loop ui.draw_icon (trait (index).text, move_x + offset, move_y + offset + codex'pos (index) * core.icon); draw (index, move_x + offset, move_y + offset + codex'pos (index) * core.icon); - core.write (trait (index).name, move_x + offset + core.icon, move_y + offset + codex'pos (index) * core.icon); + core.write (trait (index).name, move_x + offset + core.icon, move_y + offset + codex'pos (index) * core.icon, ui.font (ui.active)); end loop; end menu; diff --git a/source/skill.adb b/source/skill.adb index 780b540..a593dce 100644 --- a/source/skill.adb +++ b/source/skill.adb @@ -39,7 +39,7 @@ package body skill is loop ui.draw_icon (trait (index).text, move_x + offset, move_y + offset + codex'pos (index) * core.icon); draw (index, move_x + offset, move_y + offset + codex'pos (index) * core.icon); - core.write (trait (index).name, move_x + offset + core.icon, move_y + offset + codex'pos (index) * core.icon); + core.write (trait (index).name, move_x + offset + core.icon, move_y + offset + codex'pos (index) * core.icon, ui.font (ui.active)); end loop; end menu; diff --git a/source/ui.adb b/source/ui.adb index fd09175..b6e00d2 100644 --- a/source/ui.adb +++ b/source/ui.adb @@ -87,6 +87,8 @@ package body ui is procedure configure is procedure load_ui (index : in style; folder_path : in string) is begin + font (index) := core.load_font ("./sprite/ui/" & folder_path & "/font.png", 24, 0); + -- for this in codex loop sprite (index, this) := core.load_sprite ("./sprite/ui/" & folder_path & core.lowercase (codex'image (this)) & ".png", 1, 1); @@ -132,7 +134,7 @@ package body ui is draw (text_lower_left, x, y + height - offset); draw (text_lower_right, x + width - offset, y + height - offset); -- - core.write (core.read_text_box, x, y); + core.write (core.read_text_box, x, y, font (active)); -- select_text_box ("", x, y, width, height); end draw_text_box; @@ -172,7 +174,7 @@ package body ui is -- draw_horizontally (title_bar_middle, x + sprite (active, title_bar_left).width, y - sprite (active, title_bar_middle).height, middle_width); -- - core.write (title, x + sprite (active, title_bar_left).width / 2, y - sprite (active, title_bar_middle).height / 2 - 4); + core.write (title, x + sprite (active, title_bar_left).width / 2, y - sprite (active, title_bar_middle).height / 2 - 4, font (active)); -- select_text_box ("", x, y - sprite (active, title_bar_middle).height, width, sprite (active, title_bar_middle).height); end draw_title_bar; @@ -283,6 +285,22 @@ package body ui is select_text_box (description, x, y, width, height); end draw_icon_menu; + ------------------------------------------------------------------------------------------ + + procedure draw_state_box (x, y : in integer) is + begin + core.write ("Cursor X :" & integer'image (core.cursor_x), x, y + 0, font (active)); + core.write ("Cursor Y :" & integer'image (core.cursor_y), x, y + 32, font (active)); + core.write ("Cursor Mode :" & integer'image (core.cursor_mode), x, y + 64, font (active)); + core.write ("Signal Code :" & core.signal_code'image (core.signal_code'val (core.signal_mode)), x, y + 96, font (active)); + core.write ("Camera X :" & integer'image (core.camera.x), x, y + 128, font (active)); + core.write ("Camera Y :" & integer'image (core.camera.y), x, y + 160, font (active)); + core.write ("Global Time :" & integer'image (core.global_time), x, y + 192, font (active)); + core.write ("Gameplay Time :" & integer'image (core.gameplay_time), x, y + 224, font (active)); + core.write ("Animation Time :" & integer'image (core.animation_time), x, y + 256, font (active)); + core.write ("Framerate :" & integer'image (core.framerate), x, y + 288, font (active)); + end draw_state_box; + ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ end ui; diff --git a/source/ui.ads b/source/ui.ads index c4cac3d..c47d5a9 100644 --- a/source/ui.ads +++ b/source/ui.ads @@ -33,11 +33,13 @@ package ui is ------------------------------------------------------------------------------------------ type sprite_array is array (style, codex) of core.sprite; + type font_array is array (style) of core.font; ------------------------------------------------------------------------------------------ - sprite : sprite_array; - active : style; + sprite : sprite_array; + font : font_array; + active : style; ------------------------------------------------------------------------------------------ @@ -58,6 +60,8 @@ package ui is procedure draw_icon_menu (description : in string; x, y, width, height : in integer); + procedure draw_state_box (x, y : in integer); + ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ end ui; diff --git a/source/unit.adb b/source/unit.adb index 8022145..3936914 100644 --- a/source/unit.adb +++ b/source/unit.adb @@ -76,7 +76,7 @@ package body unit is move := faction.codex'pos (trait (index).kind) * 168; -- icon (index, move_x + offset + move, move_y + offset + (codex'pos (index) mod 14) * core.icon); - core.write (trait (index).name, move_x + offset + move + core.icon, move_y + offset + (codex'pos (index) mod 14) * core.icon); + core.write (trait (index).name, move_x + offset + move + core.icon, move_y + offset + (codex'pos (index) mod 14) * core.icon, ui.font (ui.active)); end loop; end menu; @@ -102,8 +102,9 @@ package body unit is ui.draw_icon (attribute.trait (data).text, move_x + view_width + 12 + offset, move_y + offset + move); attribute.draw (data, move_x + view_width + 12 + offset, move_y + offset + move); -- - core.write (integer'image (trait (index).attributes (data)), move_x + view_width + 12 + offset + core.icon, move_y + offset + move); + core.write (integer'image (trait (index).attributes (data)), move_x + view_width + 12 + offset + core.icon, move_y + offset + move, ui.font (ui.active)); end loop; + -- for animate in animation loop draw (index, animate, move_x + offset + animation'pos (animate) * (sprite (index).width + 8), move_y + offset + 8 + core.icon * attribute.count);