예제 #1
0
파일: screen.py 프로젝트: flintforge/Aris
 def __init__(_, window):
     _.width, _.height = (window.width, window.height) if window else (256,
                                                                       256)
     _.window = window
     scr = canvas.get_display().get_default_screen()
     #print (_.get_modes())
     #scr = get_platform().get_default_display().get_default_screen()
     _.resolution = scr.width, scr.height
     window.set_location(int(scr.width / 2 - _.width / 2),
                         int(scr.height / 2 - _.height / 2))
예제 #2
0
파일: screen.py 프로젝트: flintforge/Aris
 def get_modes(_):
     scr = canvas.get_display().get_default_screen()
     modes = set()
     for mode in scr.get_modes():
         modes.update({(mode.width, mode.height)})
     print(modes)
     '''
     existing ratio :
     3:2, 5:2 , 18:10, 16:9, 16:10
     '''
     for sz in modes:
         print(sz, sz[0] / sz[1], sz[0] * sz[1])
예제 #3
0
	def __init__(self):
		display = get_display()
		screen = display.get_default_screen()

		template = pyglet.gl.Config(alpha_size=8)
		config = screen.get_best_config(template)
		context = config.create_context(None)
		
		self.textures = []
		self.filter = 0
		self.quad = []

		self.yrot = 270.0
		self.xpos = 2
		self.zpos = 2
		self.ypos = 1.5

		self.lookupdown = 0.5

		self.mine_map = None

		self.LightAmbient  = (GLfloat*4)(0.5, 0.5, 0.5, 1.0)
		self.LightDiffuse  = (GLfloat*4)(1.0, 1.0, 1.0, 1.0)
		self.LightPosition = (GLfloat*4)(0.0, 0.0, 2.0, 1.0)		
		
		self.window = pyglet.window.Window(caption="Minecrack", visible=False, resizable=True, vsync=False, fullscreen=True)
		self.w_width = 2560
		self.w_height = 1440
		self.glInit()
		self.worldInit()
		
		self.createMapDisplayList()

		self.eventInit()
		
		self.key_state = {}
예제 #4
0
 def get_window():
     """
     Returns the current window
     :return: Window
     """
     return get_display().get_windows()[0]
예제 #5
0
 def create_context(self, share):
     display = canvas.get_display()
     screen = display.get_default_screen()
     config = pyglet.gl.Config.match(screen)
     return config.create_context(share)
예제 #6
0
    else:
        logging.basicConfig(level=logging.INFO)

    params['cacheDir'] = os.path.join(str(Path.home()), params['shortTitle'])
    if not os.path.exists(params['cacheDir']):
        os.makedirs(params['cacheDir'])

    ### Changes to defaults
    params['fullscreen'] = args.fullscreen
    params['gui'] = args.gui

    ufContentProvider.contentProviderArgParseParse(args, params)

    ### pyglet
    from pyglet import canvas
    screens = canvas.get_display().get_screens()

    if len(screens) > 1:
        logger.debug('We have %d screens', len(screens))
        for i, screen in enumerate(screens):
            logger.debug('Screen %d | res = %d x %d | pos = %d , %d', i,
                         screen.width, screen.height, screen.x, screen.y)

        if args.screen != None and args.screen >= 0 and len(
                screens) >= args.screen:
            logger.info('Using screen %d' % (args.screen))
            params['screen'] = args.screen
        elif args.screen == None and params['fullscreen']:
            print(
                'Fullscreen mode requested but no screen specified (and there\'s more than one screen). Please specify a screen:'
            )
예제 #7
0
 def create_context(self, share):
     display = canvas.get_display()
     screen = display.get_default_screen()
     config = screen.get_best_config()
     return config.create_context(share)
예제 #8
0
def get_window():
    return get_display().get_windows()[0]