Skip to content

Asset management #5

Description

@karnkaul

Since assets are shipped with the executable and required to run, the app shouldn't rely on the working directory to locate them. Instead, there should be a defined relationship between the exe location and the assets root directory, which is used to locate it at runtime.

Eg, in a shipped / release build:

carise/
  carise[.exe]
  data/...

During development:

carise/
  build/.../carise[.exe]
  out/.../carise[.exe]
  src/...
  data/...

Here, data/ is always in the same directory as carise[.exe] or in a parent directory. This setup can be used with the app "searching upwards" from argv[0] (the executable path) for a data/ directory. This will be the asset root / prefix.

All assets in source code / config files / manifests will contain URIs to assets, relative to the asset root. At runtime, the engine will resolve the full path to a given URI by appending it to the asset root.

AC

  • Locate asset root at runtime (and deal with not finding it)
  • Add a font somewhere in the asset root tree
  • Load the font in main
  • Draw some text using the font

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions