Line 704:
Line 704:
== Buttons ==
== Buttons ==
−
Buttons are very useful, as they allow an image (or any other GuiElement) to be "clicked." Buttons are simple to create, just remember, you must Append the button to your GuiWindow, not the GuiImage. To create a button, declare an instance of the GuiButton class, giving the address your GuiImage (or another GuiElement) as the argument:
+
Buttons are very useful, as they allow an image (or any other GuiElement) to be "clicked." GuiButtons add the following functions to your initial GuiElement functions:
+
<source lang = "cpp">
+
//!Constructor
+
+
//!\param w Width
+
+
//!\param h Height
+
+
GuiButton(int w, int h);
+
+
//!Destructor
+
+
~GuiButton();
+
+
//!Sets the button's image
+
+
//!\param i Pointer to GuiImage object
+
+
void SetImage(GuiImage* i);
+
+
//!Sets the button's image on over
+
+
//!\param i Pointer to GuiImage object
+
+
void SetImageOver(GuiImage* i);
+
+
//!Sets the button's image on hold
+
+
//!\param i Pointer to GuiImage object
+
+
void SetImageHold(GuiImage* i);
+
+
//!Sets the button's image on click
+
+
//!\param i Pointer to GuiImage object
+
+
void SetImageClick(GuiImage* i);
+
+
//!Sets the button's icon
+
+
//!\param i Pointer to GuiImage object
+
+
void SetIcon(GuiImage* i);
+
+
//!Sets the button's icon on over
+
+
//!\param i Pointer to GuiImage object
+
+
void SetIconOver(GuiImage* i);
+
+
//!Sets the button's icon on hold
+
+
//!\param i Pointer to GuiImage object
+
+
void SetIconHold(GuiImage* i);
+
+
//!Sets the button's icon on click
+
+
//!\param i Pointer to GuiImage object
+
+
void SetIconClick(GuiImage* i);
+
+
//!Sets the button's label
+
+
//!\param t Pointer to GuiText object
+
+
//!\param n Index of label to set (optional, default is 0)
+
+
void SetLabel(GuiText* t, int n = 0);
+
+
//!Sets the button's label on over (eg: different colored text)
+
+
//!\param t Pointer to GuiText object
+
+
//!\param n Index of label to set (optional, default is 0)
+
+
void SetLabelOver(GuiText* t, int n = 0);
+
+
//!Sets the button's label on hold
+
+
//!\param t Pointer to GuiText object
+
+
//!\param n Index of label to set (optional, default is 0)
+
+
void SetLabelHold(GuiText* t, int n = 0);
+
+
//!Sets the button's label on click
+
+
//!\param t Pointer to GuiText object
+
+
//!\param n Index of label to set (optional, default is 0)
+
+
void SetLabelClick(GuiText* t, int n = 0);
+
+
//!Sets the sound to play on over
+
+
//!\param s Pointer to GuiSound object
+
+
void SetSoundOver(GuiSound * s);
+
+
//!Sets the sound to play on hold
+
+
//!\param s Pointer to GuiSound object
+
+
void SetSoundHold(GuiSound * s);
+
+
//!Sets the sound to play on click
+
+
//!\param s Pointer to GuiSound object
+
+
void SetSoundClick(GuiSound * s);
+
+
//!Constantly called to draw the GuiButton
+
+
void Draw();
+
+
//!Constantly called to allow the GuiButton to respond to updated input data
+
+
//!\param t Pointer to a GuiTrigger, containing the current input data from PAD/WPAD
+
+
void Update(GuiTrigger * t);
+
</source>
+
Once again, it's pretty self-explanatory. Buttons are simple to create, just remember, you must Append() the ''GuiButton'' to your GuiWindow, not the ''GuiImage''. To create a button, declare an instance of the GuiButton class, giving the address your GuiImage (or another GuiElement) as the argument:
<source lang = "cpp">
<source lang = "cpp">