use no border policy (#17004)

This commit is contained in:
minggo 2016-12-13 16:31:31 +08:00 committed by GitHub
parent 80954d392d
commit ba7c977111
2 changed files with 11 additions and 11 deletions

View File

@ -30,7 +30,7 @@ if screenSize.height > 320 then
cc.Director:getInstance():setContentScaleFactor(resourceSize.height/designSize.height) cc.Director:getInstance():setContentScaleFactor(resourceSize.height/designSize.height)
end end
glView:setDesignResolutionSize(designSize.width, designSize.height, cc.ResolutionPolicy.FIXED_HEIGHT) glView:setDesignResolutionSize(designSize.width, designSize.height, cc.ResolutionPolicy.NO_BORDER)
local fileUtils = cc.FileUtils:getInstance() local fileUtils = cc.FileUtils:getInstance()
local function addSearchPath(resPrefix, height) local function addSearchPath(resPrefix, height)

View File

@ -75,7 +75,7 @@ end
function Helper.initWithLayer(layer) function Helper.initWithLayer(layer)
Helper.currentLayer = layer Helper.currentLayer = layer
local size = cc.Director:getInstance():getWinSize() local size = cc.Director:getInstance():getOpenGLView():getVisibleRect()
Helper.titleLabel = cc.Label:createWithTTF("", s_arialPath, 28) Helper.titleLabel = cc.Label:createWithTTF("", s_arialPath, 28)
Helper.titleLabel:setAnchorPoint(cc.p(0.5, 0.5)) Helper.titleLabel:setAnchorPoint(cc.p(0.5, 0.5))
layer:addChild(Helper.titleLabel, 1) layer:addChild(Helper.titleLabel, 1)
@ -99,9 +99,9 @@ function Helper.initWithLayer(layer)
menu:addChild(item2) menu:addChild(item2)
menu:addChild(item3) menu:addChild(item3)
menu:setPosition(cc.p(0, 0)) menu:setPosition(cc.p(0, 0))
item1:setPosition(cc.p(size.width / 2 - item2:getContentSize().width * 2, item2:getContentSize().height / 2)) item1:setPosition(cc.p(size.width / 2 - item2:getContentSize().width * 2, size.y + item2:getContentSize().height / 2))
item2:setPosition(cc.p(size.width / 2, item2:getContentSize().height / 2)) item2:setPosition(cc.p(size.width / 2, size.y + item2:getContentSize().height / 2))
item3:setPosition(cc.p(size.width / 2 + item2:getContentSize().width * 2, item2:getContentSize().height / 2)) item3:setPosition(cc.p(size.width / 2 + item2:getContentSize().width * 2, size.y + item2:getContentSize().height / 2))
layer:addChild(menu, 1) layer:addChild(menu, 1)
local background = cc.Layer:create() local background = cc.Layer:create()
@ -124,11 +124,11 @@ function CreateBackMenuItem()
local MenuItem = cc.MenuItemLabel:create(label) local MenuItem = cc.MenuItemLabel:create(label)
MenuItem:registerScriptTapHandler(MainMenuCallback) MenuItem:registerScriptTapHandler(MainMenuCallback)
local s = cc.Director:getInstance():getWinSize() local s = cc.Director:getInstance():getOpenGLView():getVisibleRect()
local Menu = cc.Menu:create() local Menu = cc.Menu:create()
Menu:addChild(MenuItem) Menu:addChild(MenuItem)
Menu:setPosition(0, 0) Menu:setPosition(0, 0)
MenuItem:setPosition(s.width - 50, 25) MenuItem:setPosition(s.width - 50, s.y + 25)
return Menu return Menu
end end
@ -179,7 +179,7 @@ function TestCastScene.newScene()
end end
function TestCastScene.initWithLayer(scene) function TestCastScene.initWithLayer(scene)
local size = cc.Director:getInstance():getWinSize() local size = cc.Director:getInstance():getOpenGLView():getVisibleRect()
TestCastScene.titleLabel = cc.Label:createWithTTF("", s_arialPath, 28) TestCastScene.titleLabel = cc.Label:createWithTTF("", s_arialPath, 28)
TestCastScene.titleLabel:setAnchorPoint(cc.p(0.5, 0.5)) TestCastScene.titleLabel:setAnchorPoint(cc.p(0.5, 0.5))
scene:addChild(TestCastScene.titleLabel, 1) scene:addChild(TestCastScene.titleLabel, 1)
@ -203,9 +203,9 @@ function TestCastScene.initWithLayer(scene)
menu:addChild(item2) menu:addChild(item2)
menu:addChild(item3) menu:addChild(item3)
menu:setPosition(cc.p(0, 0)) menu:setPosition(cc.p(0, 0))
item1:setPosition(cc.p(size.width / 2 - item2:getContentSize().width * 2, item2:getContentSize().height / 2)) item1:setPosition(cc.p(size.width / 2 - item2:getContentSize().width * 2, size.y + item2:getContentSize().height / 2))
item2:setPosition(cc.p(size.width / 2, item2:getContentSize().height / 2)) item2:setPosition(cc.p(size.width / 2, size.y + item2:getContentSize().height / 2))
item3:setPosition(cc.p(size.width / 2 + item2:getContentSize().width * 2, item2:getContentSize().height / 2)) item3:setPosition(cc.p(size.width / 2 + item2:getContentSize().width * 2, size.y + item2:getContentSize().height / 2))
scene:addChild(menu, 1) scene:addChild(menu, 1)
local background = cc.Layer:create() local background = cc.Layer:create()