Beispiel #1
0
def get_screen_resolutions(selected_default):
    """Create an instance of fife.DeviceCaps and compile a list of possible resolutions.

			NOTE:
				- This call only works if the engine is inited (self.run())
	"""
    possible_resolutions = []

    _MIN_X = 800
    _MIN_Y = 600

    devicecaps = fife.DeviceCaps()
    devicecaps.fillDeviceCaps()

    for screenmode in devicecaps.getSupportedScreenModes():
        x = screenmode.getWidth()
        y = screenmode.getHeight()
        if x < _MIN_X or y < _MIN_Y:
            continue
        res = str(x) + 'x' + str(y)
        if res not in possible_resolutions:
            possible_resolutions.append(res)

    if selected_default not in possible_resolutions:
        possible_resolutions.append(selected_default)

    possible_resolutions.sort(key=lambda res: int(res.split('x')[0]))

    return possible_resolutions
Beispiel #2
0
def get_screen_resolutions(selected_default):
    """Create an instance of fife.DeviceCaps and compile a list of possible resolutions.

	NOTE: This call only works if the engine is inited.
	"""
    possible_resolutions = {selected_default}

    MIN_X = 800
    MIN_Y = 600

    devicecaps = fife.DeviceCaps()
    devicecaps.fillDeviceCaps()

    for screenmode in devicecaps.getSupportedScreenModes():
        x = screenmode.getWidth()
        y = screenmode.getHeight()
        if x < MIN_X or y < MIN_Y:
            continue
        res = str(x) + 'x' + str(y)
        possible_resolutions.add(res)

    by_width = lambda res: int(res.split('x')[0])
    return sorted(possible_resolutions, key=by_width)