module SFML::Assets

Cached, search-path-driven asset loader. Use it to avoid repeating file paths and to load each asset exactly once.

font = SFML::Assets.font(“DejaVuSans”) tex = SFML::Assets.texture(“hero”) # finds hero.png/.jpg/.bmp blip = SFML::Assets.sound(“blip”) # finds blip.wav/.ogg/… music = SFML::Assets.music(“track”) # NOT cached (stateful)

By default the search root is <dir of $0>/assets/. Override:

SFML::Assets.root = File.expand_path(“data”, dir) SFML::Assets.add_search_path(“/usr/local/share/mygame”)

Cache survives until you call .clear or the process exits.