-
Notifications
You must be signed in to change notification settings - Fork 21
Open
Description
I don't find it convenient to move into the directory of the examples to get them to work, as the paths to the resources are relative to that directory.
So, I propose to add an optional ROOT environment variable to each example, such as:
+let root = Bos.OS.Env.var "ROOT"
+
let setup () =
let open Raylib in
init_window width height "raylib [textures] example - bunnymark";
- let tex_bunny = load_texture "resources/wabbit_alpha.png" in
+ let tex_bunny =
+ let path =
+ match root with
+ | Some root -> Fmt.str "%s/resources/wabbit_alpha.png" root
+ | None -> "resources/wabbit_alpha.png"
+ in
+ load_texture path
+ inWe can also put this code in some helper library to avoid duplications.
So that we can run them with:
ROOT=examples/textures dune exec -- examples/textures/textures_bunnymark_ocaml_types.exeWhat do you think?
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels