Exemple #1
0
int main(int argc, char* argv[])
{
	SSVU_TEST_RUN_ALL();

	vector<string> overrideIds; for(int i{0}; i < argc; ++i) overrideIds.emplace_back(argv[i]);

	if(contains(overrideIds, "server"))
	{
		HGAssets levelOnlyAssets{true};
		Online::initializeValidators(levelOnlyAssets);
		Online::OHServer ohServer;
		ohServer.start();
		return 0;
	}

	createProfilesFolder();

	Online::initializeClient();
	Online::tryConnectToServer();

	Config::loadConfig(overrideIds);

	GameWindow window;
	window.setTitle("Open Hexagon " + toStr(Config::getVersion()) + " - by vittorio romeo");
	Config::setTimerStatic(window, Config::getTimerStatic());
	window.setSize(Config::getWidth(), Config::getHeight());
	window.setPixelMult(Config::getPixelMultiplier());
	window.setFullscreen(Config::getFullscreen());
	window.setVsync(Config::getVsync());
	window.setFPSLimited(Config::getLimitFPS());
	window.setMaxFPS(Config::getMaxFPS());
	window.setMouseCursorVisible(false);

	HGAssets assets;
	Online::initializeValidators(assets);
	HexagonGame hg{assets, window};
	MenuGame mg{assets, hg, window};
	hg.mgPtr = &mg;

	assets.refreshVolumes();
	window.setGameState(mg.getGame()); mg.init();
	window.run();

	if(Online::getLoginStatus() != Online::LoginStat::Logged) Online::logout();

	Config::saveConfig(); assets.pSaveCurrent(); saveLogToFile("log.txt");
	return 0;
}
Exemple #2
0
 void setLimitFPS(GameWindow& mWindow, bool mValue)
 {
     limitFPS = mValue;
     mWindow.setFPSLimited(mValue);
 }