Created
June 17, 2022 02:49
-
-
Save H4ppy-04/d69335bf80f8b976c0259d9d352d6faa to your computer and use it in GitHub Desktop.
test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from __future__ import annotations | |
import sys | |
import os | |
import logging | |
from typing import Union | |
import pygame | |
from pygame.surface import Surface, SurfaceType | |
import util | |
pygame.init() | |
pygame.font.init() | |
pygame.display.init() | |
pygame.mixer.init() | |
global dt | |
logging.basicConfig( | |
level=logging.INFO, | |
format='[%(levelname)s@%(asctime)s] :: %(name)s.%(module)s.%(funcName)s %(message)s') | |
logging.debug(pygame.init()) | |
screen = pygame.display.set_mode(util.window_size) | |
pygame.display.set_caption("Castle Blitz") | |
# logging.debug("set caption - {}".format(pygame.display.get_caption()[0])) | |
favicon: Union[Surface, SurfaceType] = pygame.image.load(os.path.join("./data/images/ui", "favicon.png")) | |
pygame.display.set_icon(favicon) | |
context_menu = True | |
class Game: | |
global context_menu | |
def __init__(self, screen_obj): | |
self.screen = screen_obj | |
self.clock = pygame.time.Clock() | |
self.score = 0 | |
self._update() | |
def _update(self): | |
global context_menu | |
while not context_menu: | |
self._dt_handler_update() | |
self._clear_screen() | |
def _clear_screen(self): | |
pass | |
def _dt_handler_update(self): | |
self.clock.tick() / 1000 | |
def _process_events(self): | |
for event in pygame.event.get(): | |
if event.type == pygame.QUIT: | |
sys.exit() | |
Menu = util.Menu(screen, context_menu) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment