cocos2d-x  3.5
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
EventMouse Class Reference

The mouse event. More...

#include <CCEventMouse.h>

Inheritance diagram for EventMouse:
Event Ref

Public Types

enum  MouseEventType {
  MOUSE_NONE, MOUSE_DOWN, MOUSE_UP, MOUSE_MOVE,
  MOUSE_SCROLL
}
 MouseEventType Different types of MouseEvent. More...
 
- Public Types inherited from Event
enum  Type {
  TOUCH, KEYBOARD, ACCELERATION, MOUSE,
  FOCUS, GAME_CONTROLLER, CUSTOM
}
 Type Event type. More...
 

Public Member Functions

 EventMouse (MouseEventType mouseEventCode)
 Constructor. More...
 
void setScrollData (float scrollX, float scrollY)
 Set mouse scroll data. More...
 
float getScrollX ()
 Get mouse scroll data of x axis. More...
 
float getScrollY ()
 Get mouse scroll data of y axis. More...
 
void setCursorPosition (float x, float y)
 Set the cursor position. More...
 
void setMouseButton (int button)
 Set mouse button. More...
 
int getMouseButton ()
 Get mouse button. More...
 
float getCursorX ()
 Get the cursor position of x axis. More...
 
float getCursorY ()
 Get the cursor position of y axis. More...
 
Vec2 getLocation () const
 Returns the current touch location in OpenGL coordinates. More...
 
Vec2 getPreviousLocation () const
 Returns the previous touch location in OpenGL coordinates. More...
 
Vec2 getStartLocation () const
 Returns the start touch location in OpenGL coordinates. More...
 
Vec2 getDelta () const
 Returns the delta of 2 current touches locations in screen coordinates. More...
 
Vec2 getLocationInView () const
 Returns the current touch location in screen coordinates. More...
 
Vec2 getPreviousLocationInView () const
 Returns the previous touch location in screen coordinates. More...
 
Vec2 getStartLocationInView () const
 Returns the start touch location in screen coordinates. More...
 
- Public Member Functions inherited from Event
virtual ~Event ()
 Destructor. More...
 
Type getType () const
 Gets the event type. More...
 
void stopPropagation ()
 Stops propagation for current event. More...
 
bool isStopped () const
 Checks whether the event has been stopped. More...
 
NodegetCurrentTarget ()
 Gets current target of the event. More...
 
- Public Member Functions inherited from Ref
void retain ()
 Retains the ownership. More...
 
void release ()
 Releases the ownership immediately. More...
 
Refautorelease ()
 Releases the ownership sometime soon automatically. More...
 
unsigned int getReferenceCount () const
 Returns the Ref's current reference count. More...
 
virtual ~Ref ()
 Destructor. More...
 

Friends

class EventListenerMouse

Additional Inherited Members

- Public Attributes inherited from Event
CC_CONSTRUCTOR_ACCESS __pad0__: Event(Type type)
- Protected Member Functions inherited from Event
void setCurrentTarget (Node *target)
 Sets current target. More...
 
- Protected Member Functions inherited from Ref
 Ref ()
 Constructor. More...
 
- Protected Attributes inherited from Event
Type _type
 Event type. More...
 
bool _isStopped
 whether the event has been stopped. More...
 
Node_currentTarget
 Current target. More...
 
- Protected Attributes inherited from Ref
unsigned int _referenceCount
 count of references More...
 

Detailed Description

The mouse event.

Constructor & Destructor Documentation

EventMouse ( MouseEventType  mouseEventCode)

Constructor.

Parameters
mouseEventCodeA given mouse event type.

Member Function Documentation

float getCursorX ( )
inline

Get the cursor position of x axis.

Returns
The x coordinate of cursor position.
float getCursorY ( )
inline

Get the cursor position of y axis.

Returns
The y coordinate of cursor position.
Vec2 getDelta ( ) const

Returns the delta of 2 current touches locations in screen coordinates.

Returns
The delta of 2 current touches locations in screen coordinates.
Vec2 getLocation ( ) const

Returns the current touch location in OpenGL coordinates.

Returns
The current touch location in OpenGL coordinates.
Vec2 getLocationInView ( ) const

Returns the current touch location in screen coordinates.

Returns
The current touch location in screen coordinates.
int getMouseButton ( )
inline

Get mouse button.

Returns
The mouse button.
Vec2 getPreviousLocation ( ) const

Returns the previous touch location in OpenGL coordinates.

Returns
The previous touch location in OpenGL coordinates.
Vec2 getPreviousLocationInView ( ) const

Returns the previous touch location in screen coordinates.

Returns
The previous touch location in screen coordinates.
float getScrollX ( )
inline

Get mouse scroll data of x axis.

Returns
The scroll data of x axis.
float getScrollY ( )
inline

Get mouse scroll data of y axis.

Returns
The scroll data of y axis.
Vec2 getStartLocation ( ) const

Returns the start touch location in OpenGL coordinates.

Returns
The start touch location in OpenGL coordinates.
Vec2 getStartLocationInView ( ) const

Returns the start touch location in screen coordinates.

Returns
The start touch location in screen coordinates.
void setCursorPosition ( float  x,
float  y 
)
inline

Set the cursor position.

Parameters
xThe x coordinate of cursor position.
yThe y coordinate of cursor position.
void setMouseButton ( int  button)
inline

Set mouse button.

Parameters
buttona given mouse button.
void setScrollData ( float  scrollX,
float  scrollY 
)
inline

Set mouse scroll data.

Parameters
scrollXThe scroll data of x axis.
scrollYThe scroll data of y axis.

Friends And Related Function Documentation

friend class EventListenerMouse
friend

The documentation for this class was generated from the following file: