#!/usr/bin/python3

import sys

import pygame

from settings import Settings

class Warning_Message:
    def __init__(self):
        pygame.init()

        self.settings = Settings()

        self.screen = pygame.display.set_mode((self.settings.screen_width, self.settings.screen_height))
        self.screen_rect = self.screen.get_rect()

        self.andex_image = pygame.image.load('backgrounds/andex.png')
        self.andex_rect = self.andex_image.get_rect()
        self.andex_rect.center = self.screen_rect.center
        print(self.andex_rect.center)

    def check_events(self):
        """checks for events"""
        for event in pygame.event.get():
            if event.type == pygame.QUIT:
                sys.exit()
            elif event.type == pygame.KEYDOWN:
                if event.key == pygame.K_q:
                    sys.exit()


    def update_screen(self):
        """updates the screen"""
        self.screen.fill(self.settings.screen_color)
        self.screen.blit(self.andex_image, self.andex_rect)
        pygame.display.flip()


    def run_game(self):
        """main loop"""
        while True:
            self.check_events()
            self.update_screen()

warning_message = Warning_Message()
warning_message.run_game()


