Development #1

Merged
Spafi merged 16 commits from InfoProjekt/game:Development into main 2024-02-13 08:35:48 +01:00
2 changed files with 48 additions and 0 deletions
Showing only changes of commit 124719c0f9 - Show all commits

7
config.json Normal file
View file

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

41
main.py Normal file
View file

@ -0,0 +1,41 @@
import pygame
import sys
import json
import time
def setUp(config):
pygame.init()
if config["fullscreen"]:
screen = pygame.display.set_mode(config["res"], pygame.FULLSCREEN)
else:
screen = pygame.display.set_mode(config["res"])
clock = pygame.time.Clock()
running = True
return screen, clock, running
def readConfig():
with open('config.json', 'r') as c:
json_data = c.read()
return json.loads(json_data)
def main():
config = readConfig()
screen, clock, running = setUp(config["screen"])
while running:
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
screen.fill("purple")
# RENDER YOUR GAME HERE
# flip() the display to put your work on screen
pygame.display.flip()
clock.tick(60) # limits FPS to 60
pygame.quit()
if __name__ == '__main__':
main()