Esempio n. 1
0
    def get_position(self):
        x = ffi.new('int *')
        y = ffi.new('int *')

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

        return int(x), int(y)
Esempio n. 2
0
    def framebuffer_size(self):
        width = ffi.new('int *')
        height = ffi.new('int *')

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

        return int(width), int(height)
Esempio n. 3
0
    def size(self):
        width = ffi.new('int *')
        height = ffi.new('int *')

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

        return int(width), int(height)
Esempio n. 4
0
    def position(self):
        x = ffi.new('int *')
        y = ffi.new('int *')

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

        return int(x), int(y)
Esempio n. 5
0
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'))
Esempio n. 6
0
    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)
Esempio n. 7
0
 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)