iOS设备震动函数改为输入1|2|3三档而不是时间(适配自改love,原版love都是固定振动)

框架不再使用不属于自己的SYSTEM的变量
This commit is contained in:
MrZ626
2021-10-24 04:45:34 +08:00
parent 716c44746b
commit 2db147461c
3 changed files with 14 additions and 8 deletions

View File

@@ -408,7 +408,7 @@ function love.errorhandler(msg)
--Write messages to log file
love.filesystem.append('conf/error.log',
os.date("%Y/%m/%d %A %H:%M:%S\n")..
#ERRDATA.." crash(es) "..SYSTEM.."-"..VERSION.string.." scene: "..scn.."\n"..
#ERRDATA.." crash(es) "..love.system.getOS().."-"..VERSION.string.." scene: "..scn.."\n"..
table.concat(err,"\n",1,c-2).."\n\n"
)
@@ -449,7 +449,7 @@ function love.errorhandler(msg)
FONT.set(100)gc_print(":(",100,0,0,1.2)
FONT.set(40)gc.printf(errorMsg,100,160,SCR.w0-100)
FONT.set(20)
gc_print(SYSTEM.."-"..VERSION.string.." scene:"..(SCN and SCN.cur or"NULL"),100,660)
gc_print(love.system.getOS().."-"..VERSION.string.." scene:"..(SCN and SCN.cur or"NULL"),100,660)
gc.printf(err[1],100,360,1260-100)
gc_print("TRACEBACK",100,450)
for i=4,#err-2 do

View File

@@ -2,10 +2,10 @@ package.cpath=package.cpath..';'..SAVEDIR..'/lib/lib?.so;'..'?.dylib'
local loaded={}
return function(libName)
local require=require
if SYSTEM=='OS X'then
if love.system.getOS()=='OS X'then
require=package.loadlib(libName..'.dylib','luaopen_'..libName)
libname=nil
elseif SYSTEM=='Android'then
elseif love.system.getOS()=='Android'then
if not loaded[libName]then
local platform=(function()
local p=io.popen('uname -m')

View File

@@ -1,6 +1,12 @@
local level={0,0,.01,.016,.023,.03,.04,.05,.06,.07,.08,.09,.12,.15}
local vib=love.system.vibrate
return function(t)
t=level[t]
if t then vib(t)end
end
return love.system.getOS()=='iOS'and
function(t)
t=level[t]
if t then vib(t<=.03 and 1 or t<=.09 and 2 or 3)end
end
or
function(t)
t=level[t]
if t then vib(t)end
end