tastatur variablen änderung

This commit is contained in:
Michael S. 2024-03-22 20:02:08 +01:00
parent b25fb2e930
commit e7c77f0124

18
main.py
View file

@ -30,7 +30,7 @@ default_font = pygame.font.SysFont("sans", 14)
mitte_pos = screensize[0]//2,screensize[1]//2
frequ1 = 1
frequ2 = 10
frequ2 = 1
phasenverschiebung = 90
@ -48,6 +48,14 @@ if __name__ == "__main__":
exit()
if pressed_keys[pygame.K_d] and not preview_pressed_keys[pygame.K_d]:
show_debug = not show_debug
if pressed_keys[pygame.K_UP] and not preview_pressed_keys[pygame.K_UP]:
frequ1 += 1
if pressed_keys[pygame.K_DOWN] and not preview_pressed_keys[pygame.K_DOWN] and frequ1>=0:
frequ1 -= 1
if pressed_keys[pygame.K_RIGHT] and not preview_pressed_keys[pygame.K_RIGHT]:
frequ2 += 1
if pressed_keys[pygame.K_LEFT] and not preview_pressed_keys[pygame.K_LEFT] and frequ2>=0:
frequ2 -= 1
preview_pressed_keys = pressed_keys
## event managment
@ -69,8 +77,12 @@ if __name__ == "__main__":
pygame.draw.line(screen,(0,255,0),preview_pos,pos,3)
preview_pos = pos
#pygame.draw.circle(screen,(255,0,0),pos,2)
frequ1 = pygame.mouse.get_pos()[0]//5
frequ2 = pygame.mouse.get_pos()[1]//5
#frequ1 = pygame.mouse.get_pos()[0]//5
#frequ2 = pygame.mouse.get_pos()[1]//5
frequs_txt = default_font.render(f"x = {frequ1}, y = {frequ2}", True, (255,255,255))
screen.blit(frequs_txt,(0,0))
## bildschirm aktuallisierung
pygame.display.flip()
clock.tick(60)