def _update_modifier_keys(self): """Updates alt, ctrl, and shift states. """ modifiers = glutGetModifiers() self._is_alt_down = (modifiers & GLUT_ACTIVE_ALT != 0) self._is_ctrl_down = (modifiers & GLUT_ACTIVE_CTRL != 0) self._is_shift_down = (modifiers & GLUT_ACTIVE_SHIFT != 0)
def _glut_update_modifiers(self): self._modifiers = [] mods = glutGetModifiers() if mods & GLUT_ACTIVE_SHIFT: self._modifiers.append('shift') if mods & GLUT_ACTIVE_ALT: self._modifiers.append('alt') if mods & GLUT_ACTIVE_CTRL: self._modifiers.append('ctrl')
def mouse_press(self, *args): """ Called when a mouse button is pressed or released. The args parameter is a tuple with 4 elements, (button, pressed, x, y) The first element indicates which button is pressed, the second is a 0 (released) or 1 (pressed), and final two are the position of the mouse in window co-ordinates. """ button, up, x, y = args if button == 0: if up: self._last_mouse_press = None self._last_orientation = None else: self._last_mouse_press = (x, y, glutGetModifiers()) self._last_orientation = self.renderer.camera.orientation