diff --git a/art/exit.png b/art/exit.png new file mode 100644 index 0000000..0fcda62 Binary files /dev/null and b/art/exit.png differ diff --git a/art/new_game.png b/art/new_game.png new file mode 100644 index 0000000..b5fc60a Binary files /dev/null and b/art/new_game.png differ diff --git a/art/options.png b/art/options.png new file mode 100644 index 0000000..8d334fa Binary files /dev/null and b/art/options.png differ diff --git a/art/textbox.png b/art/textbox.png new file mode 100644 index 0000000..09a258c Binary files /dev/null and b/art/textbox.png differ diff --git a/classes.py b/classes.py new file mode 100644 index 0000000..0d2ac25 --- /dev/null +++ b/classes.py @@ -0,0 +1,25 @@ +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 \ No newline at end of file diff --git a/config.json b/config.json index ddb4598..76e9637 100644 --- a/config.json +++ b/config.json @@ -1,7 +1,7 @@ { "screen": { - "res":[1120, 780], + "res":[1280, 720], "fullscreen": false } } \ No newline at end of file diff --git a/main.py b/main.py index c7290d0..d44a2c6 100644 --- a/main.py +++ b/main.py @@ -10,8 +10,9 @@ def setUp(config): else: screen = pygame.display.set_mode(config["res"]) clock = pygame.time.Clock() - running = True - return screen, clock, running + with open('art/textbox.png', 'r') as tb: + box = pygame.image.load(tb) + return screen, clock, True, True, "start.png", box def readConfig(): with open('config.json', 'r') as c: @@ -20,20 +21,28 @@ def readConfig(): def main(): config = readConfig() - screen, clock, running = setUp(config["screen"]) + screen, clock, running, background, isblack, box = 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.fill("purple") + screen.blit(bg, (0, 0)) - # RENDER YOUR GAME HERE + # RENDER YOUR GAME HERE - # flip() the display to put your work on screen - pygame.display.flip() + else: + screen.fill('#000000') + # 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() diff --git a/test.png b/test.png new file mode 100644 index 0000000..4a92572 Binary files /dev/null and b/test.png differ