Fix the bugs that title and button disappeared because of camera setting

This commit is contained in:
samuele3hu 2015-04-14 15:40:12 +08:00
parent b2c3628aee
commit dd3b6ced34
2 changed files with 9 additions and 7 deletions

View File

@ -1032,7 +1032,6 @@ end
----------------------------------------
local Sprite3DCubeMapTest = class("Sprite3DCubeMapTest", function ()
local layer = cc.Layer:create()
Helper.initWithLayer(layer)
return layer
end)
@ -1045,9 +1044,6 @@ function Sprite3DCubeMapTest:ctor()
end
function Sprite3DCubeMapTest:init()
Helper.titleLabel:setString(self:title())
Helper.subtitleLabel:setString(self:subtitle())
self:registerScriptHandler(function (event)
if event == "enter" then
self:onEnter()
@ -1068,6 +1064,9 @@ end
function Sprite3DCubeMapTest:onEnter()
local s = cc.Director:getInstance():getWinSize()
self:addNewSpriteWithCoords(cc.p(s.width / 2, s.height / 2))
Helper.initWithLayer(self)
Helper.titleLabel:setString(self:title())
Helper.subtitleLabel:setString(self:subtitle())
end
function Sprite3DCubeMapTest:onExit()

View File

@ -5,7 +5,7 @@ require "cocos.3d.3dConstants"
----------------------------------------
local TerrainSimple = class("TerrainSimple", function ()
local layer = cc.Layer:create()
Helper.initWithLayer(layer)
return layer
end)
@ -15,8 +15,7 @@ function TerrainSimple:ctor()
end
function TerrainSimple:init()
Helper.titleLabel:setString(self:title())
Helper.subtitleLabel:setString(self:subtitle())
local visibleSize = cc.Director:getInstance():getVisibleSize()
@ -26,6 +25,10 @@ function TerrainSimple:init()
self._camera:setPosition3D(cc.vec3(-1, 1.6, 4))
self:addChild(self._camera)
Helper.initWithLayer(self)
Helper.titleLabel:setString(self:title())
Helper.subtitleLabel:setString(self:subtitle())
local detailMapR = { _detailMapSrc = "TerrainTest/dirt.jpg", _detailMapSize = 35}
local detailMapG = { _detailMapSrc = "TerrainTest/Grass2.jpg", _detailMapSize = 35}
local detailMapB = { _detailMapSrc = "TerrainTest/road.jpg", _detailMapSize = 35}