feat: initial implementation of image capture

This commit is contained in:
2025-10-25 17:20:17 +02:00
parent 8d35f76b56
commit d46aa6af45
5 changed files with 27 additions and 10 deletions

View File

@@ -5,11 +5,13 @@ from dataclasses import dataclass, field
from typing import TYPE_CHECKING, Optional
import numpy as np
import pygame
from src.vec import Vec
if TYPE_CHECKING:
from src.car import Car
from src.game import Game
def iter_unpack(format, data):
@@ -99,3 +101,6 @@ class Snapshot:
car.pos = self.position.copy()
car.direction = self.direction.copy()
car.speed = 0
def add_image(self, game: Game):
self.image = pygame.surfarray.array3d(game.game_surf)