initialized a knobs module
This commit is contained in:
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
/__pycache__
|
||||
13
knob.py
Normal file
13
knob.py
Normal file
@ -0,0 +1,13 @@
|
||||
import pygame
|
||||
|
||||
class Knob:
|
||||
|
||||
def __init__(self, screen):
|
||||
self.screen = screen
|
||||
self.radius = screen.get_width()/20
|
||||
self.fill_color = (255,0,255)
|
||||
self.position = (screen.get_width()/2, screen.get_height()/2)
|
||||
|
||||
def display(self):
|
||||
pygame.draw.circle(self.screen, self.fill_color , self.position, self.radius)
|
||||
|
||||
@ -1,9 +1,14 @@
|
||||
# Example file showing a basic pygame "game loop"
|
||||
import pygame
|
||||
from knob import *
|
||||
|
||||
# pygame setup
|
||||
pygame.init()
|
||||
screen = pygame.display.set_mode((1280, 720))
|
||||
screenW = 561
|
||||
screenH = 325
|
||||
screen = pygame.display.set_mode((screenW, screenH))
|
||||
knob1 = Knob(screen)
|
||||
|
||||
clock = pygame.time.Clock()
|
||||
running = True
|
||||
|
||||
@ -15,9 +20,11 @@ while running:
|
||||
running = False
|
||||
|
||||
# fill the screen with a color to wipe away anything from last frame
|
||||
screen.fill("purple")
|
||||
screen.fill("black")
|
||||
|
||||
# RENDER YOUR GAME HERE
|
||||
knob1.display()
|
||||
|
||||
|
||||
# flip() the display to put your work on screen
|
||||
pygame.display.flip()
|
||||
Reference in New Issue
Block a user