#!/usr/bin/env python3

import ambit.image
import pygame
import sys

DISPLAY_SIZE = (1024, 1024)


def should_exit():
    showstoppers = pygame.QUIT, pygame.KEYDOWN, pygame.MOUSEBUTTONDOWN
    return pygame.event.poll().type in showstoppers


def wait_event():
    while True:
        if should_exit():
            break


def show(surface):
    screen = pygame.display.get_surface()
    screen.fill((255, 255, 255))
    screen.blit(surface, (0, 0))
    pygame.display.flip()


def main():
    pygame.init()
    screen = pygame.display.set_mode(DISPLAY_SIZE)
    surface = ambit.image.surface(sys.argv[1], surface_size=DISPLAY_SIZE)
    pygame.display.flip()

    show(surface)

    wait_event()


if __name__ == '__main__':
    main()
