mirror of https://github.com/axmolengine/axmol.git
issue #3708:Performance Test: data structure conversion in lua binding
This commit is contained in:
parent
e90e0b0c23
commit
3d0fabe08c
|
@ -105,7 +105,7 @@ int lua_print(lua_State * luastate)
|
|||
if (i!=nargs)
|
||||
t += "\t";
|
||||
}
|
||||
CCLOG("[LUA-print] %s", t.c_str());
|
||||
log("[LUA-print] %s", t.c_str());
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -157,6 +157,7 @@ bool LuaStack::init(void)
|
|||
register_all_cocos2dx_extension(_state);
|
||||
register_all_cocos2dx_deprecated(_state);
|
||||
register_cocos2dx_extension_CCBProxy(_state);
|
||||
register_cocos2dx_PerformanceStuctAndTable(_state);
|
||||
tolua_opengl_open(_state);
|
||||
register_all_cocos2dx_gui(_state);
|
||||
register_all_cocos2dx_studio(_state);
|
||||
|
|
|
@ -106,7 +106,7 @@ bool array_to_valuevector_deprecated(Array& array,ValueVector& valueVec)
|
|||
#define deprecatedFunctionTip(oldFun,newFun) CCLOG("%s was deprecated please use %s instead ",oldFun, newFun)
|
||||
static int tolua_Cocos2d_CCPoint_new00(lua_State* tolua_S)
|
||||
{
|
||||
deprecatedClassTip("CCPoint");
|
||||
// deprecatedClassTip("CCPoint");
|
||||
|
||||
#ifndef TOLUA_RELEASE
|
||||
tolua_Error tolua_err;
|
||||
|
@ -132,7 +132,7 @@ tolua_lerror:
|
|||
|
||||
static int tolua_Cocos2d_CCPoint_new00_local(lua_State* tolua_S)
|
||||
{
|
||||
deprecatedClassTip("CCPoint");
|
||||
// deprecatedClassTip("CCPoint");
|
||||
|
||||
#ifndef TOLUA_RELEASE
|
||||
tolua_Error tolua_err;
|
||||
|
@ -183,7 +183,7 @@ tolua_lerror:
|
|||
|
||||
static int tolua_Cocos2d_CCPoint_new01_local(lua_State* tolua_S)
|
||||
{
|
||||
deprecatedClassTip("CCPoint");
|
||||
// deprecatedClassTip("CCPoint");
|
||||
|
||||
tolua_Error tolua_err;
|
||||
if (
|
||||
|
@ -197,8 +197,10 @@ static int tolua_Cocos2d_CCPoint_new01_local(lua_State* tolua_S)
|
|||
{
|
||||
float x = ((float) tolua_tonumber(tolua_S,2,0));
|
||||
float y = ((float) tolua_tonumber(tolua_S,3,0));
|
||||
Point tolua_ret(x,y);
|
||||
point_to_luaval(tolua_S, tolua_ret);
|
||||
Point* tolua_ret = (Point*) Mtolua_new((Point)(x,y));
|
||||
tolua_pushusertype(tolua_S,(void*)tolua_ret,"CCPoint");
|
||||
tolua_register_gc(tolua_S,lua_gettop(tolua_S));
|
||||
//point_to_luaval(tolua_S, tolua_ret);
|
||||
}
|
||||
return 1;
|
||||
tolua_lerror:
|
||||
|
|
|
@ -1 +1 @@
|
|||
c5f8d4a3ea721a2ecb36fe381430b7ac6fad1740
|
||||
8102f7376c603c7a65f754d9d1f981c6a5c1ce2f
|
|
@ -55,6 +55,8 @@ TOLUA_API int register_all_cocos2dx_manual(lua_State* tolua_S);
|
|||
|
||||
TOLUA_API int register_cocos2dx_event_releated(lua_State* tolua_S);
|
||||
|
||||
TOLUA_API int register_cocos2dx_PerformanceStuctAndTable(lua_State* tolua_S);
|
||||
|
||||
struct LuaEventAccelerationData
|
||||
{
|
||||
void* acc;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
require "luaScript/PerformanceTest/PerformanceSpriteTest"
|
||||
|
||||
local MAX_COUNT = 5
|
||||
local MAX_COUNT = 7
|
||||
local LINE_SPACE = 40
|
||||
local kItemTagBasic = 1000
|
||||
|
||||
|
@ -10,7 +10,9 @@ local testsName =
|
|||
"PerformanceParticleTest",
|
||||
"PerformanceSpriteTest",
|
||||
"PerformanceTextureTest",
|
||||
"PerformanceTouchesTest"
|
||||
"PerformanceTouchesTest",
|
||||
"PerformanceStructOrLuaTable",
|
||||
"PerformanceTableConversionV3",
|
||||
}
|
||||
|
||||
local s = cc.Director:getInstance():getWinSize()
|
||||
|
@ -1020,7 +1022,7 @@ local function runSpriteTest()
|
|||
|
||||
local function Performanceout20(pSprite)
|
||||
local size = cc.Director:getInstance():getWinSize()
|
||||
|
||||
print("come in")
|
||||
if math.random() < 0.2 then
|
||||
pSprite:setPosition(cc.p((math.random(0,SpriteTestParam.kRandMax) % (size.width) ), (math.random(0,SpriteTestParam.kRandMax) % (size.height))))
|
||||
else
|
||||
|
@ -1652,6 +1654,469 @@ local function runTouchesTest()
|
|||
end
|
||||
|
||||
|
||||
local function runStructOrLuaTableTest()
|
||||
-- body
|
||||
local newscene = cc.Scene:create()
|
||||
local layer = cc.Layer:create()
|
||||
local s = cc.Director:getInstance():getWinSize()
|
||||
local scheduler = cc.Director:getInstance():getScheduler()
|
||||
local scheduleEntryID = 0
|
||||
local pushNum = 1500
|
||||
local socket = require("socket")
|
||||
local maxTime = 0.0
|
||||
local minTime = 99999
|
||||
local averageTime1 = 0.0
|
||||
local averageTime2 = 0.0
|
||||
local totalTime = 0.0
|
||||
local numberOfCalls = 0
|
||||
|
||||
local function GetTitle()
|
||||
return "Struct or LuaTable Performance Test"
|
||||
end
|
||||
|
||||
local function GetSubtitle()
|
||||
return "See console for results"
|
||||
end
|
||||
|
||||
local function initVar()
|
||||
maxTime = 0.0
|
||||
minTime = 99999
|
||||
averageTime1 = 0.0
|
||||
averageTime2 = 0.0
|
||||
totalTime = 0.0
|
||||
numberOfCalls = 0
|
||||
end
|
||||
|
||||
--Title
|
||||
local title = cc.LabelTTF:create(GetTitle(), "Arial", 28)
|
||||
layer:addChild(title, 1)
|
||||
title:setPosition(cc.p(s.width/2, s.height-32))
|
||||
title:setColor(cc.c3b(255,255,40))
|
||||
--Subtitle
|
||||
local subTitle = cc.LabelTTF:create(GetSubtitle(), "Thonburi", 16)
|
||||
layer:addChild(subTitle, 1)
|
||||
subTitle:setPosition(cc.p(s.width/2, s.height-80))
|
||||
|
||||
--"+","-" Menu
|
||||
local function onDecrease()
|
||||
pushNum = pushNum - 100
|
||||
if pushNum == 0 then
|
||||
pushNum = 100
|
||||
end
|
||||
local numLabel = tolua.cast(layer:getChildByTag(NodeChildrenTestParam.kTagInfoLayer), "cc.LabelTTF")
|
||||
local strNum = string.format("%d", pushNum)
|
||||
numLabel:setString(strNum)
|
||||
end
|
||||
|
||||
local function onIncrease()
|
||||
pushNum = pushNum + 100
|
||||
local numLabel = tolua.cast(layer:getChildByTag(NodeChildrenTestParam.kTagInfoLayer), "cc.LabelTTF")
|
||||
local strNum = string.format("%d", pushNum)
|
||||
numLabel:setString(strNum)
|
||||
end
|
||||
|
||||
cc.MenuItemFont:setFontSize(65)
|
||||
local decrease = cc.MenuItemFont:create(" - ")
|
||||
decrease:registerScriptTapHandler(onDecrease)
|
||||
decrease:setColor(cc.c3b(0,200,20))
|
||||
local increase = cc.MenuItemFont:create(" + ")
|
||||
increase:registerScriptTapHandler(onIncrease)
|
||||
increase:setColor(cc.c3b(0,200,20))
|
||||
|
||||
local menuAddOrSub = cc.Menu:create()
|
||||
menuAddOrSub:addChild(decrease)
|
||||
menuAddOrSub:addChild(increase)
|
||||
menuAddOrSub:alignItemsHorizontally()
|
||||
menuAddOrSub:setPosition(cc.p(s.width/2, s.height/2+15))
|
||||
layer:addChild(menuAddOrSub,1)
|
||||
|
||||
--num
|
||||
local numLabel = cc.LabelTTF:create("10000", "Marker Felt", 30)
|
||||
numLabel:setColor(cc.c3b(0,200,20))
|
||||
numLabel:setPosition(cc.p(s.width/2, s.height/2-15))
|
||||
layer:addChild(numLabel, 1, NodeChildrenTestParam.kTagInfoLayer)
|
||||
|
||||
--struct lua_table
|
||||
local function toggleCallback(tag, sender)
|
||||
decrease:setEnabled(true)
|
||||
increase:setEnabled(true)
|
||||
layer:unscheduleUpdate()
|
||||
scheduler:unscheduleScriptEntry(scheduleEntryID)
|
||||
initVar()
|
||||
end
|
||||
|
||||
cc.MenuItemFont:setFontSize(18)
|
||||
local structItem = cc.MenuItemFont:create("push struct object")
|
||||
local tableItem = cc.MenuItemFont:create("push table object")
|
||||
local toggleItem = cc.MenuItemToggle:create(structItem)
|
||||
toggleItem:registerScriptTapHandler(toggleCallback)
|
||||
toggleItem:addSubItem(tableItem)
|
||||
toggleItem:setAnchorPoint(cc.p(0.0, 0.5))
|
||||
toggleItem:setPosition(cc.p(VisibleRect:left()))
|
||||
local menuStructOrTable = cc.Menu:create(toggleItem)
|
||||
menuStructOrTable:setPosition(cc.p(0,0))
|
||||
layer:addChild(menuStructOrTable)
|
||||
|
||||
--setPosition,getPosition,Point
|
||||
local setPositionItem = cc.MenuItemFont:create("setPosition")
|
||||
local getPositionItem = cc.MenuItemFont:create("getPosition")
|
||||
local pointItem = cc.MenuItemFont:create("object")
|
||||
local funcToggleItem = cc.MenuItemToggle:create(setPositionItem)
|
||||
funcToggleItem:addSubItem(getPositionItem)
|
||||
funcToggleItem:addSubItem(pointItem)
|
||||
funcToggleItem:setAnchorPoint(cc.p(0.0, 0.5))
|
||||
funcToggleItem:setPosition(cc.p(VisibleRect:leftBottom().x, VisibleRect:leftBottom().y + 30))
|
||||
local funcMenu = cc.Menu:create(funcToggleItem)
|
||||
funcMenu:setPosition(cc.p(0, 0))
|
||||
layer:addChild(funcMenu)
|
||||
|
||||
local performanceObject = cc.PerformanceStuctAndTable:create()
|
||||
performanceObject:retain()
|
||||
|
||||
local function step(dt)
|
||||
print(string.format("push num: %d, avg1:%f, avg2:%f,min:%f, max:%f, total: %f, calls: %d",pushNum, averageTime1, averageTime2, minTime, maxTime, totalTime, numberOfCalls))
|
||||
end
|
||||
|
||||
local function profileEnd(startTime)
|
||||
local duration = socket.gettime() - startTime
|
||||
totalTime = totalTime + duration
|
||||
averageTime1 = (averageTime1 + duration) / 2
|
||||
averageTime2 = totalTime / numberOfCalls
|
||||
|
||||
if maxTime < duration then
|
||||
maxTime = duration
|
||||
end
|
||||
|
||||
if minTime > duration then
|
||||
minTime = duration
|
||||
end
|
||||
end
|
||||
|
||||
local function callSetPositionSturct()
|
||||
numberOfCalls = numberOfCalls + 1
|
||||
local startTime = socket.gettime()
|
||||
for i=1,pushNum do
|
||||
performanceObject:setPositionStruct(CCPoint(1,2))
|
||||
end
|
||||
profileEnd(startTime)
|
||||
end
|
||||
|
||||
local function callGetPositionStruct()
|
||||
numberOfCalls = numberOfCalls + 1
|
||||
local startTime = socket.gettime()
|
||||
for i=1,pushNum do
|
||||
local pt =performanceObject:getPositionStruct()
|
||||
end
|
||||
profileEnd(startTime)
|
||||
end
|
||||
|
||||
local function callPointStruct( ... )
|
||||
numberOfCalls = numberOfCalls + 1
|
||||
local startTime = socket.gettime()
|
||||
for i=1,pushNum do
|
||||
local pt = CCPoint(1,2)
|
||||
end
|
||||
profileEnd(startTime)
|
||||
end
|
||||
|
||||
local function callSetPositionTable()
|
||||
numberOfCalls = numberOfCalls + 1
|
||||
local startTime = socket.gettime()
|
||||
for i=1,pushNum do
|
||||
performanceObject:setPositionTable(cc.p(1,2))
|
||||
end
|
||||
profileEnd(startTime)
|
||||
end
|
||||
|
||||
local function callGetPositionTable()
|
||||
numberOfCalls = numberOfCalls + 1
|
||||
local startTime = socket.gettime()
|
||||
for i=1,pushNum do
|
||||
local pt = performanceObject:getPositionTable()
|
||||
end
|
||||
profileEnd(startTime)
|
||||
end
|
||||
|
||||
local function callTableObject()
|
||||
numberOfCalls = numberOfCalls + 1
|
||||
local startTime = socket.gettime()
|
||||
for i=1,pushNum do
|
||||
local pt = cc.p(1,2)
|
||||
end
|
||||
profileEnd(startTime)
|
||||
end
|
||||
|
||||
local function update(dt)
|
||||
local selectedItem = toggleItem:getSelectedIndex()
|
||||
local funcSelected = funcToggleItem:getSelectedIndex()
|
||||
if 0 == selectedItem then
|
||||
if 0 == funcSelected then
|
||||
callSetPositionSturct()
|
||||
elseif 1 == funcSelected then
|
||||
callGetPositionStruct()
|
||||
elseif 2 == funcSelected then
|
||||
callPointStruct()
|
||||
end
|
||||
elseif 1 == selectedItem then
|
||||
if 0 == funcSelected then
|
||||
callSetPositionTable()
|
||||
elseif 1 == funcSelected then
|
||||
callGetPositionTable()
|
||||
elseif 2 == funcSelected then
|
||||
callTableObject()
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local function onNodeEvent(tag)
|
||||
if tag == "exit" then
|
||||
self:unscheduleUpdate()
|
||||
scheduler:unscheduleScriptEntry(scheduleEntryID)
|
||||
end
|
||||
end
|
||||
|
||||
layer:registerScriptHandler(onNodeEvent)
|
||||
|
||||
|
||||
local function startCallback()
|
||||
initVar()
|
||||
decrease:setEnabled(false)
|
||||
increase:setEnabled(false)
|
||||
layer:unscheduleUpdate()
|
||||
layer:scheduleUpdateWithPriorityLua(update, 0)
|
||||
scheduler:unscheduleScriptEntry(scheduleEntryID)
|
||||
scheduleEntryID = scheduler:scheduleScriptFunc(step,2,false)
|
||||
end
|
||||
|
||||
local function stopCallback()
|
||||
decrease:setEnabled(true)
|
||||
increase:setEnabled(true)
|
||||
layer:unscheduleUpdate()
|
||||
scheduler:unscheduleScriptEntry(scheduleEntryID)
|
||||
end
|
||||
local startItem = cc.MenuItemFont:create("start")
|
||||
startItem:registerScriptTapHandler(startCallback)
|
||||
local stopItem = cc.MenuItemFont:create("stop")
|
||||
stopItem:registerScriptTapHandler(stopCallback)
|
||||
local startAndStop = cc.Menu:create(startItem,stopItem)
|
||||
startAndStop:alignItemsVertically()
|
||||
startAndStop:setPosition(VisibleRect:right().x - 50, VisibleRect:right().y)
|
||||
layer:addChild(startAndStop)
|
||||
|
||||
--back menu
|
||||
local menu = cc.Menu:create()
|
||||
CreatePerfomBasicLayerMenu(menu)
|
||||
menu:setPosition(cc.p(0, 0))
|
||||
layer:addChild(menu)
|
||||
|
||||
newscene:addChild(layer)
|
||||
return newscene
|
||||
end
|
||||
|
||||
|
||||
local function runTableConversionV3()
|
||||
-- body
|
||||
local newscene = cc.Scene:create()
|
||||
local layer = cc.Layer:create()
|
||||
local s = cc.Director:getInstance():getWinSize()
|
||||
local scheduler = cc.Director:getInstance():getScheduler()
|
||||
local scheduleEntryID = 0
|
||||
local pushNum = 1500
|
||||
local socket = require("socket")
|
||||
local maxTime = 0.0
|
||||
local minTime = 99999
|
||||
local averageTime1 = 0.0
|
||||
local averageTime2 = 0.0
|
||||
local totalTime = 0.0
|
||||
local numberOfCalls = 0
|
||||
|
||||
local function GetTitle()
|
||||
return "Table Conversion Performance Test"
|
||||
end
|
||||
|
||||
local function GetSubtitle()
|
||||
return "See console for results"
|
||||
end
|
||||
|
||||
local function initVar()
|
||||
maxTime = 0.0
|
||||
minTime = 99999
|
||||
averageTime1 = 0.0
|
||||
averageTime2 = 0.0
|
||||
totalTime = 0.0
|
||||
numberOfCalls = 0
|
||||
end
|
||||
|
||||
--Title
|
||||
local title = cc.LabelTTF:create(GetTitle(), "Arial", 28)
|
||||
layer:addChild(title, 1)
|
||||
title:setPosition(cc.p(s.width/2, s.height-32))
|
||||
title:setColor(cc.c3b(255,255,40))
|
||||
--Subtitle
|
||||
local subTitle = cc.LabelTTF:create(GetSubtitle(), "Thonburi", 16)
|
||||
layer:addChild(subTitle, 1)
|
||||
subTitle:setPosition(cc.p(s.width/2, s.height-80))
|
||||
|
||||
--"+","-" Menu
|
||||
local function onDecrease()
|
||||
pushNum = pushNum - 100
|
||||
if pushNum == 0 then
|
||||
pushNum = 100
|
||||
end
|
||||
local numLabel = tolua.cast(layer:getChildByTag(NodeChildrenTestParam.kTagInfoLayer), "cc.LabelTTF")
|
||||
local strNum = string.format("%d", pushNum)
|
||||
numLabel:setString(strNum)
|
||||
end
|
||||
|
||||
local function onIncrease()
|
||||
pushNum = pushNum + 100
|
||||
local numLabel = tolua.cast(layer:getChildByTag(NodeChildrenTestParam.kTagInfoLayer), "cc.LabelTTF")
|
||||
local strNum = string.format("%d", pushNum)
|
||||
numLabel:setString(strNum)
|
||||
end
|
||||
|
||||
cc.MenuItemFont:setFontSize(65)
|
||||
local decrease = cc.MenuItemFont:create(" - ")
|
||||
decrease:registerScriptTapHandler(onDecrease)
|
||||
decrease:setColor(cc.c3b(0,200,20))
|
||||
local increase = cc.MenuItemFont:create(" + ")
|
||||
increase:registerScriptTapHandler(onIncrease)
|
||||
increase:setColor(cc.c3b(0,200,20))
|
||||
|
||||
local menuAddOrSub = cc.Menu:create()
|
||||
menuAddOrSub:addChild(decrease)
|
||||
menuAddOrSub:addChild(increase)
|
||||
menuAddOrSub:alignItemsHorizontally()
|
||||
menuAddOrSub:setPosition(cc.p(s.width/2, s.height/2+15))
|
||||
layer:addChild(menuAddOrSub,1)
|
||||
|
||||
--num
|
||||
local numLabel = cc.LabelTTF:create("10000", "Marker Felt", 30)
|
||||
numLabel:setColor(cc.c3b(0,200,20))
|
||||
numLabel:setPosition(cc.p(s.width/2, s.height/2-15))
|
||||
layer:addChild(numLabel, 1, NodeChildrenTestParam.kTagInfoLayer)
|
||||
|
||||
--setPosition,getPosition,Point
|
||||
cc.MenuItemFont:setFontSize(18)
|
||||
local setPositionItem = cc.MenuItemFont:create("setPosition")
|
||||
local getPositionItem = cc.MenuItemFont:create("getPosition")
|
||||
local pointItem = cc.MenuItemFont:create("object")
|
||||
local funcToggleItem = cc.MenuItemToggle:create(setPositionItem)
|
||||
funcToggleItem:addSubItem(getPositionItem)
|
||||
funcToggleItem:addSubItem(pointItem)
|
||||
funcToggleItem:setAnchorPoint(cc.p(0.0, 0.5))
|
||||
funcToggleItem:setPosition(cc.p(VisibleRect:left()))
|
||||
local funcMenu = cc.Menu:create(funcToggleItem)
|
||||
funcMenu:setPosition(cc.p(0, 0))
|
||||
layer:addChild(funcMenu)
|
||||
|
||||
local testNode = cc.Node:create()
|
||||
layer:addChild(testNode)
|
||||
|
||||
local function step(dt)
|
||||
print(string.format("push num: %d, avg1:%f, avg2:%f,min:%f, max:%f, total: %f, calls: %d",pushNum, averageTime1, averageTime2, minTime, maxTime, totalTime, numberOfCalls))
|
||||
end
|
||||
|
||||
local function profileEnd(startTime)
|
||||
local duration = socket.gettime() - startTime
|
||||
totalTime = totalTime + duration
|
||||
averageTime1 = (averageTime1 + duration) / 2
|
||||
averageTime2 = totalTime / numberOfCalls
|
||||
|
||||
if maxTime < duration then
|
||||
maxTime = duration
|
||||
end
|
||||
|
||||
if minTime > duration then
|
||||
minTime = duration
|
||||
end
|
||||
end
|
||||
|
||||
local function callSetPosition()
|
||||
numberOfCalls = numberOfCalls + 1
|
||||
local startTime = socket.gettime()
|
||||
for i=1,pushNum do
|
||||
testNode:setPosition(cc.p(1,2))
|
||||
end
|
||||
profileEnd(startTime)
|
||||
end
|
||||
|
||||
local function callGetPosition()
|
||||
numberOfCalls = numberOfCalls + 1
|
||||
local startTime = socket.gettime()
|
||||
for i=1,pushNum do
|
||||
local x,y = testNode:getPosition()
|
||||
end
|
||||
profileEnd(startTime)
|
||||
end
|
||||
|
||||
local function callTableObject()
|
||||
numberOfCalls = numberOfCalls + 1
|
||||
local startTime = socket.gettime()
|
||||
for i=1,pushNum do
|
||||
local pt = cc.p(1,2)
|
||||
end
|
||||
profileEnd(startTime)
|
||||
end
|
||||
|
||||
local function update(dt)
|
||||
|
||||
local funcSelected = funcToggleItem:getSelectedIndex()
|
||||
if 0 == funcSelected then
|
||||
callSetPosition()
|
||||
elseif 1 == funcSelected then
|
||||
callGetPosition()
|
||||
elseif 2 == funcSelected then
|
||||
callTableObject()
|
||||
end
|
||||
end
|
||||
|
||||
local function onNodeEvent(tag)
|
||||
if tag == "exit" then
|
||||
self:unscheduleUpdate()
|
||||
scheduler:unscheduleScriptEntry(scheduleEntryID)
|
||||
end
|
||||
end
|
||||
|
||||
layer:registerScriptHandler(onNodeEvent)
|
||||
|
||||
|
||||
local function startCallback()
|
||||
initVar()
|
||||
decrease:setEnabled(false)
|
||||
increase:setEnabled(false)
|
||||
layer:unscheduleUpdate()
|
||||
layer:scheduleUpdateWithPriorityLua(update, 0)
|
||||
scheduler:unscheduleScriptEntry(scheduleEntryID)
|
||||
scheduleEntryID = scheduler:scheduleScriptFunc(step,2,false)
|
||||
end
|
||||
|
||||
local function stopCallback()
|
||||
decrease:setEnabled(true)
|
||||
increase:setEnabled(true)
|
||||
layer:unscheduleUpdate()
|
||||
scheduler:unscheduleScriptEntry(scheduleEntryID)
|
||||
end
|
||||
local startItem = cc.MenuItemFont:create("start")
|
||||
startItem:registerScriptTapHandler(startCallback)
|
||||
local stopItem = cc.MenuItemFont:create("stop")
|
||||
stopItem:registerScriptTapHandler(stopCallback)
|
||||
local startAndStop = cc.Menu:create(startItem,stopItem)
|
||||
startAndStop:alignItemsVertically()
|
||||
startAndStop:setPosition(VisibleRect:right().x - 50, VisibleRect:right().y)
|
||||
layer:addChild(startAndStop)
|
||||
|
||||
--back menu
|
||||
local menu = cc.Menu:create()
|
||||
CreatePerfomBasicLayerMenu(menu)
|
||||
menu:setPosition(cc.p(0, 0))
|
||||
layer:addChild(menu)
|
||||
|
||||
newscene:addChild(layer)
|
||||
return newscene
|
||||
end
|
||||
|
||||
|
||||
------------------------
|
||||
--
|
||||
------------------------
|
||||
|
@ -1661,7 +2126,9 @@ local CreatePerformancesTestTable =
|
|||
runParticleTest,
|
||||
runSpriteTest,
|
||||
runTextureTest,
|
||||
runTouchesTest
|
||||
runTouchesTest,
|
||||
runStructOrLuaTableTest,
|
||||
runTableConversionV3,
|
||||
}
|
||||
|
||||
local function CreatePerformancesTestScene(nPerformanceNo)
|
||||
|
@ -1687,7 +2154,7 @@ local function PerformanceMainLayer()
|
|||
for i = 1, MAX_COUNT do
|
||||
local item = cc.MenuItemFont:create(testsName[i])
|
||||
item:registerScriptTapHandler(menuCallback)
|
||||
item:setPosition(s.width / 2, s.height - (i + 1) * LINE_SPACE)
|
||||
item:setPosition(s.width / 2, s.height - i * LINE_SPACE)
|
||||
menu:addChild(item, kItemTagBasic + i)
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in New Issue