Resources
Functions
Section titled “Functions”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)
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
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
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 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)
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)
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.
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 |
---|---|
ResourceKind.animation_resource | Animation scripts are loaded as Animationresources. These are located in the projectsResources/animations folder. |
ResourceKind.bundle_resource | Resource bundles contain lists of otherresources. These are located in the projectsResources/bundles folder. |
ResourceKind.font_resource | Fonts resources are located in theResources/fonts folder. |
ResourceKind.image_resource | Image resources are located in theResources/images folder. |
ResourceKind.json_resource | JSON resources are located in the projectsResources/json folder. |
ResourceKind.music_resource | Music resources can be played as music, andlive in the program’s Resources/sounds folder. |
ResourceKind.server_resource | Server resources that can be sent as responsesto web server requests. |
ResourceKind.sound_resource | Sound resources can be played as soundeffects, and live in the program’sResources/sounds folder. |
ResourceKind.timer_resource | Timer resources are not saved to file, butcan be created by SplashkKit resourcebundles. |
ResourceKind.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. |