1 Star 0 Fork 6

jilinge2/ggesoeasy

forked from gite-hub/ggesoeasy 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
main.lua 1.62 KB
一键复制 编辑 原始数据 按行查看 历史
cao-hub 提交于 2021-08-25 15:26 . .
__easy.commonpath = __easy.exepath .. 'bind/'
-- __easy.scriptpath = __easy.scriptpath .. 'script/'
-- print = printAsc
local 窗体宽, 窗体高, FPS = 640, 480, 60
if not gge_createEngine(窗体宽, 窗体高, FPS) then os.exit() end
local KEY = require('key')
local GGE = require('gge')
local 文字类 = require('font')
local 精灵类 = require('sprite')
local 测试文字 = 文字类()
测试文字:设坐标(10, 10)
local 辣稽精灵 = 精灵类('res/lj.png')
辣稽精灵:设坐标(窗体宽 / 2, 窗体高 / 2)
辣稽精灵:设锚点居中()
local function 改变精灵和文字(精灵, 文字)
local x = GGE:随机数(100, 窗体宽 - 100)
local y = GGE:随机数(100, 窗体高 - 100)
精灵:设坐标(x, y)
-- 0.62 ~ 1.5
精灵:设缩放(GGE:随机数(62, 150) / 100)
local r = GGE:随机数(0, 0xFF)
local g = GGE:随机数(0, 0xFF)
local b = GGE:随机数(0, 0xFF)
local 颜色 = GGE:颜色RGB(r, g, b)
文字:设颜色(颜色)
GGE:播放音效('res/闪现.wav')
end
print '按下空格试试'
function mainLoop(dt, x, y)
测试文字:设文字('帧率:' .. dt .. '\n鼠标:' .. string.format('%d %d', x, y))
if GGE:键盘按下(KEY.SPACE) then
改变精灵和文字(辣稽精灵, 测试文字)
elseif GGE:左键按下() then
print("左键按下")
elseif GGE:右键按下() then
print("右键按下")
else
local str = GGE:取字符串()
if str ~= string.empty then
print(str)
end
end
GGE:渲染开始()
测试文字:渲染()
辣稽精灵:渲染()
GGE:渲染结束()
end
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
C++
1
https://gitee.com/jilinge2/ggesoeasy.git
git@gitee.com:jilinge2/ggesoeasy.git
jilinge2
ggesoeasy
ggesoeasy
master

搜索帮助