diff --git a/.gitignore b/.gitignore index 52d0b48600..5840ff4d85 100644 --- a/.gitignore +++ b/.gitignore @@ -80,6 +80,7 @@ Device-Release/ # Ignore vim swaps *.swp +*.swo # Ignore config files in javascript bindings generator tools/tojs/user.cfg diff --git a/cocos2dx/CCDirector.cpp b/cocos2dx/CCDirector.cpp index f1f5ef28cc..7291432aeb 100644 --- a/cocos2dx/CCDirector.cpp +++ b/cocos2dx/CCDirector.cpp @@ -64,7 +64,9 @@ THE SOFTWARE. #include "platform/CCImage.h" #include "CCEGLView.h" #include "CCConfiguration.h" - +#ifdef KEYBOARD_SUPPORT +#include "keyboard_dispatcher/CCKeyboardDispatcher.h" +#endif /** @@ -155,6 +157,11 @@ bool CCDirector::init(void) m_pTouchDispatcher = new CCTouchDispatcher(); m_pTouchDispatcher->init(); +#ifdef KEYBOARD_SUPPORT + // KeyboardDispatcher + m_pKeyboardDispatcher = new CCKeyboardDispatcher(); +#endif + // KeypadDispatcher m_pKeypadDispatcher = new CCKeypadDispatcher(); @@ -181,6 +188,9 @@ CCDirector::~CCDirector(void) CC_SAFE_RELEASE(m_pScheduler); CC_SAFE_RELEASE(m_pActionManager); CC_SAFE_RELEASE(m_pTouchDispatcher); +#ifdef KEYBOARD_SUPPORT + CC_SAFE_RELEASE(m_pKeyboardDispatcher); +#endif CC_SAFE_RELEASE(m_pKeypadDispatcher); CC_SAFE_DELETE(m_pAccelerometer); @@ -961,6 +971,20 @@ CCTouchDispatcher* CCDirector::getTouchDispatcher() return m_pTouchDispatcher; } +#ifdef KEYBOARD_SUPPORT +void CCDirector::setKeyboardDispatcher(CCKeyboardDispatcher* pKeyboardDispatcher) +{ + CC_SAFE_RETAIN(pKeyboardDispatcher); + CC_SAFE_RELEASE(m_pKeyboardDispatcher); + m_pKeyboardDispatcher = pKeyboardDispatcher; +} + +CCKeyboardDispatcher* CCDirector::getKeyboardDispatcher() +{ + return m_pKeyboardDispatcher; +} +#endif + void CCDirector::setKeypadDispatcher(CCKeypadDispatcher* pKeypadDispatcher) { CC_SAFE_RETAIN(pKeypadDispatcher); diff --git a/cocos2dx/CCDirector.h b/cocos2dx/CCDirector.h index d9c6408e3a..1db6477bf0 100644 --- a/cocos2dx/CCDirector.h +++ b/cocos2dx/CCDirector.h @@ -71,6 +71,9 @@ class CCNode; class CCScheduler; class CCActionManager; class CCTouchDispatcher; +#ifdef KEYBOARD_SUPPORT +class CCKeyboardDispatcher; +#endif class CCKeypadDispatcher; class CCAccelerometer; @@ -322,6 +325,12 @@ public: */ CC_PROPERTY(CCTouchDispatcher*, m_pTouchDispatcher, TouchDispatcher); +#ifdef KEYBOARD_SUPPORT + /** CCKeyboardDispatcher associated with this director + @since v?.? + */ + CC_PROPERTY(CCKeyboardDispatcher*, m_pKeyboardDispatcher, KeyboardDispatcher); +#endif /** CCKeypadDispatcher associated with this director @since v2.0 */ diff --git a/cocos2dx/keyboard_dispatcher/CCKeyboardDispatcher.cpp b/cocos2dx/keyboard_dispatcher/CCKeyboardDispatcher.cpp new file mode 100755 index 0000000000..6603f47a77 --- /dev/null +++ b/cocos2dx/keyboard_dispatcher/CCKeyboardDispatcher.cpp @@ -0,0 +1,73 @@ +/**************************************************************************** +Copyright (c) 2010 cocos2d-x.org + +http://www.cocos2d-x.org + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +****************************************************************************/ + +#include "CCKeyboardDispatcher.h" +#include "support/data_support/ccCArray.h" + +NS_CC_BEGIN + +//------------------------------------------------------------------ +// +// CCKeyboardDispatcher +// +//------------------------------------------------------------------ +CCKeyboardDispatcher::CCKeyboardDispatcher() +: m_keyPressDelegate(NULL) +, m_keyReleaseDelegate(NULL) +{ +} + +CCKeyboardDispatcher::~CCKeyboardDispatcher() +{ +} + +void CCKeyboardDispatcher::setKeyPressDelegate(CCKeyboardDelegate delegate) +{ + m_keyPressDelegate = delegate; +} + +void CCKeyboardDispatcher::setKeyReleaseDelegate(CCKeyboardDelegate delegate) +{ + m_keyReleaseDelegate = delegate; +} + +bool CCKeyboardDispatcher::dispatchKeyboardEvent(int keyCode, bool pressed) +{ + if (m_keyPressDelegate != NULL && pressed) + { + m_keyPressDelegate(keyCode); + } + else if (m_keyReleaseDelegate != NULL) + { + m_keyReleaseDelegate(keyCode); + } + else + { + return false; + } + + return true; +} + +NS_CC_END diff --git a/cocos2dx/keyboard_dispatcher/CCKeyboardDispatcher.h b/cocos2dx/keyboard_dispatcher/CCKeyboardDispatcher.h new file mode 100755 index 0000000000..c13e66826b --- /dev/null +++ b/cocos2dx/keyboard_dispatcher/CCKeyboardDispatcher.h @@ -0,0 +1,76 @@ +/**************************************************************************** +Copyright (c) 2010 cocos2d-x.org + +http://www.cocos2d-x.org + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +****************************************************************************/ + +#ifndef __CCKEYBOARD_DISPATCHER_H__ +#define __CCKEYBOARD_DISPATCHER_H__ + +#include +#include +#include "cocoa/CCArray.h" + +NS_CC_BEGIN + +/** + * @addtogroup input + * @{ + */ + +typedef std::function CCKeyboardDelegate; + +/** +@class CCKeyboardDispatcher +@brief Dispatch the keypad message from the phone +*/ +class CC_DLL CCKeyboardDispatcher : public CCObject +{ +public: + CCKeyboardDispatcher(); + ~CCKeyboardDispatcher(); + + /** + @brief set delagate to key press event + */ + void setKeyPressDelegate(CCKeyboardDelegate delegate); + /** + @brief set delagate to key release event + */ + void setKeyReleaseDelegate(CCKeyboardDelegate delegate); + + /** + @brief dispatch the key stroke event + */ + bool dispatchKeyboardEvent(int keyCode, bool pressed); + +protected: + + CCKeyboardDelegate m_keyPressDelegate; + CCKeyboardDelegate m_keyReleaseDelegate; +}; + +// end of input group +/// @} + +NS_CC_END + +#endif //__CCKEYBOARD_DISPATCHER_H__ diff --git a/cocos2dx/layers_scenes_transitions_nodes/CCLayer.cpp b/cocos2dx/layers_scenes_transitions_nodes/CCLayer.cpp index 660ece70d0..b9ee34d38b 100644 --- a/cocos2dx/layers_scenes_transitions_nodes/CCLayer.cpp +++ b/cocos2dx/layers_scenes_transitions_nodes/CCLayer.cpp @@ -38,6 +38,9 @@ THE SOFTWARE. #include "support/TransformUtils.h" // extern #include "kazmath/GL/matrix.h" +#ifdef KEYBOARD_SUPPORT +#include "keyboard_dispatcher/CCKeyboardDispatcher.h" +#endif NS_CC_BEGIN @@ -45,6 +48,9 @@ NS_CC_BEGIN CCLayer::CCLayer() : m_bTouchEnabled(false) , m_bAccelerometerEnabled(false) +#ifdef KEYBOARD_SUPPORT +, m_bKeyboardEnabled(false) +#endif , m_bKeypadEnabled(false) , m_pScriptTouchHandlerEntry(NULL) , m_pScriptKeypadHandlerEntry(NULL) @@ -273,6 +279,34 @@ void CCLayer::unregisterScriptAccelerateHandler(void) CC_SAFE_RELEASE_NULL(m_pScriptAccelerateHandlerEntry); } +#ifdef KEYBOARD_SUPPORT +/// isKeyboardEnabled getter +bool CCLayer::isKeyboardEnabled() +{ + return m_bKeyboardEnabled; +} +/// isKeyboardEnabled setter +void CCLayer::setKeyboardEnabled(bool enabled) +{ + if (enabled != m_bKeyboardEnabled) + { + m_bKeyboardEnabled = enabled; + + CCDirector* pDirector = CCDirector::sharedDirector(); + if (enabled) + { + pDirector->getKeyboardDispatcher()->setKeyPressDelegate(std::bind(&CCLayer::keyPressed, this, std::placeholders::_1)); + pDirector->getKeyboardDispatcher()->setKeyReleaseDelegate(std::bind(&CCLayer::keyReleased, this, std::placeholders::_1)); + } + else + { + pDirector->getKeyboardDispatcher()->setKeyPressDelegate(NULL); + pDirector->getKeyboardDispatcher()->setKeyReleaseDelegate(NULL); + } + } +} +#endif + /// isKeypadEnabled getter bool CCLayer::isKeypadEnabled() { diff --git a/cocos2dx/layers_scenes_transitions_nodes/CCLayer.h b/cocos2dx/layers_scenes_transitions_nodes/CCLayer.h index f24d149736..f72c741ea4 100644 --- a/cocos2dx/layers_scenes_transitions_nodes/CCLayer.h +++ b/cocos2dx/layers_scenes_transitions_nodes/CCLayer.h @@ -130,10 +130,16 @@ public: virtual void setAccelerometerEnabled(bool value); virtual void setAccelerometerInterval(double interval); - /** whether or not it will receive keypad events + /** whether or not it will receive keyboard or keypad events You can enable / disable accelerometer events with this property. it's new in cocos2d-x */ +#ifdef 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); @@ -151,6 +157,9 @@ public: protected: bool m_bTouchEnabled; bool m_bAccelerometerEnabled; +#ifdef KEYBOARD_SUPPORT + bool m_bKeyboardEnabled; +#endif bool m_bKeypadEnabled; private: diff --git a/cocos2dx/platform/linux/CCEGLView.cpp b/cocos2dx/platform/linux/CCEGLView.cpp index 0599eb53b7..6b86faa6c1 100644 --- a/cocos2dx/platform/linux/CCEGLView.cpp +++ b/cocos2dx/platform/linux/CCEGLView.cpp @@ -13,6 +13,9 @@ #include "touch_dispatcher/CCTouch.h" #include "touch_dispatcher/CCTouchDispatcher.h" #include "text_input_node/CCIMEDispatcher.h" +#ifdef KEYBOARD_SUPPORT +#include "keyboard_dispatcher/CCKeyboardDispatcher.h" +#endif PFNGLGENFRAMEBUFFERSEXTPROC glGenFramebuffersEXT = NULL; PFNGLDELETEFRAMEBUFFERSEXTPROC glDeleteFramebuffersEXT = NULL; @@ -154,6 +157,23 @@ int closeEventHandle() { return GL_TRUE; } +#ifdef KEYBOARD_SUPPORT +void GLFWCALL keyboardEventHandle(int keyCode, int action) +{ + CCKeyboardDispatcher *kbDisp = CCDirector::sharedDirector()->getKeyboardDispatcher(); + + switch (action) + { + case GLFW_PRESS: + kbDisp->dispatchKeyboardEvent(keyCode, true); + break; + case GLFW_RELEASE: + kbDisp->dispatchKeyboardEvent(keyCode, false); + break; + } +} +#endif + void CCEGLView::setFrameSize(float width, float height) { bool eResult = false; @@ -228,6 +248,10 @@ void CCEGLView::setFrameSize(float width, float height) glfwSetMouseButtonCallback(mouseButtonEventHandle); //register the glfw mouse pos event glfwSetMousePosCallback(mousePosEventHandle); +#ifdef KEYBOARD_SUPPORT + //register the glfw keyboard event + glfwSetKeyCallback(keyboardEventHandle); +#endif glfwSetWindowCloseCallback(closeEventHandle); diff --git a/cocos2dx/platform/mac/CCEventDispatcher.mm b/cocos2dx/platform/mac/CCEventDispatcher.mm index 0cb2760862..66d4c83461 100755 --- a/cocos2dx/platform/mac/CCEventDispatcher.mm +++ b/cocos2dx/platform/mac/CCEventDispatcher.mm @@ -31,6 +31,9 @@ #import "ccConfig.h" #include "support/data_support/utlist.h" +#include "CCDirector.h" +#include "keyboard_dispatcher/CCKeyboardDispatcher.h" + //NS_CC_BEGIN; static CCEventDispatcher *sharedDispatcher = nil; @@ -502,7 +505,9 @@ static int eventQueueCount; { if( dispatchEvents_ ) { tListEntry *entry, *tmp; - + + cocos2d::CCKeyboardDispatcher *kbDisp = cocos2d::CCDirector::sharedDirector()->getKeyboardDispatcher(); + kbDisp->dispatchKeyboardEvent(event.keyCode, true); DL_FOREACH_SAFE( keyboardDelegates_, entry, tmp ) { if ( entry->flags & kCCImplementsKeyDown ) { void *swallows = [entry->delegate performSelector:@selector(ccKeyDown:) withObject:event]; @@ -518,6 +523,8 @@ static int eventQueueCount; if( dispatchEvents_ ) { tListEntry *entry, *tmp; + cocos2d::CCKeyboardDispatcher *kbDisp = cocos2d::CCDirector::sharedDirector()->getKeyboardDispatcher(); + kbDisp->dispatchKeyboardEvent(event.keyCode, true); DL_FOREACH_SAFE( keyboardDelegates_, entry, tmp ) { if ( entry->flags & kCCImplementsKeyUp ) { void *swallows = [entry->delegate performSelector:@selector(ccKeyUp:) withObject:event]; diff --git a/cocos2dx/proj.linux/Makefile b/cocos2dx/proj.linux/Makefile index 9dfd50becb..ad3c5a3677 100644 --- a/cocos2dx/proj.linux/Makefile +++ b/cocos2dx/proj.linux/Makefile @@ -42,6 +42,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 \ diff --git a/cocos2dx/proj.linux/cocos2dx.mk b/cocos2dx/proj.linux/cocos2dx.mk index ae3150d0b7..522d3fb0bc 100644 --- a/cocos2dx/proj.linux/cocos2dx.mk +++ b/cocos2dx/proj.linux/cocos2dx.mk @@ -11,7 +11,7 @@ CCFLAGS += -MMD -Werror -Wno-deprecated-declarations -fPIC CXXFLAGS += -MMD -Werror -Wno-deprecated-declarations -fPIC -std=gnu++0x ARFLAGS = cr -DEFINES += -DLINUX +DEFINES += -DLINUX -DKEYBOARD_SUPPORT ifdef USE_BOX2D DEFINES += -DCC_ENABLE_BOX2D_INTEGRATION=1 diff --git a/cocos2dx/proj.mac/cocos2dx.xcodeproj/project.pbxproj.REMOVED.git-id b/cocos2dx/proj.mac/cocos2dx.xcodeproj/project.pbxproj.REMOVED.git-id index f27e968293..15cc6a0584 100644 --- a/cocos2dx/proj.mac/cocos2dx.xcodeproj/project.pbxproj.REMOVED.git-id +++ b/cocos2dx/proj.mac/cocos2dx.xcodeproj/project.pbxproj.REMOVED.git-id @@ -1 +1 @@ -5b8ea64c349dcc515312773df1d8d0d5d20abfbe \ No newline at end of file +4f421e1ed8425f53876db5971e3deac238edb4d3 \ No newline at end of file diff --git a/cocos2dx/support/zip_support/ioapi.h b/cocos2dx/support/zip_support/ioapi.h index 48b65c95b2..575f44ece4 100644 --- a/cocos2dx/support/zip_support/ioapi.h +++ b/cocos2dx/support/zip_support/ioapi.h @@ -48,6 +48,10 @@ namespace cocos2d { +#ifndef OF +#define OF _Z_OF +#endif + #if defined(USE_FILE32API) #define fopen64 fopen #define ftello64 ftell diff --git a/extensions/spine/extension.cpp b/extensions/spine/extension.cpp index 2f973c73f8..f8fd4ba1b9 100644 --- a/extensions/spine/extension.cpp +++ b/extensions/spine/extension.cpp @@ -60,10 +60,10 @@ char* _readFile (const char* path, int* length) { fseek(file, 0, SEEK_SET); data = MALLOC(char, *length); - fread(data, 1, *length, file); + size_t ret = fread(data, 1, *length, file); fclose(file); return data; } -}} // namespace cocos2d { namespace extension { \ No newline at end of file +}} // namespace cocos2d { namespace extension { diff --git a/samples/Cpp/TestCpp/Classes/FileUtilsTest/FileUtilsTest.cpp b/samples/Cpp/TestCpp/Classes/FileUtilsTest/FileUtilsTest.cpp index cd44855e93..3f227d131b 100644 --- a/samples/Cpp/TestCpp/Classes/FileUtilsTest/FileUtilsTest.cpp +++ b/samples/Cpp/TestCpp/Classes/FileUtilsTest/FileUtilsTest.cpp @@ -180,9 +180,11 @@ void TestSearchPath::onEnter() FILE* fp = fopen(fileName.c_str(), "wb"); if (fp) { - fwrite(szBuf, 1, strlen(szBuf), fp); + size_t ret = fwrite(szBuf, 1, strlen(szBuf), fp); + CCAssert(ret == 0, "fwrite function returned nonzero value"); fclose(fp); - CCLog("Writing file to writable path succeed."); + if (ret == 0) + CCLog("Writing file to writable path succeed."); } searchPaths.insert(searchPaths.begin(), writablePath); diff --git a/samples/Cpp/TestCpp/Classes/KeyboardTest/KeyboardTest.cpp b/samples/Cpp/TestCpp/Classes/KeyboardTest/KeyboardTest.cpp new file mode 100644 index 0000000000..c9f2b5f41f --- /dev/null +++ b/samples/Cpp/TestCpp/Classes/KeyboardTest/KeyboardTest.cpp @@ -0,0 +1,42 @@ +#include "KeyboardTest.h" + +KeyboardTest::KeyboardTest() +{ + CCSize s = CCDirector::sharedDirector()->getWinSize(); + CCLabelTTF* label = CCLabelTTF::create("Keyboard Test", "Arial", 28); + addChild(label, 0); + label->setPosition( ccp(s.width/2, s.height-50) ); + + setKeyboardEnabled(true); + + // create a label to display the tip string + m_pLabel = CCLabelTTF::create("Please press any key and see console log...", "Arial", 22); + m_pLabel->setPosition(ccp(s.width / 2, s.height / 2)); + addChild(m_pLabel, 0); + + m_pLabel->retain(); +} + +KeyboardTest::~KeyboardTest() +{ + m_pLabel->release(); +} + +void KeyboardTest::keyPressed(int keyCode) +{ + CCLog("Key with keycode %d pressed", keyCode); +} + +void KeyboardTest::keyReleased(int keyCode) +{ + CCLog("Key with keycode %d released", keyCode); +} + +void KeyboardTestScene::runThisTest() +{ + CCLayer* pLayer = new KeyboardTest(); + addChild(pLayer); + + CCDirector::sharedDirector()->replaceScene(this); + pLayer->release(); +} diff --git a/samples/Cpp/TestCpp/Classes/KeyboardTest/KeyboardTest.h b/samples/Cpp/TestCpp/Classes/KeyboardTest/KeyboardTest.h new file mode 100644 index 0000000000..5eb82cc240 --- /dev/null +++ b/samples/Cpp/TestCpp/Classes/KeyboardTest/KeyboardTest.h @@ -0,0 +1,26 @@ +#ifndef _KEYBOARD_TEST_H_ +#define _KEYBOARD_TEST_H_ + +#include "cocos2d.h" +#include "../testBasic.h" + +class KeyboardTest : public CCLayer +{ +public: + KeyboardTest(); + ~KeyboardTest(); + + virtual void keyPressed(int keyCode); + virtual void keyReleased(int keyCode); + +private: + CCLabelTTF* m_pLabel; +}; + +class KeyboardTestScene : public TestScene +{ +public: + virtual void runThisTest(); +}; + +#endif diff --git a/samples/Cpp/TestCpp/Classes/controller.cpp b/samples/Cpp/TestCpp/Classes/controller.cpp index d38f89c94f..aab735613c 100644 --- a/samples/Cpp/TestCpp/Classes/controller.cpp +++ b/samples/Cpp/TestCpp/Classes/controller.cpp @@ -47,6 +47,9 @@ struct { { "FileUtilsTest", []() { return new FileUtilsTestScene(); } }, { "FontTest", []() { return new FontTestScene(); } }, { "IntervalTest", [](){return new IntervalTestScene(); } }, +#ifdef KEYBOARD_SUPPORT + { "KeyboardTest", []() { return new KeyboardTestScene(); } }, +#endif #if (CC_TARGET_PLATFORM != CC_PLATFORM_BADA) { "KeypadTest", []() { return new KeypadTestScene(); } }, #endif diff --git a/samples/Cpp/TestCpp/Classes/tests.h b/samples/Cpp/TestCpp/Classes/tests.h index a1736b87b4..7b2b9b2464 100644 --- a/samples/Cpp/TestCpp/Classes/tests.h +++ b/samples/Cpp/TestCpp/Classes/tests.h @@ -29,6 +29,9 @@ #include "EffectsAdvancedTest/EffectsAdvancedTest.h" #include "AccelerometerTest/AccelerometerTest.h" #include "KeypadTest/KeypadTest.h" +#ifdef KEYBOARD_SUPPORT +#include "KeyboardTest/KeyboardTest.h" +#endif #include "PerformanceTest/PerformanceTest.h" #include "ZwoptexTest/ZwoptexTest.h" #include "CocosDenshionTest/CocosDenshionTest.h" diff --git a/samples/Cpp/TestCpp/proj.linux/Makefile b/samples/Cpp/TestCpp/proj.linux/Makefile index dd3db1b765..0583d5ef07 100644 --- a/samples/Cpp/TestCpp/proj.linux/Makefile +++ b/samples/Cpp/TestCpp/proj.linux/Makefile @@ -1,5 +1,7 @@ EXECUTABLE = TestCpp +DEFINES += -DKEYBOARD_SUPPORT + SOURCES = ../Classes/AccelerometerTest/AccelerometerTest.cpp \ ../Classes/ActionManagerTest/ActionManagerTest.cpp \ ../Classes/ActionsEaseTest/ActionsEaseTest.cpp \ @@ -52,6 +54,7 @@ SOURCES = ../Classes/AccelerometerTest/AccelerometerTest.cpp \ ../Classes/ExtensionsTest/NetworkTest/HttpClientTest.cpp \ ../Classes/FontTest/FontTest.cpp \ ../Classes/IntervalTest/IntervalTest.cpp \ + ../Classes/KeyboardTest/KeyboardTest.cpp \ ../Classes/KeypadTest/KeypadTest.cpp \ ../Classes/LabelTest/LabelTest.cpp \ ../Classes/LayerTest/LayerTest.cpp \