#include <JoystickControl.h>
List of all members.
Public Member Functions |
const char * | getTypeName () const |
void | addListener (Control::Listener *listener, int eventFlags) |
const Vector2 & | getValue () const |
void | setInnerRegionSize (const Vector2 &size, bool isWidthPercentage=false, bool isHeightPercentage=false) |
const Vector2 & | getInnerRegionSize (bool *isWidthPercentage=NULL, bool *isHeightPercentage=NULL) const |
void | setOuterRegionSize (const Vector2 &size, bool isWidthPercentage=false, bool isHeightPercentage=false) |
const Vector2 & | getOuterRegionSize (bool *isWidthPercentage=NULL, bool *isHeightPercentage=NULL) const |
void | setRelative (bool relative) |
bool | isRelative () const |
unsigned int | getIndex () const |
void | setRadius (float radius, bool isPercentage=false) |
float | getRadius () const |
bool | isRadiusPercentage () const |
Static Public Member Functions |
static JoystickControl * | create (const char *id, Theme::Style *style=NULL) |
Protected Member Functions |
| JoystickControl () |
virtual | ~JoystickControl () |
void | initialize (const char *typeName, Theme::Style *style, Properties *properties) |
bool | touchEvent (Touch::TouchEvent evt, int x, int y, unsigned int contactIndex) |
void | updateAbsoluteBounds (const Vector2 &offset) |
unsigned int | drawImages (Form *form, const Rectangle &clip) |
Static Protected Member Functions |
static Control * | create (Theme::Style *style, Properties *properties=NULL) |
Detailed Description
Defines a control representing a joystick (axis).
This is used in virtual Gamepad instances.
- See also:
- http://gameplay3d.github.io/GamePlay/docs/file-formats.html#wiki-UI_Forms
Constructor & Destructor Documentation
Member Function Documentation
Add a listener to be notified of specific events affecting this control. Event types can be OR'ed together. E.g. To listen to touch-press and touch-release events, pass Control::Listener::TOUCH | Control::Listener::RELEASE
as the second parameter.
- Parameters:
-
listener | The listener to add. |
eventFlags | The events to listen for. |
Reimplemented from gameplay::Control.
Creates a new Joystick control.
- Parameters:
-
id | The joystick ID. |
style | The joystick style. |
- Returns:
- The new joystick.
Create a joystick control with a given style and properties.
- Parameters:
-
style | The style to apply to this joystick. |
properties | A properties object containing a definition of the joystick. |
- Returns:
- The new joystick.
Gets the index of this joystick across all joysticks on a form.
- Returns:
- The index of this joystick on a form.
Gets the image size of the inner region of the joystick. Returns (0,0) if there is no inner image region defined.
- Parameters:
-
isWidthPercentage | Set to true if the width value is a percentage value of the relative size of this control |
isHeightPercentage | Set to true if the height value is a percentage value of the relative size of this control |
- Returns:
- The image size of the inner region of the joystick. (x, y) == (width, height)
Gets the image size of the outer region of the joystick. Returns (0,0) if there is no outer image region defined.
- Parameters:
-
isWidthPercentage | Set to true if the width value is a percentage value of the relative size of this control |
isHeightPercentage | Set to true if the height value is a percentage value of the relative size of this control |
- Returns:
- The image size of the outer region of the joystick. (x, y) == (width, height)
Gets the radius of joystick motion
- Returns:
- The radius of joystick motion
Gets the value (2-dimensional direction) of the joystick.
- Returns:
- The value of the joystick.
Determines if the radius of joystick motion is a percentage value of the relative size of this control
- Returns:
- True if the radius of joystick motion is a percentage value of the relative size of this control
Gets whether absolute positioning is enabled or not.
Note: The default behavior is absolute positioning, and not relative.
- Returns:
true
if relative positioning is enabled; false
otherwise.
Sets the image size of the inner region of the joystick. Does not do anything if there is no inner image region defined.
- Parameters:
-
size | The size of the inner region of the joystick. (x, y) == (width, height) |
isWidthPercentage | If the width value should be computed as a percentage of the relative size of this control |
isHeightPercentage | If the height value should be computed as a percentage of the relative size of this control |
Sets the image size of the outer region of the joystick. Does not do anything if there is no outer image region defined.
- Parameters:
-
size | The size of the outer region of the joystick. (x, y) == (width, height) |
isWidthPercentage | If the width value should be computed as a percentage of the relative size of this control |
isHeightPercentage | If the height value should be computed as a percentage of the relative size of this control |
Sets the radius of joystick motion
- Parameters:
-
radius | The radius to be set. |
isPercentage | If the radius value is a percentage value of the relative size of this control |
Sets whether relative positioning is enabled or not.
Note: The default behavior is absolute positioning, and not relative.
- Parameters:
-
relative | Whether relative positioning should be enabled or not. |
Touch callback on touch events. Controls return true if they consume the touch event.
- Parameters:
-
evt | The touch event that occurred. |
x | The x position of the touch in pixels. Left edge is zero. |
y | The y position of the touch in pixels. Top edge is zero. |
contactIndex | The order of occurrence for multiple touch contacts starting at zero. |
- Returns:
- Whether the touch event was consumed by the control.
- See also:
- Touch::TouchEvent
Reimplemented from gameplay::Control.