From e7c77f0124a79dc377b1861c47188545c64f8073 Mon Sep 17 00:00:00 2001 From: Megamichi Date: Fri, 22 Mar 2024 20:02:08 +0100 Subject: [PATCH] =?UTF-8?q?tastatur=20variablen=20=C3=A4nderung?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- main.py | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/main.py b/main.py index 4b8b102..0b6b778 100644 --- a/main.py +++ b/main.py @@ -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)