The internal graphics engine of Novelty relies heavily on XML. XML is a markup language that is especially good for describing objects and relationships. NoveltyML is based upoin XML and adheres to the same syntax.
Don't worry if you've never written markup before. It's easier than it may sound. This following article will teach you how to type NoveltyML with its tags, attributes and values.
Remarks: NoveltyML is case-sensitive.
In NoveltyML you write tags. Each tag represents some type of object or asset. There are a finite number of valid tags in the language. One of them is the Texture tag:
Highlighted in red, a tag begins with an angle bracket (<) and ends with a forward slash and angle bracket (/>). These characters specify the beginning and the end of the tag. This particular tag is closed, but we'll come to that later.
As mentioned above, tags in NoveltyML represents some kind of object or asset, in this case a texture. For this texture to work we first need to specify some attributes. A commonly required attribute is the name attribute:
<Texture name="My texture" />
Here we've added the name-attribute to the Texture asset. The way you type an attribute is always by starting with the attribute itself followed by an equals sign (=) and the given value inside quotation marks("). something = "something". Since we're putting a name on this texture we can enter any arbitrary value; whatever name we wish to give it.
Note: Attributes are always lower case.
It is not always that you can enter whatever value to an attribute. Some attribute requires a specific value type. For instance the Texture's size attribute is a Vector2 type. Two decimal numbers separated by a comma (,). The first number is the given width and the second is the height.
<Texture name="My texture" size="800, 600" />
You can read about the different value types click here.
Creating an image
Consider the following NoveltyML:
<Texture name="My texture" source="Assets/Image.jpg"/> <Image name="My image" texture="My texture" />
The first tag, of which you should be familiar with by now, defines a new Texture resource. It only has two attributes, one being the resource name, the other is the location of the texture file.
The second tag defines a new Image asset. It also has a name-attribute, but instead of referring to a file source the texture-attribute references the Texture asset by name. You only need to define the Texture resource once and you can then use it over and over in Images and other objects.
Note: All assets must have a name so it can be handled by Novelty.
Creating an image inside an image
Another important property of tags is that they can have a parent-child relationship to eachother. This is useful for a multitude of things. In this example we're going to put one Image inside another. The second image will be a child of the first and every transform (position, size, rotation) will automatically affect the other.
What we need to do first is to change the tag from a closed tag to an open one:
<Image name="My image" texture="My texture" > </Image>
Here we've removed the forward-slash (remember, it specified a closed tag). Instead we close the tag on a new row. The syntax for closing a tag is an open angle bracket followed by a forward slash (</), then the tag name and a closed angle bracket (>).
We can now put other tags inbetween:
<Image name="My image" texture="My texture" > <Image texture="Other texture" /> </Image>
...in this case another Image. Note that this new Image doesn't have any children and is thus closed (/>). Also note that we don't specify any name for this image. Only the parent tag needs to have a name.
By now you should have grasped the basics of NoveltyML. You've learned how to define a texture resource and then use it in an Image object. There are of course many more resource and object types that you can use. Don't forget that there is a separate tool for writing NoveltyML called the NoveltyML Designer.