关闭背景时亮度可调
新增自定义图片背景功能(可调透明度,目前仅电脑可用)
This commit is contained in:
@@ -4,8 +4,9 @@ local BGs={
|
||||
}
|
||||
local BGlist={'none'}
|
||||
local BG={
|
||||
cur='none',
|
||||
default='none',
|
||||
locked=false,
|
||||
cur='none',
|
||||
init=false,
|
||||
resize=false,
|
||||
update=NULL,
|
||||
@@ -14,6 +15,8 @@ local BG={
|
||||
discard=NULL,
|
||||
}
|
||||
|
||||
function BG.lock()BG.locked=true end
|
||||
function BG.unlock()BG.locked=false end
|
||||
function BG.add(name,bg)
|
||||
BGs[name]=bg
|
||||
BGlist[#BGlist+1]=name
|
||||
@@ -29,20 +32,20 @@ end
|
||||
function BG.setDefault(bg)
|
||||
BG.default=bg
|
||||
end
|
||||
function BG.set(background)
|
||||
background=background or BG.default
|
||||
if not BGs[background]or not SETTING.bg then return end
|
||||
if background~=BG.cur then
|
||||
function BG.set(name)
|
||||
name=name or BG.default
|
||||
if not BGs[name]or BG.locked then return end
|
||||
if name~=BG.cur then
|
||||
BG.discard()
|
||||
BG.cur=background
|
||||
background=BGs[background]
|
||||
BG.cur=name
|
||||
local bg=BGs[name]
|
||||
|
||||
BG.init= background.init or NULL
|
||||
BG.resize= background.resize or NULL
|
||||
BG.update= background.update or NULL
|
||||
BG.draw= background.draw or NULL
|
||||
BG.event= background.event or NULL
|
||||
BG.discard=background.discard or NULL
|
||||
BG.init= bg.init or NULL
|
||||
BG.resize= bg.resize or NULL
|
||||
BG.update= bg.update or NULL
|
||||
BG.draw= bg.draw or NULL
|
||||
BG.event= bg.event or NULL
|
||||
BG.discard=bg.discard or NULL
|
||||
BG.init()
|
||||
end
|
||||
return true
|
||||
|
||||
1
main.lua
1
main.lua
@@ -518,6 +518,7 @@ do
|
||||
if type(SETTING.skinSet)=='number'then SETTING.skinSet='crystal_scf'end
|
||||
if not TABLE.find({8,10,13,17,22,29,37,47,62,80,100},SETTING.frameMul)then SETTING.frameMul=100 end
|
||||
if SETTING.cv then SETTING.vocPack,SETTING.cv=SETTING.cv end
|
||||
if type(SETTING.bg)~='string'then SETTING.bg='on'end
|
||||
if RANKS.infinite then RANKS.infinite=0 end
|
||||
if RANKS.infinite_dig then RANKS.infinite_dig=0 end
|
||||
if not RANKS.sprint_10l then RANKS.sprint_10l=0 end
|
||||
|
||||
16
parts/backgrounds/custom.lua
Normal file
16
parts/backgrounds/custom.lua
Normal file
@@ -0,0 +1,16 @@
|
||||
--Secret custom background
|
||||
local gc=love.graphics
|
||||
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)
|
||||
end
|
||||
function back.event(a,img)
|
||||
if a then alpha=a end
|
||||
if img then image=img end
|
||||
end
|
||||
return back
|
||||
11
parts/backgrounds/gray.lua
Normal file
11
parts/backgrounds/gray.lua
Normal file
@@ -0,0 +1,11 @@
|
||||
--Customizable grey background
|
||||
local gc=love.graphics
|
||||
local back={}
|
||||
local brightness=.26
|
||||
function back.draw()
|
||||
gc.clear(brightness,brightness,brightness)
|
||||
end
|
||||
function back.event(b)
|
||||
brightness=b
|
||||
end
|
||||
return back
|
||||
@@ -108,8 +108,32 @@ do--function applyBlockSatur,applyFieldSatur(mode)
|
||||
SHADER.fieldSatur:send('k',m[2])
|
||||
end
|
||||
end
|
||||
function applyBG()
|
||||
if SETTING.bg=='on'then
|
||||
BG.unlock()
|
||||
BG.set()
|
||||
elseif SETTING.bg=='off'then
|
||||
BG.unlock()
|
||||
BG.set('gray')
|
||||
BG.send(SETTING.bgAlpha)
|
||||
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()
|
||||
else
|
||||
SETTING.bg='off'
|
||||
applyBG()
|
||||
end
|
||||
end
|
||||
end
|
||||
function applyAllSettings()
|
||||
love.window.setFullscreen(SETTING.fullscreen)
|
||||
applyFullscreen()
|
||||
love.audio.setVolume(SETTING.mainVol)
|
||||
VK.setShape(SETTING.VKSkin)
|
||||
BGM.setVol(SETTING.bgm)
|
||||
@@ -119,6 +143,7 @@ function applyAllSettings()
|
||||
applyFieldSatur(SETTING.fieldSatur)
|
||||
applyLanguage()
|
||||
applyCursor()
|
||||
applyBG()
|
||||
end
|
||||
|
||||
--Royale mode
|
||||
|
||||
@@ -637,7 +637,8 @@ do--Userdata tables
|
||||
highCam=true,
|
||||
nextPos=true,
|
||||
fullscreen=true,
|
||||
bg=true,
|
||||
bg='on',
|
||||
bgAlpha=.26,
|
||||
powerInfo=false,
|
||||
clickFX=true,
|
||||
warn=true,
|
||||
|
||||
@@ -138,6 +138,7 @@ return{
|
||||
chatHistory="------New messages below------",
|
||||
|
||||
keySettingInstruction="Press to bind key\nescape: cancel\nbackspace: delete",
|
||||
customBGhelp="Drop image file here to apply 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).",
|
||||
@@ -390,7 +391,10 @@ return{
|
||||
power="Battery Info",
|
||||
clean="Quick Draw",
|
||||
fullscreen="Fullscreen",
|
||||
bg="Background",
|
||||
|
||||
bg_on="Normal Backgrounds",
|
||||
bg_off="No Background",
|
||||
bg_custom="Apply Custom BG",
|
||||
|
||||
blockSatur="Block Saturation",
|
||||
fieldSatur="Field Saturation",
|
||||
|
||||
@@ -127,6 +127,7 @@ return{
|
||||
chatHistory="------Nuevos mensajes------",
|
||||
|
||||
-- keySettingInstruction="Press to bind key\nescape: cancel\nbackspace: delete",
|
||||
-- customBGhelp="Drop image file here to apply 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).",
|
||||
@@ -356,7 +357,10 @@ return{
|
||||
power="Inf. de Batería",
|
||||
clean="Fast Draw",
|
||||
fullscreen="Pant. Completa",
|
||||
bg="Fondo",
|
||||
|
||||
-- bg_on="Normal Backgrounds",
|
||||
-- bg_off="No Background",
|
||||
-- bg_custom="Apply Custom BG",
|
||||
|
||||
blockSatur="Saturac. de los Bloques",
|
||||
fieldSatur="Saturac. del Tablero",
|
||||
|
||||
@@ -128,6 +128,7 @@ return{
|
||||
chatHistory="-Nouveaux messages en dessous-",
|
||||
|
||||
-- keySettingInstruction="Press to bind key\nescape: cancel\nbackspace: delete",
|
||||
-- customBGhelp="Drop image file here to apply 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).",
|
||||
@@ -354,7 +355,10 @@ return{
|
||||
power="Infos d'alimentation",
|
||||
-- clean="Fast Draw",
|
||||
fullscreen="Plein écran",
|
||||
bg="Arrière-plan",
|
||||
|
||||
-- bg_on="Normal Backgrounds",
|
||||
-- bg_off="No Background",
|
||||
-- bg_custom="Apply Custom BG",
|
||||
|
||||
-- blockSatur="Block Saturation",
|
||||
-- fieldSatur="Field Saturation",
|
||||
|
||||
@@ -126,6 +126,7 @@ return{
|
||||
chatHistory="------Novas mensagens abaixo------",
|
||||
|
||||
-- keySettingInstruction="Press to bind key\nescape: cancel\nbackspace: delete",
|
||||
-- customBGhelp="Drop image file here to apply 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).",
|
||||
@@ -378,7 +379,10 @@ return{
|
||||
power="Informação bateria",
|
||||
-- clean="Fast Draw",
|
||||
fullscreen="Tela cheia",
|
||||
bg="Fundo",
|
||||
|
||||
-- bg_on="Normal Backgrounds",
|
||||
-- bg_off="No Background",
|
||||
-- bg_custom="Apply Custom BG",
|
||||
|
||||
-- blockSatur="Block Saturation",
|
||||
-- fieldSatur="Field Saturation",
|
||||
|
||||
@@ -284,7 +284,10 @@ return{
|
||||
power="+.",
|
||||
clean="[]→→O",
|
||||
fullscreen="|←→|",
|
||||
bg="__?__",
|
||||
|
||||
bg_on="__?__",
|
||||
bg_off="__.__",
|
||||
bg_custom="__!__",
|
||||
|
||||
blockSatur="==#0x",
|
||||
fieldSatur="[]#0x",
|
||||
|
||||
@@ -138,6 +138,7 @@ return{
|
||||
chatHistory="------以上是历史消息------",
|
||||
|
||||
keySettingInstruction="点击添加键位绑定\nesc取消选中\n退格键清空选中",
|
||||
customBGhelp="把图片文件拖到这个窗口里使用自定义背景",
|
||||
|
||||
errorMsg="Techmino遭受了雷击,需要重新启动。\n我们已收集了一些错误信息,你可以向作者进行反馈。",
|
||||
tryAnotherBuild="[解码UTF-8错误] 如果你现在用的是Windows系统,请重新下载 Techmino-32位 或者 Techmino-64位 (和现在运行的不一样的那个)。",
|
||||
@@ -390,7 +391,10 @@ return{
|
||||
power="电量显示",
|
||||
clean="绘制优化",
|
||||
fullscreen="全屏",
|
||||
bg="背景",
|
||||
|
||||
bg_on="普通背景",
|
||||
bg_off="关闭背景",
|
||||
bg_custom="应用自定义背景",
|
||||
|
||||
blockSatur="方块饱和度",
|
||||
fieldSatur="场地饱和度",
|
||||
|
||||
@@ -136,6 +136,7 @@ return{
|
||||
chatHistory="------下面是新消息------",
|
||||
|
||||
keySettingInstruction="按绑定键\n退出:取消\n退格:删除",
|
||||
customBGhelp="将图像文件拖放到此处以应用自定义背景",
|
||||
|
||||
errorMsg="技术米诺遇到问题,需要重新启动。\n您可以将错误日志发送给开发人员。",
|
||||
tryAnotherBuild="[无效UTF-8]如果您在Windows上,请尝试下载Techmino-win32或Techmino-win64(与您现在使用的不同)",
|
||||
@@ -388,7 +389,10 @@ return{
|
||||
power="蓄电池信息",
|
||||
clean="快速绘制",
|
||||
fullscreen="全屏",
|
||||
bg="背景",
|
||||
|
||||
bg_on="正常背景",
|
||||
bg_off="没有背景",
|
||||
bg_custom="应用自定义背景",
|
||||
|
||||
blockSatur="块饱和",
|
||||
fieldSatur="场饱和",
|
||||
|
||||
@@ -138,6 +138,7 @@ return{
|
||||
chatHistory="------以上為歷史訊息------",
|
||||
|
||||
keySettingInstruction="點擊來設置鍵位\n按esc來取消選中\n按退格鍵來清除選中",
|
||||
customBGhelp="把圖片檔案拖到這個視窗裏使用自定義背景",
|
||||
|
||||
errorMsg="Techmino遇到問題,需要重新啟動。\n我們已經收集了一些錯誤信息,你可以反饋給作者。",
|
||||
tryAnotherBuild="[無效的 UTF-8] 如果你使用的是Windows作業系統,請嘗試下載Techmino-win32或Techmino-win64(與你現在使用的不同的版本)。",
|
||||
@@ -389,7 +390,10 @@ return{
|
||||
power="電量顯示",
|
||||
clean="渲染優化",
|
||||
fullscreen="全屏幕",
|
||||
bg="背景",
|
||||
|
||||
bg_on="普通背景",
|
||||
bg_off="無背景",
|
||||
bg_custom="應用自定義背景",
|
||||
|
||||
blockSatur="方塊飽和",
|
||||
fieldSatur="場地飽和",
|
||||
|
||||
@@ -6,6 +6,13 @@ function scene.sceneBack()
|
||||
saveSettings()
|
||||
end
|
||||
|
||||
|
||||
function scene.fileDropped(file)
|
||||
love.filesystem.write('conf/customBG',file:read('data'))
|
||||
SETTING.bg='custom'
|
||||
applyBG()
|
||||
end
|
||||
|
||||
local fakeBlock={{true}}
|
||||
function scene.draw()
|
||||
local skinLib=SKIN.lib[SETTING.skinSet]
|
||||
@@ -72,12 +79,24 @@ scene.widgetList={
|
||||
WIDGET.newSwitch{name='power', x=950,y=1070,lim=360,disp=SETval('powerInfo'), code=SETrev('powerInfo')},
|
||||
WIDGET.newSwitch{name='clean', x=950,y=1160,lim=360,disp=SETval('cleanCanvas'), code=SETrev('cleanCanvas')},
|
||||
WIDGET.newSwitch{name='fullscreen', x=950,y=1250,lim=360,disp=SETval('fullscreen'), code=function()SETTING.fullscreen=not SETTING.fullscreen applyFullscreen()end},
|
||||
WIDGET.newSwitch{name='bg', x=950,y=1340,lim=360,disp=SETval('bg'),
|
||||
|
||||
WIDGET.newKey{name='bg_on', x=900,y=1340,w=200,h=80,code=function()SETTING.bg='on'applyBG()end},
|
||||
WIDGET.newKey{name='bg_off', x=680,y=1340,w=200,h=80,code=function()SETTING.bg='off'applyBG()end},
|
||||
WIDGET.newKey{name='bg_custom', x=1120,y=1340,w=200,h=80,
|
||||
code=function()
|
||||
BG.set('none')
|
||||
SETTING.bg=not SETTING.bg
|
||||
BG.set()
|
||||
end},
|
||||
if love.filesystem.getInfo('conf/customBG')then
|
||||
SETTING.bg='custom'
|
||||
applyBG()
|
||||
else
|
||||
MES.new('info',text.customBGhelp)
|
||||
end
|
||||
end
|
||||
},
|
||||
WIDGET.newSlider{name='bgAlpha', x=1020,y=1430,w=200,
|
||||
unit=.8,disp=SETval('bgAlpha'),
|
||||
code=function(v)SETTING.bgAlpha=v BG.send(v)end,
|
||||
hideF=function()return SETTING.bg=='on'end
|
||||
},
|
||||
|
||||
WIDGET.newSelector{name='blockSatur', x=800,y=1440,w=300,color='lN',
|
||||
list={'normal','soft','gray','light','color'},
|
||||
|
||||
Reference in New Issue
Block a user