Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
GGELUA
GGELUA2
提交
a2afcb00
GGELUA2
项目概览
GGELUA
/
GGELUA2
通知
169
Star
23
Fork
2
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
代码片段
项目成员
Pages
GGELUA2
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
代码片段
代码片段
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
a2afcb00
编写于
4月 27, 2022
作者:
baidwwy
🏋
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
贪吃蛇
上级
799b7447
变更
10
隐藏空白更改
内联
并排
Showing
10 changed file
with
449 addition
and
0 deletion
+449
-0
examples/例子/贪吃蛇/.vscode/extensions.json
examples/例子/贪吃蛇/.vscode/extensions.json
+15
-0
examples/例子/贪吃蛇/.vscode/ggebuild.lua
examples/例子/贪吃蛇/.vscode/ggebuild.lua
+33
-0
examples/例子/贪吃蛇/.vscode/ggelua.code-snippets
examples/例子/贪吃蛇/.vscode/ggelua.code-snippets
+73
-0
examples/例子/贪吃蛇/.vscode/ggerun.lua
examples/例子/贪吃蛇/.vscode/ggerun.lua
+20
-0
examples/例子/贪吃蛇/.vscode/icon.png
examples/例子/贪吃蛇/.vscode/icon.png
+0
-0
examples/例子/贪吃蛇/.vscode/launch.json
examples/例子/贪吃蛇/.vscode/launch.json
+22
-0
examples/例子/贪吃蛇/.vscode/settings.json
examples/例子/贪吃蛇/.vscode/settings.json
+12
-0
examples/例子/贪吃蛇/.vscode/tasks.json
examples/例子/贪吃蛇/.vscode/tasks.json
+175
-0
examples/例子/贪吃蛇/ggelua.code-workspace
examples/例子/贪吃蛇/ggelua.code-workspace
+25
-0
examples/例子/贪吃蛇/lua/main.lua
examples/例子/贪吃蛇/lua/main.lua
+74
-0
未找到文件。
examples/例子/贪吃蛇/.vscode/extensions.json
0 → 100644
浏览文件 @
a2afcb00
{
"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
examples/例子/贪吃蛇/.vscode/ggebuild.lua
0 → 100644
浏览文件 @
a2afcb00
-- @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
..
'秒'
)
examples/例子/贪吃蛇/.vscode/ggelua.code-snippets
0 → 100644
浏览文件 @
a2afcb00
{
// 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
examples/例子/贪吃蛇/.vscode/ggerun.lua
0 → 100644
浏览文件 @
a2afcb00
-- @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
examples/例子/贪吃蛇/.vscode/icon.png
0 → 100644
浏览文件 @
a2afcb00
19.9 KB
examples/例子/贪吃蛇/.vscode/launch.json
0 → 100644
浏览文件 @
a2afcb00
{
//
使用
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
examples/例子/贪吃蛇/.vscode/settings.json
0 → 100644
浏览文件 @
a2afcb00
{
"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
examples/例子/贪吃蛇/.vscode/tasks.json
0 → 100644
浏览文件 @
a2afcb00
{
//
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
examples/例子/贪吃蛇/ggelua.code-workspace
0 → 100644
浏览文件 @
a2afcb00
{
"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
examples/例子/贪吃蛇/lua/main.lua
0 → 100644
浏览文件 @
a2afcb00
-- @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
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录