Skip to content

Resources

Remove the function from the list of functions receiving notification of resource freeing.

Parameters:

NameTypeDescription
handlerFree NotifierThe function to remove

Signatures:

void deregister_free_notifier(free_notifier *handler)

Gets the path to a give file of a certain resource kind.

Parameters:

NameTypeDescription
filenameStringThe name of the file of the resource kind.
kindResource KindThe kind of resource you are loading.

Return Type: String

Signatures:

string path_to_resource(const string &filename, resource_kind kind)

Returns the path to the resources folder for the SplashKit program. This will be auto detected at startup, but can be changed using Set Resources Path.

Return Type: String

Signatures:

string path_to_resources()

Returns the path to the folder containing a given resource kind. This is the path SplashkKit will search when you load a resource.

Parameters:

NameTypeDescription
kindResource KindThe type of resource you want the path for.

Return Type: String

Signatures:

string path_to_resources(resource_kind kind)

Register a function to be called when any resource is freed.

Parameters:

NameTypeDescription
fnFree NotifierThe function to be called when a resource is freed.

Signatures:

void register_free_notifier(free_notifier *fn)

Sets the path to the SplashKit resources folder. Resource paths are then located within this folder.

Parameters:

NameTypeDescription
pathStringThe file path to the SplashKit Resources folder.

Signatures:

void set_resources_path(const string &path)

The free notifier can be registered with the system. It is called every time a resource is freed.


SplashKit is able to manage a number of different kinds of resources for you.

ConstantDescription
ANIMATION_RESOURCEAnimation scripts are loaded as Animationresources. These are located in the projectsResources/animations folder.
BUNDLE_RESOURCEResource bundles contain lists of otherresources. These are located in the projectsResources/bundles folder.
FONT_RESOURCEFonts resources are located in theResources/fonts folder.
IMAGE_RESOURCEImage resources are located in theResources/images folder.
JSON_RESOURCEJSON resources are located in the projectsResources/json folder.
MUSIC_RESOURCEMusic resources can be played as music, andlive in the program’s Resources/soundsfolder.
SERVER_RESOURCEServer resources that can be sent as responsesto web server requests.
SOUND_RESOURCESound resources can be played as soundeffects, and live in the program’sResources/sounds folder.
TIMER_RESOURCETimer resources are not saved to file, butcan be created by SplashkKit resourcebundles.
OTHER_RESOURCEOther resources can be loaded, these will belocated directly in these project’sResources folder.