diff --git a/cocos/base/CCController.h b/cocos/base/CCController.h index 46aabbc283..0c596f3cfe 100644 --- a/cocos/base/CCController.h +++ b/cocos/base/CCController.h @@ -41,6 +41,9 @@ class EventDispatcher; class Controller { public: + /** Controllers' standard key + * Controller receives only standard key which contained within enum Key by default. + */ enum Key { JOYSTICK_LEFT_X = 1000, @@ -87,9 +90,17 @@ public: static const int TAG_UNSET = -1; static const std::vector& getAllController(){ return s_allController;} + /** Gets a controller with its tag + * @param tag An identifier to find the controller. + */ static Controller* getControllerByTag(int tag); - + /** To start discovering new controllers + * @warning The API only work on the IOS platform.Empty implementation on Android + */ static void startDiscoveryController(); + /** End the discovery process + * @warning The API only work on the IOS platform.Empty implementation on Android + */ static void stopDiscoveryController(); const std::string& getDeviceName() const { return _deviceName;} @@ -108,7 +119,15 @@ public: */ void receiveExternalKeyEvent(int externalKeyCode,bool receive); + /** Changes the tag that is used to identify the controller easily. + * @param tag A integer that identifies the controller. + */ void setTag(int tag) { _controllerTag = tag;} + /** + * Returns a tag that is used to identify the controller easily. + * + * @return An integer that identifies the controller. + */ int getTag() const { return _controllerTag;} private: