From 30b3a6f8c3a2df3f43277873a4fc8261bd708cdd Mon Sep 17 00:00:00 2001 From: Dhilan007 Date: Mon, 30 Dec 2013 14:21:32 +0800 Subject: [PATCH 1/2] fix compiling error on liblua VS 2012 project --- .../lua/bindings/LuaScriptHandlerMgr.cpp | 4 ++-- cocos/scripting/lua/bindings/liblua.vcxproj | 9 +++++++- .../lua/bindings/liblua.vcxproj.filters | 21 +++++++++++++++++++ .../lua_cocos2dx_manual.cpp.REMOVED.git-id | 2 +- 4 files changed, 32 insertions(+), 4 deletions(-) diff --git a/cocos/scripting/lua/bindings/LuaScriptHandlerMgr.cpp b/cocos/scripting/lua/bindings/LuaScriptHandlerMgr.cpp index 947efb9a4b..6ed20bf4ba 100644 --- a/cocos/scripting/lua/bindings/LuaScriptHandlerMgr.cpp +++ b/cocos/scripting/lua/bindings/LuaScriptHandlerMgr.cpp @@ -276,7 +276,7 @@ static int tolua_Cocos2d_ScriptHandlerMgr_registerScriptHandler00(lua_State* tol } #endif LUA_FUNCTION handler = toluafix_ref_function(tolua_S,3,0); - ScriptHandlerMgr::HandlerType handlerType = (ScriptHandlerMgr::HandlerType)tolua_tonumber(tolua_S, 4, 0); + ScriptHandlerMgr::HandlerType handlerType = (ScriptHandlerMgr::HandlerType)(int)tolua_tonumber(tolua_S, 4, 0); scriptHanlderMgr->addObjectHandler(tolua_tousertype(tolua_S, 2, 0), handler,handlerType); } return 1; @@ -308,7 +308,7 @@ static int tolua_Cocos2d_ScriptHandlerMgr_unregisterScriptHandler00(lua_State* t return 0; } #endif - ScriptHandlerMgr::HandlerType handlerType = (ScriptHandlerMgr::HandlerType)tolua_tonumber(tolua_S, 3, 0); + ScriptHandlerMgr::HandlerType handlerType = (ScriptHandlerMgr::HandlerType)(int)tolua_tonumber(tolua_S, 3, 0); scriptHanlderMgr->removeObjectHandler(tolua_tousertype(tolua_S, 2, 0), handlerType); } return 1; diff --git a/cocos/scripting/lua/bindings/liblua.vcxproj b/cocos/scripting/lua/bindings/liblua.vcxproj index 7f5c6e4894..5006e34a8e 100644 --- a/cocos/scripting/lua/bindings/liblua.vcxproj +++ b/cocos/scripting/lua/bindings/liblua.vcxproj @@ -64,7 +64,7 @@ Disabled - $(ProjectDir);$(ProjectDir)..\..\..;$(EngineRoot);$(EngineRoot)cocos\editor-support;$(EngineRoot)cocos\editor-support\cocostudio;$(EngineRoot)cocos\editor-support\cocosbuilder;$(EngineRoot)cocos\audio\include;$(EngineRoot)extensions;$(EngineRoot)extensions\network;$(EngineRoot)external;$(EngineRoot)external\libwebsockets\win32\include;$(EngineRoot)external\lua\tolua;$(EngineRoot)external\lua\luajit\include;$(EngineRoot)cocos\scripting\auto-generated\lua-bindings;$(EngineRoot)cocos\gui;%(AdditionalIncludeDirectories) + $(ProjectDir);$(ProjectDir)..\..\..;$(EngineRoot);$(EngineRoot)cocos\editor-support;$(EngineRoot)cocos\editor-support\cocostudio;$(EngineRoot)cocos\editor-support\cocosbuilder;$(EngineRoot)cocos\editor-support\spine;$(EngineRoot)cocos\audio\include;$(EngineRoot)extensions;$(EngineRoot)extensions\network;$(EngineRoot)external;$(EngineRoot)external\libwebsockets\win32\include;$(EngineRoot)external\lua\tolua;$(EngineRoot)external\lua\luajit\include;$(EngineRoot)cocos\scripting\auto-generated\lua-bindings;$(EngineRoot)cocos\gui;%(AdditionalIncludeDirectories) WIN32;_WINDOWS;_DEBUG;COCOS2D_DEBUG=1;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) false EnableFastChecks @@ -131,6 +131,7 @@ xcopy /Y /Q "$(ProjectDir)..\..\..\..\external\lua\luajit\prebuilt\win32\*.*" "$ + @@ -141,10 +142,12 @@ xcopy /Y /Q "$(ProjectDir)..\..\..\..\external\lua\luajit\prebuilt\win32\*.*" "$ + + @@ -158,6 +161,7 @@ xcopy /Y /Q "$(ProjectDir)..\..\..\..\external\lua\luajit\prebuilt\win32\*.*" "$ + @@ -168,10 +172,12 @@ xcopy /Y /Q "$(ProjectDir)..\..\..\..\external\lua\luajit\prebuilt\win32\*.*" "$ + + @@ -179,6 +185,7 @@ xcopy /Y /Q "$(ProjectDir)..\..\..\..\external\lua\luajit\prebuilt\win32\*.*" "$ + diff --git a/cocos/scripting/lua/bindings/liblua.vcxproj.filters b/cocos/scripting/lua/bindings/liblua.vcxproj.filters index 78d323eeb6..5f7bbe6fb6 100644 --- a/cocos/scripting/lua/bindings/liblua.vcxproj.filters +++ b/cocos/scripting/lua/bindings/liblua.vcxproj.filters @@ -90,6 +90,15 @@ cocos2dx_support + + cocos2dx_support\generated + + + cocos2dx_support + + + cocos2dx_support + @@ -167,6 +176,15 @@ cocos2dx_support + + cocos2dx_support\generated + + + cocos2dx_support + + + cocos2dx_support + @@ -175,5 +193,8 @@ cocos2dx_support\generated + + cocos2dx_support\generated + \ No newline at end of file diff --git a/cocos/scripting/lua/bindings/lua_cocos2dx_manual.cpp.REMOVED.git-id b/cocos/scripting/lua/bindings/lua_cocos2dx_manual.cpp.REMOVED.git-id index 3a902b8339..368292552d 100644 --- a/cocos/scripting/lua/bindings/lua_cocos2dx_manual.cpp.REMOVED.git-id +++ b/cocos/scripting/lua/bindings/lua_cocos2dx_manual.cpp.REMOVED.git-id @@ -1 +1 @@ -91928b80f0e66732d837b163cd32fd7613369715 \ No newline at end of file +c3e1d45b75519a265427c1b2479e2bf43305fc1d \ No newline at end of file From 1962dfa52d143bc72638a3fa57129f74a8e23d87 Mon Sep 17 00:00:00 2001 From: "Huabing.Xu" Date: Mon, 30 Dec 2013 14:43:18 +0800 Subject: [PATCH 2/2] migration transition page turn to new renderer --- cocos/2d/CCTransitionPageTurn.cpp | 36 ++++++++++++++++++++++++------- cocos/2d/CCTransitionPageTurn.h | 7 ++++++ 2 files changed, 35 insertions(+), 8 deletions(-) diff --git a/cocos/2d/CCTransitionPageTurn.cpp b/cocos/2d/CCTransitionPageTurn.cpp index f7b0188143..a4bc2fbe15 100644 --- a/cocos/2d/CCTransitionPageTurn.cpp +++ b/cocos/2d/CCTransitionPageTurn.cpp @@ -30,6 +30,7 @@ THE SOFTWARE. #include "CCActionGrid.h" #include "CCActionPageTurn3D.h" #include "CCNodeGrid.h" +#include "renderer/CCRenderer.h" NS_CC_BEGIN @@ -78,24 +79,43 @@ void TransitionPageTurn::sceneOrder() _isInSceneOnTop = _back; } +void TransitionPageTurn::onEnablePolygonOffset() +{ + glEnable(GL_POLYGON_OFFSET_FILL); + glPolygonOffset(POLYGON_OFFSET_FACTOR, POLYGON_OFFSET_UNITS); +} + +void TransitionPageTurn::onDisablePolygonOffset() +{ + glDisable(GL_POLYGON_OFFSET_FILL); + glPolygonOffset(0, 0); +} + void TransitionPageTurn::draw() { Scene::draw(); if( _isInSceneOnTop ) { _outSceneProxy->visit(); - glEnable(GL_POLYGON_OFFSET_FILL); - glPolygonOffset(POLYGON_OFFSET_FACTOR, POLYGON_OFFSET_UNITS); + _enableOffsetCmd.init(0, _vertexZ); + _enableOffsetCmd.func = CC_CALLBACK_0(TransitionPageTurn::onEnablePolygonOffset, this); + Director::getInstance()->getRenderer()->addCommand(&_enableOffsetCmd); _inSceneProxy->visit(); - glDisable(GL_POLYGON_OFFSET_FILL); - glPolygonOffset(0, 0); + _disableOffsetCmd.init(0, _vertexZ); + _disableOffsetCmd.func = CC_CALLBACK_0(TransitionPageTurn::onDisablePolygonOffset, this); + Director::getInstance()->getRenderer()->addCommand(&_disableOffsetCmd); } else { _inSceneProxy->visit(); - glEnable(GL_POLYGON_OFFSET_FILL); - glPolygonOffset(POLYGON_OFFSET_FACTOR, POLYGON_OFFSET_UNITS); + + _enableOffsetCmd.init(0, _vertexZ); + _enableOffsetCmd.func = CC_CALLBACK_0(TransitionPageTurn::onEnablePolygonOffset, this); + Director::getInstance()->getRenderer()->addCommand(&_enableOffsetCmd); + _outSceneProxy->visit(); - glDisable(GL_POLYGON_OFFSET_FILL); - glPolygonOffset(0, 0); + + _disableOffsetCmd.init(0, _vertexZ); + _disableOffsetCmd.func = CC_CALLBACK_0(TransitionPageTurn::onDisablePolygonOffset, this); + Director::getInstance()->getRenderer()->addCommand(&_disableOffsetCmd); } } diff --git a/cocos/2d/CCTransitionPageTurn.h b/cocos/2d/CCTransitionPageTurn.h index 7230f2bd51..f21598c8f2 100644 --- a/cocos/2d/CCTransitionPageTurn.h +++ b/cocos/2d/CCTransitionPageTurn.h @@ -27,6 +27,7 @@ THE SOFTWARE. #define __CCPAGE_TURN_TRANSITION_H__ #include "CCTransition.h" +#include "renderer/CCCustomCommand.h" NS_CC_BEGIN @@ -96,6 +97,12 @@ protected: bool _back; static float POLYGON_OFFSET_FACTOR; static float POLYGON_OFFSET_UNITS; + +protected: + CustomCommand _enableOffsetCmd; + CustomCommand _disableOffsetCmd; + void onEnablePolygonOffset(); + void onDisablePolygonOffset(); }; // end of transition group