-
Notifications
You must be signed in to change notification settings - Fork 0
/
Display.py
37 lines (32 loc) · 1019 Bytes
/
Display.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import pygame
import RAM
pygame.init()
resolution = (256, 256)
scale = 4
width, height = resolution[0] * scale, resolution[1] * scale
screen = pygame.display.set_mode((width, height))
clock = pygame.time.Clock()
def refresh():
x = RAM.read(252, False)
y = RAM.read(253, False)
r = RAM.read(249, False)
g = RAM.read(250, False)
b = RAM.read(251, False)
mode = RAM.read(254)
if mode == 1:
pixel_color = (r, g, b)
pixel_rect = pygame.Rect(x * scale, y * scale, scale, scale)
pygame.draw.rect(screen, pixel_color, pixel_rect)
elif mode == 2:
pixel_color = (0, 0, 0)
pixel_rect = pygame.Rect(x * scale, y * scale, scale, scale)
pygame.draw.rect(screen, pixel_color, pixel_rect)
elif mode == 3:
print("fill screen with color data")
def start():
running = True
while running:
for event in pygame.event.get():
if event.type == pygame.QUIT:
running = False
pygame.display.flip()