mirror of https://github.com/axmolengine/axmol.git
Merge branch 'iss2347-keyboard-macro' of https://github.com/dumganhar/cocos2d-x into iss2347-keyboard-macro
This commit is contained in:
commit
8a4eab608e
|
@ -59,6 +59,7 @@ kazmath/src/GL/mat4stack.c \
|
|||
kazmath/src/GL/matrix.c \
|
||||
keypad_dispatcher/CCKeypadDelegate.cpp \
|
||||
keypad_dispatcher/CCKeypadDispatcher.cpp \
|
||||
keyboard_dispatcher/CCKeyboardDispatcher.cpp \
|
||||
label_nodes/CCLabelAtlas.cpp \
|
||||
label_nodes/CCLabelBMFont.cpp \
|
||||
label_nodes/CCLabelTTF.cpp \
|
||||
|
|
|
@ -64,9 +64,7 @@ THE SOFTWARE.
|
|||
#include "platform/CCImage.h"
|
||||
#include "CCEGLView.h"
|
||||
#include "CCConfiguration.h"
|
||||
#ifdef CC_KEYBOARD_SUPPORT
|
||||
#include "keyboard_dispatcher/CCKeyboardDispatcher.h"
|
||||
#endif
|
||||
|
||||
|
||||
/**
|
||||
|
@ -154,10 +152,8 @@ bool Director::init(void)
|
|||
_touchDispatcher = new TouchDispatcher();
|
||||
_touchDispatcher->init();
|
||||
|
||||
#ifdef CC_KEYBOARD_SUPPORT
|
||||
// KeyboardDispatcher
|
||||
_keyboardDispatcher = new KeyboardDispatcher();
|
||||
#endif
|
||||
|
||||
// KeypadDispatcher
|
||||
_keypadDispatcher = new KeypadDispatcher();
|
||||
|
@ -185,9 +181,7 @@ Director::~Director(void)
|
|||
CC_SAFE_RELEASE(_scheduler);
|
||||
CC_SAFE_RELEASE(_actionManager);
|
||||
CC_SAFE_RELEASE(_touchDispatcher);
|
||||
#ifdef CC_KEYBOARD_SUPPORT
|
||||
CC_SAFE_RELEASE(_keyboardDispatcher);
|
||||
#endif
|
||||
CC_SAFE_RELEASE(_keypadDispatcher);
|
||||
CC_SAFE_DELETE(_accelerometer);
|
||||
|
||||
|
@ -1004,7 +998,6 @@ TouchDispatcher* Director::getTouchDispatcher()
|
|||
return _touchDispatcher;
|
||||
}
|
||||
|
||||
#ifdef CC_KEYBOARD_SUPPORT
|
||||
void Director::setKeyboardDispatcher(KeyboardDispatcher* pKeyboardDispatcher)
|
||||
{
|
||||
CC_SAFE_RETAIN(pKeyboardDispatcher);
|
||||
|
@ -1016,7 +1009,6 @@ KeyboardDispatcher* Director::getKeyboardDispatcher()
|
|||
{
|
||||
return _keyboardDispatcher;
|
||||
}
|
||||
#endif
|
||||
|
||||
void Director::setKeypadDispatcher(KeypadDispatcher* pKeypadDispatcher)
|
||||
{
|
||||
|
|
|
@ -71,9 +71,7 @@ class Node;
|
|||
class Scheduler;
|
||||
class ActionManager;
|
||||
class TouchDispatcher;
|
||||
#ifdef CC_KEYBOARD_SUPPORT
|
||||
class KeyboardDispatcher;
|
||||
#endif
|
||||
class KeypadDispatcher;
|
||||
class Accelerometer;
|
||||
|
||||
|
@ -328,12 +326,12 @@ public:
|
|||
*/
|
||||
CC_PROPERTY(TouchDispatcher*, _touchDispatcher, TouchDispatcher);
|
||||
|
||||
#ifdef CC_KEYBOARD_SUPPORT
|
||||
/** KeyboardDispatcher associated with this director
|
||||
@since v?.?
|
||||
@note Supported on Mac and Linux only now.
|
||||
@since v3.0
|
||||
*/
|
||||
CC_PROPERTY(KeyboardDispatcher*, _keyboardDispatcher, KeyboardDispatcher);
|
||||
#endif
|
||||
|
||||
/** KeypadDispatcher associated with this director
|
||||
@since v2.0
|
||||
*/
|
||||
|
|
|
@ -33,8 +33,8 @@ NS_CC_BEGIN
|
|||
//
|
||||
//------------------------------------------------------------------
|
||||
KeyboardDispatcher::KeyboardDispatcher()
|
||||
: _keyPressDelegate(NULL)
|
||||
, _keyReleaseDelegate(NULL)
|
||||
: _keyPressDelegate(nullptr)
|
||||
, _keyReleaseDelegate(nullptr)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -38,9 +38,7 @@ THE SOFTWARE.
|
|||
#include "support/TransformUtils.h"
|
||||
// extern
|
||||
#include "kazmath/GL/matrix.h"
|
||||
#ifdef CC_KEYBOARD_SUPPORT
|
||||
#include "keyboard_dispatcher/CCKeyboardDispatcher.h"
|
||||
#endif
|
||||
|
||||
NS_CC_BEGIN
|
||||
|
||||
|
@ -48,9 +46,7 @@ NS_CC_BEGIN
|
|||
Layer::Layer()
|
||||
: _touchEnabled(false)
|
||||
, _accelerometerEnabled(false)
|
||||
#ifdef CC_KEYBOARD_SUPPORT
|
||||
, _keyboardEnabled(false)
|
||||
#endif
|
||||
, _keypadEnabled(false)
|
||||
, _scriptTouchHandlerEntry(NULL)
|
||||
, _scriptKeypadHandlerEntry(NULL)
|
||||
|
@ -279,7 +275,6 @@ void Layer::unregisterScriptAccelerateHandler(void)
|
|||
CC_SAFE_RELEASE_NULL(_scriptAccelerateHandlerEntry);
|
||||
}
|
||||
|
||||
#ifdef CC_KEYBOARD_SUPPORT
|
||||
/// isKeyboardEnabled getter
|
||||
bool Layer::isKeyboardEnabled()
|
||||
{
|
||||
|
@ -300,12 +295,11 @@ void Layer::setKeyboardEnabled(bool enabled)
|
|||
}
|
||||
else
|
||||
{
|
||||
pDirector->getKeyboardDispatcher()->setKeyPressDelegate(NULL);
|
||||
pDirector->getKeyboardDispatcher()->setKeyReleaseDelegate(NULL);
|
||||
pDirector->getKeyboardDispatcher()->setKeyPressDelegate(nullptr);
|
||||
pDirector->getKeyboardDispatcher()->setKeyReleaseDelegate(nullptr);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
/// isKeypadEnabled getter
|
||||
bool Layer::isKeypadEnabled()
|
||||
|
|
|
@ -134,12 +134,12 @@ public:
|
|||
You can enable / disable accelerometer events with this property.
|
||||
it's new in cocos2d-x
|
||||
*/
|
||||
#ifdef CC_KEYBOARD_SUPPORT
|
||||
|
||||
virtual bool isKeyboardEnabled();
|
||||
virtual void setKeyboardEnabled(bool value);
|
||||
virtual void keyPressed(int keyCode) {};
|
||||
virtual void keyReleased(int keyCode) {};
|
||||
#endif
|
||||
|
||||
virtual bool isKeypadEnabled();
|
||||
virtual void setKeypadEnabled(bool value);
|
||||
|
||||
|
@ -157,9 +157,7 @@ public:
|
|||
protected:
|
||||
bool _touchEnabled;
|
||||
bool _accelerometerEnabled;
|
||||
#ifdef CC_KEYBOARD_SUPPORT
|
||||
bool _keyboardEnabled;
|
||||
#endif
|
||||
bool _keypadEnabled;
|
||||
|
||||
private:
|
||||
|
|
|
@ -13,9 +13,7 @@
|
|||
#include "touch_dispatcher/CCTouch.h"
|
||||
#include "touch_dispatcher/CCTouchDispatcher.h"
|
||||
#include "text_input_node/CCIMEDispatcher.h"
|
||||
#ifdef CC_KEYBOARD_SUPPORT
|
||||
#include "keyboard_dispatcher/CCKeyboardDispatcher.h"
|
||||
#endif
|
||||
|
||||
PFNGLGENFRAMEBUFFERSEXTPROC glGenFramebuffersEXT = NULL;
|
||||
PFNGLDELETEFRAMEBUFFERSEXTPROC glDeleteFramebuffersEXT = NULL;
|
||||
|
@ -157,7 +155,6 @@ int closeEventHandle() {
|
|||
return GL_TRUE;
|
||||
}
|
||||
|
||||
#ifdef CC_KEYBOARD_SUPPORT
|
||||
void GLFWCALL keyboardEventHandle(int keyCode, int action)
|
||||
{
|
||||
KeyboardDispatcher *kbDisp = Director::sharedDirector()->getKeyboardDispatcher();
|
||||
|
@ -172,7 +169,6 @@ void GLFWCALL keyboardEventHandle(int keyCode, int action)
|
|||
break;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
void EGLView::setFrameSize(float width, float height)
|
||||
{
|
||||
|
|
|
@ -1 +1 @@
|
|||
0bfb5fd7085d3486aae4789b60c34035491f0338
|
||||
d668f142f61f02f102e45e6839b7df302d545b79
|
|
@ -109,6 +109,11 @@ files
|
|||
"*.h"
|
||||
"*.cpp"
|
||||
|
||||
("../keyboard_dispatcher")
|
||||
[keyboard_dispatcher]
|
||||
"*.h"
|
||||
"*.cpp"
|
||||
|
||||
("../label_nodes")
|
||||
[label_nodes]
|
||||
"*.h"
|
||||
|
|
|
@ -37,6 +37,7 @@ SOURCES = ../actions/CCAction.cpp \
|
|||
../effects/CCGrid.cpp \
|
||||
../keypad_dispatcher/CCKeypadDelegate.cpp \
|
||||
../keypad_dispatcher/CCKeypadDispatcher.cpp \
|
||||
../keyboard_dispatcher/CCKeyboardDispatcher.cpp \
|
||||
../label_nodes/CCLabelAtlas.cpp \
|
||||
../label_nodes/CCLabelBMFont.cpp \
|
||||
../label_nodes/CCLabelTTF.cpp \
|
||||
|
|
|
@ -172,6 +172,7 @@ xcopy /Y /Q "$(ProjectDir)..\platform\third_party\win32\libraries\*.*" "$(OutDir
|
|||
<ClCompile Include="..\actions\CCActionProgressTimer.cpp" />
|
||||
<ClCompile Include="..\actions\CCActionTiledGrid.cpp" />
|
||||
<ClCompile Include="..\actions\CCActionTween.cpp" />
|
||||
<ClCompile Include="..\keyboard_dispatcher\CCKeyboardDispatcher.cpp" />
|
||||
<ClCompile Include="..\label_nodes\CCLabelAtlas.cpp" />
|
||||
<ClCompile Include="..\label_nodes\CCLabelBMFont.cpp" />
|
||||
<ClCompile Include="..\label_nodes\CCLabelTTF.cpp" />
|
||||
|
@ -312,6 +313,7 @@ xcopy /Y /Q "$(ProjectDir)..\platform\third_party\win32\libraries\*.*" "$(OutDir
|
|||
<ClInclude Include="..\include\CCProtocols.h" />
|
||||
<ClInclude Include="..\include\ccTypes.h" />
|
||||
<ClInclude Include="..\include\cocos2d.h" />
|
||||
<ClInclude Include="..\keyboard_dispatcher\CCKeyboardDispatcher.h" />
|
||||
<ClInclude Include="..\label_nodes\CCLabelAtlas.h" />
|
||||
<ClInclude Include="..\label_nodes\CCLabelBMFont.h" />
|
||||
<ClInclude Include="..\label_nodes\CCLabelTTF.h" />
|
||||
|
|
|
@ -103,6 +103,9 @@
|
|||
<Filter Include="support\component">
|
||||
<UniqueIdentifier>{caa78ce0-9b58-4314-b117-1acae278691e}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="keyboard_dispatcher">
|
||||
<UniqueIdentifier>{e7134ba0-4220-4dd1-b120-3533883394ac}</UniqueIdentifier>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\base_nodes\CCAtlasNode.cpp">
|
||||
|
@ -477,6 +480,9 @@
|
|||
<ClCompile Include="..\support\component\CCComponentContainer.cpp">
|
||||
<Filter>support\component</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\keyboard_dispatcher\CCKeyboardDispatcher.cpp">
|
||||
<Filter>keyboard_dispatcher</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\base_nodes\CCAtlasNode.h">
|
||||
|
@ -958,5 +964,8 @@
|
|||
<ClInclude Include="..\support\component\CCComponent.h">
|
||||
<Filter>support\component</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\keyboard_dispatcher\CCKeyboardDispatcher.h">
|
||||
<Filter>keyboard_dispatcher</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
</Project>
|
Loading…
Reference in New Issue