Config-file less constructor

git-svn-id: https://projectm.svn.sourceforge.net/svnroot/projectm/trunk@1231 6778bc44-b910-0410-a7a0-be141de4315d
This commit is contained in:
psperl
2009-07-10 02:58:36 +00:00
parent 7f70b88c81
commit 96f98abffd
2 changed files with 61 additions and 21 deletions

View File

@ -106,12 +106,20 @@ DLLEXPORT void projectM::projectM_resetTextures()
DLLEXPORT projectM::projectM ( std::string config_file, int flags) :
beatDetect ( 0 ), renderer ( 0 ), _pcm(0), m_presetPos(0), m_flags(flags), _pipelineContext(new PipelineContext())
{
readConfig ( config_file );
readConfig(config_file);
projectM_reset();
projectM_resetGL ( _settings.windowWidth, _settings.windowHeight);
projectM_resetGL(_settings.windowWidth, _settings.windowHeight);
}
DLLEXPORT projectM::projectM(Settings settings, int flags):
beatDetect ( 0 ), renderer ( 0 ), _pcm(0), m_presetPos(0), m_flags(flags), _pipelineContext(new PipelineContext())
{
readSettings(settings);
projectM_reset();
projectM_resetGL(_settings.windowWidth, _settings.windowHeight);
}
bool projectM::writeConfig(const std::string & configFile, const Settings & settings) {
@ -212,6 +220,35 @@ void projectM::readConfig (const std::string & configFile )
}
void projectM::readSettings (const Settings & settings )
{
_settings.meshX = settings.meshX;
_settings.meshY = settings.meshY;
_settings.textureSize = settings.textureSize;
_settings.fps = settings.fps;
_settings.windowWidth = settings.windowWidth;
_settings.windowHeight = settings.windowHeight;
_settings.smoothPresetDuration = settings.smoothPresetDuration;
_settings.presetDuration = settings.presetDuration;
_settings.presetURL = settings.presetURL;
_settings.titleFontURL = settings.titleFontURL;
_settings.menuFontURL = settings.menuFontURL;
_settings.shuffleEnabled = settings.shuffleEnabled;
_settings.easterEgg = settings.easterEgg;
projectM_init ( _settings.meshX, _settings.meshY, _settings.fps,
_settings.textureSize, _settings.windowWidth,_settings.windowHeight);
_settings.beatSensitivity = settings.beatSensitivity;
_settings.aspectCorrection = settings.aspectCorrection;
}
#ifdef USE_THREADS
static void *thread_callback(void *prjm) {
projectM *p = (projectM *)prjm;