testabcd
This commit is contained in:
parent
d808910705
commit
c761e5bb40
24
main.lua
24
main.lua
|
@ -52,6 +52,9 @@ local colors={
|
||||||
g.line(0.3,0.5, 0.7,0.5)
|
g.line(0.3,0.5, 0.7,0.5)
|
||||||
end,
|
end,
|
||||||
}
|
}
|
||||||
|
function pairs(t)
|
||||||
|
return next,t,nil
|
||||||
|
end
|
||||||
local gobjs={}
|
local gobjs={}
|
||||||
local cgobjs={}
|
local cgobjs={}
|
||||||
local lgobjs={}
|
local lgobjs={}
|
||||||
|
@ -62,12 +65,12 @@ for k,v in ipairs(colors) do
|
||||||
lgobjs[k]={c=k,super="lines"}
|
lgobjs[k]={c=k,super="lines"}
|
||||||
mgobjs[k]={c=k,super="color"}
|
mgobjs[k]={c=k,super="color"}
|
||||||
end
|
end
|
||||||
local ltest=os.time()
|
local ltest=0
|
||||||
debug.sethook(function()
|
debug.sethook(function()
|
||||||
local lt=os.time()
|
ltest=ltest+1
|
||||||
if lt-ltest>4 then
|
if ltest>=10000 then
|
||||||
print("!! we are in a freezer !!",debug.traceback())
|
print("!! we are in a freezer !!",debug.traceback())
|
||||||
ltest=lt
|
ltest=0
|
||||||
end
|
end
|
||||||
end,"",1000)
|
end,"",1000)
|
||||||
local cc=3
|
local cc=3
|
||||||
|
@ -694,15 +697,14 @@ function love.mousemoved()
|
||||||
end
|
end
|
||||||
|
|
||||||
function love.update(dt)
|
function love.update(dt)
|
||||||
ltest=os.time()
|
ltest=0
|
||||||
dt=math.min(dt,0.2)*(speeds[slow])
|
dt=math.min(dt,0.2)*(speeds[slow])
|
||||||
accumdt=math.min(1,accumdt+dt)
|
accumdt=math.min(0.6,accumdt+dt)
|
||||||
local fcc=0
|
local fcc=0
|
||||||
while accumdt>1/tps do
|
while accumdt>1/tps do
|
||||||
fcc=fcc+1
|
fcc=fcc+1
|
||||||
local dt=1/tps
|
local dt=1/tps
|
||||||
accumdt=accumdt-dt
|
accumdt=accumdt-dt
|
||||||
if fcc>10 then return end
|
|
||||||
if running and playdbg then
|
if running and playdbg then
|
||||||
local gc=0
|
local gc=0
|
||||||
local tc=0
|
local tc=0
|
||||||
|
@ -711,7 +713,7 @@ function love.update(dt)
|
||||||
gc=gc+(board[x][y] and 1 or 0)
|
gc=gc+(board[x][y] and 1 or 0)
|
||||||
tc=tc+1
|
tc=tc+1
|
||||||
end end
|
end end
|
||||||
if gc/tc>0.8 then
|
if gc/tc>0.4 then
|
||||||
local goods={}
|
local goods={}
|
||||||
for _=1,1000 do
|
for _=1,1000 do
|
||||||
local ix,iy=math.random(1,bw),math.random(1,bh)
|
local ix,iy=math.random(1,bw),math.random(1,bh)
|
||||||
|
@ -856,11 +858,7 @@ function love.update(dt)
|
||||||
toplchi=plchint
|
toplchi=plchint
|
||||||
end
|
end
|
||||||
local oam,obm,rm={},{},{}
|
local oam,obm,rm={},{},{}
|
||||||
local tt=os.clock()
|
|
||||||
local itc=0
|
|
||||||
for k,v in pairs(tk) do
|
for k,v in pairs(tk) do
|
||||||
itc=itc+1
|
|
||||||
if os.clock()-tt>2 then error("too long "..itc.."; #"..#tk) end
|
|
||||||
local x,y=unpack(v)
|
local x,y=unpack(v)
|
||||||
check(x,y,rm,oam,obm)
|
check(x,y,rm,oam,obm)
|
||||||
end
|
end
|
||||||
|
@ -942,6 +940,8 @@ function love.keypressed(k)
|
||||||
bat=bat*2
|
bat=bat*2
|
||||||
elseif k=="f10" then
|
elseif k=="f10" then
|
||||||
playdbg=not playdbg
|
playdbg=not playdbg
|
||||||
|
elseif k=="f11" then
|
||||||
|
love.window.setFullscreen(not love.window.getFullscreen())
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue