Compare commits
No commits in common. "aea443cdb4b193804a5802fd164fc5b84b9a280c" and "124719c0f9258a0aa2ec0cebc1928fa97ecb3a0b" have entirely different histories.
aea443cdb4
...
124719c0f9
8 changed files with 9 additions and 43 deletions
BIN
art/exit.png
BIN
art/exit.png
Binary file not shown.
|
Before Width: | Height: | Size: 738 B |
BIN
art/new_game.png
BIN
art/new_game.png
Binary file not shown.
|
Before Width: | Height: | Size: 974 B |
BIN
art/options.png
BIN
art/options.png
Binary file not shown.
|
Before Width: | Height: | Size: 808 B |
BIN
art/textbox.png
BIN
art/textbox.png
Binary file not shown.
|
Before Width: | Height: | Size: 607 B |
25
classes.py
25
classes.py
|
|
@ -1,25 +0,0 @@
|
|||
import pygame
|
||||
|
||||
font = pygame.font.SysFont('Arial', 40)
|
||||
|
||||
class Button():
|
||||
def __init__(self, x, y, width, height, buttonText='Button', onclickFunction=None, onePress=False):
|
||||
self.x = x
|
||||
self.y = y
|
||||
self.width = width
|
||||
self.height = height
|
||||
self.onclickFunction = onclickFunction
|
||||
self.onePress = onePress
|
||||
self.alreadyPressed = False
|
||||
|
||||
self.fillColors = {
|
||||
'normal': '#ffffff',
|
||||
'hover': '#666666',
|
||||
'pressed': '#333333',
|
||||
}
|
||||
|
||||
self.buttonSurface = pygame.Surface((self.width, self.height))
|
||||
self.buttonRect = pygame.Rect(self.x, self.y, self.width, self.height)
|
||||
|
||||
self.buttonSurf = font.render(buttonText, True, (20, 20, 20))
|
||||
return self
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"screen":
|
||||
{
|
||||
"res":[1280, 720],
|
||||
"res":[1120, 780],
|
||||
"fullscreen": false
|
||||
}
|
||||
}
|
||||
17
main.py
17
main.py
|
|
@ -10,9 +10,8 @@ def setUp(config):
|
|||
else:
|
||||
screen = pygame.display.set_mode(config["res"])
|
||||
clock = pygame.time.Clock()
|
||||
with open('art/textbox.png', 'r') as tb:
|
||||
box = pygame.image.load(tb)
|
||||
return screen, clock, True, True, "start.png", box
|
||||
running = True
|
||||
return screen, clock, running
|
||||
|
||||
def readConfig():
|
||||
with open('config.json', 'r') as c:
|
||||
|
|
@ -21,24 +20,16 @@ def readConfig():
|
|||
|
||||
def main():
|
||||
config = readConfig()
|
||||
screen, clock, running, background, isblack, box = setUp(config["screen"])
|
||||
|
||||
screen, clock, running = setUp(config["screen"])
|
||||
while running:
|
||||
for event in pygame.event.get():
|
||||
if event.type == pygame.QUIT:
|
||||
running = False
|
||||
|
||||
if not isblack:
|
||||
with open(background, 'r') as i:
|
||||
bg = pygame.image.load(i)
|
||||
bg = pygame.transform.scale(bg, screen.get_size())
|
||||
# fill the screen with a color to wipe away anything from last frame
|
||||
screen.blit(bg, (0, 0))
|
||||
screen.fill("purple")
|
||||
|
||||
# RENDER YOUR GAME HERE
|
||||
|
||||
else:
|
||||
screen.fill('#000000')
|
||||
# flip() the display to put your work on screen
|
||||
pygame.display.flip()
|
||||
|
||||
|
|
|
|||
BIN
test.png
BIN
test.png
Binary file not shown.
|
Before Width: | Height: | Size: 529 KiB |
Loading…
Add table
Reference in a new issue