コード例 #1
0
    def _info(self):
        '''Get SDL2 version and system's Display Server type'''

        self.info = sdl2.SDL_SysWMinfo()
        logging.info(
            'Initialise variable for SDL2 version and subsystem info.')

        sdl2.SDL_VERSION(self.info.version)
        logging.info('- version = {0}.{1}.{2}'.format(self.info.version.major,
                                                      self.info.version.minor,
                                                      self.info.version.patch))

        if sdl2.SDL_GetWindowWMInfo(self.window, ctypes.byref(self.info)) != 1:
            logging.error('sdl2.SDL_GetWindowWMInfo failed: Could not get '
                          'window subsystem.')
            exit()
        logging.info('- subsystem = {0}'.format(self.info.subsystem))
コード例 #2
0
ファイル: context.py プロジェクト: Echelon9/vulk
    def open(self, configuration):
        '''Open the SDL2 Window

        *Parameters:*

        - `configuration`: Configurations parameters from Application
        '''
        if sdl2.SDL_Init(sdl2.SDL_INIT_VIDEO) != 0:
            msg = "Can't open window: %s" % sdl2.SDL_GetError()
            logger.critical(msg)
            raise SDL2Error(msg)

        flags = 0
        if configuration.fullscreen and \
           configuration.width and configuration.height:
            flags |= sdl2.SDL_WINDOW_FULLSCREEN
        elif configuration.fullscreen:
            flags |= sdl2.SDL_WINDOW_FULLSCREEN_DESKTOP
        if not configuration.decorated:
            flags |= sdl2.SDL_WINDOW_BORDERLESS
        if configuration.resizable:
            flags |= sdl2.SDL_WINDOW_RESIZABLE
        if configuration.highdpi:
            flags |= sdl2.SDL_WINDOW_ALLOW_HIGHDPI

        self.window = sdl2.SDL_CreateWindow(configuration.name.encode('ascii'),
                                            configuration.x, configuration.y,
                                            configuration.width,
                                            configuration.height, 0)

        if not self.window:
            msg = "Can't open window: %s" % sdl2.SDL_GetError()
            logger.critical(msg)
            raise SDL2Error(msg)

        logger.debug("SDL2 window opened with configuration: %s",
                     (configuration, ))

        self.info = sdl2.SDL_SysWMinfo()
        sdl2.SDL_VERSION(self.info.version)
        sdl2.SDL_GetWindowWMInfo(self.window, ctypes.byref(self.info))
コード例 #3
0
# ----------
# Init sdl2
if sdl2.SDL_Init(sdl2.SDL_INIT_VIDEO) != 0:
    raise Exception(sdl2.SDL_GetError())

window = sdl2.SDL_CreateWindow('test'.encode('ascii'),
                               sdl2.SDL_WINDOWPOS_UNDEFINED,
                               sdl2.SDL_WINDOWPOS_UNDEFINED, WIDTH, HEIGHT, 0)

if not window:
    raise Exception(sdl2.SDL_GetError())

wm_info = sdl2.SDL_SysWMinfo()
sdl2.SDL_VERSION(wm_info.version)
sdl2.SDL_GetWindowWMInfo(window, ctypes.byref(wm_info))

# ----------
# Create instance
appInfo = VkApplicationInfo(sType=VK_STRUCTURE_TYPE_APPLICATION_INFO,
                            pApplicationName="Hello Triangle",
                            applicationVersion=VK_MAKE_VERSION(1, 0, 0),
                            pEngineName="No Engine",
                            engineVersion=VK_MAKE_VERSION(1, 0, 0),
                            apiVersion=VK_API_VERSION_1_0)

extensions = vkEnumerateInstanceExtensionProperties(None)
extensions = [e.extensionName for e in extensions]
print("availables extensions: %s\n" % extensions)

layers = vkEnumerateInstanceLayerProperties()
コード例 #4
0
ファイル: app.py プロジェクト: Quarnion/xtreme3d
def windowHandle(sdlwnd):
    info = sdl2.SDL_SysWMinfo()
    sdl2.SDL_GetWindowWMInfo(sdlwnd, ctypes.byref(info))
    return info.info.win.window
コード例 #5
0
 def _x11info(self):
     info = sdl2.SDL_SysWMinfo()
     sdl2.SDL_GetWindowWMInfo(self._window, ctypes.byref(info))
     return info.info.x11