Compare commits
No commits in common. "b31e90ef680c3cdcd711c15b2cdb793456b24605" and "530789f0b336a41dd477f6e41c7b40848da24d0b" have entirely different histories.
b31e90ef68
...
530789f0b3
3 changed files with 6 additions and 19 deletions
|
@ -14,10 +14,9 @@
|
|||
#include <memory>
|
||||
#include <numbers>
|
||||
#include <optional>
|
||||
#include <qsoundeffect.h>
|
||||
#include <reactphysics3d/collision/RaycastInfo.h>
|
||||
#include <vector>
|
||||
#include <QSoundEffect>
|
||||
#include <QSound>
|
||||
|
||||
#include "datatypes/cframe.h"
|
||||
#include "datatypes/vector.h"
|
||||
|
@ -53,13 +52,6 @@ void MainGLWidget::initializeGL() {
|
|||
renderInit(NULL, width(), height());
|
||||
}
|
||||
|
||||
inline void playSound(QString path) {
|
||||
QSoundEffect *sound = new QSoundEffect;
|
||||
sound->setSource(QUrl::fromLocalFile(path));
|
||||
sound->play();
|
||||
sound->connect(sound, &QSoundEffect::playingChanged, [=]() { /* Thank you QSound source code! */ sound->deleteLater(); return false; });
|
||||
}
|
||||
|
||||
extern int vpx, vpy;
|
||||
|
||||
void MainGLWidget::resizeGL(int w, int h) {
|
||||
|
@ -220,7 +212,9 @@ void MainGLWidget::handleLinearTransform(QMouseEvent* evt) {
|
|||
|
||||
// Apply snapping in the current frame
|
||||
glm::vec3 diff = centerPoint - (glm::vec3)editorToolHandles->adornee->lock()->position();
|
||||
// printf("\n=======\nPre-snap: (%f, %f, %f)\n", diff.x, diff.y, diff.z);
|
||||
if (snappingFactor()) diff = frame.Rotation() * (glm::round(glm::vec3(frame.Inverse().Rotation() * diff) / snappingFactor()) * snappingFactor());
|
||||
// printf("Post-snap: (%f, %f, %f)\n", diff.x, diff.y, diff.z);
|
||||
|
||||
Data::Vector3 oldSize = part->size;
|
||||
|
||||
|
@ -253,7 +247,7 @@ void MainGLWidget::handleLinearTransform(QMouseEvent* evt) {
|
|||
}
|
||||
|
||||
if (mainWindow()->editSoundEffects && (oldSize != part->size) && QFile::exists("./assets/excluded/switch.wav"))
|
||||
playSound("./assets/excluded/switch.wav");
|
||||
QSound::play("./assets/excluded/switch.wav");
|
||||
|
||||
syncPartPhysics(std::dynamic_pointer_cast<Part>(editorToolHandles->adornee->lock()));
|
||||
}
|
||||
|
@ -324,13 +318,6 @@ void MainGLWidget::handleCursorChange(QMouseEvent* evt) {
|
|||
setCursor(Qt::ArrowCursor);
|
||||
}
|
||||
|
||||
void MainGLWidget::wheelEvent(QWheelEvent* evt) {
|
||||
camera.processMovement(evt->angleDelta().y() < 0 ? DIRECTION_BACKWARDS : DIRECTION_FORWARD, 0.25f);
|
||||
|
||||
if (mainWindow()->editSoundEffects && QFile::exists("./assets/excluded/SWITCH3.wav"))
|
||||
playSound("./assets/excluded/SWITCH3.wav");
|
||||
}
|
||||
|
||||
void MainGLWidget::mouseMoveEvent(QMouseEvent* evt) {
|
||||
handleCameraRotate(evt);
|
||||
handleObjectDrag(evt);
|
||||
|
@ -394,7 +381,7 @@ void MainGLWidget::mousePressEvent(QMouseEvent* evt) {
|
|||
}
|
||||
|
||||
if (mainWindow()->editSoundEffects && QFile::exists("./assets/excluded/electronicpingshort.wav"))
|
||||
playSound("./assets/excluded/electronicpingshort.wav");
|
||||
QSound::play("./assets/excluded/electronicpingshort.wav");
|
||||
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -28,7 +28,6 @@ protected:
|
|||
void handleCursorChange(QMouseEvent* evt);
|
||||
std::optional<HandleFace> raycastHandle(glm::vec3 pointDir);
|
||||
|
||||
void wheelEvent(QWheelEvent* evt) override;
|
||||
void mouseMoveEvent(QMouseEvent* evt) override;
|
||||
void mousePressEvent(QMouseEvent* evt) override;
|
||||
void mouseReleaseEvent(QMouseEvent* evt) override;
|
||||
|
|
|
@ -131,6 +131,7 @@ MainWindow::MainWindow(QWidget *parent)
|
|||
|
||||
connect(ui->actionToggleEditSounds, &QAction::triggered, this, [&](bool state) {
|
||||
editSoundEffects = state;
|
||||
printf("%d\n", editSoundEffects);
|
||||
ui->actionToggleEditSounds->setIcon(QIcon::fromTheme(editSoundEffects ? "audio-volume-high" : "audio-volume-muted"));
|
||||
});
|
||||
ui->actionToggleEditSounds->setChecked(true);
|
||||
|
|
Loading…
Add table
Reference in a new issue