if player == CLIENT:
while True:
for event in pygame.event.get():
if event.type == QUIT:
pygame.quit()
sys.exit()
elif event.type == MOUSEMOTION:
mousex, mousey = event.pos
elif event.type == MOUSEBUTTONUP:
mousex, mousey = event.pos
i,j,x,y = get_position_clicked(CROSSPOS,mousex,mousey)
if (i,j,x,y) != (None,None,None,None):
sock.send(str(i)+" " +str(j) + " " + str(x) + " " + str(y) )
cross[i][j] = 1
pygame.draw.circle(DISPLAYSURF,WHITE, (x,y), 10)
logger("client","send()")
buf = sock.recv(1024)
i,j,x,y = tuple(buf.split(' '))
i,j,x,y = int(i),int(j),int(x),int(y)
pygame.draw.circle(DISPLAYSURF,BLACK, (x,y), 10)
while True:
for event in pygame.event.get():
if event.type == QUIT:
pygame.quit()
sys.exit()
elif event.type == MOUSEMOTION:
mousex, mousey = event.pos
elif event.type == MOUSEBUTTONUP:
mousex, mousey = event.pos
i,j,x,y = get_position_clicked(CROSSPOS,mousex,mousey)
if (i,j,x,y) != (None,None,None,None):
sock.send(str(i)+" " +str(j) + " " + str(x) + " " + str(y) )
cross[i][j] = 1
pygame.draw.circle(DISPLAYSURF,WHITE, (x,y), 10)
logger("client","send()")
buf = sock.recv(1024)
i,j,x,y = tuple(buf.split(' '))
i,j,x,y = int(i),int(j),int(x),int(y)
pygame.draw.circle(DISPLAYSURF,BLACK, (x,y), 10)