About objects and resources
- Resources are assets meant to be used by objects.
- Objects are assets that can be place within a Novelty scene. Things like images, buttons, text and so forth.
Loading resources in NoveltyML
It's very easy to load a resource in NoveltyML. You only need to point to the source file and more importantly give the resource a name. By giving the resource a unique name you make it available for other assets to use.
Note: Any resource file must be within, or in a subdirectory of Novelty's Asset folder. (Novelty\Assets\...)
Fig 1: Loading a texture and naming it 'My texture'
Once a resouce has been loaded it can be used by other objects. In the following piece of NoveltyML we will create an image object and tell it to use the texture we just loaded.
Fig 2: Creating an image by using a texture.
Image objects can load more than texture resources. If you're creating an animated image you need to load an animation resource as well.
Fig 3: Creating an animated image by using a texture and an animation resource.
Textures and Images
If a Texture really is an image then what's an Image? In Novelty they're two completely different things. To put it simply: A Texture is a resource while an Image is an object that displays a texture.
- Textures is a resource that can be used by many different object types, not just Image.
- Images are objects that displays a texture.
- An Image has many more properties than a resource, such as position, scale and animation and can be placed within a scene.
List of resource types
- Animation - Information describing one or more sequences of animation. Can be used by Images.
- Audio - Loads an audio file.
- Font - Loads a bitmap fonts. Uses one or more textures and has information required to render the font.
- Script - Loads a script file (Angelscript).
- Shape - Defines a custom shape.
- Texture - Loads a texture file. Can be used by several object types.
List of object types
- Border - A stretchable image that retains the size of its corners.
- Button - A button. Triggers an event when the player clicks it.
- Canvas - An image that uses a generated texture. Child objects will be rendered onto this texture.
- Group - An invisible container for objects.
- Image - Renders an texture. Can be animated.
- Set - Like a canvas, but has multiple states that you can switch between with transition effects.
- SystemText - Renders text using a system font.
- Text - Renders text using a bitmap font.
- Video - Displays video.