Instance initializer. Args: width: Initial window width, in pixels. height: Initial window height, in pixels. title: A string with a window title. context: (Optional) A `render.GLFWContext` instance. Raises: RuntimeError: If GLFW initialization or window initi
(self, width, height, title, context=None)
| 173 | """ |
| 174 | |
| 175 | def __init__(self, width, height, title, context=None): |
| 176 | """Instance initializer. |
| 177 | |
| 178 | Args: |
| 179 | width: Initial window width, in pixels. |
| 180 | height: Initial window height, in pixels. |
| 181 | title: A string with a window title. |
| 182 | context: (Optional) A `render.GLFWContext` instance. |
| 183 | |
| 184 | Raises: |
| 185 | RuntimeError: If GLFW initialization or window initialization fails. |
| 186 | """ |
| 187 | super().__init__() |
| 188 | self._context = context or DoubleBufferedGlfwContext(width, height, title) |
| 189 | |
| 190 | if not self._context.window: |
| 191 | raise RuntimeError('Failed to create window') |
| 192 | |
| 193 | self._oldsize = None |
| 194 | |
| 195 | with self._context.make_current() as ctx: |
| 196 | self._fullscreen_quad = ctx.call(self._glfw_setup, self._context.window) |
| 197 | self.on_files_drop = util.QuietSet() |
| 198 | |
| 199 | self._keyboard = GlfwKeyboard(self._context) |
| 200 | self._mouse = GlfwMouse(self._context) |
| 201 | |
| 202 | def _glfw_setup(self, window): |
| 203 | glfw.set_drop_callback(window, self._handle_file_drop) |
nothing calls this directly
no test coverage detected