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

@ -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;