DuelMatch::DuelMatch(bool remote, std::string rules) : // we send a pointer to an unconstructed object here! mLogic(createGameLogic(rules, this)), mPaused(false), events(0), external_events(0), mRemote(remote) { mPhysicWorld.reset( new PhysicWorld() ); setInputSources(boost::make_shared<InputSource>(), boost::make_shared<InputSource>()); }
DuelMatch::DuelMatch(InputSource* linput, InputSource* rinput, bool global, bool remote):mLogic(createGameLogic("rules.lua")), mPaused(false), events(0), external_events(0), mRemote(remote) { mGlobal = global; if (mGlobal) { assert(mMainGame == 0); mMainGame = this; } mLeftInput = linput; mRightInput = rinput; mBallDown = false; mPhysicWorld.resetPlayer(); mPhysicWorld.step(); UserConfig gameConfig; gameConfig.loadFile("config.xml"); mLogic->setScoreToWin(gameConfig.getInteger("scoretowin")); };
void DuelMatch::setRules(std::string rulesFile) { mLogic = createGameLogic(rulesFile, this); }