mirror of https://github.com/axmolengine/axmol.git
[ci skip] Add javascript notes...
cocos/base/CCEventListener.h cocos/base/CCEventListenerAcceleration.h cocos/base/CCEventListenerController.h cocos/base/CCEventListenerCustom.h cocos/base/CCEventListenerFocus.h cocos/base/CCEventListenerKeyboard.h cocos/base/CCEventListenerMouse.h cocos/base/CCEventListenerTouch.h cocos/base/CCEventMouse.h cocos/base/CCEventTouch.h
This commit is contained in:
parent
9cb02c800a
commit
6590d34bda
|
@ -39,6 +39,7 @@ public:
|
|||
/** Constructor.
|
||||
*
|
||||
* @param eventName A given name of the custom event.
|
||||
* @js ctor
|
||||
*/
|
||||
EventCustom(const std::string& eventName);
|
||||
|
||||
|
|
|
@ -52,6 +52,7 @@ The EventListener list is managed in such a way that
|
|||
event listeners can be added and removed even
|
||||
from within an EventListener, while events are being
|
||||
dispatched.
|
||||
@js NA
|
||||
*/
|
||||
class CC_DLL EventDispatcher : public Ref
|
||||
{
|
||||
|
|
|
@ -45,6 +45,7 @@ public:
|
|||
*
|
||||
* @param widgetLoseFocus The widget which lose focus.
|
||||
* @param widgetGetFocus The widget which get focus.
|
||||
* @js ctor
|
||||
*/
|
||||
EventFocus(ui::Widget* widgetLoseFocus, ui::Widget* widgetGetFocus);
|
||||
|
||||
|
|
|
@ -38,6 +38,7 @@ class CC_DLL EventKeyboard : public Event
|
|||
public:
|
||||
/**
|
||||
* KeyCode The key (code).
|
||||
* @js NA
|
||||
*/
|
||||
enum class KeyCode
|
||||
{
|
||||
|
@ -217,6 +218,7 @@ public:
|
|||
*
|
||||
* @param keyCode A given keycode.
|
||||
* @param isPressed True if the key is pressed.
|
||||
* @js ctor
|
||||
*/
|
||||
EventKeyboard(KeyCode keyCode, bool isPressed);
|
||||
|
||||
|
|
|
@ -62,13 +62,20 @@ public:
|
|||
typedef std::string ListenerID;
|
||||
|
||||
CC_CONSTRUCTOR_ACCESS:
|
||||
/** Constructor */
|
||||
/**
|
||||
* Constructor
|
||||
* @js ctor
|
||||
*/
|
||||
EventListener();
|
||||
|
||||
/** Initializes event with type and callback function */
|
||||
/**
|
||||
* Initializes event with type and callback function
|
||||
* @js NA
|
||||
*/
|
||||
bool init(Type t, const ListenerID& listenerID, const std::function<void(Event*)>& callback);
|
||||
public:
|
||||
/** Destructor.
|
||||
* @js NA
|
||||
*/
|
||||
virtual ~EventListener();
|
||||
|
||||
|
|
|
@ -32,6 +32,7 @@ NS_CC_BEGIN
|
|||
|
||||
/** @class EventListenerAcceleration
|
||||
* @brief Acceleration event listener.
|
||||
* @js NA
|
||||
*/
|
||||
class CC_DLL EventListenerAcceleration : public EventListener
|
||||
{
|
||||
|
|
|
@ -36,6 +36,7 @@ class Controller;
|
|||
|
||||
/** @class EventListenerController
|
||||
* @param Controller event listener.
|
||||
* @js NA
|
||||
*/
|
||||
class EventListenerController : public EventListener
|
||||
{
|
||||
|
|
|
@ -49,6 +49,7 @@ class EventCustom;
|
|||
* Removes a listener
|
||||
*
|
||||
* dispatcher->removeEventListener(listener);
|
||||
* @js cc._EventListenerCustom
|
||||
*/
|
||||
class CC_DLL EventListenerCustom : public EventListener
|
||||
{
|
||||
|
|
|
@ -50,6 +50,7 @@ public:
|
|||
static EventListenerFocus* create();
|
||||
|
||||
/** Destructor.
|
||||
* @js NA
|
||||
*/
|
||||
virtual ~EventListenerFocus();
|
||||
|
||||
|
|
|
@ -35,6 +35,7 @@ class Event;
|
|||
|
||||
/** @class EventListenerKeyboard
|
||||
* @brief Keyboard event listener.
|
||||
* @js cc._EventListenerKeyboard
|
||||
*/
|
||||
class CC_DLL EventListenerKeyboard : public EventListener
|
||||
{
|
||||
|
|
|
@ -35,6 +35,7 @@ class Event;
|
|||
|
||||
/** @class EventListenerMouse
|
||||
* @brief Mouse event listener.
|
||||
* @js cc._EventListenerMouse
|
||||
*/
|
||||
class CC_DLL EventListenerMouse : public EventListener
|
||||
{
|
||||
|
|
|
@ -36,6 +36,7 @@ class Touch;
|
|||
|
||||
/** @class EventListenerTouchOneByOne
|
||||
* @brief Single touch event listener.
|
||||
* @js cc._EventListenerTouchOneByOne
|
||||
*/
|
||||
class CC_DLL EventListenerTouchOneByOne : public EventListener
|
||||
{
|
||||
|
@ -46,7 +47,10 @@ public:
|
|||
*/
|
||||
static EventListenerTouchOneByOne* create();
|
||||
|
||||
/** Destructor. */
|
||||
/**
|
||||
* Destructor.
|
||||
* @js NA
|
||||
*/
|
||||
virtual ~EventListenerTouchOneByOne();
|
||||
|
||||
/** Whether or not to swall touches.
|
||||
|
@ -100,6 +104,7 @@ public:
|
|||
*/
|
||||
static EventListenerTouchAllAtOnce* create();
|
||||
/** Destructor.
|
||||
* @js NA
|
||||
*/
|
||||
virtual ~EventListenerTouchAllAtOnce();
|
||||
|
||||
|
|
|
@ -48,6 +48,7 @@ class CC_DLL EventMouse : public Event
|
|||
public:
|
||||
/**
|
||||
* MouseEventType Different types of MouseEvent.
|
||||
* @js NA
|
||||
*/
|
||||
enum class MouseEventType
|
||||
{
|
||||
|
@ -61,6 +62,7 @@ public:
|
|||
/** Constructor.
|
||||
*
|
||||
* @param mouseEventCode A given mouse event type.
|
||||
* @js ctor
|
||||
*/
|
||||
EventMouse(MouseEventType mouseEventCode);
|
||||
|
||||
|
@ -85,6 +87,7 @@ public:
|
|||
*
|
||||
* @param x The x coordinate of cursor position.
|
||||
* @param y The y coordinate of cursor position.
|
||||
* @js setLocation
|
||||
*/
|
||||
inline void setCursorPosition(float x, float y) {
|
||||
_x = x;
|
||||
|
@ -102,21 +105,25 @@ public:
|
|||
/** Set mouse button.
|
||||
*
|
||||
* @param button a given mouse button.
|
||||
* @js setButton
|
||||
*/
|
||||
inline void setMouseButton(int button) { _mouseButton = button; };
|
||||
/** Get mouse button.
|
||||
*
|
||||
* @return The mouse button.
|
||||
* @js getButton
|
||||
*/
|
||||
inline int getMouseButton() { return _mouseButton; };
|
||||
/** Get the cursor position of x axis.
|
||||
*
|
||||
* @return The x coordinate of cursor position.
|
||||
* @js getLocationX
|
||||
*/
|
||||
inline float getCursorX() { return _x; };
|
||||
/** Get the cursor position of y axis.
|
||||
*
|
||||
* @return The y coordinate of cursor position.
|
||||
* @js getLocationY
|
||||
*/
|
||||
inline float getCursorY() { return _y; };
|
||||
|
||||
|
@ -128,11 +135,13 @@ public:
|
|||
/** Returns the previous touch location in OpenGL coordinates.
|
||||
*
|
||||
* @return The previous touch location in OpenGL coordinates.
|
||||
* @js NA
|
||||
*/
|
||||
Vec2 getPreviousLocation() const;
|
||||
/** Returns the start touch location in OpenGL coordinates.
|
||||
*
|
||||
* @return The start touch location in OpenGL coordinates.
|
||||
* @js NA
|
||||
*/
|
||||
Vec2 getStartLocation() const;
|
||||
/** Returns the delta of 2 current touches locations in screen coordinates.
|
||||
|
@ -148,11 +157,13 @@ public:
|
|||
/** Returns the previous touch location in screen coordinates.
|
||||
*
|
||||
* @return The previous touch location in screen coordinates.
|
||||
* @js NA
|
||||
*/
|
||||
Vec2 getPreviousLocationInView() const;
|
||||
/** Returns the start touch location in screen coordinates.
|
||||
*
|
||||
* @return The start touch location in screen coordinates.
|
||||
* @js NA
|
||||
*/
|
||||
Vec2 getStartLocationInView() const;
|
||||
|
||||
|
|
|
@ -51,7 +51,10 @@ public:
|
|||
CANCELLED
|
||||
};
|
||||
|
||||
/** Constructor.*/
|
||||
/**
|
||||
* Constructor.
|
||||
* @js NA
|
||||
*/
|
||||
EventTouch();
|
||||
|
||||
/** Get event code.
|
||||
|
|
Loading…
Reference in New Issue