local MainScene = class("MainScene", function()
return display.newScene("MainScene")
end)
function MainScene:ctor()
cc.ui.UIPushButton.new("test/BlueButton.png", {scale9 = true})
:setButtonSize(160, 60)
:setButtonLabel(cc.ui.UILabel.new({text = "Next", size = 32}))
:onButtonClicked(function(event)
self:doPause()
end)
:align(display.CENTER, display.cx, display.cy)
:addTo(self)
end
function MainScene:doPause()
local renderTexture=cc.RenderTexture:create(display.width,display.height)
renderTexture:begin()
self:visit()
renderTexture:endToLua()
local GamePause=require("src.app.scenes.GamePause")
local gamePause=GamePause.new(renderTexture)
cc.Director:getInstance():pushScene(gamePause)
end
return MainScene
local GamePause = class("GamePause", function()
return display.newScene("GamePause")
end)
function GamePause:ctor(renderTexture)
local sp=cc.Sprite:createWithTexture(renderTexture:getSprite():getTexture()):addTo(self)
sp:setFlippedY(true)
sp:setColor(cc.c3b(125,125,125))
sp:setPosition(display.cx,display.cy)
cc.ui.UIPushButton.new("test/BlueButton.png", {scale9 = true})
:setButtonSize(160, 60)
:setButtonLabel(cc.ui.UILabel.new({text = "back", size = 32}))
:onButtonClicked(function(event)
self:back()
end)
:align(display.CENTER, display.cx, display.cy+100)
:addTo(self)
end
function GamePause:back()
cc.Director:getInstance():popScene();
end
return GamePause