A commit.

This commit is contained in:
bʰedoh₂ swé 2024-04-03 17:20:11 +05:00
parent 6b4380d130
commit 2d08605590

17
main.py
View File

@ -12,7 +12,7 @@ def deg2rad(rA): return rA/180*PI
WHITE = (255,255,255)
BLACK = (0,0,0)
OFFSET = .015625
OFFSET = 0.015625
I = complex(0,1)
PI = 3.14159265358979323846264338327
ROT = cNorm(exp(deg2rad(2)*I))
@ -34,7 +34,9 @@ class DrawnSegment:
self.color = color
level = [
# Segment(False,cNorm(-1),cNorm(I),(255,255,20)),
Segment(False,.5,I*.5,(255,0,0)),
Segment(False,.5,-I*.5,(0,255,0)),
Segment(False,-.5,-I*.5,(0,0,255)),
Segment(False,-.5,I*.5,BLACK)
]
@ -75,15 +77,18 @@ def mainLoop():
for event in pygame.event.get():
if event.type == pygame.QUIT:
return True
if event.type == pygame.KEYDOWN:
if event.key == pygame.K_q:
gPlayer.cRot *= -1
keys = pygame.key.get_pressed()
if keys[pygame.K_d]:
gPlayer.rotate(IROT)
if keys[pygame.K_a]:
gPlayer.rotate(ROT)
if keys[pygame.K_a]:
gPlayer.rotate(IROT)
if keys[pygame.K_w]:
gPlayer += GyroVector(OFFSET, 1)
if keys[pygame.K_s]:
gPlayer -= GyroVector(OFFSET, 1)
if keys[pygame.K_s]:
gPlayer += GyroVector(OFFSET, 1)
display.fill(WHITE)
#pygame.draw.rect(display,BLACK, c_tr(Poincare2Klein(gPlayer.cPos) * -100) + (100,100),0)
drawn = draw(level,gPlayer,PI/2,640)