def get_position(self): x = ffi.new('int *') y = ffi.new('int *') call('glfwGetWindowPos', self._window, x, y) return int(x), int(y)
def framebuffer_size(self): width = ffi.new('int *') height = ffi.new('int *') call('glfwGetWindowSize', self._window, width, height) return int(width), int(height)
def size(self): width = ffi.new('int *') height = ffi.new('int *') call('glfwGetMonitorPos', self._monitor, width, height) return int(width), int(height)
def position(self): x = ffi.new('int *') y = ffi.new('int *') call('glfwGetMonitorPos', self._monitor, x, y) return int(x), int(y)
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'))
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)
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)