Machine_learning_2023/Interface/vacuum_render.py

32 lines
934 B
Python
Raw Normal View History

2023-03-12 16:22:51 +01:00
from Interface.grid_draw import GridDraw, Colors
2023-03-12 18:11:31 +01:00
import sys
import pygame
2023-03-11 19:31:43 +01:00
2023-03-12 16:22:51 +01:00
# dummy function
def initial_draw():
grid = GridDraw(500, 500)
2023-03-12 18:11:31 +01:00
tile_width = 500 / 10
tile_height = 500 / 10
x = tile_width / 2
y = tile_height / 2
radius = 15
2023-03-12 16:22:51 +01:00
while True:
grid.start_draw()
grid.board(10, 10)
2023-03-12 18:11:31 +01:00
for event in pygame.event.get():
if event.type == pygame.QUIT:
sys.exit()
if event.type == pygame.KEYDOWN:
if event.key == pygame.K_LEFT:
x -= tile_width
if event.key == pygame.K_RIGHT:
x += tile_width
if event.key == pygame.K_UP:
y -= tile_height
if event.key == pygame.K_DOWN:
y += tile_height
grid.circle(x, y, 20, color=Colors.RED)
grid.end_draw()
pygame.time.delay(10)