<commit_before>#include "include/Cerium/vec2.hpp"
#include "include/Cerium/Window.hpp"
#include "include/Cerium/EventManager.hpp"
#include "include/Cerium/Act.hpp"
#include "include/Cerium/VertexArray.hpp"
#include "include/Cerium/Scriptable.hpp"
#include "include/Cerium/Camera.hpp"
#include "include/Cerium/ActManager.hpp"
#include "include/Cerium/ResourceManager.hpp"
#include "include/Cerium/ShaderProgram.hpp"
#include "include/Cerium/Person.hpp"
#include "include/Cerium/Clock.hpp"
#include "include/Cerium/Costumed.hpp"
#include "include/Cerium/Costume.hpp"
#include "include/Cerium/Font.hpp"
#include "include/Cerium/Label.hpp"

#include "include/Cerium/Button.hpp"
#include "include/Cerium/DebugLog.hpp"

#include "include/Cerium/Script.hpp"
#include "include/Cerium/Music.hpp"
#include "include/Cerium/Sound.hpp"

#include "include/Cerium/RigidBody.hpp"

#include <rapidxml.hpp>
#include <rapidxml_utils.hpp>

#undef main

cerium::vec2 size_of_window()
{
    rapidxml::file <> file("res/settings.xml");
    rapidxml::xml_document<> settings;
    settings.parse<0>(file.data());

    rapidxml::xml_node <> * size = settings.first_node("settings")->first_node("size");

    int width = (int)strtod(size->first_attribute("width")->value(), nullptr);
    int height = (int)strtod(size->first_attribute("height")->value(), nullptr);
    return { (float)width, (float)height};
}


std::string title_of_window()
{
    rapidxml::file <> file("res/settings.xml");
    rapidxml::xml_document<> settings;
    settings.parse<0>(file.data());

    rapidxml::xml_node <> * caption = settings.first_node("settings")->first_node("caption");

    return caption->first_attribute("title")->value();
}


bool is_debug_mode()
{
    rapidxml::file <> file("res/settings.xml");
    rapidxml::xml_document<> settings;
    settings.parse<0>(file.data());

    std::string value = settings.first_node("settings")->first_attribute("debug_mode")->value();
    return value == "True";
}


void load_resources(const int & musicVolume, const int & soundVolume)
{
    rapidxml::file<> file("res/data.xml");
    rapidxml::xml_document<> document;
    document.parse<0>(file.data());

    rapidxml::xml_node<> * root = document.first_node("data");

    for(rapidxml::xml_node<> * d = root->first_node("resource"); d; d = d->next_sibling("resource"))
    {
        std::string name = d->first_attribute("name")->value();
        std::string type = d->first_attribute("type")->value();

        if(type == "costume")
        {
            cerium::ResourceManager::add(name, new cerium::Costume(d->first_attribute("path")->value()));
        }
        else if (type == "clock")
        {
            cerium::ResourceManager::add(name, new cerium::Clock);
        }
        else if (type == "font")
        {
            cerium::ResourceManager::add(name, new cerium::Font(d->first_attribute("path")->value(),
				static_cast<unsigned int>(strtod(d->first_attribute("size")->value(), nullptr))));
        }
        else if (type == "script")
        {
            cerium::ResourceManager::add(name, new cerium::Script(d->first_attribute("path")->value()));
        }
        else if (type == "music")
        {
            bool looped = d->first_attribute("looped")->value() == "True";
            cerium::ResourceManager::add(name, new cerium::Music(d->first_attribute("path")->value(), looped,
				musicVolume));
        }
        else if (type == "sound")
        {
            std::string path = d->first_attribute("path")->value();
            cerium::ResourceManager::add(name, new cerium::Sound(path, soundVolume));
        }
    }
}


void load_scenes(const cerium::vec4 & normalTextColor, const cerium::vec4 & hoveredTextColor,
                 const cerium::vec4 & normalBackgroundColor, const cerium::vec4 & hoveredBackgroundColor)
{
    rapidxml::file<> file("res/scenes.xml");
    rapidxml::xml_document<> document;
    document.parse<0>(file.data());

    rapidxml::xml_node <> * root = document.first_node("scenes");
    for(rapidxml::xml_node <> * scene = root->first_node("scene"); scene; scene=scene->next_sibling("scene"))
    {
        std::string sceneName = scene->first_attribute("name")->value();
        cerium::ActManager::add(sceneName);

		cerium::Act * act = cerium::ActManager::get(sceneName);

        std::string isCurrent = scene->first_attribute("current")->value();
        if(isCurrent == "True") cerium::ActManager::setCurrent(sceneName);
        for(rapidxml::xml_node <> * person = scene->first_node("person"); person;person=person->next_sibling("person"))
        {
            std::string personName = person->first_attribute("name")->value();
			std::string personTag = person->first_attribute("tag")->value();
            cerium::vec2 position = {strtof(person->first_attribute("x")->value(), nullptr), strtof(person->first_attribute("y")->value(), nullptr)};
            cerium::vec2 size = {strtof(person->first_attribute("w")->value(), nullptr), strtof(person->first_attribute("h")->value(), nullptr)};
            float angle = strtof(person->first_attribute("angle")->value(), nullptr);

			act->add(new cerium::Person(personName, nullptr, cerium::ActManager::get(sceneName), personTag));
			cerium::Person * per = act->get(personName);

			per->setPosition(position);
			per->setSize(size);
			per->setRotation(angle);

            for(rapidxml::xml_node <> * prop = person->first_node("prop"); prop;prop=prop->next_sibling("prop"))
            {
                std::string type = prop->first_attribute("type")->value();
                std::string name = prop->first_attribute("name")->value();

                if(type == "costumed")
                {
                    std::string costumeName = prop->first_attribute("costume_name")->value();
					per->addProp(new cerium::Costumed(cerium::ActManager::get(sceneName)->get(personName), nullptr, name, cerium::ResourceManager::get(costumeName)->cast_to<cerium::Costume>()));
                }
                else if (type == "vertexArray")
                {
                    cerium::vec4 color = {strtof(prop->first_attribute("r")->value(), nullptr),
                                          strtof(prop->first_attribute("g")->value(), nullptr),
                                          strtof(prop->first_attribute("b")->value(), nullptr),
                                          strtof(prop->first_attribute("a")->value(), nullptr)};

					per->addProp(new cerium::VertexArray(cerium::ActManager::get(sceneName)->get(personName), nullptr, name, color));<commit_msg>Little changes in main<commit_after>#include "include/Cerium/vec2.hpp"
#include "include/Cerium/Window.hpp"
#include "include/Cerium/EventManager.hpp"
#include "include/Cerium/Act.hpp"
#include "include/Cerium/VertexArray.hpp"
#include "include/Cerium/Scriptable.hpp"
#include "include/Cerium/Camera.hpp"
#include "include/Cerium/ActManager.hpp"
#include "include/Cerium/ResourceManager.hpp"
#include "include/Cerium/ShaderProgram.hpp"
#include "include/Cerium/Person.hpp"
#include "include/Cerium/Clock.hpp"
#include "include/Cerium/Costumed.hpp"
#include "include/Cerium/Costume.hpp"
#include "include/Cerium/Font.hpp"
#include "include/Cerium/Label.hpp"

#include "include/Cerium/Button.hpp"
#include "include/Cerium/DebugLog.hpp"

#include "include/Cerium/Script.hpp"
#include "include/Cerium/Music.hpp"
#include "include/Cerium/Sound.hpp"

#include "include/Cerium/RigidBody.hpp"

#include <rapidxml.hpp>
#include <rapidxml_utils.hpp>

#undef main

cerium::vec2 size_of_window()
{
    rapidxml::file <> file("res/settings.xml");
    rapidxml::xml_document<> settings;
    settings.parse<0>(file.data());

    rapidxml::xml_node <> * size = settings.first_node("settings")->first_node("size");

    int width = (int)strtod(size->first_attribute("width")->value(), nullptr);
    int height = (int)strtod(size->first_attribute("height")->value(), nullptr);
    return { (float)width, (float)height};
}


std::string title_of_window()
{
    rapidxml::file <> file("res/settings.xml");
    rapidxml::xml_document<> settings;
    settings.parse<0>(file.data());

    rapidxml::xml_node <> * caption = settings.first_node("settings")->first_node("caption");

    return caption->first_attribute("title")->value();
}


bool is_debug_mode()
{
    rapidxml::file <> file("res/settings.xml");
    rapidxml::xml_document<> settings;
    settings.parse<0>(file.data());

    std::string value = settings.first_node("settings")->first_attribute("debug_mode")->value();
    return value == "True";
}


void load_resources(const int & musicVolume, const int & soundVolume)
{
    rapidxml::file<> file("res/data.xml");
    rapidxml::xml_document<> document;
    document.parse<0>(file.data());

    rapidxml::xml_node<> * root = document.first_node("data");

    for(rapidxml::xml_node<> * d = root->first_node("resource"); d; d = d->next_sibling("resource"))
    {
        std::string name = d->first_attribute("name")->value();
        std::string type = d->first_attribute("type")->value();

        if(type == "costume")
        {
            cerium::ResourceManager::add(name, new cerium::Costume(d->first_attribute("path")->value()));
        }
        else if (type == "clock")
        {
            cerium::ResourceManager::add(name, new cerium::Clock);
        }
        else if (type == "font")
        {
            cerium::ResourceManager::add(name, new cerium::Font(d->first_attribute("path")->value(),
				static_cast<unsigned int>(strtod(d->first_attribute("size")->value(), nullptr))));
        }
        else if (type == "script")
        {
            cerium::ResourceManager::add(name, new cerium::Script(d->first_attribute("path")->value()));
        }
        else if (type == "music")
        {
            bool looped = d->first_attribute("looped")->value() == "True";
            cerium::ResourceManager::add(name, new cerium::Music(d->first_attribute("path")->value(), looped,
				musicVolume));
        }
        else if (type == "sound")
        {
            std::string path = d->first_attribute("path")->value();
            cerium::ResourceManager::add(name, new cerium::Sound(path, soundVolume));
        }
    }
}


void load_scenes(const cerium::vec4 & normalTextColor, const cerium::vec4 & hoveredTextColor,
                 const cerium::vec4 & normalBackgroundColor, const cerium::vec4 & hoveredBackgroundColor)
{
    rapidxml::file<> file("res/scenes.xml");
    rapidxml::xml_document<> document;
    document.parse<0>(file.data());

	cerium::Person * per = nullptr;
	cerium::Act * act = nullptr;

    rapidxml::xml_node <> * root = document.first_node("scenes");
    for(rapidxml::xml_node <> * scene = root->first_node("scene"); scene; scene=scene->next_sibling("scene"))
    {
        std::string sceneName = scene->first_attribute("name")->value();
        cerium::ActManager::add(sceneName);

		act = cerium::ActManager::get(sceneName);

        std::string isCurrent = scene->first_attribute("current")->value();
        if(isCurrent == "True") cerium::ActManager::setCurrent(sceneName);
        for(rapidxml::xml_node <> * person = scene->first_node("person"); person;person=person->next_sibling("person"))
        {
            std::string personName = person->first_attribute("name")->value();
			std::string personTag = person->first_attribute("tag")->value();
            cerium::vec2 position = {strtof(person->first_attribute("x")->value(), nullptr), strtof(person->first_attribute("y")->value(), nullptr)};
            cerium::vec2 size = {strtof(person->first_attribute("w")->value(), nullptr), strtof(person->first_attribute("h")->value(), nullptr)};
            float angle = strtof(person->first_attribute("angle")->value(), nullptr);

			act->add(new cerium::Person(personName, nullptr, act, personTag));
			per = act->get(personName);

			per->setPosition(position);
			per->setSize(size);
			per->setRotation(angle);

            for(rapidxml::xml_node <> * prop = person->first_node("prop"); prop;prop=prop->next_sibling("prop"))
            {
                std::string type = prop->first_attribute("type")->value();
                std::string name = prop->first_attribute("name")->value();

                if(type == "costumed")
                {
                    std::string costumeName = prop->first_attribute("costume_name")->value();
					per->addProp(new cerium::Costumed(cerium::ActManager::get(sceneName)->get(personName), nullptr, name, cerium::ResourceManager::get(costumeName)->cast_to<cerium::Costume>()));
                }
                else if (type == "vertexArray")
                {
                    cerium::vec4 color = {strtof(prop->first_attribute("r")->value(), nullptr),
                                          strtof(prop->first_attribute("g")->value(), nullptr),
                                          strtof(prop->first_attribute("b")->value(), nullptr),
                                          strtof(prop->first_attribute("a")->value(), nullptr)};

					per->addProp(new cerium::VertexArray(cerium::ActManager::get(sceneName)->get(personName), nullptr, name, color));
{'fraction_non_alphanumeric': 0.17783878593761915, 'fraction_numerical': 0.0021352855944482573, 'mean_word_length': 3.6127330284910304, 'pattern_counts': {'":': 0, '<': 57, '<?xml version=': 0, '>': 213, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 76}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 12, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4757799', 'n_tokens_mistral': 4151, 'n_tokens_neox': 4018, 'n_words': 588}