initialized pygame
This commit is contained in:
parent
1c28b3a644
commit
5e33e55396
@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
"window": {
|
||||||
|
"width": 1280,
|
||||||
|
"height": 720
|
||||||
|
}
|
||||||
|
}
|
@ -1,6 +1,28 @@
|
|||||||
|
import pygame
|
||||||
|
import json
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
|
|
||||||
class Game:
|
class Game:
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.resolution
|
print("Loading configuration...", end=" ")
|
||||||
self.windowName
|
|
||||||
self.fps
|
try:
|
||||||
self.timer
|
configFolder = Path("../../data/config/")
|
||||||
|
configFile = configFolder / "mainConfig.json"
|
||||||
|
|
||||||
|
self.config = json.loads(configFile.read_text())
|
||||||
|
|
||||||
|
print("OK")
|
||||||
|
except IOError:
|
||||||
|
print("Error reading configuration file. Exiting...")
|
||||||
|
exit(1)
|
||||||
|
|
||||||
|
print("Initializing pygame...", end=" ")
|
||||||
|
pygame.init()
|
||||||
|
print("OK")
|
||||||
|
|
||||||
|
print("Initializing screen, params: " + str(self.config["window"]) + "...", end=" ")
|
||||||
|
|
||||||
|
|
||||||
|
game = Game()
|
||||||
|
Loading…
Reference in New Issue
Block a user