quick cocos 暂停场景
2024-10-18 13:18:16
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
最新文章
- Linux 命令积累
- 取得系统属性和Java环境
- Res_Orders_01需求分析
- jstack简单使用,定位死循环、线程阻塞、死锁等问题
- This in JavaScript
- Zookeeper Invalid config, exiting abnormally
- YTU 3004: 栈的基本运算(栈和队列)
- spark HA 安装配置和使用(spark1.2-cdh5.3)
- API接口测试01理论
- linux 定时下载github最新代码
- TsinsenA1221 大楼【矩阵快速幂】
- LeetCode 145 二叉树的后序遍历(非递归)
- ValueError: attempted relative import beyond top-level package
- Laravel API Tutorial: How to Build and Test a RESTful API
- python学习笔记:python异常的调用原理
- Retrofit提交Json
- LINQ to Entities 不识别方法“System.String get_Item(Int32)”,因此该方法无法转换为存储表达式。
- JAVA中解决Filter过滤掉css,js,图片文件等问题
- <;转载>;iTerm2使用技巧
- 寻找数组中第K大的数
热门文章
- [Effective JavaScript 笔记]第2章:变量作用域--个人总结
- Delphi开发Windows服务程序
- APScheduler &mdash;&mdash; Python化的Cron
- 暑假热身 B. 下载测速
- 再论pyquery
- centos rm -rf 恢复删除的文件
- linux shell 字符串操作详解 (长度,读取,替换,截取,连接,对比,删除,位置 )
- linux下查看文件夹的大小
- ubuntu安装到选择位置时闪退
- maven No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK?