整理代码,微调房间内玩家布局
This commit is contained in:
@@ -1,16 +1,19 @@
|
|||||||
local gc=love.graphics
|
local gc=love.graphics
|
||||||
|
local gc_draw,gc_rectangle,gc_print=gc.draw,gc.rectangle,gc.print
|
||||||
|
local gc_setColor,gc_setLineWidth,gc_translate=gc.setColor,gc.setLineWidth,gc.translate
|
||||||
|
local gc_stencil,gc_setStencilTest=gc.stencil,gc.setStencilTest
|
||||||
|
|
||||||
local rnd,min=math.random,math.min
|
local rnd,min=math.random,math.min
|
||||||
local sin,cos=math.sin,math.cos
|
local sin,cos=math.sin,math.cos
|
||||||
|
|
||||||
|
|
||||||
local ins,rem=table.insert,table.remove
|
local ins,rem=table.insert,table.remove
|
||||||
|
local setFont=setFont
|
||||||
|
|
||||||
local posLists={
|
local posLists={
|
||||||
--1~5
|
--1~5
|
||||||
(function()
|
(function()
|
||||||
local L={}
|
local L={}
|
||||||
for i=1,5 do
|
for i=1,5 do
|
||||||
L[i]={x=70,y=20+90*i,w=1000,h=80}
|
L[i]={x=70,y=20+90*i,w=790,h=80}
|
||||||
end
|
end
|
||||||
return L
|
return L
|
||||||
end)(),
|
end)(),
|
||||||
@@ -161,59 +164,59 @@ end
|
|||||||
|
|
||||||
local stencilW,stencilH
|
local stencilW,stencilH
|
||||||
local function plyStencil()
|
local function plyStencil()
|
||||||
gc.rectangle('fill',0,0,stencilW,stencilH)
|
gc_rectangle('fill',0,0,stencilW,stencilH)
|
||||||
end
|
end
|
||||||
function netPLY.draw()
|
function netPLY.draw()
|
||||||
for i=1,#PLY do
|
for i=1,#PLY do
|
||||||
local p=PLY[i]
|
local p=PLY[i]
|
||||||
gc.translate(p.x,p.y)
|
gc_translate(p.x,p.y)
|
||||||
--Rectangle
|
--Rectangle
|
||||||
gc.setColor(COLOR[
|
gc_setColor(COLOR[
|
||||||
p.mode==0 and'Z'or
|
p.mode==0 and'Z'or
|
||||||
p.mode==1 and(p.connected and"N"or"G")or
|
p.mode==1 and(p.connected and"N"or"G")or
|
||||||
p.mode==2 and(p.connected and"Y"or"F")
|
p.mode==2 and(p.connected and"Y"or"F")
|
||||||
])
|
])
|
||||||
gc.setLineWidth(2)
|
gc_setLineWidth(2)
|
||||||
gc.rectangle('line',0,0,p.w,p.h)
|
gc_rectangle('line',0,0,p.w,p.h)
|
||||||
|
|
||||||
--Stencil
|
--Stencil
|
||||||
stencilW,stencilH=p.w,p.h
|
stencilW,stencilH=p.w,p.h
|
||||||
gc.setStencilTest('equal',1)
|
gc_setStencilTest('equal',1)
|
||||||
gc.stencil(plyStencil,'replace',1)
|
gc_stencil(plyStencil,'replace',1)
|
||||||
gc.setColor(1,1,1)
|
gc_setColor(1,1,1)
|
||||||
|
|
||||||
--Avatar
|
--Avatar
|
||||||
local avatarSize=min(p.h,50)/128*.9
|
local avatarSize=min(p.h,50)/128*.9
|
||||||
gc.draw(USERS.getAvatar(p.uid),2,2,nil,avatarSize)
|
gc_draw(USERS.getAvatar(p.uid),2,2,nil,avatarSize)
|
||||||
|
|
||||||
--UID & Username
|
--UID & Username
|
||||||
if p.h>=47 then
|
if p.h>=47 then
|
||||||
setFont(40)
|
setFont(40)
|
||||||
gc.print("#"..p.uid,50,-5)
|
gc_print("#"..p.uid,50,-5)
|
||||||
gc.print(p.username,210,-5)
|
gc_print(p.username,210,-5)
|
||||||
else
|
else
|
||||||
setFont(15)
|
setFont(15)
|
||||||
gc.print("#"..p.uid,46,-1)
|
gc_print("#"..p.uid,46,-1)
|
||||||
setFont(30)
|
setFont(30)
|
||||||
gc.print(p.username,p.h,8)
|
gc_print(p.username,p.h,8)
|
||||||
end
|
end
|
||||||
gc.setStencilTest()
|
gc_setStencilTest()
|
||||||
gc.translate(-p.x,-p.y)
|
gc_translate(-p.x,-p.y)
|
||||||
end
|
end
|
||||||
if selP then
|
if selP then
|
||||||
gc.translate(min(mouseX,880),min(mouseY,460))
|
gc_translate(min(mouseX,880),min(mouseY,460))
|
||||||
gc.setColor(.2,.2,.2,.7)
|
gc_setColor(.2,.2,.2,.7)
|
||||||
gc.rectangle('fill',0,0,400,260)
|
gc_rectangle('fill',0,0,400,260)
|
||||||
gc.setColor(1,1,1)
|
gc_setColor(1,1,1)
|
||||||
gc.setLineWidth(2)
|
gc_setLineWidth(2)
|
||||||
gc.rectangle('line',0,0,400,260)
|
gc_rectangle('line',0,0,400,260)
|
||||||
|
|
||||||
gc.draw(USERS.getAvatar(selP.uid),5,5,nil,.5)
|
gc_draw(USERS.getAvatar(selP.uid),5,5,nil,.5)
|
||||||
setFont(30)
|
setFont(30)
|
||||||
gc.print("#"..selP.uid,75,0)
|
gc_print("#"..selP.uid,75,0)
|
||||||
setFont(35)
|
setFont(35)
|
||||||
gc.print(selP.username,75,25)
|
gc_print(selP.username,75,25)
|
||||||
gc.translate(-min(mouseX,880),-min(mouseY,460))
|
gc_translate(-min(mouseX,880),-min(mouseY,460))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user