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:
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:
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:
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:
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:
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:
Types
Free Notifier
The free notifier can be registered with the system. It is called every time a resource is freed.
Resource Kind
Constant | Value | 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. |
SplashKit is able to manage a number of different kinds of resources for you.