Amphora Docs Help

Working with Binary Resources

Amphora builds static binaries with resources built into the game executable. These resources are specified in the resources.h file using a similar x-macro pattern to what's seen in setting up keymaps and colors.

Each LOAD* macro looks roughly as follows:

LOAD*(name, path) \

The name field will be used to refer to the resource in your game code, and the path is the relative path to the resource file. The LOAD* macros are each of LOADIMG, LOADFONT, LOADMAP, LOADSFX, and LOADMUSIC.

This is how a completed resourses.h file might look:

#define IMAGES \ LOADIMG(Character, "../content/img/character.png") \ LOADIMG(Objects, "../content/img/objects.png") \ LOADIMG(Overworld, "../content/img/overworld.png") #define FONTS \ LOADFONT(Roboto, "../content/font/Roboto/Roboto-Regular.ttf") #define MAPS \ LOADMAP(Overworld, "../content/maps/overworld.tmj") #define SFX \ LOADSFX(leaves01, "../content/sfx/leaves01.ogg") \ LOADSFX(leaves02, "../content/sfx/leaves02.ogg") #define MUSIC \ LOADMUSIC(forest, "../content/music/forest.ogg")
30 November 2024