wip, might not be good

This commit is contained in:
Waylon Walker 2025-11-22 19:28:42 -06:00
parent f53879f961
commit 6d5bfaeeda
63 changed files with 1897 additions and 93 deletions

View file

@ -5,6 +5,7 @@ from websocket import create_connection
from learn_sql_model.config import get_config
from learn_sql_model.console import console
from learn_sql_model.game.debug import Debug
from learn_sql_model.game.light import Light
from learn_sql_model.game.map import Map
from learn_sql_model.game.menu import Menu
@ -20,7 +21,8 @@ config = get_config()
class Client:
def __init__(self):
self.screen = pygame.display.set_mode((0, 0), pygame.FULLSCREEN)
# self.screen = pygame.display.set_mode((0, 0), pygame.FULLSCREEN)
self.screen = pygame.display.set_mode((1280, 720))
pygame.display.set_caption("Learn SQL Model")
self.clock = pygame.time.Clock()
self.running = True
@ -38,8 +40,11 @@ class Client:
self.font = pygame.font.SysFont("", 25)
self.joysticks = {}
self.darkness = pygame.Surface(
(self.screen.get_width(), self.screen.get_height())
(self.screen.get_width(), self.screen.get_height()),
pygame.SRCALPHA,
32,
)
self.debug = Debug(self)
atexit.register(self.quit)
@ -75,11 +80,11 @@ class Client:
console.print("update")
self.update()
console.print("render")
self.render()
time = self.clock.tick(60)
self.elapsed = time / 100
self.ticks += 1
# Console().print(self.clock.get_fps())
console.print(f"time: {time}")
console.print(f"ticks: {self.ticks}")
if profiler:
@ -98,9 +103,11 @@ class Client:
self.screen.fill((0, 0, 0))
self.map.render()
self.player.render()
light_level = 0
self.darkness.fill((light_level, light_level, light_level))
self.light.render()
if self.ticks % 1 == 0 or self.ticks == 0:
light_level = 0
self.darkness.fill((light_level, light_level, light_level))
self.light.render()
self.screen.blit(
self.darkness,
(0, 0),
@ -109,11 +116,13 @@ class Client:
# update the screen
self.menu.render()
self.debug.render()
pygame.display.flip()
def handle_events(self):
self.events = pygame.event.get()
self.menu.handle_events(self.events)
self.debug.handle_events(self.events)
self.player.handle_events()
for event in self.events:
if event.type == pygame.QUIT: