def mouseMoveEvent(self, e): if not self.cam: return pt = e.pos() if self.mouse_dwn: cam = dheng.wld_get_cam() dx = pt.x() - self.prev_x dy = pt.y() - self.prev_y dheng.cam_yaw(cam, dx * 0.01) dheng.cam_pitch(cam, dy * 0.01) self.prev_x = pt.x() self.prev_y = pt.y()
def mouseMoveEvent(self, e): if not self.cam: return pt = e.pos() if self.mouse_dwn: cam = dheng.wld_get_cam() dx = pt.x() - self.prev_x dy = pt.y() - self.prev_y dheng.cam_yaw(cam, dx*0.01) dheng.cam_pitch(cam, dy*0.01) self.prev_x = pt.x() self.prev_y = pt.y()
def keyPressEvent(self, e): if not self.cam: return if self.mouse_dwn: cam = dheng.wld_get_cam() key = e.key() if key == QtCore.Qt.Key_W or key == QtCore.Qt.Key_Up: dheng.cam_fwd(self.cam, 0.5) elif e.key() == QtCore.Qt.Key_S or key == QtCore.Qt.Key_Down: dheng.cam_fwd(self.cam, -0.5) elif e.key() == QtCore.Qt.Key_D or key == QtCore.Qt.Key_Right: dheng.cam_strafe(self.cam, 0.5) elif e.key() == QtCore.Qt.Key_A or key == QtCore.Qt.Key_Left: dheng.cam_strafe(self.cam, -0.5)