Ejemplo n.º 1
0
void CfgLoad()
{
	std::strcpy(cfgW, Itoa(get_config_int("gfxmode", "width", 640)).c_str());
	std::strcpy(cfgH, Itoa(get_config_int("gfxmode", "height", 480)).c_str());
	cfgFull = get_config_int("gfxmode", "fullscreen", 0);
	cfgZoom = get_config_int("gfxmode", "zoomin", 0);
	LoadControls();
}
Ejemplo n.º 2
0
void Theme::parseFile(const char* file)
{
	XML::gcXMLDocument doc(file);

	if (!doc.IsValid())
		throw gcException(ERR_BADXML);

	auto mcNode = doc.GetRoot("theme");

	if (!mcNode.IsValid())
		throw gcException(ERR_XML_NOPRIMENODE);

	mcNode.GetChild("creator", m_szDev);
	mcNode.GetChild("name", m_szPName);

	UTIL::FS::Path path(file, "", true);

	auto iNode = mcNode.FirstChildElement("images");

	if (iNode.IsValid())
		LoadImages(path, iNode);

	auto wNode = mcNode.FirstChildElement("web");

	if (wNode.IsValid())
		LoadWeb(path, wNode);

	auto sNode = mcNode.FirstChildElement("sprites");

	if (sNode.IsValid())
		LoadSprites(sNode);

	auto cNode = mcNode.FirstChildElement("controls");

	if (cNode.IsValid())
		LoadControls(cNode);

	auto control = ControlList::findItem("default");

	if (!control)
	{
		control = gcRefPtr<ThemeControlInfo>::create("default");

		auto col1 = gcRefPtr<ThemeColorInfo>::create("bg");
		auto col2 = gcRefPtr<ThemeColorInfo>::create("fg");

		col1->color = Color(0);
		col2->color = Color(0xFFFFFF);

		control->add(col1);
		control->add(col2);

		ControlList::addItem( control );
	}
}
Ejemplo n.º 3
0
void DoConfiguration()
{
	std::cout << numMIDIs;
	LoadControls();
	
	if(cfgFull) cfgDialog[1].flags |= D_SELECTED;
	if(cfgZoom) cfgDialog[2].flags |= D_SELECTED;

	int ret;
	while((ret = do_dialog(cfgDialog, -1)) != 5)
	{
		switch(ret)
		{
			case 4:		//apply
				CfgApply();
				if((screen->w != std::atoi(cfgW)) || (screen->h != std::atoi(cfgH)))
				{
					if(!set_gfx_mode(cfgFull ? GFX_AUTODETECT_FULLSCREEN : GFX_AUTODETECT_WINDOWED, std::atoi(cfgW), std::atoi(cfgH), 0, 0))
					{
						if(alert("Keep this graphics mode?", "If not, configuration won't be saved", "", "Yes", "No", 0, 0) == 1) CfgSave();
						else
						{
							strcpy(cfgW, "640");
							strcpy(cfgH, "480");
							set_gfx_mode(cfgFull ? GFX_AUTODETECT_FULLSCREEN : GFX_AUTODETECT_WINDOWED, std::atoi(cfgW), std::atoi(cfgH), 0, 0);
						}
					}
					else
					{
						strcpy(cfgW, "640");
						strcpy(cfgH, "480");
						set_gfx_mode(cfgFull ? GFX_AUTODETECT_FULLSCREEN : GFX_AUTODETECT_WINDOWED, std::atoi(cfgW), std::atoi(cfgH), 0, 0);
					}
				}
				break;
			case 5:		//leave
				break;
			case 6:		//kb
				CfgKb();
				break;
			case 7:		//joy
				CfgJoy();
				break;
			case 16:	//leave default
				CfgDefaults();
				break;
		}
	}
}