mirror of https://github.com/axmolengine/axmol.git
Merge pull request #4345 from dumganhar/develop
Don't deprecate callback functions in Layer.
This commit is contained in:
commit
8f0063aa26
|
@ -86,21 +86,25 @@ public:
|
||||||
CC_DEPRECATED_ATTRIBUTE virtual void ccTouchesEnded(Set *pTouches, Event *pEvent) final {CC_UNUSED_PARAM(pTouches); CC_UNUSED_PARAM(pEvent);}
|
CC_DEPRECATED_ATTRIBUTE virtual void ccTouchesEnded(Set *pTouches, Event *pEvent) final {CC_UNUSED_PARAM(pTouches); CC_UNUSED_PARAM(pEvent);}
|
||||||
CC_DEPRECATED_ATTRIBUTE virtual void ccTouchesCancelled(Set *pTouches, Event *pEvent) final {CC_UNUSED_PARAM(pTouches); CC_UNUSED_PARAM(pEvent);}
|
CC_DEPRECATED_ATTRIBUTE virtual void ccTouchesCancelled(Set *pTouches, Event *pEvent) final {CC_UNUSED_PARAM(pTouches); CC_UNUSED_PARAM(pEvent);}
|
||||||
|
|
||||||
// Deprecated touch callbacks.There not have add CC_DEPRECATED_ATTRIBUTE because of menu still use these api
|
/* Callback function should not be deprecated, it will generate lots of warnings.
|
||||||
virtual bool onTouchBegan(Touch *touch, Event *unused_event);
|
Since 'setTouchEnabled' was deprecated, it will make warnings if developer overrides onTouchXXX and invokes setTouchEnabled(true) instead of using EventDispatcher::addEventListenerWithXXX.
|
||||||
|
*/
|
||||||
|
virtual bool onTouchBegan(Touch *touch, Event *unused_event);
|
||||||
virtual void onTouchMoved(Touch *touch, Event *unused_event);
|
virtual void onTouchMoved(Touch *touch, Event *unused_event);
|
||||||
virtual void onTouchEnded(Touch *touch, Event *unused_event);
|
virtual void onTouchEnded(Touch *touch, Event *unused_event);
|
||||||
virtual void onTouchCancelled(Touch *touch, Event *unused_event);
|
virtual void onTouchCancelled(Touch *touch, Event *unused_event);
|
||||||
|
|
||||||
// Deprecated touch callbacks.
|
virtual void onTouchesBegan(const std::vector<Touch*>& touches, Event *unused_event);
|
||||||
CC_DEPRECATED_ATTRIBUTE virtual void onTouchesBegan(const std::vector<Touch*>& touches, Event *unused_event);
|
virtual void onTouchesMoved(const std::vector<Touch*>& touches, Event *unused_event);
|
||||||
CC_DEPRECATED_ATTRIBUTE virtual void onTouchesMoved(const std::vector<Touch*>& touches, Event *unused_event);
|
virtual void onTouchesEnded(const std::vector<Touch*>& touches, Event *unused_event);
|
||||||
CC_DEPRECATED_ATTRIBUTE virtual void onTouchesEnded(const std::vector<Touch*>& touches, Event *unused_event);
|
virtual void onTouchesCancelled(const std::vector<Touch*>&touches, Event *unused_event);
|
||||||
CC_DEPRECATED_ATTRIBUTE virtual void onTouchesCancelled(const std::vector<Touch*>&touches, Event *unused_event);
|
|
||||||
/** @deprecated Please override onAcceleration */
|
/** @deprecated Please override onAcceleration */
|
||||||
CC_DEPRECATED_ATTRIBUTE virtual void didAccelerate(Acceleration* accelerationValue) final {};
|
CC_DEPRECATED_ATTRIBUTE virtual void didAccelerate(Acceleration* accelerationValue) final {};
|
||||||
|
|
||||||
CC_DEPRECATED_ATTRIBUTE virtual void onAcceleration(Acceleration* acc, Event* unused_event);
|
/* Callback function should not be deprecated, it will generate lots of warnings.
|
||||||
|
Since 'setAccelerometerEnabled' was deprecated, it will make warnings if developer overrides onAcceleration and invokes setAccelerometerEnabled(true) instead of using EventDispatcher::addEventListenerWithXXX.
|
||||||
|
*/
|
||||||
|
virtual void onAcceleration(Acceleration* acc, Event* unused_event);
|
||||||
|
|
||||||
/** If isTouchEnabled, this method is called onEnter. Override it to change the
|
/** If isTouchEnabled, this method is called onEnter. Override it to change the
|
||||||
way Layer receives touch events.
|
way Layer receives touch events.
|
||||||
|
@ -119,8 +123,8 @@ public:
|
||||||
Only the touches of this node will be affected. This "method" is not propagated to it's children.
|
Only the touches of this node will be affected. This "method" is not propagated to it's children.
|
||||||
@since v0.8.1
|
@since v0.8.1
|
||||||
*/
|
*/
|
||||||
CC_DEPRECATED_ATTRIBUTE virtual bool isTouchEnabled() const;
|
CC_DEPRECATED_ATTRIBUTE bool isTouchEnabled() const;
|
||||||
CC_DEPRECATED_ATTRIBUTE virtual void setTouchEnabled(bool value);
|
CC_DEPRECATED_ATTRIBUTE void setTouchEnabled(bool value);
|
||||||
|
|
||||||
CC_DEPRECATED_ATTRIBUTE virtual void setTouchMode(Touch::DispatchMode mode);
|
CC_DEPRECATED_ATTRIBUTE virtual void setTouchMode(Touch::DispatchMode mode);
|
||||||
CC_DEPRECATED_ATTRIBUTE virtual Touch::DispatchMode getTouchMode() const;
|
CC_DEPRECATED_ATTRIBUTE virtual Touch::DispatchMode getTouchMode() const;
|
||||||
|
@ -146,13 +150,16 @@ public:
|
||||||
CC_DEPRECATED_ATTRIBUTE virtual void setKeyboardEnabled(bool value);
|
CC_DEPRECATED_ATTRIBUTE virtual void setKeyboardEnabled(bool value);
|
||||||
|
|
||||||
/** Please use onKeyPressed instead. */
|
/** Please use onKeyPressed instead. */
|
||||||
virtual void keyPressed(int keyCode) final {};
|
CC_DEPRECATED_ATTRIBUTE virtual void keyPressed(int keyCode) final {};
|
||||||
|
|
||||||
/** Please use onKeyReleased instead. */
|
/** Please use onKeyReleased instead. */
|
||||||
virtual void keyReleased(int keyCode) final {};
|
CC_DEPRECATED_ATTRIBUTE virtual void keyReleased(int keyCode) final {};
|
||||||
|
|
||||||
CC_DEPRECATED_ATTRIBUTE virtual void onKeyPressed(EventKeyboard::KeyCode keyCode, Event* event);
|
/* Callback function should not be deprecated, it will generate lots of warnings.
|
||||||
CC_DEPRECATED_ATTRIBUTE virtual void onKeyReleased(EventKeyboard::KeyCode keyCode, Event* event);
|
Since 'setKeyboardEnabled' was deprecated, it will make warnings if developer overrides onKeyXXX and invokes setKeyboardEnabled(true) instead of using EventDispatcher::addEventListenerWithXXX.
|
||||||
|
*/
|
||||||
|
virtual void onKeyPressed(EventKeyboard::KeyCode keyCode, Event* event);
|
||||||
|
virtual void onKeyReleased(EventKeyboard::KeyCode keyCode, Event* event);
|
||||||
|
|
||||||
CC_DEPRECATED_ATTRIBUTE virtual bool isKeypadEnabled() const final { return _keyboardEnabled; }
|
CC_DEPRECATED_ATTRIBUTE virtual bool isKeypadEnabled() const final { return _keyboardEnabled; }
|
||||||
CC_DEPRECATED_ATTRIBUTE virtual void setKeypadEnabled(bool value);
|
CC_DEPRECATED_ATTRIBUTE virtual void setKeypadEnabled(bool value);
|
||||||
|
@ -160,9 +167,6 @@ public:
|
||||||
/** @deprecated Please override onKeyReleased and check the keycode of KeyboardEvent::KeyCode::Menu(KEY_BACKSPACE) instead. */
|
/** @deprecated Please override onKeyReleased and check the keycode of KeyboardEvent::KeyCode::Menu(KEY_BACKSPACE) instead. */
|
||||||
CC_DEPRECATED_ATTRIBUTE virtual void keyBackClicked() final {};
|
CC_DEPRECATED_ATTRIBUTE virtual void keyBackClicked() final {};
|
||||||
CC_DEPRECATED_ATTRIBUTE virtual void keyMenuClicked() final {};
|
CC_DEPRECATED_ATTRIBUTE virtual void keyMenuClicked() final {};
|
||||||
//
|
|
||||||
// Overrides
|
|
||||||
//
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
bool _touchEnabled;
|
bool _touchEnabled;
|
||||||
|
|
|
@ -272,7 +272,7 @@ void UIPageView::updateChildrenSize()
|
||||||
}
|
}
|
||||||
|
|
||||||
cocos2d::Size selfSize = getSize();
|
cocos2d::Size selfSize = getSize();
|
||||||
for (unsigned int i=0; i<_pages->count(); i++)
|
for (long i=0; i<_pages->count(); i++)
|
||||||
{
|
{
|
||||||
UILayout* page = dynamic_cast<UILayout*>(_pages->getObjectAtIndex(i));
|
UILayout* page = dynamic_cast<UILayout*>(_pages->getObjectAtIndex(i));
|
||||||
page->setSize(selfSize);
|
page->setSize(selfSize);
|
||||||
|
|
|
@ -68,8 +68,6 @@ bool Control::init()
|
||||||
{
|
{
|
||||||
if (Layer::init())
|
if (Layer::init())
|
||||||
{
|
{
|
||||||
//this->setTouchEnabled(true);
|
|
||||||
//_isTouchEnabled=true;
|
|
||||||
// Initialise instance variables
|
// Initialise instance variables
|
||||||
_state=Control::State::NORMAL;
|
_state=Control::State::NORMAL;
|
||||||
setEnabled(true);
|
setEnabled(true);
|
||||||
|
|
|
@ -177,10 +177,16 @@ void ScrollView::resume(Object* sender)
|
||||||
_container->resume();
|
_container->resume();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool ScrollView::isTouchEnabled() const
|
||||||
|
{
|
||||||
|
return _touchListener != nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
void ScrollView::setTouchEnabled(bool enabled)
|
void ScrollView::setTouchEnabled(bool enabled)
|
||||||
{
|
{
|
||||||
_eventDispatcher->removeEventListener(_touchListener);
|
_eventDispatcher->removeEventListener(_touchListener);
|
||||||
|
_touchListener = nullptr;
|
||||||
|
|
||||||
if (enabled)
|
if (enabled)
|
||||||
{
|
{
|
||||||
_touchListener = EventListenerTouchOneByOne::create();
|
_touchListener = EventListenerTouchOneByOne::create();
|
||||||
|
|
|
@ -167,6 +167,7 @@ public:
|
||||||
void resume(Object* sender);
|
void resume(Object* sender);
|
||||||
|
|
||||||
void setTouchEnabled(bool enabled);
|
void setTouchEnabled(bool enabled);
|
||||||
|
bool isTouchEnabled() const;
|
||||||
bool isDragging() const {return _dragging;}
|
bool isDragging() const {return _dragging;}
|
||||||
bool isTouchMoved() const { return _touchMoved; }
|
bool isTouchMoved() const { return _touchMoved; }
|
||||||
bool isBounceable() const { return _bounceable; }
|
bool isBounceable() const { return _bounceable; }
|
||||||
|
|
|
@ -15,7 +15,7 @@ public:
|
||||||
AccelerometerTest(void);
|
AccelerometerTest(void);
|
||||||
~AccelerometerTest(void);
|
~AccelerometerTest(void);
|
||||||
|
|
||||||
virtual void onAcceleration(Acceleration* acc, Event* event);
|
void onAcceleration(Acceleration* acc, Event* event);
|
||||||
|
|
||||||
virtual std::string title();
|
virtual std::string title();
|
||||||
virtual void onEnter();
|
virtual void onEnter();
|
||||||
|
|
|
@ -10,8 +10,8 @@ public:
|
||||||
KeyboardTest();
|
KeyboardTest();
|
||||||
~KeyboardTest();
|
~KeyboardTest();
|
||||||
|
|
||||||
virtual void onKeyPressed(EventKeyboard::KeyCode keyCode, Event* event);
|
void onKeyPressed(EventKeyboard::KeyCode keyCode, Event* event);
|
||||||
virtual void onKeyReleased(EventKeyboard::KeyCode keyCode, Event* event);
|
void onKeyReleased(EventKeyboard::KeyCode keyCode, Event* event);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
LabelTTF* _label;
|
LabelTTF* _label;
|
||||||
|
|
|
@ -10,7 +10,7 @@ public:
|
||||||
KeypadTest();
|
KeypadTest();
|
||||||
~KeypadTest();
|
~KeypadTest();
|
||||||
|
|
||||||
virtual void onKeyReleased(EventKeyboard::KeyCode keycode, Event* event);
|
void onKeyReleased(EventKeyboard::KeyCode keycode, Event* event);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
LabelTTF* _label;
|
LabelTTF* _label;
|
||||||
|
|
|
@ -98,7 +98,7 @@ skip = Node::[setGLServerState description getUserObject .*UserData getGLServerS
|
||||||
Scheduler::[pause resume unschedule schedule update isTargetPaused],
|
Scheduler::[pause resume unschedule schedule update isTargetPaused],
|
||||||
TextureCache::[addPVRTCImage],
|
TextureCache::[addPVRTCImage],
|
||||||
Timer::[getSelector createWithScriptHandler],
|
Timer::[getSelector createWithScriptHandler],
|
||||||
*::[copyWith.* onEnter.* onExit.* ^description$ getObjectType (g|s)etDelegate],
|
*::[copyWith.* onEnter.* onExit.* ^description$ getObjectType (g|s)etDelegate onTouch.* onAcc.* onKey.* onRegisterTouchListener],
|
||||||
FileUtils::[(g|s)etSearchResolutionsOrder$ (g|s)etSearchPaths$],
|
FileUtils::[(g|s)etSearchResolutionsOrder$ (g|s)etSearchPaths$],
|
||||||
Application::[^application.* ^run$],
|
Application::[^application.* ^run$],
|
||||||
Camera::[getEyeXYZ getCenterXYZ getUpXYZ],
|
Camera::[getEyeXYZ getCenterXYZ getUpXYZ],
|
||||||
|
|
Loading…
Reference in New Issue