From 902490c79a88475b82e60f05813f26bb8d8d6598 Mon Sep 17 00:00:00 2001 From: James Chen Date: Thu, 26 Dec 2013 04:07:15 -0800 Subject: [PATCH 1/2] Generates execute file in cocos root_dir/bin folder for HelloCpp. --- samples/Cpp/HelloCpp/CMakeLists.txt | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/samples/Cpp/HelloCpp/CMakeLists.txt b/samples/Cpp/HelloCpp/CMakeLists.txt index cb9c3f0fd1..f5af51def4 100644 --- a/samples/Cpp/HelloCpp/CMakeLists.txt +++ b/samples/Cpp/HelloCpp/CMakeLists.txt @@ -41,13 +41,11 @@ add_executable(${APP_NAME} ${SAMPLE_SRC} ) -#get our resources -add_custom_command(TARGET ${APP_NAME} PRE_BUILD - COMMAND ${CMAKE_COMMAND} -E copy_directory - ${CMAKE_CURRENT_SOURCE_DIR}/Resources ${CMAKE_CURRENT_BINARY_DIR}) - if(WIN32 AND MSVC) - + #get our resources + add_custom_command(TARGET ${APP_NAME} PRE_BUILD + COMMAND ${CMAKE_COMMAND} -E copy_directory + ${CMAKE_CURRENT_SOURCE_DIR}/Resources ${CMAKE_CURRENT_BINARY_DIR}) #get our dlls add_custom_command(TARGET ${APP_NAME} PRE_BUILD COMMAND ${CMAKE_COMMAND} -E copy @@ -62,6 +60,16 @@ if(WIN32 AND MSVC) #Visual Studio Defaults to wrong type set_target_properties(${APP_NAME} PROPERTIES LINK_FLAGS_DEBUG "/SUBSYSTEM:WINDOWS") set_target_properties(${APP_NAME} PROPERTIES LINK_FLAGS_RELEASE "/SUBSYSTEM:WINDOWS") +else() + set(APP_BIN_DIR "${CMAKE_SOURCE_DIR}/bin/${APP_NAME}") + + set_target_properties(${APP_NAME} PROPERTIES + RUNTIME_OUTPUT_DIRECTORY "${APP_BIN_DIR}") + + pre_build(${APP_NAME} + COMMAND ${CMAKE_COMMAND} -E remove_directory ${APP_BIN_DIR}/Resources + COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_SOURCE_DIR}/Resources ${APP_BIN_DIR}/Resources + ) endif() target_link_libraries(${APP_NAME} audio cocos2d) From 93ed5a4f0f209f0253d27a4b07d79098dcd00957 Mon Sep 17 00:00:00 2001 From: James Chen Date: Thu, 26 Dec 2013 04:07:36 -0800 Subject: [PATCH 2/2] long --> ssize_t for TableView callback. --- .../bindings/extension/jsb_cocos2dx_extension_manual.cpp | 6 +++--- .../lua/bindings/lua_cocos2dx_extension_manual.cpp | 8 ++++---- extensions/GUI/CCScrollView/CCTableView.h | 2 +- .../ExtensionsTest/TableViewTest/TableViewTestScene.cpp | 2 +- .../ExtensionsTest/TableViewTest/TableViewTestScene.h | 2 +- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/cocos/scripting/javascript/bindings/extension/jsb_cocos2dx_extension_manual.cpp b/cocos/scripting/javascript/bindings/extension/jsb_cocos2dx_extension_manual.cpp index 2371ebbad6..6deed71add 100644 --- a/cocos/scripting/javascript/bindings/extension/jsb_cocos2dx_extension_manual.cpp +++ b/cocos/scripting/javascript/bindings/extension/jsb_cocos2dx_extension_manual.cpp @@ -288,15 +288,15 @@ public: return NULL; } - virtual long numberOfCellsInTableView(TableView *table) + virtual ssize_t numberOfCellsInTableView(TableView *table) { jsval ret; bool ok = callJSDelegate(table, "numberOfCellsInTableView", ret); if (ok) { JSContext* cx = ScriptingCore::getInstance()->getGlobalContext(); - long count = 0; - JSBool isSucceed = jsval_to_long(cx, ret, &count); + ssize_t count = 0; + JSBool isSucceed = jsval_to_ssize(cx, ret, &count); if (isSucceed) return count; } return 0; diff --git a/cocos/scripting/lua/bindings/lua_cocos2dx_extension_manual.cpp b/cocos/scripting/lua/bindings/lua_cocos2dx_extension_manual.cpp index fd58ccd5ba..f0136d44bf 100644 --- a/cocos/scripting/lua/bindings/lua_cocos2dx_extension_manual.cpp +++ b/cocos/scripting/lua/bindings/lua_cocos2dx_extension_manual.cpp @@ -1026,7 +1026,7 @@ public: LUA_TableViewDataSource(){} virtual ~LUA_TableViewDataSource(){} - virtual Size tableCellSizeForIndex(TableView *table, long idx) + virtual Size tableCellSizeForIndex(TableView *table, ssize_t idx) { if (nullptr != table ) { @@ -1052,7 +1052,7 @@ public: return Size::ZERO; } - virtual TableViewCell* tableCellAtIndex(TableView *table, long idx) + virtual TableViewCell* tableCellAtIndex(TableView *table, ssize_t idx) { if (nullptr != table ) { @@ -1078,7 +1078,7 @@ public: return NULL; } - virtual long numberOfCellsInTableView(TableView *table) + virtual ssize_t numberOfCellsInTableView(TableView *table) { if (nullptr != table ) { @@ -1094,7 +1094,7 @@ public: Double* numbers = dynamic_cast(resultArray.getObjectAtIndex(0)); if (NULL != numbers) { - return (long)numbers->getValue(); + return (ssize_t)numbers->getValue(); } } } diff --git a/extensions/GUI/CCScrollView/CCTableView.h b/extensions/GUI/CCScrollView/CCTableView.h index c01b3eb4a2..649fc19175 100644 --- a/extensions/GUI/CCScrollView/CCTableView.h +++ b/extensions/GUI/CCScrollView/CCTableView.h @@ -129,7 +129,7 @@ public: * * @return number of cells */ - virtual long numberOfCellsInTableView(TableView *table) = 0; + virtual ssize_t numberOfCellsInTableView(TableView *table) = 0; }; diff --git a/samples/Cpp/TestCpp/Classes/ExtensionsTest/TableViewTest/TableViewTestScene.cpp b/samples/Cpp/TestCpp/Classes/ExtensionsTest/TableViewTest/TableViewTestScene.cpp index 24e3fb34d0..917225c14b 100644 --- a/samples/Cpp/TestCpp/Classes/ExtensionsTest/TableViewTest/TableViewTestScene.cpp +++ b/samples/Cpp/TestCpp/Classes/ExtensionsTest/TableViewTest/TableViewTestScene.cpp @@ -96,7 +96,7 @@ TableViewCell* TableViewTestLayer::tableCellAtIndex(TableView *table, ssize_t id return cell; } -long TableViewTestLayer::numberOfCellsInTableView(TableView *table) +ssize_t TableViewTestLayer::numberOfCellsInTableView(TableView *table) { return 20; } diff --git a/samples/Cpp/TestCpp/Classes/ExtensionsTest/TableViewTest/TableViewTestScene.h b/samples/Cpp/TestCpp/Classes/ExtensionsTest/TableViewTest/TableViewTestScene.h index fa4f8e6b05..fb406ef91d 100644 --- a/samples/Cpp/TestCpp/Classes/ExtensionsTest/TableViewTest/TableViewTestScene.h +++ b/samples/Cpp/TestCpp/Classes/ExtensionsTest/TableViewTest/TableViewTestScene.h @@ -20,7 +20,7 @@ public: virtual void tableCellTouched(cocos2d::extension::TableView* table, cocos2d::extension::TableViewCell* cell); virtual cocos2d::Size tableCellSizeForIndex(cocos2d::extension::TableView *table, ssize_t idx); virtual cocos2d::extension::TableViewCell* tableCellAtIndex(cocos2d::extension::TableView *table, ssize_t idx); - virtual long numberOfCellsInTableView(cocos2d::extension::TableView *table); + virtual ssize_t numberOfCellsInTableView(cocos2d::extension::TableView *table); }; #endif // __TABLEVIEWTESTSCENE_H__