コード例 #1
0
ファイル: window.py プロジェクト: PlumpMath/glfw-cffi
    def framebuffer_size(self):
        width = ffi.new('int *')
        height = ffi.new('int *')

        call('glfwGetWindowSize', self._window, width, height)

        return int(width), int(height)
コード例 #2
0
ファイル: window.py プロジェクト: PlumpMath/glfw-cffi
    def get_position(self):
        x = ffi.new('int *')
        y = ffi.new('int *')

        call('glfwGetWindowPos', self._window, x, y)

        return int(x), int(y)
コード例 #3
0
ファイル: monitor.py プロジェクト: bwhmather/glfw-cffi
    def size(self):
        width = ffi.new('int *')
        height = ffi.new('int *')

        call('glfwGetMonitorPos', self._monitor, width, height)

        return int(width), int(height)
コード例 #4
0
ファイル: monitor.py プロジェクト: bwhmather/glfw-cffi
    def position(self):
        x = ffi.new('int *')
        y = ffi.new('int *')

        call('glfwGetMonitorPos', self._monitor, x, y)

        return int(x), int(y)
コード例 #5
0
ファイル: __init__.py プロジェクト: PlumpMath/glfw-cffi
def get_version(verbose=False):
    if not verbose:
        major = ffi.new('int *')
        minor = ffi.new('int *')
        rev = ffi.new('int *')

        call('glfwGetVersion', major, minor, rev)

        return '{}.{}.{}'.format(major, minor, rev)
    else:
        return str(call('glfwGetVersionString'))
コード例 #6
0
ファイル: monitor.py プロジェクト: bwhmather/glfw-cffi
def get_primary_monitor():
    monitor = call('glfwGetPrimaryMonitor', )

    if monitor not in _monitors:
        _monitors[monitor] = Monitor(monitor)

    return _monitors[monitor]
コード例 #7
0
ファイル: __init__.py プロジェクト: PlumpMath/glfw-cffi
def wait_events():
    """ Sleep until at least one event has been received.

    This will invoke all relevant window callbacks in the current thread.

    This function is not required for joystick input to work.

    .. note::
      - This function may only be called from the main thread.
      - This function may not be called from a callback.
      - On some platforms, certain callbacks may be called outside of a call
        to one of the event processing functions.

    .. seealso::
        :py:fun:`poll_events`

    """
    call('glfwWaitEvents')
コード例 #8
0
ファイル: __init__.py プロジェクト: PlumpMath/glfw-cffi
def poll_events():
    """ Process events that have already been received and return immediately.

    This will invoke all relevant window callbacks in the current thread.

    This function is not required for joystick input to work.

    .. note::
      - This function may only be called from the main thread.
      - This function may not be called from a callback.
      - On some platforms, certain callbacks may be called outside of a call
        to one of the event processing functions.

    .. seealso::
      :py:fun:`wait_events`

    """
    call('glfwPollEvents')
コード例 #9
0
ファイル: window.py プロジェクト: PlumpMath/glfw-cffi
    def __init__(self, width, height, title, monitor=None):
        self._title = str(title)
        if not isinstance(title, ffi.CData):
            title = ffi.new('const char[]', title.encode('utf-8'))

        if isinstance(monitor, Monitor):
            monitor = monitor._monitor

        if monitor is None:
            monitor = ffi.NULL

        self._window = call('glfwCreateWindow', width, height, title, monitor,
                            ffi.NULL)
コード例 #10
0
ファイル: window.py プロジェクト: PlumpMath/glfw-cffi
 def set_position(self, x, y):
     call('glfwSetWindowSize', self._window, x, y)
コード例 #11
0
ファイル: window.py プロジェクト: PlumpMath/glfw-cffi
 def set_title(self, title):
     self._title = str(title)
     if not isinstance(title, ffi.CData):
         title = ffi.new('const char *', title)
     call('glfwSetWindowTitle', self._window, title)
コード例 #12
0
ファイル: window.py プロジェクト: PlumpMath/glfw-cffi
 def should_close(self):
     return bool(call('glfwWindowShouldClose', self._window))
コード例 #13
0
ファイル: window.py プロジェクト: PlumpMath/glfw-cffi
 def swap_buffers(self):
     call('glfwSwapBuffers', self._window)
コード例 #14
0
ファイル: window.py プロジェクト: PlumpMath/glfw-cffi
 def hide(self):
     call('glfwHideWindow', self._window)
コード例 #15
0
ファイル: window.py プロジェクト: PlumpMath/glfw-cffi
 def restore(self):
     call('glfwRestoreWindow', self._window)
コード例 #16
0
ファイル: monitor.py プロジェクト: bwhmather/glfw-cffi
 def name(self):
     return str(call('glfwGetMonitorName', self._monitor))
コード例 #17
0
ファイル: window.py プロジェクト: PlumpMath/glfw-cffi
 def set_size(self, width, height):
     call('glfwSetWindowSize', self._window, width, height)
コード例 #18
0
ファイル: window.py プロジェクト: PlumpMath/glfw-cffi
 def show(self):
     call('glfwShowWindow', self._window)
コード例 #19
0
ファイル: window.py プロジェクト: PlumpMath/glfw-cffi
 def iconify(self):
     call('glfwIconifyWindow', self._window)
コード例 #20
0
ファイル: window.py プロジェクト: PlumpMath/glfw-cffi
 def make_current(self):
     call('glfwMakeContextCurrent', self._window)