Compare commits

..

No commits in common. "aea443cdb4b193804a5802fd164fc5b84b9a280c" and "124719c0f9258a0aa2ec0cebc1928fa97ecb3a0b" have entirely different histories.

8 changed files with 9 additions and 43 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 738 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 974 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 808 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 607 B

View file

@ -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

View file

@ -1,7 +1,7 @@
{ {
"screen": "screen":
{ {
"res":[1280, 720], "res":[1120, 780],
"fullscreen": false "fullscreen": false
} }
} }

25
main.py
View file

@ -10,9 +10,8 @@ def setUp(config):
else: else:
screen = pygame.display.set_mode(config["res"]) screen = pygame.display.set_mode(config["res"])
clock = pygame.time.Clock() clock = pygame.time.Clock()
with open('art/textbox.png', 'r') as tb: running = True
box = pygame.image.load(tb) return screen, clock, running
return screen, clock, True, True, "start.png", box
def readConfig(): def readConfig():
with open('config.json', 'r') as c: with open('config.json', 'r') as c:
@ -21,28 +20,20 @@ def readConfig():
def main(): def main():
config = readConfig() config = readConfig()
screen, clock, running, background, isblack, box = setUp(config["screen"]) screen, clock, running = setUp(config["screen"])
while running: while running:
for event in pygame.event.get(): for event in pygame.event.get():
if event.type == pygame.QUIT: if event.type == pygame.QUIT:
running = False 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 # 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 # RENDER YOUR GAME HERE
else: # flip() the display to put your work on screen
screen.fill('#000000') pygame.display.flip()
# flip() the display to put your work on screen
pygame.display.flip()
clock.tick(60) # limits FPS to 60 clock.tick(60) # limits FPS to 60
pygame.quit() pygame.quit()

BIN
test.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 529 KiB