def __init__(self, tkwin=None, use_pygame=False): """ Constructs a raw Display. Use pi3d.Display.create to create an initialized Display. *tkwin* An optional Tk window. *use_pygame* Flag to opt for pygame """ if Display.INSTANCE is not None: assert ALLOW_MULTIPLE_DISPLAYS LOGGER.warning('A second instance of Display was created') else: Display.INSTANCE = self self.tkwin = tkwin if pi3d.PLATFORM == pi3d.PLATFORM_PI: use_pygame = False elif use_pygame or pi3d.PLATFORM == pi3d.PLATFORM_WINDOWS: try: import pygame use_pygame = True # for Windows except ImportError: LOGGER.warning('Do you need to install pygame?') use_pygame = False pi3d.USE_PYGAME = use_pygame self.sprites = [] self.sprites_to_load = set() self.sprites_to_unload = set() self.tidy_needed = False self.textures_dict = {} self.vbufs_dict = {} self.ebufs_dict = {} self.last_shader = None self.last_textures = [ None, None, None ] # if more than 3 used this will break in Buffer.draw() self.external_mouse = None if (pi3d.PLATFORM != pi3d.PLATFORM_PI and pi3d.PLATFORM != pi3d.PLATFORM_ANDROID and not pi3d.USE_PYGAME): self.event_list = [] self.ev = xlib.XEvent() elif pi3d.PLATFORM == pi3d.PLATFORM_ANDROID: self.android = Pi3dApp() self.opengl = DisplayOpenGL() self.max_width, self.max_height = self.opengl.width, self.opengl.height self.first_time = True self.is_running = True self.lock = threading.RLock() LOGGER.debug(pi3d.STARTUP_MESSAGE)
def __init__(self, tkwin=None): """ Constructs a raw Display. Use pi3d.Display.create to create an initialized Display. *tkwin* An optional Tk window. """ if Display.INSTANCE is not None: assert ALLOW_MULTIPLE_DISPLAYS LOGGER.warning('A second instance of Display was created') else: Display.INSTANCE = self self.tkwin = tkwin self.sprites = [] self.sprites_to_load = set() self.sprites_to_unload = set() self.tidy_needed = False self.textures_dict = {} self.vbufs_dict = {} self.ebufs_dict = {} self.last_shader = None self.last_textures = [ None, None, None ] # if more than 3 used this will break in Buffer.draw() self.external_mouse = None if (PLATFORM != PLATFORM_PI and PLATFORM != PLATFORM_ANDROID and PLATFORM != PLATFORM_WINDOWS): self.event_list = [] self.ev = xlib.XEvent() elif PLATFORM == PLATFORM_ANDROID: self.android = Pi3dApp() self.opengl = DisplayOpenGL() self.max_width, self.max_height = self.opengl.width, self.opengl.height self.first_time = True self.is_running = True self.lock = threading.RLock() LOGGER.debug(STARTUP_MESSAGE)
def __init__(self, tkwin=None): """ Constructs a raw Display. Use pi3d.Display.create to create an initialized Display. *tkwin* An optional Tk window. """ if Display.INSTANCE: assert ALLOW_MULTIPLE_DISPLAYS LOGGER.warning('A second instance of Display was created') else: Display.INSTANCE = self self.tkwin = tkwin self.sprites = [] self.sprites_to_load = set() self.sprites_to_unload = set() self.tidy_needed = False self.textures_dict = {} self.vbufs_dict = {} self.ebufs_dict = {} if not ON_PI: self.event_list = [] self.ev = xlib.XEvent() self.opengl = DisplayOpenGL() self.max_width, self.max_height = self.opengl.width, self.opengl.height self.first_time = True self.is_running = True self.lock = threading.RLock() LOGGER.debug(STARTUP_MESSAGE)