48 lines
1.0 KiB
Python
48 lines
1.0 KiB
Python
#!/usr/bin/env python
|
|
|
|
#Copyright (C) 2010-2012 Sam Bull
|
|
|
|
"""
|
|
Screen class to store rect information with the screen and setup the toolkit.
|
|
|
|
"""
|
|
|
|
import pygame.display
|
|
from pygame.locals import *
|
|
|
|
import widgets._locals
|
|
|
|
class Screen():
|
|
|
|
"""
|
|
Class for the screen.
|
|
|
|
This must be used instead of ``pygame.display.set_mode()``.
|
|
|
|
Attributes:
|
|
image: The pygame.display screen.
|
|
rect: ``pygame.Rect`` containing screen size.
|
|
|
|
"""
|
|
|
|
__slots__ = ("_a", "rect", "image", "_opengl")
|
|
|
|
_a = 1 # Base alpha for OpenGLImage's
|
|
_opengl = False
|
|
|
|
def __init__(self, size, flags=0, depth=0):
|
|
"""
|
|
Args:
|
|
size, flags, depth: Arguments for pygame.display.set_mode()
|
|
|
|
"""
|
|
self.rect = Rect((0,0), size)
|
|
self.image = pygame.display.set_mode(size, flags, depth)
|
|
if flags & OPENGL:
|
|
self._opengl = True
|
|
widgets._locals.SCREEN = self
|
|
widgets._locals.Font.set_fonts()
|
|
|
|
def __getattr__(self, atr):
|
|
return getattr(self.image, atr)
|