当前位置: 首页>>代码示例>>Python>>正文


Python sdl2.SDL_WINDOWEVENT属性代码示例

本文整理汇总了Python中sdl2.SDL_WINDOWEVENT属性的典型用法代码示例。如果您正苦于以下问题:Python sdl2.SDL_WINDOWEVENT属性的具体用法?Python sdl2.SDL_WINDOWEVENT怎么用?Python sdl2.SDL_WINDOWEVENT使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在sdl2的用法示例。


在下文中一共展示了sdl2.SDL_WINDOWEVENT属性的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: poll_events

# 需要导入模块: import sdl2 [as 别名]
# 或者: from sdl2 import SDL_WINDOWEVENT [as 别名]
def poll_events(self, scene_state, data=None):
        """Process each event in the queue.

        Parameters
        ----------
        scene_state : hienoi.renderer.SceneState
            Scene state.
        data : object
            Data to pass back and forth between the caller and the function set
            for the 'on event' callback.
        """
        self._has_view_changed = False

        event = sdl2.SDL_Event()
        while sdl2.SDL_PollEvent(ctypes.byref(event)) != 0:
            event_type = event.type
            if event_type == sdl2.SDL_QUIT:
                self._on_quit_event(event.quit)
            elif event_type == sdl2.SDL_WINDOWEVENT:
                self._on_window_event(event.window)
            elif event_type == sdl2.SDL_KEYDOWN:
                self._on_key_down_event(event.key, scene_state)
            elif event_type == sdl2.SDL_KEYUP:
                self._on_key_up_event(event.key)
            elif event_type == sdl2.SDL_MOUSEBUTTONDOWN:
                self._on_mouse_button_down_event(event.button)
            elif event_type == sdl2.SDL_MOUSEBUTTONUP:
                self._on_mouse_button_up_event(event.button)
            elif event_type == sdl2.SDL_MOUSEWHEEL:
                self._on_mouse_wheel_event(event.wheel)
            elif event_type == sdl2.SDL_MOUSEMOTION:
                self._on_mouse_motion_event(event.motion)

            if self._on_event_callback:
                self._on_event_callback(self, data, event)

            if self.quit:
                break 
开发者ID:christophercrouzet,项目名称:hienoi,代码行数:40,代码来源:gui.py

示例2: __init__

# 需要导入模块: import sdl2 [as 别名]
# 或者: from sdl2 import SDL_WINDOWEVENT [as 别名]
def __init__(self, **options):
        Component.__init__(self, self, None, **options)
        self.viewport = sdl2.SDL_Rect()
        self._components_activation = OrderedDict()
        self.resources = {}
        self.tints = []
        self.timers = []
        self._running = True
        self.logger.info("Initializing application: %s", self.name)
        sdl2.SDL_Init(self.props.get('init_flags', 0))
        self.register_event_handler(sdl2.SDL_QUIT, self._quit)
        self.register_event_handler(sdl2.SDL_WINDOWEVENT, self._window_event)
        self.keys = sdl2.SDL_GetKeyboardState(None)
        self.window = self._get_window()
        self.renderer = self._get_renderer()
        self.load_resource('font-6', 'font-6.png')
        self.resources['font-6'].make_font(
            "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!?("
            ")[][email protected]:/'., ")
        self.enable()
        try:
            _deep_call(self, 'init')
        except:
            self.quit()
            self._clean_up()
            raise
        sdl2.SDL_ShowWindow(self.window) 
开发者ID:cecton,项目名称:pysdl2-sdl2ui,代码行数:29,代码来源:app.py


注:本文中的sdl2.SDL_WINDOWEVENT属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。