提交 bf0af684 编写于 作者: baidwwy's avatar baidwwy 🏋

异形窗口

上级 cb8104cc
{
"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
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册