Resources

SplashKit resource functions allow you to locate resources in a project's `Resources` folder.

Functions

Deregister Free Notifier

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

Parameters
Name Type Description
Handler

Free Notifier

The function to remove

Signatures
void deregister_free_notifier(free_notifier *handler)
public static void Resources.DeregisterFreeNotifier(FreeNotifier handler);
public static void SplashKit.DeregisterFreeNotifier(FreeNotifier handler);
procedure DeregisterFreeNotifier(handler: FreeNotifier)
def deregister_free_notifier(handler):

Path To Resource

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

Return Type

String

The full path to the resource.

Parameters
Name Type Description
Filename

String

The name of the file of the resource kind.

Kind

Resource Kind

The kind of resource you are loading.

Signatures
string path_to_resource(const string &filename, resource_kind kind)
public static string Resources.PathToResource(string filename, ResourceKind kind);
public static string SplashKit.PathToResource(string filename, ResourceKind kind);
function PathToResource(const filename: String; kind: ResourceKind): String
def path_to_resource(filename, kind):

Path To Resources

This function is overloaded. The following versions exist.

Path To Resources

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

Path to SplashKit Resources folder.

Signatures
string path_to_resources()
public static string Resources.PathToResources();
public static string SplashKit.PathToResources();
function PathToResources(): String
def path_to_resources():

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.

Return Type

String

The path to the folder containing this kind of resource.

Parameters
Name Type Description
Kind

Resource Kind

The type of resource you want the path for.

Signatures
string path_to_resources(resource_kind kind)
public static string Resources.PathToResources(ResourceKind kind);
public static string SplashKit.PathToResources(ResourceKind kind);
function PathToResources(kind: ResourceKind): String
def path_to_resources_for_kind(kind):

Register Free Notifier

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

Parameters
Name Type Description
Fn

Free Notifier

The function to be called when a resource is freed.

Signatures
void register_free_notifier(free_notifier *fn)
public static void Resources.RegisterFreeNotifier(FreeNotifier fn);
public static void SplashKit.RegisterFreeNotifier(FreeNotifier fn);
procedure RegisterFreeNotifier(fn: FreeNotifier)
def register_free_notifier(fn):

Set Resources Path

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

Parameters
Name Type Description
Path

String

The file path to the SplashKit Resources folder.

Signatures
void set_resources_path(const string &path)
public static void Resources.SetResourcesPath(string path);
public static void SplashKit.SetResourcesPath(string path);
procedure SetResourcesPath(const path: String)
def set_resources_path(path):

Types

Free Notifier

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

Resource Kind

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

Constants
Name Description
Animation Resource

Animation scripts are loaded as Animation resources. These are located in the projects Resources/animations folder.

Bundle Resource

Resource bundles contain lists of other resources. These are located in the projects Resources/bundles folder.

Database Resource

Database resources are located in the Resources/databases folder.

Font Resource

Fonts resources are located in the Resources/fonts folder.

Image Resource

Image resources are located in the Resources/images folder.

JSON Resource

JSON resources are located in the projects Resources/json folder.

Music Resource

Music resources can be played as music, and live in the program's Resources/sounds folder.

Server Resource

Server resources that can be sent as responses to web server requests.

Sound Resource

Sound resources can be played as sound effects, and live in the program's Resources/sounds folder.

Timer Resource

Timer resources are not saved to file, but can be created by SplashkKit resource bundles.

Other Resource

Other resources can be loaded, these will be located directly in these project's Resources folder.