parent
36916785d6
commit
517b8faeaf
|
@ -1,7 +1,7 @@
|
||||||
--[[
|
--[[
|
||||||
@Author : baidwwy
|
@Author : baidwwy
|
||||||
@Date : 2021-02-08 15:51:46
|
@Date : 2021-02-08 15:51:46
|
||||||
@LastEditTime : 2021-04-28 13:44:53
|
@LastEditTime : 2021-05-06 12:49:29
|
||||||
--]]
|
--]]
|
||||||
io.stdout:setvbuf('no',0)
|
io.stdout:setvbuf('no',0)
|
||||||
gge = package.loadlib("ggelua", "luaopen_ggelua")()
|
gge = package.loadlib("ggelua", "luaopen_ggelua")()
|
||||||
|
@ -60,7 +60,9 @@ function 创建目录(path,...)
|
||||||
path = path:gsub('\\',dirsep)
|
path = path:gsub('\\',dirsep)
|
||||||
end
|
end
|
||||||
path = 分割文本(path,dirsep)
|
path = 分割文本(path,dirsep)
|
||||||
table.remove(path)
|
if #path>1 then
|
||||||
|
table.remove(path)
|
||||||
|
end
|
||||||
for i,v in ipairs(path) do
|
for i,v in ipairs(path) do
|
||||||
lfs.mkdir(table.concat(path, dirsep,1,i))
|
lfs.mkdir(table.concat(path, dirsep,1,i))
|
||||||
end
|
end
|
||||||
|
@ -209,18 +211,24 @@ function 写出Windows(path,c)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
print("写出失败")
|
error("写出失败",2)
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
|
||||||
function 写出Android()
|
function 写出Android(path)
|
||||||
-- local file<close> = io.open("assets\\ggescript","wb")
|
path = 绝对路径(path)
|
||||||
-- if file then
|
--创建目录(path)
|
||||||
-- local data = getscript()
|
--创建目录('android')
|
||||||
-- file:write(core)
|
local file<close> = io.open("ggescript","wb")
|
||||||
-- file:write(data)
|
if file then
|
||||||
-- file:write(string.pack("<I4I4I4",0x20454747,#core,#data))
|
local data = getscript()
|
||||||
-- end
|
file:write(core)
|
||||||
|
file:write(data)
|
||||||
|
file:write(string.pack("<I4I4I4",0x20454747,#core,#data))
|
||||||
|
return
|
||||||
|
end
|
||||||
|
error("写出失败",2)
|
||||||
|
return false
|
||||||
end
|
end
|
||||||
|
|
||||||
function 写出脚本()
|
function 写出脚本()
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
--[[
|
--[[
|
||||||
@Author : baidwwy
|
@Author : baidwwy
|
||||||
@Date : 2020-09-22 19:49:01
|
@Date : 2020-09-22 19:49:01
|
||||||
@LastEditTime : 2021-05-02 11:02:57
|
@LastEditTime : 2021-05-06 12:06:52
|
||||||
--]]
|
--]]
|
||||||
require("ggelua")
|
require("ggelua")
|
||||||
io.stdout:setvbuf('no',0)
|
io.stdout:setvbuf('no',0)
|
||||||
|
@ -37,7 +37,7 @@ package.cpath = nil
|
||||||
setmetatable(package, {
|
setmetatable(package, {
|
||||||
__newindex = function (t,k,v)
|
__newindex = function (t,k,v)
|
||||||
if v and k=='path' then
|
if v and k=='path' then
|
||||||
lpath = v:upper():gsub('\\','/')
|
lpath = v:lower():gsub('\\','/')
|
||||||
lpath_ = 分割路径(lpath)
|
lpath_ = 分割路径(lpath)
|
||||||
elseif k=='cpath' then
|
elseif k=='cpath' then
|
||||||
cpath = v
|
cpath = v
|
||||||
|
@ -71,7 +71,7 @@ local function 处理路径(path)
|
||||||
-- end
|
-- end
|
||||||
-- path = table.concat(t, "/")
|
-- path = table.concat(t, "/")
|
||||||
|
|
||||||
path = path:upper()--大写
|
path = path:lower()
|
||||||
path = path:gsub('%.','/')
|
path = path:gsub('%.','/')
|
||||||
path = path:gsub('\\','/')
|
path = path:gsub('\\','/')
|
||||||
return path
|
return path
|
||||||
|
@ -183,7 +183,7 @@ table.insert(package.searchers, 1, function (path)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
function gge.require(path,env,...)
|
function gge.require(path,env,...)
|
||||||
path = path:gsub('\\','/'):upper()
|
path = path:gsub('\\','/'):lower()
|
||||||
local data = 读取文件(path)
|
local data = 读取文件(path)
|
||||||
if data then
|
if data then
|
||||||
return assert(load(data,path,"bt",env))(...)
|
return assert(load(data,path,"bt",env))(...)
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
--[[
|
--[[
|
||||||
@Author : baidwwy
|
@Author : baidwwy
|
||||||
@Date : 2021-02-11 11:49:09
|
@Date : 2021-02-11 11:49:09
|
||||||
@LastEditTime : 2021-05-02 07:52:09
|
@LastEditTime : 2021-05-06 08:30:34
|
||||||
--]]
|
--]]
|
||||||
local GGE资源包
|
local GGE资源包
|
||||||
local _ENV = require("SDL")
|
local _ENV = require("SDL")
|
||||||
|
@ -47,7 +47,6 @@ function GGE资源:是否存在(path,...)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
--搜索包
|
--搜索包
|
||||||
|
|
||||||
for f,p in pairs(self._pack) do
|
for f,p in pairs(self._pack) do
|
||||||
if p:是否存在(path) then
|
if p:是否存在(path) then
|
||||||
return p,f
|
return p,f
|
||||||
|
@ -65,7 +64,7 @@ function GGE资源:读数据(path,...)
|
||||||
if type(r)=='string' then
|
if type(r)=='string' then
|
||||||
return LoadFile(r)--SDL
|
return LoadFile(r)--SDL
|
||||||
end
|
end
|
||||||
return r:读数据(path)
|
return r:读数据(path)--pack
|
||||||
end
|
end
|
||||||
return nil
|
return nil
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
--[[
|
--[[
|
||||||
@Author : baidwwy
|
@Author : baidwwy
|
||||||
@Date : 2021-02-11 11:49:09
|
@Date : 2021-02-11 11:49:09
|
||||||
@LastEditTime : 2021-05-03 10:38:07
|
@LastEditTime : 2021-05-06 16:42:43
|
||||||
--]]
|
--]]
|
||||||
|
|
||||||
local SDL = require("SDL")
|
local SDL = require("SDL")
|
||||||
|
@ -19,6 +19,19 @@ function SDL渲染:SDL渲染(t)
|
||||||
self._texs = setmetatable({}, {__mode='kv'})--纹理列表
|
self._texs = setmetatable({}, {__mode='kv'})--纹理列表
|
||||||
SDL.Log('渲染器 %s',self._rd:GetRendererInfo().name)
|
SDL.Log('渲染器 %s',self._rd:GetRendererInfo().name)
|
||||||
|
|
||||||
|
local platform = SDL.GetPlatform()
|
||||||
|
if platform == 'Android' or platform == 'iOS' then
|
||||||
|
local w,h = self._rd:GetRendererOutputSize()
|
||||||
|
if w<h then
|
||||||
|
w,h = h,w
|
||||||
|
end
|
||||||
|
if self.宽度>self.高度 then--横屏
|
||||||
|
self._rd:RenderSetLogicalSize(math.floor(w/(h/self.高度)),self.高度)
|
||||||
|
else
|
||||||
|
self._rd:RenderSetLogicalSize(self.宽度,math.floor(w/(h/self.宽度)))
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
-- for i=0,SDL.GetNumRenderDrivers()-1 do--CreateRenderer第1参数来启用相应的渲染器,(-1)第1个
|
-- for i=0,SDL.GetNumRenderDrivers()-1 do--CreateRenderer第1参数来启用相应的渲染器,(-1)第1个
|
||||||
-- print(i,SDL.GetRenderDriverInfo(i).name)
|
-- print(i,SDL.GetRenderDriverInfo(i).name)
|
||||||
-- end
|
-- end
|
||||||
|
@ -38,8 +51,8 @@ function SDL渲染:SDL渲染(t)
|
||||||
-- print(string.format( "%s,%s",k,v ))
|
-- print(string.format( "%s,%s",k,v ))
|
||||||
-- end
|
-- end
|
||||||
|
|
||||||
--print(self._rd:GetRendererOutputSize())
|
-- SDL.Log("OutputSize %d,%d",self._rd:GetRendererOutputSize())
|
||||||
--print(self._rd:RenderGetLogicalSize())
|
-- SDL.Log("LogicalSize %d,%d",self._rd:RenderGetLogicalSize())
|
||||||
--print(self._rd:RenderGetIntegerScale())
|
--print(self._rd:RenderGetIntegerScale())
|
||||||
|
|
||||||
--print(SDL.GetPixelFormatName(self._win:GetWindowPixelFormat()))
|
--print(SDL.GetPixelFormatName(self._win:GetWindowPixelFormat()))
|
||||||
|
@ -89,8 +102,10 @@ function SDL渲染:渲染清除(r,g,b,a)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function SDL渲染:创建渲染区()
|
function SDL渲染:创建渲染区(w,h)
|
||||||
|
if self._rd then
|
||||||
|
return self._rd:CreateTexture(w,h)--SDL_PIXELFORMAT_ARGB8888,SDL_TEXTUREACCESS_TARGET
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function SDL渲染:置渲染区(tex)
|
function SDL渲染:置渲染区(tex)
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
--[[
|
--[[
|
||||||
@Author : GGELUA
|
@Author : GGELUA
|
||||||
@Date : 2020-11-27 10:05:41
|
@Date : 2020-11-27 10:05:41
|
||||||
@LastEditTime : 2021-05-03 19:54:40
|
@LastEditTime : 2021-05-06 17:13:05
|
||||||
--]]
|
--]]
|
||||||
require("GGE")
|
require("GGE")
|
||||||
local type = type
|
local type = type
|
||||||
|
@ -21,21 +21,6 @@ function SDL窗口:SDL窗口(t)
|
||||||
self[k] = v
|
self[k] = v
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
local flags = 0x00000004--SDL_WINDOW_SHOWN
|
|
||||||
local platform = SDL.GetPlatform()
|
|
||||||
if platform == 'Android' or platform == 'iOS' then
|
|
||||||
t.全屏 = t.全屏~=false
|
|
||||||
t.渲染器 = "opengl"
|
|
||||||
SDL.SetHint("SDL_IOS_ORIENTATIONS", "LandscapeLeft LandscapeRight")--只能横向
|
|
||||||
SDL.SetHint("SDL_ANDROID_BLOCK_ON_PAUSE", "0")--后台不停止
|
|
||||||
if t.全屏 then
|
|
||||||
flags = flags|0x00001000--SDL_WINDOW_FULLSCREEN_DESKTOP
|
|
||||||
end
|
|
||||||
if SDL._win then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
self.标题 = t.标题 or "GGELUA Game Engine"
|
self.标题 = t.标题 or "GGELUA Game Engine"
|
||||||
self.原始标题 = self.标题
|
self.原始标题 = self.标题
|
||||||
self.宽度 = t.宽度 or 800
|
self.宽度 = t.宽度 or 800
|
||||||
|
@ -47,6 +32,27 @@ function SDL窗口:SDL窗口(t)
|
||||||
self.x = 0
|
self.x = 0
|
||||||
self.y = 0
|
self.y = 0
|
||||||
|
|
||||||
|
local flags = 0x00000004--SDL_WINDOW_SHOWN
|
||||||
|
local platform = SDL.GetPlatform()
|
||||||
|
if platform == 'Android' or platform == 'iOS' then
|
||||||
|
self.是否全屏 = t.全屏~=false
|
||||||
|
t.渲染器 = "opengl"
|
||||||
|
|
||||||
|
if self.宽度>self.高度 then--横向
|
||||||
|
SDL.SetHint("SDL_IOS_ORIENTATIONS", "LandscapeLeft LandscapeRight")
|
||||||
|
else
|
||||||
|
SDL.SetHint("SDL_IOS_ORIENTATIONS", "Portrait")
|
||||||
|
end
|
||||||
|
|
||||||
|
SDL.SetHint("SDL_ANDROID_BLOCK_ON_PAUSE", "0")--后台不停止
|
||||||
|
if self.是否全屏 then
|
||||||
|
flags = flags|0x00001000--SDL_WINDOW_FULLSCREEN_DESKTOP
|
||||||
|
end
|
||||||
|
if SDL._win then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
if type(t.渲染器)=='string' then
|
if type(t.渲染器)=='string' then
|
||||||
SDL.SetHint('SDL_RENDER_DRIVER',t.渲染器)
|
SDL.SetHint('SDL_RENDER_DRIVER',t.渲染器)
|
||||||
if t.渲染器=='opengl' then
|
if t.渲染器=='opengl' then
|
||||||
|
@ -54,7 +60,7 @@ function SDL窗口:SDL窗口(t)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
if t.全屏 then
|
if self.是否全屏 then
|
||||||
flags = flags|0x00000001--SDL_WINDOW_FULLSCREEN
|
flags = flags|0x00000001--SDL_WINDOW_FULLSCREEN
|
||||||
end
|
end
|
||||||
if t.无边框 then--隐藏边框
|
if t.无边框 then--隐藏边框
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
--[[
|
--[[
|
||||||
@Author : GGELUA
|
@Author : GGELUA
|
||||||
@Date : 2020-10-11 11:55:41
|
@Date : 2020-10-11 11:55:41
|
||||||
@LastEditTime : 2021-05-03 14:23:16
|
@LastEditTime : 2021-05-06 13:10:24
|
||||||
--]]
|
--]]
|
||||||
local _ENV = require("SDL")
|
local _ENV = require("SDL")
|
||||||
IMG_Init()
|
IMG_Init()
|
||||||
|
@ -83,7 +83,7 @@ function SDL精灵:显示(x,y)
|
||||||
--tex:SetTextureAlphaMod(self._a)
|
--tex:SetTextureAlphaMod(self._a)
|
||||||
--tex:SetTextureBlendMode(self._blend)
|
--tex:SetTextureBlendMode(self._blend)
|
||||||
|
|
||||||
if self._f or self._deg then--高级
|
if self._f or self._deg then--src,dst,旋转,翻转,翻转中心
|
||||||
self._win:显示纹理(tex,self._sr,self._dr,self._deg,self._f,self._ax,self._ay);
|
self._win:显示纹理(tex,self._sr,self._dr,self._deg,self._f,self._ax,self._ay);
|
||||||
if self._hl then--高亮
|
if self._hl then--高亮
|
||||||
tex:SetTextureBlendMode(BLENDMODE_ADD)--FIXME
|
tex:SetTextureBlendMode(BLENDMODE_ADD)--FIXME
|
||||||
|
|
|
@ -2,12 +2,11 @@
|
||||||
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x86'">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x86'">
|
||||||
<DebuggerFlavor>AndroidDebugger</DebuggerFlavor>
|
<DebuggerFlavor>AndroidDebugger</DebuggerFlavor>
|
||||||
<AndroidDeviceID>emulator-5554;api26</AndroidDeviceID>
|
<AndroidDeviceID>emulator-####;api26</AndroidDeviceID>
|
||||||
<LaunchActivity>com.GGELUA.game.ggemain</LaunchActivity>
|
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x86'">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x86'">
|
||||||
<AndroidDeviceID>emulator-5554;api26</AndroidDeviceID>
|
|
||||||
<DebuggerFlavor>AndroidDebugger</DebuggerFlavor>
|
<DebuggerFlavor>AndroidDebugger</DebuggerFlavor>
|
||||||
|
<AndroidDeviceID>emulator-####;api26</AndroidDeviceID>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">
|
||||||
<DebuggerFlavor>AndroidDebugger</DebuggerFlavor>
|
<DebuggerFlavor>AndroidDebugger</DebuggerFlavor>
|
||||||
|
@ -15,17 +14,22 @@
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">
|
||||||
<DebuggerFlavor>AndroidDebugger</DebuggerFlavor>
|
<DebuggerFlavor>AndroidDebugger</DebuggerFlavor>
|
||||||
|
<LaunchActivity>com.GGELUA.game.ggemain</LaunchActivity>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'">
|
||||||
<DebuggerFlavor>AndroidDebugger</DebuggerFlavor>
|
<DebuggerFlavor>AndroidDebugger</DebuggerFlavor>
|
||||||
|
<LaunchActivity>com.GGELUA.game.ggemain</LaunchActivity>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'">
|
||||||
<DebuggerFlavor>AndroidDebugger</DebuggerFlavor>
|
<DebuggerFlavor>AndroidDebugger</DebuggerFlavor>
|
||||||
|
<LaunchActivity>com.GGELUA.game.ggemain</LaunchActivity>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||||
<DebuggerFlavor>AndroidDebugger</DebuggerFlavor>
|
<DebuggerFlavor>AndroidDebugger</DebuggerFlavor>
|
||||||
|
<AndroidDeviceID>emulator-####;api26</AndroidDeviceID>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||||
<DebuggerFlavor>AndroidDebugger</DebuggerFlavor>
|
<DebuggerFlavor>AndroidDebugger</DebuggerFlavor>
|
||||||
|
<AndroidDeviceID>emulator-####;api26</AndroidDeviceID>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
</Project>
|
</Project>
|
Loading…
Reference in New Issue