HbThemeSystemEffectMap *HbThemeSystemEffect::parseConfigurationFile(const QString &effectsFolder)
{
    HbThemeSystemEffectMap *effects = new HbThemeSystemEffectMap;
    effects->setEffectsFolder(QDir::toNativeSeparators(effectsFolder));
    QString filePath = effectsFolder + confFilePath;
#ifdef HBTHEMESYSTEMEFFECT_DEBUG
    qDebug() << "HbThemeSystemEffect::parseConfigurationFile trying to  parse file" << filePath;
#endif //HBTHEMESYSTEMEFFECT_DEBUG
    bool success = true;
    QFile confFile(filePath);
    success = confFile.open(QIODevice::ReadOnly);
    if (success) {
        QXmlStreamReader xml(&confFile);
        success = checkStartElement(xml, mainElement);
        if (success) {
            parseEffects(xml, effects);
            if (xml.error()) {
                qWarning() << "HbThemeSystemEffect::parseConfigurationFile: Error when parsing xml "
                           << xml.errorString();
                success = false;
            }
        }
        confFile.close();
    } else {
#ifdef HBTHEMESYSTEMEFFECT_DEBUG
        qDebug() << "HbThemeSystemEffect::parseConfigurationFile:"
                 << confFile.fileName() << "not found.";
#endif //HBTHEMESYSTEMEFFECT_DEBUG
    }
    return effects;
}
示例#2
0
Knight::Knight(Window *window, int knight_number, int lives_total):
	window(window),
	hitbox(0, 0, 0, 0),
	decal(nullptr),
	lives(lives_total),
	deaths(0),
	specialpower(0)
{
	roster_result = roster_document.load_file("../Scripts/roster.xml");
	attack_hitboxes.reserve(8);

	alive = true;
	hit = false;
	jumping = false;
	landing = false;
	is_landed = false;
	is_jumping = false;
	out_of_bounds = false;
	
	moves.resize(ANIMATION_MAX);

	
	std::string knight_file = 
		roster_document.child("roster").
		find_child_by_attribute("id", std::to_string(knight_number).c_str()).
		attribute("script").value();

	knight_result = knight_document.load_file(knight_file.c_str());
	
	if (!knight_result) {
		printf("Failed to load knight %s.\n", knight_file.c_str());
		return;
	}

	animations.resize(ANIMATION_MAX);

	// NOTE(juha): This is filled with each combo, pushed to *special_combos 
	//             and cleared before another fill
	SpecialCombo combo;
	
	/* NOTE(juha): example code
	atoi(levelDocument.child("map").attribute("height").value());
	levelDocument.child("map").find_child_by_attribute("name", "Background2").child("data");
	tmp = new Animation(window, "../Graphics/Knights/wizard_knight_run.png", 50, 50, 0, 4, 8);*/
	
	pugi::xml_node tmp_node;
	tmp_node = knight_document.child("knight");
	
	parseSounds(&tmp_node);

	parseEffects(&tmp_node);

	Rectangle tmp_hitbox(0, 0, 0, 0);
	std::vector<Rectangle> tmp_move_hitboxes;

	tmp_node = knight_document.child("knight").child("action");
	parseActions(&tmp_node);
}