mirror of
https://github.com/overte-org/overte.git
synced 2025-08-08 10:17:40 +02:00
move avatar size changes to Avatar slots
This commit is contained in:
parent
92b6459e4b
commit
811fc87294
5 changed files with 39 additions and 32 deletions
|
@ -710,10 +710,10 @@ void Application::keyPressEvent(QKeyEvent* event) {
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case Qt::Key_Plus:
|
case Qt::Key_Plus:
|
||||||
increaseAvatarSize();
|
_myAvatar.increaseSize();
|
||||||
break;
|
break;
|
||||||
case Qt::Key_Minus:
|
case Qt::Key_Minus:
|
||||||
decreaseAvatarSize();
|
_myAvatar.decreaseSize();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Qt::Key_1:
|
case Qt::Key_1:
|
||||||
|
@ -1142,25 +1142,6 @@ void Application::setFullscreen(bool fullscreen) {
|
||||||
updateCursor();
|
updateCursor();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Application::increaseAvatarSize() {
|
|
||||||
if ((1.f + SCALING_RATIO) * _myAvatar.getNewScale() < MAX_SCALE) {
|
|
||||||
_myAvatar.setNewScale((1.f + SCALING_RATIO) * _myAvatar.getNewScale());
|
|
||||||
qDebug("Changed scale to %f\n", _myAvatar.getNewScale());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void Application::decreaseAvatarSize() {
|
|
||||||
if (MIN_SCALE < (1.f - SCALING_RATIO) * _myAvatar.getNewScale()) {
|
|
||||||
_myAvatar.setNewScale((1.f - SCALING_RATIO) * _myAvatar.getNewScale());
|
|
||||||
qDebug("Changed scale to %f\n", _myAvatar.getNewScale());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void Application::resetAvatarSize() {
|
|
||||||
_myAvatar.setNewScale(1.f);
|
|
||||||
qDebug("Reseted scale to %f\n", _myAvatar.getNewScale());
|
|
||||||
}
|
|
||||||
|
|
||||||
void Application::setFrustumOffset(bool frustumOffset) {
|
void Application::setFrustumOffset(bool frustumOffset) {
|
||||||
// reshape so that OpenGL will get the right lens details for the camera of choice
|
// reshape so that OpenGL will get the right lens details for the camera of choice
|
||||||
resizeGL(_glWidget->width(), _glWidget->height());
|
resizeGL(_glWidget->width(), _glWidget->height());
|
||||||
|
|
|
@ -142,10 +142,6 @@ private slots:
|
||||||
|
|
||||||
void setFullscreen(bool fullscreen);
|
void setFullscreen(bool fullscreen);
|
||||||
|
|
||||||
void increaseAvatarSize();
|
|
||||||
void decreaseAvatarSize();
|
|
||||||
void resetAvatarSize();
|
|
||||||
|
|
||||||
void renderThrustAtVoxel(const glm::vec3& thrust);
|
void renderThrustAtVoxel(const glm::vec3& thrust);
|
||||||
void renderLineToTouchedVoxel();
|
void renderLineToTouchedVoxel();
|
||||||
|
|
||||||
|
|
|
@ -151,13 +151,21 @@ Menu::Menu() :
|
||||||
addCheckableActionToQMenuAndActionHash(renderMenu, MenuOption::ParticleSystem);
|
addCheckableActionToQMenuAndActionHash(renderMenu, MenuOption::ParticleSystem);
|
||||||
addCheckableActionToQMenuAndActionHash(renderMenu, MenuOption::FirstPerson, Qt::Key_P, true);
|
addCheckableActionToQMenuAndActionHash(renderMenu, MenuOption::FirstPerson, Qt::Key_P, true);
|
||||||
|
|
||||||
addActionToQMenuAndActionHash(renderMenu, MenuOption::IncreaseAvatarSize);
|
addActionToQMenuAndActionHash(renderMenu,
|
||||||
addActionToQMenuAndActionHash(renderMenu, MenuOption::DecreaseAvatarSize);
|
MenuOption::IncreaseAvatarSize,
|
||||||
addActionToQMenuAndActionHash(renderMenu, MenuOption::ResetAvatarSize);
|
Qt::Key_Plus,
|
||||||
|
appInstance->getAvatar(),
|
||||||
// renderMenu->addAction("Increase Avatar Size", this, SLOT(increaseAvatarSize()), Qt::Key_Plus);
|
SLOT(increaseSize()));
|
||||||
// renderMenu->addAction("Decrease Avatar Size", this, SLOT(decreaseAvatarSize()), Qt::Key_Minus);
|
addActionToQMenuAndActionHash(renderMenu,
|
||||||
// renderMenu->addAction("Reset Avatar Size", this, SLOT(resetAvatarSize()));
|
MenuOption::DecreaseAvatarSize,
|
||||||
|
Qt::Key_Minus,
|
||||||
|
appInstance->getAvatar(),
|
||||||
|
SLOT(decreaseSize()));
|
||||||
|
addActionToQMenuAndActionHash(renderMenu,
|
||||||
|
MenuOption::ResetAvatarSize,
|
||||||
|
0,
|
||||||
|
appInstance->getAvatar(),
|
||||||
|
SLOT(resetSize()));
|
||||||
|
|
||||||
QMenu* toolsMenu = addMenu("Tools");
|
QMenu* toolsMenu = addMenu("Tools");
|
||||||
addCheckableActionToQMenuAndActionHash(toolsMenu, MenuOption::Stats, Qt::Key_Slash);
|
addCheckableActionToQMenuAndActionHash(toolsMenu, MenuOption::Stats, Qt::Key_Slash);
|
||||||
|
|
|
@ -1659,6 +1659,25 @@ void Avatar::goHome() {
|
||||||
setPosition(START_LOCATION);
|
setPosition(START_LOCATION);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Avatar::increaseSize() {
|
||||||
|
if ((1.f + SCALING_RATIO) * _newScale < MAX_SCALE) {
|
||||||
|
_newScale *= (1.f + SCALING_RATIO);
|
||||||
|
qDebug("Changed scale to %f\n", _newScale);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void Avatar::decreaseSize() {
|
||||||
|
if (MIN_SCALE < (1.f - SCALING_RATIO) * _newScale) {
|
||||||
|
_newScale *= (1.f - SCALING_RATIO);
|
||||||
|
qDebug("Changed scale to %f\n", _newScale);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void Avatar::resetSize() {
|
||||||
|
_newScale = 1.0f;
|
||||||
|
qDebug("Reseted scale to %f\n", _newScale);
|
||||||
|
}
|
||||||
|
|
||||||
void Avatar::setNewScale(const float scale) {
|
void Avatar::setNewScale(const float scale) {
|
||||||
_newScale = scale;
|
_newScale = scale;
|
||||||
}
|
}
|
||||||
|
|
|
@ -215,6 +215,9 @@ public:
|
||||||
public slots:
|
public slots:
|
||||||
void setWantCollisionsOn(bool wantCollisionsOn) { _isCollisionsOn = wantCollisionsOn; }
|
void setWantCollisionsOn(bool wantCollisionsOn) { _isCollisionsOn = wantCollisionsOn; }
|
||||||
void goHome();
|
void goHome();
|
||||||
|
void increaseSize();
|
||||||
|
void decreaseSize();
|
||||||
|
void resetSize();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// privatize copy constructor and assignment operator to avoid copying
|
// privatize copy constructor and assignment operator to avoid copying
|
||||||
|
|
Loading…
Reference in a new issue