-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
36 lines (24 loc) · 687 Bytes
/
main.py
File metadata and controls
36 lines (24 loc) · 687 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import pygame
import socket
from guest_fase import Guest_screen
HOST = '127.0.0.1'
PORT = 5000
tcp = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
dest = (HOST, PORT)
tcp.connect(dest)
id = int(tcp.recv(1024))
if id < 0:
print("A partida está lotada... :(")
exit(1)
pygame.init()
clock = pygame.time.Clock()
screen = pygame.display.set_mode([800, 600])
tcp.send("get_size".encode())
string_len = int(tcp.recv(1024))
guest_screen = Guest_screen(id, string_len, screen)
while True:
guest_screen.tick(string_len, tcp)
screen.fill((50, 50, 90))
guest_screen.render(screen)
pygame.display.flip()
clock.tick(60)