自定义背景拖入无法识别的格式时会提示
This commit is contained in:
@@ -4,10 +4,12 @@ local back={}
|
||||
local image=false
|
||||
local alpha=.26
|
||||
function back.draw()
|
||||
gc.clear(.1,.1,.1)
|
||||
gc.setColor(1,1,1,alpha)
|
||||
local k=math.max(SCR.w/image:getWidth(),SCR.h/image:getHeight())
|
||||
mDraw(image,SCR.w*.5,SCR.h*.5,nil,k)
|
||||
if image then
|
||||
gc.clear(.1,.1,.1)
|
||||
gc.setColor(1,1,1,alpha)
|
||||
local k=math.max(SCR.w/image:getWidth(),SCR.h/image:getHeight())
|
||||
mDraw(image,SCR.w*.5,SCR.h*.5,nil,k)
|
||||
end
|
||||
end
|
||||
function back.event(a,img)
|
||||
if a then alpha=a end
|
||||
|
||||
@@ -119,13 +119,17 @@ function applyBG()
|
||||
BG.lock()
|
||||
elseif SETTING.bg=='custom'then
|
||||
if love.filesystem.getInfo('conf/customBG')then
|
||||
BG.unlock()
|
||||
BG.set('custom')
|
||||
gc.setDefaultFilter('linear','linear')
|
||||
local image=gc.newImage(love.filesystem.newFile('conf/customBG'))
|
||||
gc.setDefaultFilter('nearest','nearest')
|
||||
BG.send(SETTING.bgAlpha,image)
|
||||
BG.lock()
|
||||
local res,image=pcall(gc.newImage,love.filesystem.newFile('conf/customBG'))
|
||||
if res then
|
||||
BG.unlock()
|
||||
BG.set('custom')
|
||||
gc.setDefaultFilter('linear','linear')
|
||||
BG.send(SETTING.bgAlpha,image)
|
||||
gc.setDefaultFilter('nearest','nearest')
|
||||
BG.lock()
|
||||
else
|
||||
MES.new('error',text.customBGloadFailed)
|
||||
end
|
||||
else
|
||||
SETTING.bg='off'
|
||||
applyBG()
|
||||
|
||||
@@ -139,6 +139,7 @@ return{
|
||||
|
||||
keySettingInstruction="Press to bind key\nescape: cancel\nbackspace: delete",
|
||||
customBGhelp="Drop image file here to apply custom background",
|
||||
customBGloadFailed="Unsupport image format for custom background",
|
||||
|
||||
errorMsg="Techmino ran into a problem and needs to restart.\nYou can send the error log to the developers.",
|
||||
tryAnotherBuild="[Invalid UTF-8] If you are on Windows, try downloading Techmino-win32 or Techmino-win64 (different from what you are using now).",
|
||||
|
||||
@@ -128,6 +128,7 @@ return{
|
||||
|
||||
-- keySettingInstruction="Press to bind key\nescape: cancel\nbackspace: delete",
|
||||
-- customBGhelp="Drop image file here to apply custom background",
|
||||
-- customBGloadFailed="Unsupport image format for custom background",
|
||||
|
||||
errorMsg="Ha ocurrido un error y Techmino necesita reiniciarse.\nSe creó un registro de error, puedes enviarlo al autor.",
|
||||
-- tryAnotherBuild="[Invalid UTF-8] If you are on Windows, try downloading Techmino-win32 or Techmino-win64 (different from what you are using now).",
|
||||
|
||||
@@ -129,6 +129,7 @@ return{
|
||||
|
||||
-- keySettingInstruction="Press to bind key\nescape: cancel\nbackspace: delete",
|
||||
-- customBGhelp="Drop image file here to apply custom background",
|
||||
-- customBGloadFailed="Unsupport image format for custom background",
|
||||
|
||||
errorMsg="Une erreur est survenue et Techmino doit redémarrer.\nDes informations concernant l'erreur ont été créées, et vous pouvez les envoyer au créateur.",
|
||||
-- tryAnotherBuild="[Invalid UTF-8] If you are on Windows, try downloading Techmino-win32 or Techmino-win64 (different from what you are using now).",
|
||||
|
||||
@@ -127,6 +127,7 @@ return{
|
||||
|
||||
-- keySettingInstruction="Press to bind key\nescape: cancel\nbackspace: delete",
|
||||
-- customBGhelp="Drop image file here to apply custom background",
|
||||
-- customBGloadFailed="Unsupport image format for custom background",
|
||||
|
||||
errorMsg="Um erro ocorreu e Techmino precisa reiniciar.\nInformação do erro foi criada, e você pode mandar ao autor.",
|
||||
-- tryAnotherBuild="[Invalid UTF-8] If you are on Windows, try downloading Techmino-win32 or Techmino-win64 (different from what you are using now).",
|
||||
|
||||
@@ -139,6 +139,7 @@ return{
|
||||
|
||||
keySettingInstruction="点击添加键位绑定\nesc取消选中\n退格键清空选中",
|
||||
customBGhelp="把图片文件拖到这个窗口里使用自定义背景",
|
||||
customBGloadFailed="自定义背景的图片文件格式不支持",
|
||||
|
||||
errorMsg="Techmino遭受了雷击,需要重新启动。\n我们已收集了一些错误信息,你可以向作者进行反馈。",
|
||||
tryAnotherBuild="[解码UTF-8错误] 如果你现在用的是Windows系统,请重新下载 Techmino-32位 或者 Techmino-64位 (和现在运行的不一样的那个)。",
|
||||
|
||||
@@ -137,6 +137,7 @@ return{
|
||||
|
||||
keySettingInstruction="按绑定键\n退出:取消\n退格:删除",
|
||||
customBGhelp="将图像文件拖放到此处以应用自定义背景",
|
||||
customBGloadFailed="不支持自定义背景的图像格式",
|
||||
|
||||
errorMsg="技术米诺遇到问题,需要重新启动。\n您可以将错误日志发送给开发人员。",
|
||||
tryAnotherBuild="[无效UTF-8]如果您在Windows上,请尝试下载Techmino-win32或Techmino-win64(与您现在使用的不同)",
|
||||
|
||||
@@ -139,6 +139,7 @@ return{
|
||||
|
||||
keySettingInstruction="點擊來設置鍵位\n按esc來取消選中\n按退格鍵來清除選中",
|
||||
customBGhelp="把圖片檔案拖到這個視窗裏使用自定義背景",
|
||||
customBGloadFailed="自定義背景的圖片檔案格式不支持",
|
||||
|
||||
errorMsg="Techmino遇到問題,需要重新啟動。\n我們已經收集了一些錯誤信息,你可以反饋給作者。",
|
||||
tryAnotherBuild="[無效的 UTF-8] 如果你使用的是Windows作業系統,請嘗試下載Techmino-win32或Techmino-win64(與你現在使用的不同的版本)。",
|
||||
|
||||
@@ -8,9 +8,13 @@ end
|
||||
|
||||
|
||||
function scene.fileDropped(file)
|
||||
love.filesystem.write('conf/customBG',file:read('data'))
|
||||
SETTING.bg='custom'
|
||||
applyBG()
|
||||
if pcall(gc.newImage,file)then
|
||||
love.filesystem.write('conf/customBG',file:read('data'))
|
||||
SETTING.bg='custom'
|
||||
applyBG()
|
||||
else
|
||||
MES.new('error',text.customBGloadFailed)
|
||||
end
|
||||
end
|
||||
|
||||
local fakeBlock={{true}}
|
||||
|
||||
Reference in New Issue
Block a user