From f422ec5ac8102abb99a92d4742b4baa88130b75f Mon Sep 17 00:00:00 2001 From: Jedidiah Barber Date: Tue, 15 Apr 2025 00:41:02 +1200 Subject: Executable now knows where it is, installs and finds logo image correctly, better build config --- src/images.adb | 44 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 src/images.adb (limited to 'src/images.adb') diff --git a/src/images.adb b/src/images.adb new file mode 100644 index 0000000..07897d1 --- /dev/null +++ b/src/images.adb @@ -0,0 +1,44 @@ + + +with + + Ada.Command_Line, + Ada.Directories, + FLTK.Images.RGB.PNG, + Here_I_Am; + + +package body Images is + + + package ACom renames Ada.Command_Line; + package ADir renames Ada.Directories; + + + Dummy : constant FLTK.Color_Component_Array := (1 .. 0 => 0); + + + + + function Load_Logo + return FLTK.Images.RGB.RGB_Image'Class is + begin + declare + Base_Path : String := ADir.Containing_Directory (Here_I_Am.Executable); + Logo_Path : String := + ADir.Compose + (ADir.Compose -- No matter how many times I write this, still looks weird... + (ADir.Compose + (ADir.Compose (Base_Path, ".."), "share"), "adapad"), "logo.png"); + begin + return FLTK.Images.RGB.PNG.Forge.Create (Logo_Path); + end; + exception + when others => + return FLTK.Images.RGB.Forge.Create (Dummy, 0, 0); + end Load_Logo; + + +end Images; + + -- cgit