[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:
VisualSJ 2015-03-24 16:37:09 +08:00
parent 9cb02c800a
commit 6590d34bda
14 changed files with 41 additions and 4 deletions

View File

@ -39,6 +39,7 @@ public:
/** Constructor. /** Constructor.
* *
* @param eventName A given name of the custom event. * @param eventName A given name of the custom event.
* @js ctor
*/ */
EventCustom(const std::string& eventName); EventCustom(const std::string& eventName);

View File

@ -52,6 +52,7 @@ The EventListener list is managed in such a way that
event listeners can be added and removed even event listeners can be added and removed even
from within an EventListener, while events are being from within an EventListener, while events are being
dispatched. dispatched.
@js NA
*/ */
class CC_DLL EventDispatcher : public Ref class CC_DLL EventDispatcher : public Ref
{ {

View File

@ -45,6 +45,7 @@ public:
* *
* @param widgetLoseFocus The widget which lose focus. * @param widgetLoseFocus The widget which lose focus.
* @param widgetGetFocus The widget which get focus. * @param widgetGetFocus The widget which get focus.
* @js ctor
*/ */
EventFocus(ui::Widget* widgetLoseFocus, ui::Widget* widgetGetFocus); EventFocus(ui::Widget* widgetLoseFocus, ui::Widget* widgetGetFocus);

View File

@ -38,6 +38,7 @@ class CC_DLL EventKeyboard : public Event
public: public:
/** /**
* KeyCode The key (code). * KeyCode The key (code).
* @js NA
*/ */
enum class KeyCode enum class KeyCode
{ {
@ -217,6 +218,7 @@ public:
* *
* @param keyCode A given keycode. * @param keyCode A given keycode.
* @param isPressed True if the key is pressed. * @param isPressed True if the key is pressed.
* @js ctor
*/ */
EventKeyboard(KeyCode keyCode, bool isPressed); EventKeyboard(KeyCode keyCode, bool isPressed);

View File

@ -62,13 +62,20 @@ public:
typedef std::string ListenerID; typedef std::string ListenerID;
CC_CONSTRUCTOR_ACCESS: CC_CONSTRUCTOR_ACCESS:
/** Constructor */ /**
* Constructor
* @js ctor
*/
EventListener(); 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); bool init(Type t, const ListenerID& listenerID, const std::function<void(Event*)>& callback);
public: public:
/** Destructor. /** Destructor.
* @js NA
*/ */
virtual ~EventListener(); virtual ~EventListener();

View File

@ -32,6 +32,7 @@ NS_CC_BEGIN
/** @class EventListenerAcceleration /** @class EventListenerAcceleration
* @brief Acceleration event listener. * @brief Acceleration event listener.
* @js NA
*/ */
class CC_DLL EventListenerAcceleration : public EventListener class CC_DLL EventListenerAcceleration : public EventListener
{ {

View File

@ -36,6 +36,7 @@ class Controller;
/** @class EventListenerController /** @class EventListenerController
* @param Controller event listener. * @param Controller event listener.
* @js NA
*/ */
class EventListenerController : public EventListener class EventListenerController : public EventListener
{ {

View File

@ -49,6 +49,7 @@ class EventCustom;
* Removes a listener * Removes a listener
* *
* dispatcher->removeEventListener(listener); * dispatcher->removeEventListener(listener);
* @js cc._EventListenerCustom
*/ */
class CC_DLL EventListenerCustom : public EventListener class CC_DLL EventListenerCustom : public EventListener
{ {

View File

@ -50,6 +50,7 @@ public:
static EventListenerFocus* create(); static EventListenerFocus* create();
/** Destructor. /** Destructor.
* @js NA
*/ */
virtual ~EventListenerFocus(); virtual ~EventListenerFocus();

View File

@ -35,6 +35,7 @@ class Event;
/** @class EventListenerKeyboard /** @class EventListenerKeyboard
* @brief Keyboard event listener. * @brief Keyboard event listener.
* @js cc._EventListenerKeyboard
*/ */
class CC_DLL EventListenerKeyboard : public EventListener class CC_DLL EventListenerKeyboard : public EventListener
{ {

View File

@ -35,6 +35,7 @@ class Event;
/** @class EventListenerMouse /** @class EventListenerMouse
* @brief Mouse event listener. * @brief Mouse event listener.
* @js cc._EventListenerMouse
*/ */
class CC_DLL EventListenerMouse : public EventListener class CC_DLL EventListenerMouse : public EventListener
{ {

View File

@ -36,6 +36,7 @@ class Touch;
/** @class EventListenerTouchOneByOne /** @class EventListenerTouchOneByOne
* @brief Single touch event listener. * @brief Single touch event listener.
* @js cc._EventListenerTouchOneByOne
*/ */
class CC_DLL EventListenerTouchOneByOne : public EventListener class CC_DLL EventListenerTouchOneByOne : public EventListener
{ {
@ -46,7 +47,10 @@ public:
*/ */
static EventListenerTouchOneByOne* create(); static EventListenerTouchOneByOne* create();
/** Destructor. */ /**
* Destructor.
* @js NA
*/
virtual ~EventListenerTouchOneByOne(); virtual ~EventListenerTouchOneByOne();
/** Whether or not to swall touches. /** Whether or not to swall touches.
@ -100,6 +104,7 @@ public:
*/ */
static EventListenerTouchAllAtOnce* create(); static EventListenerTouchAllAtOnce* create();
/** Destructor. /** Destructor.
* @js NA
*/ */
virtual ~EventListenerTouchAllAtOnce(); virtual ~EventListenerTouchAllAtOnce();

View File

@ -48,6 +48,7 @@ class CC_DLL EventMouse : public Event
public: public:
/** /**
* MouseEventType Different types of MouseEvent. * MouseEventType Different types of MouseEvent.
* @js NA
*/ */
enum class MouseEventType enum class MouseEventType
{ {
@ -61,6 +62,7 @@ public:
/** Constructor. /** Constructor.
* *
* @param mouseEventCode A given mouse event type. * @param mouseEventCode A given mouse event type.
* @js ctor
*/ */
EventMouse(MouseEventType mouseEventCode); EventMouse(MouseEventType mouseEventCode);
@ -85,6 +87,7 @@ public:
* *
* @param x The x coordinate of cursor position. * @param x The x coordinate of cursor position.
* @param y The y coordinate of cursor position. * @param y The y coordinate of cursor position.
* @js setLocation
*/ */
inline void setCursorPosition(float x, float y) { inline void setCursorPosition(float x, float y) {
_x = x; _x = x;
@ -102,21 +105,25 @@ public:
/** Set mouse button. /** Set mouse button.
* *
* @param button a given mouse button. * @param button a given mouse button.
* @js setButton
*/ */
inline void setMouseButton(int button) { _mouseButton = button; }; inline void setMouseButton(int button) { _mouseButton = button; };
/** Get mouse button. /** Get mouse button.
* *
* @return The mouse button. * @return The mouse button.
* @js getButton
*/ */
inline int getMouseButton() { return _mouseButton; }; inline int getMouseButton() { return _mouseButton; };
/** Get the cursor position of x axis. /** Get the cursor position of x axis.
* *
* @return The x coordinate of cursor position. * @return The x coordinate of cursor position.
* @js getLocationX
*/ */
inline float getCursorX() { return _x; }; inline float getCursorX() { return _x; };
/** Get the cursor position of y axis. /** Get the cursor position of y axis.
* *
* @return The y coordinate of cursor position. * @return The y coordinate of cursor position.
* @js getLocationY
*/ */
inline float getCursorY() { return _y; }; inline float getCursorY() { return _y; };
@ -128,11 +135,13 @@ public:
/** Returns the previous touch location in OpenGL coordinates. /** Returns the previous touch location in OpenGL coordinates.
* *
* @return The previous touch location in OpenGL coordinates. * @return The previous touch location in OpenGL coordinates.
* @js NA
*/ */
Vec2 getPreviousLocation() const; Vec2 getPreviousLocation() const;
/** Returns the start touch location in OpenGL coordinates. /** Returns the start touch location in OpenGL coordinates.
* *
* @return The start touch location in OpenGL coordinates. * @return The start touch location in OpenGL coordinates.
* @js NA
*/ */
Vec2 getStartLocation() const; Vec2 getStartLocation() const;
/** Returns the delta of 2 current touches locations in screen coordinates. /** Returns the delta of 2 current touches locations in screen coordinates.
@ -148,11 +157,13 @@ public:
/** Returns the previous touch location in screen coordinates. /** Returns the previous touch location in screen coordinates.
* *
* @return The previous touch location in screen coordinates. * @return The previous touch location in screen coordinates.
* @js NA
*/ */
Vec2 getPreviousLocationInView() const; Vec2 getPreviousLocationInView() const;
/** Returns the start touch location in screen coordinates. /** Returns the start touch location in screen coordinates.
* *
* @return The start touch location in screen coordinates. * @return The start touch location in screen coordinates.
* @js NA
*/ */
Vec2 getStartLocationInView() const; Vec2 getStartLocationInView() const;

View File

@ -51,7 +51,10 @@ public:
CANCELLED CANCELLED
}; };
/** Constructor.*/ /**
* Constructor.
* @js NA
*/
EventTouch(); EventTouch();
/** Get event code. /** Get event code.