Resources
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 SplashKit.DeregisterFreeNotifier(FreeNotifier handler);
def deregister_free_notifier(handler):
procedure DeregisterFreeNotifier(handler: FreeNotifier)
Path To Resource
Gets the path to a give file of a certain resource kind.
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. |
Return Type: String
Signatures:
string path_to_resource(const string &filename, resource_kind kind)
public static string SplashKit.PathToResource(string filename, ResourceKind kind);
def path_to_resource(filename, kind):
function PathToResource(const filename: String; kind: ResourceKind): String
Path To Resources
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
Signatures:
string path_to_resources()
public static string SplashKit.PathToResources();
def path_to_resources():
function PathToResources(): 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:
Name | Type | Description |
---|---|---|
kind | Resource Kind | The type of resource you want the path for. |
Return Type: String
Signatures:
string path_to_resources(resource_kind kind)
public static string SplashKit.PathToResources(ResourceKind kind);
def path_to_resources_for_kind(kind):
function PathToResources(kind: ResourceKind): String
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 SplashKit.RegisterFreeNotifier(FreeNotifier fn);
def register_free_notifier(fn):
procedure RegisterFreeNotifier(fn: FreeNotifier)
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 SplashKit.SetResourcesPath(string path);
def set_resources_path(path):
procedure SetResourcesPath(const path: String)
Types
Free Notifier
The free notifier can be registered with the system. It is called every time a resource is freed.
Resource Kind
Constant | Description |
---|---|
ANIMATION_RESOURCE | Animation scripts are loaded as Animationresources. These are located in the projectsResources/animations folder. |
BUNDLE_RESOURCE | Resource bundles contain lists of otherresources. These are located in the projectsResources/bundles folder. |
FONT_RESOURCE | Fonts resources are located in theResources/fonts folder. |
IMAGE_RESOURCE | Image resources are located in theResources/images folder. |
JSON_RESOURCE | JSON resources are located in the projectsResources/json folder. |
MUSIC_RESOURCE | Music resources can be played as music, andlive in the program’s Resources/sounds folder. |
SERVER_RESOURCE | Server resources that can be sent as responsesto web server requests. |
SOUND_RESOURCE | Sound resources can be played as soundeffects, and live in the program’sResources/sounds folder. |
TIMER_RESOURCE | Timer resources are not saved to file, butcan be created by SplashkKit resourcebundles. |
OTHER_RESOURCE | Other resources can be loaded, these will belocated directly in these project’sResources folder. |
Constant | Description |
---|---|
ResourceKind.AnimationResource | Animation scripts are loaded as Animationresources. These are located in the projectsResources/animations folder. |
ResourceKind.BundleResource | Resource bundles contain lists of otherresources. These are located in the projectsResources/bundles folder. |
ResourceKind.FontResource | Fonts resources are located in theResources/fonts folder. |
ResourceKind.ImageResource | Image resources are located in theResources/images folder. |
ResourceKind.JsonResource | JSON resources are located in the projectsResources/json folder. |
ResourceKind.MusicResource | Music resources can be played as music, andlive in the program’s Resources/sounds folder. |
ResourceKind.ServerResource | Server resources that can be sent as responsesto web server requests. |
ResourceKind.SoundResource | Sound resources can be played as soundeffects, and live in the program’sResources/sounds folder. |
ResourceKind.TimerResource | Timer resources are not saved to file, butcan be created by SplashkKit resourcebundles. |
ResourceKind.OtherResource | Other resources can be loaded, these will belocated directly in these project’sResources folder. |
Constant | Description |
---|---|
resource_kind.animation_resource | Animation scripts are loaded as Animationresources. These are located in the projectsResources/animations folder. |
resource_kind.bundle_resource | Resource bundles contain lists of otherresources. These are located in the projectsResources/bundles folder. |
resource_kind.font_resource | Fonts resources are located in theResources/fonts folder. |
resource_kind.image_resource | Image resources are located in theResources/images folder. |
resource_kind.json_resource | JSON resources are located in the projectsResources/json folder. |
resource_kind.music_resource | Music resources can be played as music, andlive in the program’s Resources/sounds folder. |
resource_kind.server_resource | Server resources that can be sent as responsesto web server requests. |
resource_kind.sound_resource | Sound resources can be played as soundeffects, and live in the program’sResources/sounds folder. |
resource_kind.timer_resource | Timer resources are not saved to file, butcan be created by SplashkKit resourcebundles. |
resource_kind.other_resource | Other resources can be loaded, these will belocated directly in these project’sResources folder. |
Constant | Description |
---|---|
ResourceKind.AnimationResource | Animation scripts are loaded as Animationresources. These are located in the projectsResources/animations folder. |
ResourceKind.BundleResource | Resource bundles contain lists of otherresources. These are located in the projectsResources/bundles folder. |
ResourceKind.FontResource | Fonts resources are located in theResources/fonts folder. |
ResourceKind.ImageResource | Image resources are located in theResources/images folder. |
ResourceKind.JsonResource | JSON resources are located in the projectsResources/json folder. |
ResourceKind.MusicResource | Music resources can be played as music, andlive in the program’s Resources/sounds folder. |
ResourceKind.ServerResource | Server resources that can be sent as responsesto web server requests. |
ResourceKind.SoundResource | Sound resources can be played as soundeffects, and live in the program’sResources/sounds folder. |
ResourceKind.TimerResource | Timer resources are not saved to file, butcan be created by SplashkKit resourcebundles. |
ResourceKind.OtherResource | Other resources can be loaded, these will belocated directly in these project’sResources folder. |
SplashKit is able to manage a number of different kinds of resources for you.