涉及框架的设置项统一应用,不再细分时机
修改errData的获得方式 WIDGET新增setOnChange方法,不再依赖THEME
This commit is contained in:
@@ -319,7 +319,7 @@ function love.keypressed(key,_,isRep)
|
||||
MES.new('info',"DEBUG ON",.2)
|
||||
elseif key=='f11'then
|
||||
SETTING.fullscreen=not SETTING.fullscreen
|
||||
applyFullscreen()
|
||||
applySettings()
|
||||
saveSettings()
|
||||
elseif not SCN.swapping then
|
||||
if EDITING==""and(not SCN.keyDown or SCN.keyDown(key,isRep))then
|
||||
@@ -492,6 +492,7 @@ function love.lowmemory()
|
||||
end
|
||||
end
|
||||
function love.resize(w,h)
|
||||
if SCR.w==w and SCR.h==h then return end
|
||||
SCR.resize(w,h)
|
||||
if BG.resize then BG.resize(w,h)end
|
||||
if SCN.resize then SCN.resize(w,h)end
|
||||
@@ -829,13 +830,19 @@ end
|
||||
|
||||
local Z={}
|
||||
|
||||
Z.js=jsState
|
||||
Z.errData=errData
|
||||
function Z.getJsState()return jsState end
|
||||
function Z.getErr(i)
|
||||
if i=='#'then
|
||||
return errData[#errData]
|
||||
elseif i then
|
||||
return errData[i]
|
||||
else
|
||||
return errData
|
||||
end
|
||||
end
|
||||
|
||||
function Z.setPowerInfo(bool)showPowerInfo=bool end
|
||||
|
||||
function Z.setCleanCanvas(bool)discardCanvas=bool end
|
||||
|
||||
function Z.setFrameMul(n)frameMul=n end
|
||||
function Z.setClickFX(bool)showClickFX=bool end
|
||||
|
||||
@@ -844,12 +851,12 @@ function Z.setCursor(func)drawCursor=func end
|
||||
|
||||
--Change F1~F7 events of devmode (F8 mode)
|
||||
function Z.setOnFnKeys(list)
|
||||
assert(type(list)=='table')
|
||||
assert(type(list)=='table',"Z.setOnFnKeys(list): list must be a table.")
|
||||
for i=1,7 do fnKey[i]=type(list[i])=='function'and list[i]or NULL end
|
||||
end
|
||||
|
||||
function Z.setOnFocus(func)onFocus=type(func)=='function'and func or NULL end
|
||||
function Z.setOnFocus(func)onFocus=assert(type(func)=='function'and func,"Z.setOnFocus(func): func must be a function")end
|
||||
|
||||
function Z.setOnQuit(func)onQuit=type(func)=='function'and func or NULL end
|
||||
function Z.setOnQuit(func)onQuit=assert(type(func)=='function'and func,"Z.setOnQuit(func): func must be a function")end
|
||||
|
||||
return Z
|
||||
|
||||
@@ -45,7 +45,12 @@ local function _rectangleStencil()
|
||||
gc.rectangle('fill',1,1,STW-2,STH-2)
|
||||
end
|
||||
|
||||
local onChange=NULL
|
||||
|
||||
local WIDGET={}
|
||||
|
||||
function WIDGET.setOnChange(func)onChange=assert(type(func)=='function'and func,"WIDGET.setOnChange(func): func must be a function")end
|
||||
|
||||
local widgetMetatable={
|
||||
__tostring=function(self)
|
||||
return self:getInfo()
|
||||
@@ -1263,7 +1268,7 @@ end
|
||||
function listBox:getInfo()
|
||||
return("x=%d,y=%d,w=%d,h=%d"):format(self.x+self.w*.5,self.y+self.h*.5,self.w,self.h)
|
||||
end
|
||||
function WIDGET.newListBox(D)--name,x,y,w,h,lineH[,hideF][,hide][,drawF]
|
||||
function WIDGET.newListBox(D)--name,x,y,w,h,lineH,drawF[,hideF][,hide]
|
||||
local _={
|
||||
name= D.name or"_",
|
||||
|
||||
@@ -1320,16 +1325,7 @@ function WIDGET.setWidgetList(list)
|
||||
for i=1,#list do
|
||||
list[i]:reset()
|
||||
end
|
||||
if SCN.cur~='custom_field'then
|
||||
local colorList=THEME.getThemeColor()
|
||||
if not colorList then return end
|
||||
local rnd=math.random
|
||||
for _,W in next,list do
|
||||
if W.color and not W.fText then
|
||||
W.color=colorList[rnd(#colorList)]
|
||||
end
|
||||
end
|
||||
end
|
||||
onChange()
|
||||
end
|
||||
end
|
||||
function WIDGET.setScrollHeight(height)
|
||||
|
||||
Reference in New Issue
Block a user