Added a copy of SGC
This commit is contained in:
parent
90ff7ceba8
commit
52eb18994d
22 changed files with 3283 additions and 0 deletions
47
sgc/surface.py
Normal file
47
sgc/surface.py
Normal file
|
@ -0,0 +1,47 @@
|
|||
#!/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)
|
Loading…
Add table
Add a link
Reference in a new issue