#include <SDL/SDL.h>
#include "fastevents.h"
+#include <SDL/SDL_sound.h>
+#include <AL/alut.h>
#include "Dispatcher.hh"
#include "Engine.hh"
namespace Mf {
-class Engine::EngineImpl
+class Engine::Impl
{
public:
- EngineImpl(int argc, char* argv[], const std::string& configFile,
+ Impl(int argc, char* argv[], const std::string& configFile,
const std::string& name, const std::string& iconFile,
Engine* outer) :
interface(outer),
{
throw Exception(FE_GetError());
}
+ if (Sound_Init() != 0)
+ {
+ //throw Exception(Sound_GetError());
+ std::cerr << Sound_GetError() << std::endl;
+ }
+ alutInit(&argc, argv);
settings.loadFromFile(configFile);
long randomSeed;
- if (settings.get("engine.rngseed", randomSeed))
- {
- setSeed(randomSeed);
- }
- else
- {
- setSeed();
- }
+ if (settings.get("engine.rngseed", randomSeed)) setSeed(randomSeed);
+ else setSeed();
double ts = 0.01;
settings.get("engine.timestep", ts);
video->makeActive();
}
- ~EngineImpl()
+ ~Impl()
{
// the video object must be destroyed before we can shutdown SDL
video.reset();
+ alutExit();
+ Sound_Quit();
FE_Quit();
SDL_Quit();
}
Engine::Engine(int argc, char* argv[], const std::string& configFile,
const std::string& name, const std::string& iconFile) :
- impl_(new Engine::EngineImpl(argc, argv, configFile, name, iconFile, this))
-{}
+ impl_(new Engine::Impl(argc, argv, configFile, name, iconFile, this)) {}
Engine::~Engine() {}