2025-02-23 15:26:53 +01:00
|
|
|
# Example file showing a basic pygame "game loop"
|
|
|
|
|
import pygame
|
2025-02-23 16:17:11 +01:00
|
|
|
from knob import *
|
2025-02-23 15:26:53 +01:00
|
|
|
|
|
|
|
|
# pygame setup
|
|
|
|
|
pygame.init()
|
2025-02-23 16:17:11 +01:00
|
|
|
screenW = 561
|
|
|
|
|
screenH = 325
|
|
|
|
|
screen = pygame.display.set_mode((screenW, screenH))
|
|
|
|
|
knob1 = Knob(screen)
|
|
|
|
|
|
2025-02-23 15:26:53 +01:00
|
|
|
clock = pygame.time.Clock()
|
|
|
|
|
running = True
|
|
|
|
|
|
|
|
|
|
while running:
|
|
|
|
|
# poll for events
|
|
|
|
|
# pygame.QUIT event means the user clicked X to close your window
|
|
|
|
|
for event in pygame.event.get():
|
|
|
|
|
if event.type == pygame.QUIT:
|
|
|
|
|
running = False
|
|
|
|
|
|
|
|
|
|
# fill the screen with a color to wipe away anything from last frame
|
2025-02-23 16:17:11 +01:00
|
|
|
screen.fill("black")
|
2025-02-23 15:26:53 +01:00
|
|
|
|
|
|
|
|
# RENDER YOUR GAME HERE
|
2025-02-23 16:17:11 +01:00
|
|
|
knob1.display()
|
|
|
|
|
|
2025-02-23 15:26:53 +01:00
|
|
|
|
|
|
|
|
# flip() the display to put your work on screen
|
|
|
|
|
pygame.display.flip()
|
|
|
|
|
|
|
|
|
|
clock.tick(60) # limits FPS to 60
|
|
|
|
|
|
|
|
|
|
pygame.quit()
|