Compare commits
No commits in common. "52cfa69a6e34d4a2d604999366273f87331c36c5" and "2fec4cc7f297b2b1a1d7467ff302bc2b598a30e1" have entirely different histories.
52cfa69a6e
...
2fec4cc7f2
5 changed files with 15 additions and 22 deletions
|
@ -27,6 +27,4 @@ CPMAddPackage("gh:nothings/stb#8cfb1605c02aee9fb6eb5d8ea559017745bd9a16") # 2.14
|
||||||
CPMAddPackage("gh:WohlSoft/LuaJIT#a5da8f4a31972b74254f00969111b8b7a07cf584") # v2.1
|
CPMAddPackage("gh:WohlSoft/LuaJIT#a5da8f4a31972b74254f00969111b8b7a07cf584") # v2.1
|
||||||
set(LUAJIT_INCLUDE_DIRS ${LuaJIT_SOURCE_DIR}/src)
|
set(LUAJIT_INCLUDE_DIRS ${LuaJIT_SOURCE_DIR}/src)
|
||||||
|
|
||||||
CPMAddPackage("gh:mackron/miniaudio#0.11.22")
|
|
||||||
|
|
||||||
set (CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PREV_BIN_PATH})
|
set (CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PREV_BIN_PATH})
|
|
@ -37,7 +37,7 @@ set(PROJECT_SOURCES
|
||||||
|
|
||||||
qt_add_executable(editor MANUAL_FINALIZATION ${PROJECT_SOURCES})
|
qt_add_executable(editor MANUAL_FINALIZATION ${PROJECT_SOURCES})
|
||||||
target_include_directories(editor PRIVATE .)
|
target_include_directories(editor PRIVATE .)
|
||||||
target_link_libraries(editor PRIVATE openblocks Qt6::Widgets Qt6::OpenGLWidgets ${QSCINTILLA_LIBRARY} miniaudio)
|
target_link_libraries(editor PRIVATE openblocks Qt6::Widgets Qt6::OpenGLWidgets ${QSCINTILLA_LIBRARY})
|
||||||
|
|
||||||
set_target_properties(editor PROPERTIES
|
set_target_properties(editor PROPERTIES
|
||||||
WIN32_EXECUTABLE ON
|
WIN32_EXECUTABLE ON
|
||||||
|
|
|
@ -9,16 +9,13 @@
|
||||||
#include <QSurfaceFormat>
|
#include <QSurfaceFormat>
|
||||||
#include <qfont.h>
|
#include <qfont.h>
|
||||||
#include <qsurfaceformat.h>
|
#include <qsurfaceformat.h>
|
||||||
#include <miniaudio.h>
|
|
||||||
|
|
||||||
ma_engine miniaudio;
|
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
QSurfaceFormat format;
|
QSurfaceFormat format;
|
||||||
format.setSamples(4);
|
format.setSamples(4);
|
||||||
format.setRenderableType(QSurfaceFormat::OpenGL);
|
// TODO: This is broken for some reason on Linux, Qt refuses to use any version newer than 3.2. Figure out why
|
||||||
format.setVersion(3, 3);
|
// format.setVersion(3, 3);
|
||||||
format.setProfile(QSurfaceFormat::CompatibilityProfile); // Valid only in OpenGL 3.2+, see: https://stackoverflow.com/a/70519392/16255372
|
format.setProfile(QSurfaceFormat::CompatibilityProfile); // Valid only in OpenGL 3.2+, see: https://stackoverflow.com/a/70519392/16255372
|
||||||
QSurfaceFormat::setDefaultFormat(format);
|
QSurfaceFormat::setDefaultFormat(format);
|
||||||
|
|
||||||
|
@ -26,17 +23,10 @@ int main(int argc, char *argv[])
|
||||||
|
|
||||||
Logger::init();
|
Logger::init();
|
||||||
|
|
||||||
ma_result res = ma_engine_init(NULL, &miniaudio);
|
|
||||||
if (res != MA_SUCCESS) {
|
|
||||||
Logger::fatalErrorf("Failed to initialize Miniaudio withe error [%d]", res);
|
|
||||||
panic();
|
|
||||||
}
|
|
||||||
|
|
||||||
MainWindow w;
|
MainWindow w;
|
||||||
w.show();
|
w.show();
|
||||||
int result = a.exec();
|
int result = a.exec();
|
||||||
|
|
||||||
ma_engine_uninit(&miniaudio);
|
|
||||||
Logger::finish();
|
Logger::finish();
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,8 +2,8 @@
|
||||||
#include <glm/common.hpp>
|
#include <glm/common.hpp>
|
||||||
#include <glm/vector_relational.hpp>
|
#include <glm/vector_relational.hpp>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <miniaudio.h>
|
|
||||||
#include <qnamespace.h>
|
#include <qnamespace.h>
|
||||||
|
#include <qsoundeffect.h>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include "./ui_mainwindow.h"
|
#include "./ui_mainwindow.h"
|
||||||
#include "mainglwidget.h"
|
#include "mainglwidget.h"
|
||||||
|
@ -45,10 +45,12 @@ void MainGLWidget::initializeGL() {
|
||||||
renderInit(width(), height());
|
renderInit(width(), height());
|
||||||
}
|
}
|
||||||
|
|
||||||
extern ma_engine miniaudio;
|
|
||||||
inline void playSound(QString path) {
|
inline void playSound(QString path) {
|
||||||
ma_engine_stop(&miniaudio);
|
return; // TODO: Fix pulseaudio bug causing stutters
|
||||||
ma_engine_play_sound(&miniaudio, path.toStdString().c_str(), NULL);
|
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;
|
extern int vpx, vpy;
|
||||||
|
|
|
@ -20,13 +20,13 @@
|
||||||
#include <qmessagebox.h>
|
#include <qmessagebox.h>
|
||||||
#include <qmimedata.h>
|
#include <qmimedata.h>
|
||||||
#include <qnamespace.h>
|
#include <qnamespace.h>
|
||||||
|
#include <qsoundeffect.h>
|
||||||
#include <qstylefactory.h>
|
#include <qstylefactory.h>
|
||||||
#include <qstylehints.h>
|
#include <qstylehints.h>
|
||||||
#include <qmdisubwindow.h>
|
#include <qmdisubwindow.h>
|
||||||
#include <pugixml.hpp>
|
#include <pugixml.hpp>
|
||||||
#include <qtextcursor.h>
|
#include <qtextcursor.h>
|
||||||
#include <qtextedit.h>
|
#include <qtextedit.h>
|
||||||
#include <miniaudio.h>
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#ifdef _NDEBUG
|
#ifdef _NDEBUG
|
||||||
|
@ -58,9 +58,12 @@ void logQtMessage(QtMsgType type, const QMessageLogContext &context, const QStri
|
||||||
// if (defaultMessageHandler) defaultMessageHandler(type, context, msg);
|
// if (defaultMessageHandler) defaultMessageHandler(type, context, msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
extern ma_engine miniaudio;
|
|
||||||
inline void playSound(QString path) {
|
inline void playSound(QString path) {
|
||||||
ma_engine_play_sound(&miniaudio, path.toStdString().c_str(), NULL);
|
return; // TODO: Fix pulseaudio bug causing stutters
|
||||||
|
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; });
|
||||||
}
|
}
|
||||||
|
|
||||||
MainWindow::MainWindow(QWidget *parent)
|
MainWindow::MainWindow(QWidget *parent)
|
||||||
|
|
Loading…
Add table
Reference in a new issue