feat: improve websocket connection performance
This commit is contained in:
@@ -6,7 +6,7 @@ from tetris.util import TextGenerator
|
||||
from tetris.entity import PieceGenerator
|
||||
from tetris.entity import Well
|
||||
from tetris.entity import Stack
|
||||
from tetris.online import OnlineService
|
||||
from tetris.online import MultiplayerService
|
||||
|
||||
# TODO should be a singleton and refactor the whole file?
|
||||
class Game:
|
||||
@@ -24,7 +24,7 @@ class Game:
|
||||
|
||||
def initialize(self) -> None:
|
||||
pygame.init()
|
||||
OnlineService.init()
|
||||
MultiplayerService.init()
|
||||
TextGenerator.load(ConfigurationManager.get("image", "font"), (20, 20))
|
||||
|
||||
win_width = ConfigurationManager.get("window", "width")
|
||||
@@ -52,8 +52,6 @@ class Game:
|
||||
# gets called from the games main loop
|
||||
def update(self) -> None:
|
||||
# TODO write not initialized exception
|
||||
OnlineService.update()
|
||||
|
||||
elapsed_time = self.clock.tick(self.fps)
|
||||
|
||||
if not self.next_piece:
|
||||
@@ -69,8 +67,6 @@ class Game:
|
||||
pygame.quit()
|
||||
sys.exit()
|
||||
|
||||
OnlineService.ping_server()
|
||||
|
||||
if self.stack:
|
||||
self.stack.update(elapsed_time, self)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user