...
 
Commits (13)
    https://gitcode.net/GGELUA/GGELUA2/-/commit/391a21f85176c5dd28113cbb353702cdec5b4634 异形 2022-04-26T21:23:44+08:00 baidwwy baidwwy@vip.qq.com https://gitcode.net/GGELUA/GGELUA2/-/commit/cb8104cc2447938e6181e7144bb2ab35090cb287 置透明色 2022-04-26T21:24:00+08:00 baidwwy baidwwy@vip.qq.com https://gitcode.net/GGELUA/GGELUA2/-/commit/bf0af684142beba60860ac07d9d0859814e5adf5 异形窗口 2022-04-27T02:25:28+08:00 baidwwy baidwwy@vip.qq.com https://gitcode.net/GGELUA/GGELUA2/-/commit/faba17f808dc08e2f2fd41d41a375746abc5e527 DOL 2022-04-27T02:28:28+08:00 baidwwy baidwwy@vip.qq.com https://gitcode.net/GGELUA/GGELUA2/-/commit/799b744735290c15ccaacdc335402bd05c58e158 圆形小地图 2022-04-27T02:34:33+08:00 baidwwy baidwwy@vip.qq.com https://gitcode.net/GGELUA/GGELUA2/-/commit/a2afcb00a4e0c88ac4e0b45640bbdfc08deafd96 贪吃蛇 2022-04-27T02:39:42+08:00 baidwwy baidwwy@vip.qq.com https://gitcode.net/GGELUA/GGELUA2/-/commit/ad84ea0f50659edace7280ebe2bb9b93656684b3 默认黑色 2022-04-28T05:13:24+08:00 baidwwy baidwwy@vip.qq.com https://gitcode.net/GGELUA/GGELUA2/-/commit/c126c85631c2f2a3a5802529f5a70a5739d68f6d 安卓 2022-04-28T05:56:01+08:00 baidwwy baidwwy@vip.qq.com https://gitcode.net/GGELUA/GGELUA2/-/commit/445dc51894dae24204df7f5f358751e6eb1e1eb2 FPS 2022-04-28T06:11:01+08:00 baidwwy baidwwy@vip.qq.com https://gitcode.net/GGELUA/GGELUA2/-/commit/68e405d2e7762acba41dd9f94ac01279391a9a2c 安卓 2022-04-28T06:11:31+08:00 baidwwy baidwwy@vip.qq.com https://gitcode.net/GGELUA/GGELUA2/-/commit/3d1ca385070951846db2dddb81faa0522f047513 安卓 2022-04-28T06:13:11+08:00 baidwwy baidwwy@vip.qq.com https://gitcode.net/GGELUA/GGELUA2/-/commit/77d55ed1d0d72f5ff9b59e292ca93147495db2eb 安卓 2022-04-28T06:14:53+08:00 baidwwy baidwwy@vip.qq.com https://gitcode.net/GGELUA/GGELUA2/-/commit/709fac22a19c743fd4dd00ab62e3e00fcd35e115 优化 2022-04-28T06:18:51+08:00 baidwwy baidwwy@vip.qq.com
...@@ -3,8 +3,9 @@ ...@@ -3,8 +3,9 @@
-- @Last Modified by : baidwwy -- @Last Modified by : baidwwy
-- @Last Modified time : 2022-01-22 14:19:27 -- @Last Modified time : 2022-01-22 14:19:27
print('ggerun',arg[1]) print('ggerun', arg[1])
if arg[1]=='android' then 复制文件('assets/test.bmp', './assets/test.bmp')
if arg[1] == 'android' then
编译目录('ggelua') 编译目录('ggelua')
编译目录('./lua') 编译目录('./lua')
-- for path,rel in 遍历目录('./data') do -- for path,rel in 遍历目录('./data') do
...@@ -15,5 +16,4 @@ if arg[1]=='android' then ...@@ -15,5 +16,4 @@ if arg[1]=='android' then
-- end -- end
写出脚本('./assets/ggelua') 写出脚本('./assets/ggelua')
else else
end
end
\ No newline at end of file
-- @Author : GGELUA -- @Author : GGELUA
-- @Last Modified by : baidwwy -- @Last Modified by : baidwwy
-- @Date : 2022-03-23 10:09:27 -- @Date : 2022-03-23 10:09:27
-- @Last Modified time : 2022-03-23 11:04:00 -- @Last Modified time : 2022-04-28 06:08:07
local SDL = require('SDL') local SDL = require('SDL')
引擎 = 引擎 =
...@@ -9,18 +9,16 @@ local SDL = require('SDL') ...@@ -9,18 +9,16 @@ local SDL = require('SDL')
标题 = 'GGELUA_图片', 标题 = 'GGELUA_图片',
宽度 = 800, 宽度 = 800,
高度 = 600, 高度 = 600,
帧率 = 60, 帧率 = 60
渲染器 = 'direct3d11'
} }
function 引擎:初始化() function 引擎:初始化()
spr1 = require('SDL.精灵')('../../../assets/test.bmp') spr1 = require('SDL.精灵')('assets/test.bmp')
tex = require('SDL.纹理')('assets/test.bmp')
tex = require('SDL.纹理')('../../../assets/test.bmp')
spr2 = require('SDL.精灵')(tex) spr2 = require('SDL.精灵')(tex)
--图像一般用于切割,线程,和直读 --图像一般用于切割,线程,和直读
sf = require('SDL.图像')('../../../assets/test.bmp'):到灰度() sf = require('SDL.图像')('assets/test.bmp'):到灰度()
spr3 = require('SDL.精灵')(sf) spr3 = require('SDL.精灵')(sf)
end end
......
-- @Author : GGELUA -- @Author : GGELUA
-- @Date : 2022-01-17 02:57:37 -- @Date : 2022-01-17 02:57:37
-- @Last Modified by : baidwwy -- @Last Modified by : baidwwy
-- @Last Modified time : 2022-01-22 14:19:27 -- @Last Modified time : 2022-04-28 05:53:46
print('ggerun',arg[1]) print('ggerun', arg[1])
if arg[1]=='android' then 复制文件('assets/simsun.ttc', './assets/simsun.ttc')
if arg[1] == 'android' then
编译目录('ggelua') 编译目录('ggelua')
编译目录('./lua') 编译目录('./lua')
-- for path,rel in 遍历目录('./data') do -- for path,rel in 遍历目录('./data') do
...@@ -15,5 +16,4 @@ if arg[1]=='android' then ...@@ -15,5 +16,4 @@ if arg[1]=='android' then
-- end -- end
写出脚本('./assets/ggelua') 写出脚本('./assets/ggelua')
else else
end
end
\ No newline at end of file
-- @Author : GGELUA -- @Author : GGELUA
-- @Last Modified by : baidwwy -- @Last Modified by : baidwwy
-- @Date : 2022-03-23 10:09:27 -- @Date : 2022-03-23 10:09:27
-- @Last Modified time : 2022-04-04 18:10:33 -- @Last Modified time : 2022-04-28 05:53:51
local SDL = require('SDL') local SDL = require('SDL')
引擎 = 引擎 =
...@@ -13,8 +13,8 @@ local SDL = require('SDL') ...@@ -13,8 +13,8 @@ local SDL = require('SDL')
} }
function 引擎:初始化() function 引擎:初始化()
ttf = require('SDL.文字')('../../../assets/simsun.ttc', 14) ttf = require('SDL.文字')('assets/simsun.ttc', 14)
ttf2 = require('SDL.文字')('../../../assets/simsun.ttc', 14, true, 0) ttf2 = require('SDL.文字')('assets/simsun.ttc', 14, true, 0)
测试 = ttf:取精灵('测试测试') 测试 = ttf:取精灵('测试测试')
折行 = ttf2:取精灵('折\n行\n测\n试') 折行 = ttf2:取精灵('折\n行\n测\n试')
......
-- @Author : GGELUA -- @Author : GGELUA
-- @Date : 2022-01-17 02:57:37 -- @Date : 2022-01-17 02:57:37
-- @Last Modified by : baidwwy -- @Last Modified by : baidwwy
-- @Last Modified time : 2022-01-22 14:19:27 -- @Last Modified time : 2022-04-28 06:12:27
print('ggerun',arg[1]) print('ggerun', arg[1])
if arg[1]=='android' then 复制文件('assets/test.mp3', './assets/test.mp3')
if arg[1] == 'android' then
编译目录('ggelua') 编译目录('ggelua')
编译目录('./lua') 编译目录('./lua')
-- for path,rel in 遍历目录('./data') do -- for path,rel in 遍历目录('./data') do
...@@ -15,5 +16,4 @@ if arg[1]=='android' then ...@@ -15,5 +16,4 @@ if arg[1]=='android' then
-- end -- end
写出脚本('./assets/ggelua') 写出脚本('./assets/ggelua')
else else
end
end
\ No newline at end of file
-- @Author : GGELUA -- @Author : GGELUA
-- @Last Modified by : baidwwy -- @Last Modified by : baidwwy
-- @Date : 2022-03-23 10:09:27 -- @Date : 2022-03-23 10:09:27
-- @Last Modified time : 2022-03-23 10:55:57 -- @Last Modified time : 2022-04-28 06:12:32
local SDL = require('SDL') local SDL = require('SDL')
引擎 = 引擎 =
...@@ -11,8 +11,9 @@ local SDL = require('SDL') ...@@ -11,8 +11,9 @@ local SDL = require('SDL')
高度 = 600, 高度 = 600,
帧率 = 60 帧率 = 60
} }
function 引擎:初始化() function 引擎:初始化()
music = require('SDL.音乐')('../../../assets/test.mp3'):播放(true) music = require('SDL.音乐')('assets/test.mp3'):播放(true)
end end
function 引擎:更新事件(dt, x, y) function 引擎:更新事件(dt, x, y)
......
-- @Author : GGELUA -- @Author : GGELUA
-- @Date : 2022-01-17 02:57:37 -- @Date : 2022-01-17 02:57:37
-- @Last Modified by : baidwwy -- @Last Modified by : baidwwy
-- @Last Modified time : 2022-01-22 14:19:27 -- @Last Modified time : 2022-04-28 06:14:18
print('ggerun',arg[1]) print('ggerun', arg[1])
if arg[1]=='android' then 复制文件('assets/simsun.ttc', './assets/simsun.ttc')
if arg[1] == 'android' then
编译目录('ggelua') 编译目录('ggelua')
编译目录('./lua') 编译目录('./lua')
-- for path,rel in 遍历目录('./data') do -- for path,rel in 遍历目录('./data') do
...@@ -15,5 +16,4 @@ if arg[1]=='android' then ...@@ -15,5 +16,4 @@ if arg[1]=='android' then
-- end -- end
写出脚本('./assets/ggelua') 写出脚本('./assets/ggelua')
else else
end
end
\ No newline at end of file
-- @Author : GGELUA -- @Author : GGELUA
-- @Last Modified by : baidwwy -- @Last Modified by : baidwwy
-- @Date : 2022-03-23 10:09:30 -- @Date : 2022-03-23 10:09:30
-- @Last Modified time : 2022-03-23 11:24:09 -- @Last Modified time : 2022-04-28 06:14:24
local SDL = require('SDL') local SDL = require('SDL')
引擎 = 引擎 =
...@@ -13,7 +13,7 @@ local SDL = require('SDL') ...@@ -13,7 +13,7 @@ local SDL = require('SDL')
} }
function 引擎:初始化() function 引擎:初始化()
ttf = require('SDL.文字')('../../../assets/simsun.ttc', 20) ttf = require('SDL.文字')('assets/simsun.ttc', 20)
rect = require('SDL.矩形')(200, 50, 100, 100) rect = require('SDL.矩形')(200, 50, 100, 100)
rect2 = require('SDL.矩形')(200, 50, 50, 50) rect2 = require('SDL.矩形')(200, 50, 50, 50)
end end
......
{
"recommendations": [
"CodeInChinese.ChineseInputAssistant",
"aaron-bond.better-comments",
"coenraads.bracket-pair-colorizer-2",
"ms-ceintl.vscode-language-pack-zh-hans",
"asuka.insertnumbers",
"obkoro1.korofileheader",
"tomblind.local-lua-debugger-vscode",
"sumneko.lua",
"autsing.lua-format-extension",
"vscode-icons-team.vscode-icons",
]
}
\ No newline at end of file
-- @Author : GGELUA
-- @Date : 2021-12-02 20:09:56
-- @Last Modified time : 2022-01-27 08:08:56
-- [./] 表示项目目录
local tt = os.clock()
print('编译文件')
编译目录('ggelua')
编译目录('./lua')
if arg[1] == 'windows' then
print('复制文件')
复制文件('SDL2.dll', './build/SDL2.dll')
复制文件('SDL_image.dll', './build/SDL_image.dll')
复制文件('SDL_mixer.dll', './build/SDL_mixer.dll')
复制文件('SDL_ttf.dll', './build/SDL_ttf.dll')
复制文件('lua54.dll', './build/lua54.dll')
复制文件('ggelua.dll', './build/ggelua.dll')
复制文件('lib/gsdl2.dll', './build/lib/gsdl2.dll')
联接目录('./assets', './build/assets')
写出Windows('./build/GGELUA.exe')
elseif arg[1] == 'android' then
--由于assets不支持中文,资源名转换
-- print('处理文件')
-- for path,rel in 遍历目录('./data') do
-- local hash = gge.hash(path:sub(#rel+6))
-- print(string.format('assets/%08x', hash), path)
-- 复制文件(path, string.format('./assets/%08x', hash), false)
-- end
写出Android('mygame', '我的游戏', '.vscode/ico.png')
end
print('编译完成\n用时:' .. os.clock() - tt .. '秒')
{
// Place your client 工作区 snippets here. Each snippet is defined under a snippet name and has a scope, prefix, body and
// description. Add comma separated ids of the languages where the snippet is applicable in the scope field. If scope
// is left empty or omitted, the snippet gets applied to all languages. The prefix is what is
// used to trigger the snippet and the body will be expanded and inserted. Possible variables are:
// $1, $2 for tab stops, $0 for the final cursor position, and ${1:label}, ${2:another} for placeholders.
// Placeholders with the same ids are connected.
// Example:
// "Print to console": {
// "scope": "javascript,typescript",
// "prefix": "log",
// "body": [
// "console.log('$1');",
// "$2"
// ],
// "description": "Log output to console"
// }
"GGE类_初始化": {
"scope": "lua",
"prefix": "class",
"description": "GGE类",
"body": ["local ${1:$TM_FILENAME_BASE} = class('${1}')",
"",
"function ${1}:初始化(${2})",
"${3}",
"end",
"",
"function ${1}:更新(dt)",
"",
"end",
"",
"function ${1}:显示(x,y)",
"",
"end",
"",
"return ${1}"]
},
"GGE类_方法": {
"scope": "lua",
"prefix": "classfunction",
"description": "GGE类方法",
"body": [
"function ${1:$TM_FILENAME_BASE}:${2:名称}(${3})",
"${4}",
"end",
]
},
"GGE类_类名": {
"scope": "lua",
"prefix": "class",
"description": "GGE类",
"body": ["local ${1:$TM_FILENAME_BASE} = class('${1}')",
"",
"function ${1}:${1}(${2})",
"${3}",
"end",
"",
"function ${1}:更新(dt)",
"",
"end",
"",
"function ${1}:显示(x,y)",
"",
"end",
"",
"return ${1}"]
}
}
\ No newline at end of file
-- @Author : GGELUA
-- @Date : 2022-01-17 02:57:37
-- @Last Modified by : baidwwy
-- @Last Modified time : 2022-01-22 14:19:27
print('ggerun',arg[1])
if arg[1]=='android' then
编译目录('ggelua')
编译目录('./lua')
-- for path,rel in 遍历目录('./data') do
-- local hash = gge.hash(path:sub(#rel+6))
-- if 复制文件(path, string.format('./assets/%08x', hash), false) then
-- print(string.format('assets/%08x', hash), path)
-- end
-- end
写出脚本('./assets/ggelua')
else
end
\ No newline at end of file
{
// 使用 IntelliSense 了解相关属性。
// 悬停以查看现有属性的描述。
// 欲了解更多信息,请访问: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Debug GGELUA",
"type": "lua-local",
"request": "launch",
"program": {
"command": "%GGELUA%/ggelua.exe"
},
"args": [
"${fileWorkspaceFolder}"
],
"cwd": "${fileWorkspaceFolder}",
//"breakInCoroutines": true
}
]
}
\ No newline at end of file
{
"Lua.diagnostics.disable": [
"lowercase-global",
"unused-local",
"undefined-global",
"undefined-env-child",
"unbalanced-assignments",
"trailing-space"
],
"Lua.runtime.unicodeName": true,
}
\ No newline at end of file
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"tasks": [
//ggebuild windows
{
"label": "ggebuild_windows",
"type": "shell",
"command": "%GGELUA%/build/windows/build.bat",
"args": [
"${workspaceFolder}"
],
"presentation": {
"echo": true,
"reveal": "always",
"focus": true,
"panel": "shared",
"showReuseMessage": false,
"clear": true
},
"group": {
"kind": "build",
"isDefault": true
},
"problemMatcher": {
"owner": "lua",
"fileLocation": [
"autoDetect",
"${workspaceFolder}"
],
"pattern": {
"regexp": "([^\"]+)\"\\]:(\\d+):\\s*(.*)",
"file": 1,
"line": 2,
"message": 3
}
}
},
//ggebuild android
{
"label": "ggebuild_android",
"type": "shell",
"command": "%GGELUA%/build/android/build.bat",
"args": [
"${workspaceFolder}"
],
"presentation": {
"echo": true,
"reveal": "always",
"focus": true,
"panel": "shared",
"showReuseMessage": false,
"clear": true
},
"problemMatcher": {
"owner": "lua",
"fileLocation": [
"autoDetect",
"${workspaceFolder}"
],
"pattern": {
"regexp": "([^\"]+)\"\\]:(\\d+):\\s*(.*)",
"file": 1,
"line": 2,
"message": 3
}
}
},
//ggerun
{
"label": "ggerun",
"type": "shell",
"command": "%GGELUA%/build/windows/run.bat",
"args": [
"${workspaceFolder}"
],
"presentation": {
"echo": true,
"reveal": "always",
"focus": true,
"panel": "shared",
"showReuseMessage": false,
"clear": true,
"group": "ggelua"
},
"problemMatcher": {
"owner": "lua",
"fileLocation": [
"autoDetect",
"${workspaceFolder}"
],
"pattern": {
"regexp": "([^\"]+)\"\\]:(\\d+):\\s*(.*)",
"file": 1,
"line": 2,
"message": 3
}
}
},
{
"label": "ggerun_android",
"type": "shell",
"command": "%GGELUA%/build/android/run.bat",
"args": [
"${workspaceFolder}"
],
"presentation": {
"echo": true,
"reveal": "always",
"focus": true,
"panel": "shared",
"showReuseMessage": false,
"clear": true,
"group": "ggelua"
},
"problemMatcher": {
"owner": "lua",
"fileLocation": [
"autoDetect",
"${workspaceFolder}"
],
"pattern": {
"regexp": "([^\"]+)\"\\]:(\\d+):\\s*(.*)",
"file": 1,
"line": 2,
"message": 3
}
}
},
//lua
{
"label": "lua",
"type": "shell",
"command": "%GGELUA%/lua.exe",
"args": [
"${file}",
"${workspaceFolder}"
],
"windows": {
"options": {
"shell": {
"executable": "cmd.exe",
"args": [
"/c \"\" ",
"chcp 65001 &&"
]
}
}
},
"presentation": {
"echo": true,
"reveal": "always",
"focus": true,
"panel": "shared",
"showReuseMessage": false,
"clear": true
},
"problemMatcher": {
"owner": "lua",
"fileLocation": [
"autoDetect",
"${workspaceFolder}"
],
"pattern": {
"regexp": "([^\"]+)\"\\]:(\\d+):\\s*(.*)",
"file": 1,
"line": 2,
"message": 3
}
}
}
]
}
\ No newline at end of file
{
"folders": [
{
"path": "."
},
{
"path": "../../../GGELUA",
"name": "GGELUA"
}
],
"settings": {
"fileheader.customMade": {
"Author": "GGELUA", //作者名称
"LastEditors": "baidwwy",
"Date": "Do not edit", // 设置后默认设置文件生成时间
"LastEditTime": "Do not edit", // 设置后,保存文件更改默认更新最后编辑时间
},
"fileheader.configObj": {
"createFileTime": true,
"language": {
"lua": {
"middle": "-- @",
}
},
"customHasHeadEnd": {
"lua": "cancel head and function",
},
"supportAutoLanguage": [
"lua"
],
"specialOptions": {
"特殊字段": "自定义比如LastEditTime/LastEditors",
"LastEditTime": "Last Modified time",
"LastEditors": "Last Modified by",
},
"wideSame": true,
"wideNum": 20,
},
"terminal.integrated.defaultProfile.windows": "Command Prompt"
},
}
\ No newline at end of file
-- @Author : GGELUA
-- @Last Modified by : baidwwy
-- @Date : 2022-03-23 10:09:27
-- @Last Modified time : 2022-04-27 01:30:45
local SDL = require('SDL')
引擎 =
require 'SDL.窗口' {
标题 = 'GGELUA_异形窗口',
宽度 = 800,
高度 = 600,
帧率 = 60,
渲染器 = 'software',
异形 = true
}
function 引擎:初始化()
local sf = require('SDL.图像')('assets/uin2.png')
--sf:置透明色(255, 0, 255)
print(self:置图像(sf))
spr = require('SDL.精灵')('assets/uin2.png')
end
function 引擎:更新事件(dt, x, y)
end
function 引擎:渲染事件(dt, x, y)
if self:渲染开始(0x70, 0x70, 0x70) then
spr:显示(0, 0)
self:渲染结束()
end
end
function 引擎:窗口事件(ev)
if ev == SDL.WINDOWEVENT_CLOSE then
引擎:关闭()
end
end
function 引擎:键盘事件(KEY, KMOD, 状态, 按住)
if not 状态 then --弹起
if KEY == SDL.KEY_ESCAPE then
引擎:关闭()
end
end
if KMOD & SDL.KMOD_LCTRL ~= 0 then
print('左CTRL', 按住)
end
if KMOD & SDL.KMOD_ALT ~= 0 then
print('左右ALT', 按住)
end
end
function 引擎:鼠标事件(消息, x, y, key)
if 消息 == SDL.MOUSE_DOWN then
self.按下偏移 = require('GGE.坐标')(x, y)
local _, gx, gy = SDL.GetGlobalMouseState()
self.按下位置 = require('GGE.坐标')(gx, gy)
elseif 消息 == SDL.MOUSE_MOTION and key & SDL.BUTTON_LEFT == SDL.BUTTON_LEFT then
local _, gx, gy = SDL.GetGlobalMouseState()
self:置坐标(require('GGE.坐标')(gx, gy) - self.按下偏移)
end
end
function 引擎:输入事件()
end
function 引擎:销毁事件()
end
{
"recommendations": [
"CodeInChinese.ChineseInputAssistant",
"aaron-bond.better-comments",
"coenraads.bracket-pair-colorizer-2",
"ms-ceintl.vscode-language-pack-zh-hans",
"asuka.insertnumbers",
"obkoro1.korofileheader",
"tomblind.local-lua-debugger-vscode",
"sumneko.lua",
"autsing.lua-format-extension",
"vscode-icons-team.vscode-icons",
]
}
\ No newline at end of file
-- @Author : GGELUA
-- @Date : 2021-12-02 20:09:56
-- @Last Modified time : 2022-01-27 08:08:56
-- [./] 表示项目目录
local tt = os.clock()
print('编译文件')
编译目录('ggelua')
编译目录('./lua')
if arg[1] == 'windows' then
print('复制文件')
复制文件('SDL2.dll', './build/SDL2.dll')
复制文件('SDL_image.dll', './build/SDL_image.dll')
复制文件('SDL_mixer.dll', './build/SDL_mixer.dll')
复制文件('SDL_ttf.dll', './build/SDL_ttf.dll')
复制文件('lua54.dll', './build/lua54.dll')
复制文件('ggelua.dll', './build/ggelua.dll')
复制文件('lib/gsdl2.dll', './build/lib/gsdl2.dll')
联接目录('./assets', './build/assets')
写出Windows('./build/GGELUA.exe')
elseif arg[1] == 'android' then
--由于assets不支持中文,资源名转换
-- print('处理文件')
-- for path,rel in 遍历目录('./data') do
-- local hash = gge.hash(path:sub(#rel+6))
-- print(string.format('assets/%08x', hash), path)
-- 复制文件(path, string.format('./assets/%08x', hash), false)
-- end
写出Android('mygame', '我的游戏', '.vscode/ico.png')
end
print('编译完成\n用时:' .. os.clock() - tt .. '秒')
{
// Place your client 工作区 snippets here. Each snippet is defined under a snippet name and has a scope, prefix, body and
// description. Add comma separated ids of the languages where the snippet is applicable in the scope field. If scope
// is left empty or omitted, the snippet gets applied to all languages. The prefix is what is
// used to trigger the snippet and the body will be expanded and inserted. Possible variables are:
// $1, $2 for tab stops, $0 for the final cursor position, and ${1:label}, ${2:another} for placeholders.
// Placeholders with the same ids are connected.
// Example:
// "Print to console": {
// "scope": "javascript,typescript",
// "prefix": "log",
// "body": [
// "console.log('$1');",
// "$2"
// ],
// "description": "Log output to console"
// }
"GGE类_初始化": {
"scope": "lua",
"prefix": "class",
"description": "GGE类",
"body": ["local ${1:$TM_FILENAME_BASE} = class('${1}')",
"",
"function ${1}:初始化(${2})",
"${3}",
"end",
"",
"function ${1}:更新(dt)",
"",
"end",
"",
"function ${1}:显示(x,y)",
"",
"end",
"",
"return ${1}"]
},
"GGE类_方法": {
"scope": "lua",
"prefix": "classfunction",
"description": "GGE类方法",
"body": [
"function ${1:$TM_FILENAME_BASE}:${2:名称}(${3})",
"${4}",
"end",
]
},
"GGE类_类名": {
"scope": "lua",
"prefix": "class",
"description": "GGE类",
"body": ["local ${1:$TM_FILENAME_BASE} = class('${1}')",
"",
"function ${1}:${1}(${2})",
"${3}",
"end",
"",
"function ${1}:更新(dt)",
"",
"end",
"",
"function ${1}:显示(x,y)",
"",
"end",
"",
"return ${1}"]
}
}
\ No newline at end of file
-- @Author : GGELUA
-- @Date : 2022-01-17 02:57:37
-- @Last Modified by : baidwwy
-- @Last Modified time : 2022-01-22 14:19:27
print('ggerun',arg[1])
if arg[1]=='android' then
编译目录('ggelua')
编译目录('./lua')
-- for path,rel in 遍历目录('./data') do
-- local hash = gge.hash(path:sub(#rel+6))
-- if 复制文件(path, string.format('./assets/%08x', hash), false) then
-- print(string.format('assets/%08x', hash), path)
-- end
-- end
写出脚本('./assets/ggelua')
else
end
\ No newline at end of file
{
// 使用 IntelliSense 了解相关属性。
// 悬停以查看现有属性的描述。
// 欲了解更多信息,请访问: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Debug GGELUA",
"type": "lua-local",
"request": "launch",
"program": {
"command": "%GGELUA%/ggelua.exe"
},
"args": [
"${fileWorkspaceFolder}"
],
"cwd": "${fileWorkspaceFolder}",
//"breakInCoroutines": true
}
]
}
\ No newline at end of file
{
"Lua.diagnostics.disable": [
"lowercase-global",
"unused-local",
"undefined-global",
"undefined-env-child",
"unbalanced-assignments",
"trailing-space"
],
"Lua.runtime.unicodeName": true,
}
\ No newline at end of file
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"tasks": [
//ggebuild windows
{
"label": "ggebuild_windows",
"type": "shell",
"command": "%GGELUA%/build/windows/build.bat",
"args": [
"${workspaceFolder}"
],
"presentation": {
"echo": true,
"reveal": "always",
"focus": true,
"panel": "shared",
"showReuseMessage": false,
"clear": true
},
"group": {
"kind": "build",
"isDefault": true
},
"problemMatcher": {
"owner": "lua",
"fileLocation": [
"autoDetect",
"${workspaceFolder}"
],
"pattern": {
"regexp": "([^\"]+)\"\\]:(\\d+):\\s*(.*)",
"file": 1,
"line": 2,
"message": 3
}
}
},
//ggebuild android
{
"label": "ggebuild_android",
"type": "shell",
"command": "%GGELUA%/build/android/build.bat",
"args": [
"${workspaceFolder}"
],
"presentation": {
"echo": true,
"reveal": "always",
"focus": true,
"panel": "shared",
"showReuseMessage": false,
"clear": true
},
"problemMatcher": {
"owner": "lua",
"fileLocation": [
"autoDetect",
"${workspaceFolder}"
],
"pattern": {
"regexp": "([^\"]+)\"\\]:(\\d+):\\s*(.*)",
"file": 1,
"line": 2,
"message": 3
}
}
},
//ggerun
{
"label": "ggerun",
"type": "shell",
"command": "%GGELUA%/build/windows/run.bat",
"args": [
"${workspaceFolder}"
],
"presentation": {
"echo": true,
"reveal": "always",
"focus": true,
"panel": "shared",
"showReuseMessage": false,
"clear": true,
"group": "ggelua"
},
"problemMatcher": {
"owner": "lua",
"fileLocation": [
"autoDetect",
"${workspaceFolder}"
],
"pattern": {
"regexp": "([^\"]+)\"\\]:(\\d+):\\s*(.*)",
"file": 1,
"line": 2,
"message": 3
}
}
},
{
"label": "ggerun_android",
"type": "shell",
"command": "%GGELUA%/build/android/run.bat",
"args": [
"${workspaceFolder}"
],
"presentation": {
"echo": true,
"reveal": "always",
"focus": true,
"panel": "shared",
"showReuseMessage": false,
"clear": true,
"group": "ggelua"
},
"problemMatcher": {
"owner": "lua",
"fileLocation": [
"autoDetect",
"${workspaceFolder}"
],
"pattern": {
"regexp": "([^\"]+)\"\\]:(\\d+):\\s*(.*)",
"file": 1,
"line": 2,
"message": 3
}
}
},
//lua
{
"label": "lua",
"type": "shell",
"command": "%GGELUA%/lua.exe",
"args": [
"${file}",
"${workspaceFolder}"
],
"windows": {
"options": {
"shell": {
"executable": "cmd.exe",
"args": [
"/c \"\" ",
"chcp 65001 &&"
]
}
}
},
"presentation": {
"echo": true,
"reveal": "always",
"focus": true,
"panel": "shared",
"showReuseMessage": false,
"clear": true
},
"problemMatcher": {
"owner": "lua",
"fileLocation": [
"autoDetect",
"${workspaceFolder}"
],
"pattern": {
"regexp": "([^\"]+)\"\\]:(\\d+):\\s*(.*)",
"file": 1,
"line": 2,
"message": 3
}
}
}
]
}
\ No newline at end of file
{
"folders": [
{
"path": "."
},
{
"path": "../../../GGELUA",
"name": "GGELUA"
}
],
"settings": {
"fileheader.customMade": {
"Author": "GGELUA", //作者名称
"LastEditors": "baidwwy",
"Date": "Do not edit", // 设置后默认设置文件生成时间
"LastEditTime": "Do not edit", // 设置后,保存文件更改默认更新最后编辑时间
},
"fileheader.configObj": {
"createFileTime": true,
"language": {
"lua": {
"middle": "-- @",
}
},
"customHasHeadEnd": {
"lua": "cancel head and function",
},
"supportAutoLanguage": [
"lua"
],
"specialOptions": {
"特殊字段": "自定义比如LastEditTime/LastEditors",
"LastEditTime": "Last Modified time",
"LastEditors": "Last Modified by",
},
"wideSame": true,
"wideNum": 20,
},
"terminal.integrated.defaultProfile.windows": "Command Prompt"
},
}
\ No newline at end of file
-- @Author : GGELUA
-- @Last Modified by : baidwwy
-- @Date : 2022-03-23 10:09:27
-- @Last Modified time : 2022-04-27 02:27:08
local SDL = require('SDL')
引擎 =
require 'SDL.窗口' {
标题 = '大航海时代-世界地图',
宽度 = 800,
高度 = 600,
帧率 = 30,
可调整 = true
}
function 引擎:初始化()
spr = require('SDL.精灵')('assets/171122.png')
xy = require('GGE.坐标')(0, 0)
end
function 引擎:更新事件(dt, x, y)
end
function 引擎:渲染事件(dt, x, y)
if self:渲染开始(0, 0, 0) then
for x = xy.x - spr.宽度, self.宽度, spr.宽度 do
spr:显示(x, xy.y)
end
self:渲染结束()
end
end
function 引擎:窗口事件(消息)
if 消息 == SDL.WINDOWEVENT_CLOSE then
引擎:关闭()
end
end
function 引擎:键盘事件(KEY, KMOD, 状态, 按住)
if not 状态 then --弹起
if KEY == SDL.KEY_F1 then
print('F1')
end
end
if KMOD & SDL.KMOD_LCTRL ~= 0 then
print('左CTRL', 按住)
end
if KMOD & SDL.KMOD_ALT ~= 0 then
print('左右ALT', 按住)
end
end
function 引擎:鼠标事件(消息, x, y, b)
if 消息 == SDL.MOUSE_MOTION and b & SDL.BUTTON_LMASK ~= 0 then
xy = 当前位置 + (require('GGE.坐标')(x, y) - 按下位置)
if xy.x > 0 then
xy.x = xy.x % spr.宽度
else
xy.x = xy.x % -spr.宽度
end
elseif 消息 == SDL.MOUSE_DOWN then
当前位置 = xy
按下位置 = require('GGE.坐标')(x, y)
elseif 消息 == SDL.MOUSE_UP then
if xy.y > 0 then
xy.y = 0
elseif math.abs(xy.y) > spr.高度 - self.高度 then
xy.y = -(spr.高度 - self.高度)
end
end
end
function 引擎:输入事件()
end
function 引擎:销毁事件()
end
{
"recommendations": [
"CodeInChinese.ChineseInputAssistant",
"aaron-bond.better-comments",
"coenraads.bracket-pair-colorizer-2",
"ms-ceintl.vscode-language-pack-zh-hans",
"asuka.insertnumbers",
"obkoro1.korofileheader",
"tomblind.local-lua-debugger-vscode",
"sumneko.lua",
"autsing.lua-format-extension",
"vscode-icons-team.vscode-icons",
]
}
\ No newline at end of file
-- @Author : GGELUA
-- @Date : 2021-12-02 20:09:56
-- @Last Modified time : 2022-01-27 08:08:56
-- [./] 表示项目目录
local tt = os.clock()
print('编译文件')
编译目录('ggelua')
编译目录('./lua')
if arg[1] == 'windows' then
print('复制文件')
复制文件('SDL2.dll', './build/SDL2.dll')
复制文件('SDL_image.dll', './build/SDL_image.dll')
复制文件('SDL_mixer.dll', './build/SDL_mixer.dll')
复制文件('SDL_ttf.dll', './build/SDL_ttf.dll')
复制文件('lua54.dll', './build/lua54.dll')
复制文件('ggelua.dll', './build/ggelua.dll')
复制文件('lib/gsdl2.dll', './build/lib/gsdl2.dll')
联接目录('./assets', './build/assets')
写出Windows('./build/GGELUA.exe')
elseif arg[1] == 'android' then
--由于assets不支持中文,资源名转换
-- print('处理文件')
-- for path,rel in 遍历目录('./data') do
-- local hash = gge.hash(path:sub(#rel+6))
-- print(string.format('assets/%08x', hash), path)
-- 复制文件(path, string.format('./assets/%08x', hash), false)
-- end
写出Android('mygame', '我的游戏', '.vscode/ico.png')
end
print('编译完成\n用时:' .. os.clock() - tt .. '秒')
{
// Place your client 工作区 snippets here. Each snippet is defined under a snippet name and has a scope, prefix, body and
// description. Add comma separated ids of the languages where the snippet is applicable in the scope field. If scope
// is left empty or omitted, the snippet gets applied to all languages. The prefix is what is
// used to trigger the snippet and the body will be expanded and inserted. Possible variables are:
// $1, $2 for tab stops, $0 for the final cursor position, and ${1:label}, ${2:another} for placeholders.
// Placeholders with the same ids are connected.
// Example:
// "Print to console": {
// "scope": "javascript,typescript",
// "prefix": "log",
// "body": [
// "console.log('$1');",
// "$2"
// ],
// "description": "Log output to console"
// }
"GGE类_初始化": {
"scope": "lua",
"prefix": "class",
"description": "GGE类",
"body": ["local ${1:$TM_FILENAME_BASE} = class('${1}')",
"",
"function ${1}:初始化(${2})",
"${3}",
"end",
"",
"function ${1}:更新(dt)",
"",
"end",
"",
"function ${1}:显示(x,y)",
"",
"end",
"",
"return ${1}"]
},
"GGE类_方法": {
"scope": "lua",
"prefix": "classfunction",
"description": "GGE类方法",
"body": [
"function ${1:$TM_FILENAME_BASE}:${2:名称}(${3})",
"${4}",
"end",
]
},
"GGE类_类名": {
"scope": "lua",
"prefix": "class",
"description": "GGE类",
"body": ["local ${1:$TM_FILENAME_BASE} = class('${1}')",
"",
"function ${1}:${1}(${2})",
"${3}",
"end",
"",
"function ${1}:更新(dt)",
"",
"end",
"",
"function ${1}:显示(x,y)",
"",
"end",
"",
"return ${1}"]
}
}
\ No newline at end of file
-- @Author : GGELUA
-- @Date : 2022-01-17 02:57:37
-- @Last Modified by : baidwwy
-- @Last Modified time : 2022-01-22 14:19:27
print('ggerun',arg[1])
if arg[1]=='android' then
编译目录('ggelua')
编译目录('./lua')
-- for path,rel in 遍历目录('./data') do
-- local hash = gge.hash(path:sub(#rel+6))
-- if 复制文件(path, string.format('./assets/%08x', hash), false) then
-- print(string.format('assets/%08x', hash), path)
-- end
-- end
写出脚本('./assets/ggelua')
else
end
\ No newline at end of file
{
// 使用 IntelliSense 了解相关属性。
// 悬停以查看现有属性的描述。
// 欲了解更多信息,请访问: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Debug GGELUA",
"type": "lua-local",
"request": "launch",
"program": {
"command": "%GGELUA%/ggelua.exe"
},
"args": [
"${fileWorkspaceFolder}"
],
"cwd": "${fileWorkspaceFolder}",
//"breakInCoroutines": true
}
]
}
\ No newline at end of file
{
"Lua.diagnostics.disable": [
"lowercase-global",
"unused-local",
"undefined-global",
"undefined-env-child",
"unbalanced-assignments",
"trailing-space"
],
"Lua.runtime.unicodeName": true,
}
\ No newline at end of file
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"tasks": [
//ggebuild windows
{
"label": "ggebuild_windows",
"type": "shell",
"command": "%GGELUA%/build/windows/build.bat",
"args": [
"${workspaceFolder}"
],
"presentation": {
"echo": true,
"reveal": "always",
"focus": true,
"panel": "shared",
"showReuseMessage": false,
"clear": true
},
"group": {
"kind": "build",
"isDefault": true
},
"problemMatcher": {
"owner": "lua",
"fileLocation": [
"autoDetect",
"${workspaceFolder}"
],
"pattern": {
"regexp": "([^\"]+)\"\\]:(\\d+):\\s*(.*)",
"file": 1,
"line": 2,
"message": 3
}
}
},
//ggebuild android
{
"label": "ggebuild_android",
"type": "shell",
"command": "%GGELUA%/build/android/build.bat",
"args": [
"${workspaceFolder}"
],
"presentation": {
"echo": true,
"reveal": "always",
"focus": true,
"panel": "shared",
"showReuseMessage": false,
"clear": true
},
"problemMatcher": {
"owner": "lua",
"fileLocation": [
"autoDetect",
"${workspaceFolder}"
],
"pattern": {
"regexp": "([^\"]+)\"\\]:(\\d+):\\s*(.*)",
"file": 1,
"line": 2,
"message": 3
}
}
},
//ggerun
{
"label": "ggerun",
"type": "shell",
"command": "%GGELUA%/build/windows/run.bat",
"args": [
"${workspaceFolder}"
],
"presentation": {
"echo": true,
"reveal": "always",
"focus": true,
"panel": "shared",
"showReuseMessage": false,
"clear": true,
"group": "ggelua"
},
"problemMatcher": {
"owner": "lua",
"fileLocation": [
"autoDetect",
"${workspaceFolder}"
],
"pattern": {
"regexp": "([^\"]+)\"\\]:(\\d+):\\s*(.*)",
"file": 1,
"line": 2,
"message": 3
}
}
},
{
"label": "ggerun_android",
"type": "shell",
"command": "%GGELUA%/build/android/run.bat",
"args": [
"${workspaceFolder}"
],
"presentation": {
"echo": true,
"reveal": "always",
"focus": true,
"panel": "shared",
"showReuseMessage": false,
"clear": true,
"group": "ggelua"
},
"problemMatcher": {
"owner": "lua",
"fileLocation": [
"autoDetect",
"${workspaceFolder}"
],
"pattern": {
"regexp": "([^\"]+)\"\\]:(\\d+):\\s*(.*)",
"file": 1,
"line": 2,
"message": 3
}
}
},
//lua
{
"label": "lua",
"type": "shell",
"command": "%GGELUA%/lua.exe",
"args": [
"${file}",
"${workspaceFolder}"
],
"windows": {
"options": {
"shell": {
"executable": "cmd.exe",
"args": [
"/c \"\" ",
"chcp 65001 &&"
]
}
}
},
"presentation": {
"echo": true,
"reveal": "always",
"focus": true,
"panel": "shared",
"showReuseMessage": false,
"clear": true
},
"problemMatcher": {
"owner": "lua",
"fileLocation": [
"autoDetect",
"${workspaceFolder}"
],
"pattern": {
"regexp": "([^\"]+)\"\\]:(\\d+):\\s*(.*)",
"file": 1,
"line": 2,
"message": 3
}
}
}
]
}
\ No newline at end of file
-- @Author : GGELUA
-- @Date : 2021-04-08 08:00:20
-- @Last Modified by : GGELUA
-- @Last Modified time : 2022-04-27 02:32:36
-- 声明:例子仅供学习交流
local GGEF = require('GGE.函数')
local SDL = require('SDL')
引擎 =
require 'SDL.窗口' {
标题 = '圆形地图框',
宽度 = 800,
高度 = 600,
帧率 = 30,
}
function 引擎:初始化()
渲染区 = require('SDL.纹理')(111, 111)
渲染精灵 = 渲染区:到精灵()
小地图 = require('SDL.精灵')('assets/镇魔谷.jpg')
if 1 == 2 then --两种方式
精灵 = require('SDL.精灵')('assets/B.png')
抠图 = SDL.ComposeCustomBlendMode(1, 2, 1, 2, 1, 1)
精灵:置混合(抠图)
else
精灵 = require('SDL.精灵')('assets/A.png')
抠图 = SDL.ComposeCustomBlendMode(1, 2, 3, 2, 2, 3)
精灵:置混合(抠图)
end
print(抠图)
end
function 引擎:更新事件(dt, x, y)
if 渲染区:渲染开始() then
小地图:显示(0, 0)
精灵:显示(0, 0)
渲染区:渲染结束()
end
end
function 引擎:渲染事件(dt, x, y)
if self:渲染开始(0x70, 0x70, 0x70) then
渲染精灵:显示(50, 50)
self:渲染结束()
end
end
function 引擎:窗口事件(ev)
if ev == SDL.WINDOWEVENT_CLOSE then
引擎:关闭()
end
end
function 引擎:键盘事件(KEY, KMOD, 状态, 按住)
if not 状态 then --弹起
if KEY == SDL.KEY_F1 then
print('F1')
end
end
if KMOD & SDL.KMOD_LCTRL ~= 0 then
print('左CTRL', 按住)
end
if KMOD & SDL.KMOD_ALT ~= 0 then
print('左右ALT', 按住)
end
end
function 引擎:鼠标事件(key, x, y, btn, ...)
end
function 引擎:输入事件()
end
function 引擎:销毁事件()
end
{
"folders": [
{
"path": "."
},
{
"path": "X:\\GGELUA\\GGELUA2\\ggelua"
}
],
"settings": {
"fileheader.customMade": {
"Author": "GGELUA", //作者名称
"Date": "Do not edit", // 设置后默认设置文件生成时间
"LastEditors": "GGELUA",
"LastEditTime": "Do not edit", // 设置后,保存文件更改默认更新最后编辑时间
},
"fileheader.configObj": {
"specialOptions": {
"LastEditTime": "Last Modified time",
"LastEditors": "Last Modified by",
},
}
},
}
\ No newline at end of file
{
"recommendations": [
"CodeInChinese.ChineseInputAssistant",
"aaron-bond.better-comments",
"coenraads.bracket-pair-colorizer-2",
"ms-ceintl.vscode-language-pack-zh-hans",
"asuka.insertnumbers",
"obkoro1.korofileheader",
"tomblind.local-lua-debugger-vscode",
"sumneko.lua",
"autsing.lua-format-extension",
"vscode-icons-team.vscode-icons",
]
}
\ No newline at end of file
-- @Author : GGELUA
-- @Date : 2021-12-02 20:09:56
-- @Last Modified time : 2022-01-27 08:08:56
-- [./] 表示项目目录
local tt = os.clock()
print('编译文件')
编译目录('ggelua')
编译目录('./lua')
if arg[1] == 'windows' then
print('复制文件')
复制文件('SDL2.dll', './build/SDL2.dll')
复制文件('SDL_image.dll', './build/SDL_image.dll')
复制文件('SDL_mixer.dll', './build/SDL_mixer.dll')
复制文件('SDL_ttf.dll', './build/SDL_ttf.dll')
复制文件('lua54.dll', './build/lua54.dll')
复制文件('ggelua.dll', './build/ggelua.dll')
复制文件('lib/gsdl2.dll', './build/lib/gsdl2.dll')
联接目录('./assets', './build/assets')
写出Windows('./build/GGELUA.exe')
elseif arg[1] == 'android' then
--由于assets不支持中文,资源名转换
-- print('处理文件')
-- for path,rel in 遍历目录('./data') do
-- local hash = gge.hash(path:sub(#rel+6))
-- print(string.format('assets/%08x', hash), path)
-- 复制文件(path, string.format('./assets/%08x', hash), false)
-- end
写出Android('mygame', '我的游戏', '.vscode/ico.png')
end
print('编译完成\n用时:' .. os.clock() - tt .. '秒')
{
// Place your client 工作区 snippets here. Each snippet is defined under a snippet name and has a scope, prefix, body and
// description. Add comma separated ids of the languages where the snippet is applicable in the scope field. If scope
// is left empty or omitted, the snippet gets applied to all languages. The prefix is what is
// used to trigger the snippet and the body will be expanded and inserted. Possible variables are:
// $1, $2 for tab stops, $0 for the final cursor position, and ${1:label}, ${2:another} for placeholders.
// Placeholders with the same ids are connected.
// Example:
// "Print to console": {
// "scope": "javascript,typescript",
// "prefix": "log",
// "body": [
// "console.log('$1');",
// "$2"
// ],
// "description": "Log output to console"
// }
"GGE类_初始化": {
"scope": "lua",
"prefix": "class",
"description": "GGE类",
"body": ["local ${1:$TM_FILENAME_BASE} = class('${1}')",
"",
"function ${1}:初始化(${2})",
"${3}",
"end",
"",
"function ${1}:更新(dt)",
"",
"end",
"",
"function ${1}:显示(x,y)",
"",
"end",
"",
"return ${1}"]
},
"GGE类_方法": {
"scope": "lua",
"prefix": "classfunction",
"description": "GGE类方法",
"body": [
"function ${1:$TM_FILENAME_BASE}:${2:名称}(${3})",
"${4}",
"end",
]
},
"GGE类_类名": {
"scope": "lua",
"prefix": "class",
"description": "GGE类",
"body": ["local ${1:$TM_FILENAME_BASE} = class('${1}')",
"",
"function ${1}:${1}(${2})",
"${3}",
"end",
"",
"function ${1}:更新(dt)",
"",
"end",
"",
"function ${1}:显示(x,y)",
"",
"end",
"",
"return ${1}"]
}
}
\ No newline at end of file
-- @Author : GGELUA
-- @Date : 2022-01-17 02:57:37
-- @Last Modified by : baidwwy
-- @Last Modified time : 2022-01-22 14:19:27
print('ggerun',arg[1])
if arg[1]=='android' then
编译目录('ggelua')
编译目录('./lua')
-- for path,rel in 遍历目录('./data') do
-- local hash = gge.hash(path:sub(#rel+6))
-- if 复制文件(path, string.format('./assets/%08x', hash), false) then
-- print(string.format('assets/%08x', hash), path)
-- end
-- end
写出脚本('./assets/ggelua')
else
end
\ No newline at end of file
{
// 使用 IntelliSense 了解相关属性。
// 悬停以查看现有属性的描述。
// 欲了解更多信息,请访问: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Debug GGELUA",
"type": "lua-local",
"request": "launch",
"program": {
"command": "%GGELUA%/ggelua.exe"
},
"args": [
"${fileWorkspaceFolder}"
],
"cwd": "${fileWorkspaceFolder}",
//"breakInCoroutines": true
}
]
}
\ No newline at end of file
{
"Lua.diagnostics.disable": [
"lowercase-global",
"unused-local",
"undefined-global",
"undefined-env-child",
"unbalanced-assignments",
"trailing-space"
],
"Lua.runtime.unicodeName": true,
}
\ No newline at end of file
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"tasks": [
//ggebuild windows
{
"label": "ggebuild_windows",
"type": "shell",
"command": "%GGELUA%/build/windows/build.bat",
"args": [
"${workspaceFolder}"
],
"presentation": {
"echo": true,
"reveal": "always",
"focus": true,
"panel": "shared",
"showReuseMessage": false,
"clear": true
},
"group": {
"kind": "build",
"isDefault": true
},
"problemMatcher": {
"owner": "lua",
"fileLocation": [
"autoDetect",
"${workspaceFolder}"
],
"pattern": {
"regexp": "([^\"]+)\"\\]:(\\d+):\\s*(.*)",
"file": 1,
"line": 2,
"message": 3
}
}
},
//ggebuild android
{
"label": "ggebuild_android",
"type": "shell",
"command": "%GGELUA%/build/android/build.bat",
"args": [
"${workspaceFolder}"
],
"presentation": {
"echo": true,
"reveal": "always",
"focus": true,
"panel": "shared",
"showReuseMessage": false,
"clear": true
},
"problemMatcher": {
"owner": "lua",
"fileLocation": [
"autoDetect",
"${workspaceFolder}"
],
"pattern": {
"regexp": "([^\"]+)\"\\]:(\\d+):\\s*(.*)",
"file": 1,
"line": 2,
"message": 3
}
}
},
//ggerun
{
"label": "ggerun",
"type": "shell",
"command": "%GGELUA%/build/windows/run.bat",
"args": [
"${workspaceFolder}"
],
"presentation": {
"echo": true,
"reveal": "always",
"focus": true,
"panel": "shared",
"showReuseMessage": false,
"clear": true,
"group": "ggelua"
},
"problemMatcher": {
"owner": "lua",
"fileLocation": [
"autoDetect",
"${workspaceFolder}"
],
"pattern": {
"regexp": "([^\"]+)\"\\]:(\\d+):\\s*(.*)",
"file": 1,
"line": 2,
"message": 3
}
}
},
{
"label": "ggerun_android",
"type": "shell",
"command": "%GGELUA%/build/android/run.bat",
"args": [
"${workspaceFolder}"
],
"presentation": {
"echo": true,
"reveal": "always",
"focus": true,
"panel": "shared",
"showReuseMessage": false,
"clear": true,
"group": "ggelua"
},
"problemMatcher": {
"owner": "lua",
"fileLocation": [
"autoDetect",
"${workspaceFolder}"
],
"pattern": {
"regexp": "([^\"]+)\"\\]:(\\d+):\\s*(.*)",
"file": 1,
"line": 2,
"message": 3
}
}
},
//lua
{
"label": "lua",
"type": "shell",
"command": "%GGELUA%/lua.exe",
"args": [
"${file}",
"${workspaceFolder}"
],
"windows": {
"options": {
"shell": {
"executable": "cmd.exe",
"args": [
"/c \"\" ",
"chcp 65001 &&"
]
}
}
},
"presentation": {
"echo": true,
"reveal": "always",
"focus": true,
"panel": "shared",
"showReuseMessage": false,
"clear": true
},
"problemMatcher": {
"owner": "lua",
"fileLocation": [
"autoDetect",
"${workspaceFolder}"
],
"pattern": {
"regexp": "([^\"]+)\"\\]:(\\d+):\\s*(.*)",
"file": 1,
"line": 2,
"message": 3
}
}
}
]
}
\ No newline at end of file
{
"folders": [
{
"path": "."
},
{
"path": "X:\\GGELUA\\GGELUA2\\ggelua"
}
],
"settings": {
"fileheader.customMade": {
"Author": "GGELUA", //作者名称
"Date": "Do not edit", // 设置后默认设置文件生成时间
"LastEditors": "GGELUA",
"LastEditTime": "Do not edit", // 设置后,保存文件更改默认更新最后编辑时间
},
"fileheader.configObj": {
"specialOptions": {
"LastEditTime": "Last Modified time",
"LastEditors": "Last Modified by",
},
}
},
}
\ No newline at end of file
-- @Author : GGELUA
-- @Date : 2021-04-24 10:12:21
-- @Last Modified by : baidwwy
-- @Last Modified time : 2022-04-27 02:38:46
local SDL = require('SDL')
引擎 =
require 'SDL.窗口' {
标题 = 'GGELUA_贪吃蛇',
宽度 = 800,
高度 = 600,
帧率 = 60
}
function 引擎:初始化()
精灵 = require 'SDL.精灵'(0, 0, 0, 20, 20):置颜色(255)
蛇体 = {require 'GGE.坐标'(0, 0)}
方向 = require 'GGE.坐标'(20, 0)
虫子 = require 'SDL.精灵'(0, 0, 0, 20, 20):置颜色(0, 255)
位置 = require 'GGE.坐标'(math.random(0, (引擎.宽度 / 20) - 1) * 20, math.random(0, (引擎.高度 / 20) - 1) * 20)
t = 0
end
function 引擎:更新事件(dt, x, y)
t = t + dt
if t > 0.2 then
t = 0
蛇体[#蛇体] = 蛇体[1] + 方向
table.insert(蛇体, 1, table.remove(蛇体))
if 蛇体[1] == 位置 then
table.insert(蛇体, 1, 位置 + 方向)
位置 = require 'GGE.坐标'(math.random(0, (引擎.宽度 / 20) - 1) * 20, math.random(0, (引擎.高度 / 20) - 1) * 20)
end
end
end
function 引擎:渲染事件(dt, x, y)
if self:渲染开始(0x70, 0x70, 0x70) then
引擎:置颜色(0, 0, 0, 50)
for y = 20, 引擎.高度, 20 do
引擎:画线(0, y, 引擎.宽度, y)
end
for x = 20, 引擎.宽度, 20 do
引擎:画线(x, 0, x, 引擎.高度)
end
for i, v in ipairs(蛇体) do
精灵:显示(v:unpack())
end
虫子:显示(位置:unpack())
self:渲染结束()
end
end
function 引擎:窗口事件(消息)
if 消息 == SDL.WINDOWEVENT_CLOSE then
引擎:关闭()
end
end
function 引擎:键盘事件(KEY, KMOD, 状态, 按住)
--print(状态,键码,按住)
if not 状态 then
t = 1
if KEY == SDL.KEY_UP then
方向 = require 'GGE.坐标'(0, -20)
elseif KEY == SDL.KEY_DOWN then
方向 = require 'GGE.坐标'(0, 20)
elseif KEY == SDL.KEY_LEFT then
方向 = require 'GGE.坐标'(-20, 0)
elseif KEY == SDL.KEY_RIGHT then
方向 = require 'GGE.坐标'(20, 0)
end
end
end
此差异已折叠。
-- @Author : GGELUA -- @Author : GGELUA
-- @Date : 2022-03-07 18:52:00 -- @Date : 2022-03-07 18:52:00
-- @Last Modified by : baidwwy -- @Last Modified by : baidwwy
-- @Last Modified time : 2022-04-04 06:42:10 -- @Last Modified time : 2022-04-25 09:09:48
local SDL = require('SDL') local SDL = require('SDL')
local ggetype = ggetype local ggetype = ggetype
...@@ -132,6 +132,10 @@ function SDL图像:保存文件(file, tp, quality) ...@@ -132,6 +132,10 @@ function SDL图像:保存文件(file, tp, quality)
end end
end end
function SDL图像:置透明色(r, g, b)
return self._sf:SetColorKey(r, g, b)
end
function SDL图像:取透明色() function SDL图像:取透明色()
return self._sf:GetColorKey() return self._sf:GetColorKey()
end end
......
-- @Author : GGELUA -- @Author : GGELUA
-- @Date : 2022-03-21 14:01:02 -- @Date : 2022-03-21 14:01:02
-- @Last Modified by : baidwwy -- @Last Modified by : baidwwy
-- @Last Modified time : 2022-04-01 02:00:06 -- @Last Modified time : 2022-04-28 06:17:49
local SDL = require('SDL') local SDL = require('SDL')
local gge = require('ggelua') local gge = require('ggelua')
...@@ -73,9 +73,10 @@ function SDL窗口:SDL窗口(t) ...@@ -73,9 +73,10 @@ function SDL窗口:SDL窗口(t)
if t.无边框 then --隐藏边框 if t.无边框 then --隐藏边框
flags = flags | 0x00000010 --SDL_WINDOW_BORDERLESS flags = flags | 0x00000010 --SDL_WINDOW_BORDERLESS
end end
if t.隐藏 then --隐藏窗口
flags = flags | 0x00000008 --SDL_WINDOW_HIDDEN self.是否隐藏 = t.隐藏
end flags = flags | 0x00000008 --SDL_WINDOW_HIDDEN
if t.可调整 then --可调整 if t.可调整 then --可调整
flags = flags | 0x00000020 --SDL_WINDOW_RESIZABLE flags = flags | 0x00000020 --SDL_WINDOW_RESIZABLE
end end
...@@ -83,7 +84,12 @@ function SDL窗口:SDL窗口(t) ...@@ -83,7 +84,12 @@ function SDL窗口:SDL窗口(t)
flags = flags | 0x00010000 --SDL_WINDOW_SKIP_TASKBAR flags = flags | 0x00010000 --SDL_WINDOW_SKIP_TASKBAR
end end
self._win = assert(SDL.CreateWindow(self.标题, t.x, t.y, self.宽度, self.高度, flags), SDL.GetError()) if gge.platform == 'Windows' and t.异形 then
self._win = assert(SDL.CreateShapedWindow(self.标题, t.x, t.y, self.宽度, self.高度, flags), SDL.GetError())
else
self._win = assert(SDL.CreateWindow(self.标题, t.x, t.y, self.宽度, self.高度, flags), SDL.GetError())
end
local id = self._win:GetWindowID() local id = self._win:GetWindowID()
SDL._wins[id] = self SDL._wins[id] = self
...@@ -96,8 +102,10 @@ function SDL窗口:SDL窗口(t) ...@@ -96,8 +102,10 @@ function SDL窗口:SDL窗口(t)
SDL._mth = SDL.ThreadID() SDL._mth = SDL.ThreadID()
SDL._win = self SDL._win = self
SDL.FPS = self.帧率 SDL.FPS = self.帧率
if SDL.FPS > 0 then self._ft = 1 / SDL.FPS
SDL._ft = 1 / SDL.FPS self._dt = 0
if SDL.FPS > 0 and (SDL._ft == 0 or self._ft < SDL._ft) then
SDL._ft = self._ft
end end
end end
...@@ -109,10 +117,6 @@ function SDL窗口:SDL窗口(t) ...@@ -109,10 +117,6 @@ function SDL窗口:SDL窗口(t)
end end
SDL.CreateEvent(ggeinit, id):PushEvent() SDL.CreateEvent(ggeinit, id):PushEvent()
--设置黑色
self:渲染清除(0, 0, 0)
self:渲染结束()
self._reg = setmetatable({}, {__mode = 'k'}) --注册消息 self._reg = setmetatable({}, {__mode = 'k'}) --注册消息
self._tick = {} self._tick = {}
self._timer = {} --定时器 self._timer = {} --定时器
...@@ -213,16 +217,33 @@ function SDL窗口:_Event(t, ...) ...@@ -213,16 +217,33 @@ function SDL窗口:_Event(t, ...)
_Destroy(self) _Destroy(self)
return SDL._win == self return SDL._win == self
else else
self.dt = ... local dt = ...
_Sendreg(self, '更新事件', ...) --注册事件 if dt + 0.001 > self._ft then
_Sendmsg(self, '更新事件', ...) self.dt = dt
_Sendmsg(self, '渲染事件', ...) self._dt = 0
_Sendreg(self, '更新事件', ...) --注册事件
_Sendmsg(self, '更新事件', ...)
_Sendmsg(self, '渲染事件', ...)
else
self._dt = self._dt + dt
end
end end
elseif t == ggeinit then elseif t == ggeinit then
do --设置黑色
if not self.是否隐藏 then
self._win:ShowWindow()
end
self:渲染开始(0, 0, 0)
self:渲染结束()
if self._rd then
self._rd:RenderFlush()
end
end
if not self._inited and self.初始化 then if not self._inited and self.初始化 then
ggexpcall(self.初始化, self) ggexpcall(self.初始化, self)
self._inited = true
end end
self._inited = true
elseif t == 0x100 then --SDL_QUIT elseif t == 0x100 then --SDL_QUIT
self:_Event(0x200, SDL.WINDOWEVENT_CLOSE) self:_Event(0x200, SDL.WINDOWEVENT_CLOSE)
elseif t == 0x200 or t == 0x1000 then --SDL_WINDOWEVENT|SDL_DROPFILE|SDL_DROPTEXT elseif t == 0x200 or t == 0x1000 then --SDL_WINDOWEVENT|SDL_DROPFILE|SDL_DROPTEXT
...@@ -339,6 +360,9 @@ function SDL窗口:显示图像(sf, x, y, rect) ...@@ -339,6 +360,9 @@ function SDL窗口:显示图像(sf, x, y, rect)
end end
function SDL窗口:FPS() function SDL窗口:FPS()
if not SDL._fps then
SDL._fps = 0
end
return SDL.FPS return SDL.FPS
end end
...@@ -352,9 +376,10 @@ function SDL窗口:消息框(title, message, flags) ...@@ -352,9 +376,10 @@ function SDL窗口:消息框(title, message, flags)
return self._win:ShowSimpleMessageBox(flags, tostring(title), tostring(message)) return self._win:ShowSimpleMessageBox(flags, tostring(title), tostring(message))
end end
function SDL窗口:置隐藏(b) function SDL窗口:置隐藏(v)
assert(SDL._mth == SDL.ThreadID(), '无法在线程中调用') assert(SDL._mth == SDL.ThreadID(), '无法在线程中调用')
if b then self.是否隐藏 = v
if v then
self._win:HideWindow() self._win:HideWindow()
else else
self._win:ShowWindow() self._win:ShowWindow()
...@@ -416,6 +441,16 @@ function SDL窗口:取标题() ...@@ -416,6 +441,16 @@ function SDL窗口:取标题()
return self._win:GetWindowTitle() return self._win:GetWindowTitle()
end end
function SDL窗口:置图像(v)
assert(SDL._mth == SDL.ThreadID(), '无法在线程中调用')
if ggetype(v) == 'SDL图像' and self._win:IsShapedWindow() then
local sf = v:取对象()
self._win:SetWindowSize(sf.w, sf.h)
return self._win:SetWindowShape(sf)
end
return false
end
function SDL窗口:置图标(v) function SDL窗口:置图标(v)
assert(SDL._mth == SDL.ThreadID(), '无法在线程中调用') assert(SDL._mth == SDL.ThreadID(), '无法在线程中调用')
if ggetype(v) == 'SDL图像' then if ggetype(v) == 'SDL图像' then
...@@ -425,6 +460,9 @@ end ...@@ -425,6 +460,9 @@ end
function SDL窗口:置坐标(x, y) function SDL窗口:置坐标(x, y)
assert(SDL._mth == SDL.ThreadID(), '无法在线程中调用') assert(SDL._mth == SDL.ThreadID(), '无法在线程中调用')
if not y and ggetype(x) == 'GGE坐标' then
x, y = x:unpack()
end
self._win:SetWindowPosition(x, y) self._win:SetWindowPosition(x, y)
end end
......