NoveltyML reference > Objects > Button

<Button>

A button object is..
1) A group container with four states; "Default", "Hover", "Pressed" and "Disabled".
2) An object that can be configured to trigger game events from within the Novelty editor.

The content of each state is displayed depending on the current state of the button. Any child objects to a button (not defined within a state) will be drawn for all states.

Another property of the button is that any child objects whose size attribute is undefined will be automatically resized to fit the button's dimensions.


Button attributes

Attribute Description
enabled Is button enabled?

Additionally, this asset type inherits all object attributes.


enabled [bool]
If false, the button will be disabled by default.

Example:
enabled = "true"


Valid child tags

Child tags Description
<Default> Default state container
<Hover> Hover state container
<Pressed> Pressed state container
<Disabled> Disabled state container
<Traits> Object traits list
<Meta> Meta information
Objects... Other objects


<Default>

The contents of this state will be displayed when the button is in it's default state.

Child tags Description Count
Objects.. Other objects 0 or more


<Hover>

The contents of this state will be displayed when the mouse cursor hovers the button.

Child tags Description Count
Objects.. Other objects 0 or more


<Label>

Defines the font and look of a text object displaying the button's caption, which will be visible for all button states.

The attributes are the same as for <Text> object.


<Pressed>

The contents of this state will be displayed when the player is clicking the button.

Child tags Description Count
Objects.. Other objects 0 or more


<Disabled>

The contents of this state will be displayed when the button is disabled.

Child tags Description Count
Objects.. Other objects 0 or more


Example

<!-- Button with four states defined -->
<Button name="My button" size="100,50" >
	<Default>
		<Text font="My font" text="Default" />
	</Default>
	<Hover>
		<Text font="My font" text="Hover" />
	</Hover>
	<Pressed>
		<Text font="My font" text="Pressed" />
	</Pressed>
	<Disabled>
		<Text font="My font" text="Disabled" />
	</Disabled>
</Button>

<!-- Simple button made from an Image -->
<Button name="My button 2" size="100,50" >
	<Image texture="Button texture" />
</Button>

Back to top