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