feat: initial implementation of image capture
This commit is contained in:
		| @@ -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) | ||||
|   | ||||
		Reference in New Issue
	
	Block a user