Fix openMPT implementation

lmao
This commit is contained in:
/nick haya 2022-02-11 15:38:31 +08:00
parent 033de55ddf
commit 06fcac4c34
4 changed files with 17 additions and 5 deletions

View File

@ -21,7 +21,6 @@ else ()
set(MAIN_LIBRARIES_E "${CMAKE_CURRENT_LIST_DIR}/lib/x86/")
endif ()
# strip it all
string(STRIP "${MAIN_LIBRARIES}" MAIN_LIBRARIES)
@ -35,7 +34,6 @@ include_directories(${CMAKE_CURRENT_LIST_DIR}/src)
# add EVERY FUCKING source file to SOURCES
FILE(GLOB SOURCES "${CMAKE_CURRENT_LIST_DIR}/src/*.cpp"
"${CMAKE_CURRENT_LIST_DIR}/src/*.hpp"
"${CMAKE_CURRENT_LIST_DIR}/src/*.c"
"${CMAKE_CURRENT_LIST_DIR}/src/*.h"
"${CMAKE_CURRENT_LIST_DIR}/src/SDL2/*.c"
"${CMAKE_CURRENT_LIST_DIR}/src/SDL2/*.h"

View File

@ -35,7 +35,8 @@ To use it (in windows atleast),
- Get SDL2 and SDL_ttf 2.0, and put em on the respective x86 and x64 folders.
You know how to place them. It's fucking common sense.
- [SoLoud.](https://sol.gfxile.net/soloud/index.html) Follow GENie instructions and build as a static library.
Since it's currently confusing to do, [here's some prebuilt lib files for use with this wrapper.](https://cdn.discordapp.com/attachments/872338952483381258/940791426797686804/SoLoud_Static.zip)
- If you are gonna be using the OpenMPT module, you'll need the libopenmpt dll in your exe directory as well.
- Prebuilt binaries (with OpenMPT) are [here.](https://cdn.discordapp.com/attachments/872338952483381258/941594180461932564/SoLoud-SDL2.7z)
- Clone the dam repo somewhere on ur machine.
- Go to where you cloned it, and run `cmake -B build -DCMAKE_BUILD_TYPE=Release`
- After successfully making the build files, run `cmake --build --config Release` to build it without the use of VStudio.

View File

@ -19,11 +19,16 @@
#include <stdlib.h>
#include "argh.h"
#include "guicon.h"
#include <random>
using namespace std;
using namespace Render;
using namespace argh;
bool randomBool() {
return rand() % 2;
}
class MainState : public State {
AnimatedObject objs;
TextObject text;
@ -38,7 +43,13 @@ class MainState : public State {
// before it
virtual void Create() {
// SPEAK("eyeyeyayeyayeyaeyaeyayeayeyaeyaeyayeyaeyayeyayeyayeyayeaye", 3000.0f, 5.0f);
playModPlug("data/canyon.mid");
srand(time(0));
if (randomBool())
playModPlug("data/canyon.mid");
else
{
playModPlug("data/solarbeams.xm");
}
// i know that this isnt the best idea to do this
// yeah, im just lazy
title.create(0, 0, "data/bg.png");

View File

@ -425,7 +425,9 @@ bool Render::playModPlug(string path) {
return true;
}
log("", "Played mod tracker from " + path, NORMAL, __FILENAME__, __LINE__);
modLoader.load(path.c_str());
if (modLoader.load(path.c_str()) != SoLoud::SO_NO_ERROR) {
log("", "Could not play " + path, NORMAL, __FILENAME__, __LINE__);
}
modLoader.setLooping(true);
music.play(modLoader);
currentMusic = path;