规范代码,大量xxx=nil换成xxx=false
This commit is contained in:
@@ -7,11 +7,11 @@ local BGlist={
|
||||
}
|
||||
local BG={
|
||||
cur="none",
|
||||
init=nil,
|
||||
resize=nil,
|
||||
init=false,
|
||||
resize=false,
|
||||
update=NULL,
|
||||
draw=BGlist.none.draw,
|
||||
event=nil,
|
||||
event=false,
|
||||
discard=NULL,
|
||||
}
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@ local ins,rem=table.insert,table.remove
|
||||
local SCR=SCR
|
||||
|
||||
local mx,my,mouseShow=-20,-20,false
|
||||
local touching=nil--First touching ID(userdata)
|
||||
local touching--First touching ID(userdata)
|
||||
local xOy=SCR.xOy
|
||||
joysticks={}
|
||||
|
||||
@@ -146,7 +146,7 @@ function love.touchmoved(id,x,y,dx,dy)
|
||||
else
|
||||
WIDGET.moveCursor(x,y)
|
||||
if not WIDGET.sel then
|
||||
touching=nil
|
||||
touching=false
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -156,9 +156,9 @@ function love.touchreleased(id,x,y)
|
||||
if id==touching then
|
||||
WIDGET.press(x,y)
|
||||
WIDGET.release(x,y)
|
||||
touching=nil
|
||||
touching=false
|
||||
if WIDGET.sel and not WIDGET.sel.keepFocus then
|
||||
WIDGET.sel=nil
|
||||
WIDGET.sel=false
|
||||
end
|
||||
end
|
||||
if SCN.touchUp then SCN.touchUp(id,x,y)end
|
||||
|
||||
@@ -8,33 +8,33 @@ local SCN={
|
||||
cur="NULL",--Current scene name
|
||||
swapping=false,--If Swapping
|
||||
stat={
|
||||
tar=nil, --Swapping target
|
||||
style=nil, --Swapping style
|
||||
mid=nil, --Loading point
|
||||
time=nil, --Full swap time
|
||||
draw=nil, --Swap draw func
|
||||
tar=false, --Swapping target
|
||||
style=false,--Swapping style
|
||||
mid=false, --Loading point
|
||||
time=false, --Full swap time
|
||||
draw=false, --Swap draw func
|
||||
},
|
||||
stack={"quit","slowFade"},--Scene stack
|
||||
|
||||
scenes=scenes,
|
||||
|
||||
--Events
|
||||
update=nil,
|
||||
draw=nil,
|
||||
mouseClick=nil,
|
||||
touchClick=nil,
|
||||
mouseDown=nil,
|
||||
mouseMove=nil,
|
||||
mouseUp=nil,
|
||||
wheelMoved=nil,
|
||||
touchDown=nil,
|
||||
touchUp=nil,
|
||||
touchMove=nil,
|
||||
keyDown=nil,
|
||||
keyUp=nil,
|
||||
gamepadDown=nil,
|
||||
gamepadUp=nil,
|
||||
socketRead=nil,
|
||||
update=false,
|
||||
draw=false,
|
||||
mouseClick=false,
|
||||
touchClick=false,
|
||||
mouseDown=false,
|
||||
mouseMove=false,
|
||||
mouseUp=false,
|
||||
wheelMoved=false,
|
||||
touchDown=false,
|
||||
touchUp=false,
|
||||
touchMove=false,
|
||||
keyDown=false,
|
||||
keyUp=false,
|
||||
gamepadDown=false,
|
||||
gamepadUp=false,
|
||||
socketRead=false,
|
||||
}--Scene datas, returned
|
||||
|
||||
function SCN.add(name,scene)
|
||||
|
||||
@@ -499,13 +499,13 @@ function WIDGET.newSlider(D)--name,x,y,w[,unit][,smooth][,font][,change],disp,co
|
||||
},
|
||||
|
||||
unit= D.unit or 1,
|
||||
smooth=nil,
|
||||
smooth= false,
|
||||
font= D.font or 30,
|
||||
change= D.change,
|
||||
disp= D.disp,
|
||||
code= D.code,
|
||||
hide= D.hide,
|
||||
show= nil,
|
||||
show= false,
|
||||
}
|
||||
if D.smooth~=nil then
|
||||
_.smooth=D.smooth
|
||||
@@ -534,7 +534,7 @@ local selector={
|
||||
type="selector",
|
||||
ATV=8,--Activating time(0~4)
|
||||
select=0,--Selected item ID
|
||||
selText=nil,--Selected item name
|
||||
selText=false,--Selected item name
|
||||
}
|
||||
function selector:reset()
|
||||
self.ATV=0
|
||||
@@ -787,7 +787,7 @@ function WIDGET.newTextBox(D)--name,x,y,w[,h][,font][,secret][,regex],hide
|
||||
end
|
||||
|
||||
WIDGET.active={}--Table contains all active widgets
|
||||
WIDGET.sel=nil--Selected widget
|
||||
WIDGET.sel=false--Selected widget
|
||||
|
||||
function WIDGET.lnk_BACK() SCN.back()end
|
||||
function WIDGET.lnk_CUSval(k) return function() return CUSTOMENV[k] end end
|
||||
@@ -813,7 +813,7 @@ WIDGET.indexMeta={
|
||||
}
|
||||
function WIDGET.set(list)
|
||||
kb.setTextInput(false)
|
||||
WIDGET.sel=nil
|
||||
WIDGET.sel=false
|
||||
WIDGET.active=list or NONE
|
||||
|
||||
--Reset all widgets
|
||||
@@ -841,7 +841,7 @@ function WIDGET.moveCursor(x,y)
|
||||
end
|
||||
end
|
||||
if WIDGET.sel and not WIDGET.sel.keepFocus then
|
||||
WIDGET.sel=nil
|
||||
WIDGET.sel=false
|
||||
end
|
||||
end
|
||||
function WIDGET.press(x,y)
|
||||
@@ -852,7 +852,7 @@ function WIDGET.press(x,y)
|
||||
elseif W.type=="slider"then
|
||||
WIDGET.drag(x,y)
|
||||
end
|
||||
if W.hide and W.hide()then WIDGET.sel=nil end
|
||||
if W.hide and W.hide()then WIDGET.sel=false end
|
||||
end
|
||||
function WIDGET.drag(x,y)
|
||||
local W=WIDGET.sel
|
||||
@@ -860,7 +860,7 @@ function WIDGET.drag(x,y)
|
||||
if W.type=="slider"then
|
||||
W:drag(x,y)
|
||||
elseif not W:isAbove(x,y)then
|
||||
WIDGET.sel=nil
|
||||
WIDGET.sel=false
|
||||
end
|
||||
end
|
||||
function WIDGET.release(x,y)
|
||||
|
||||
Reference in New Issue
Block a user