Ejemplo n.º 1
0
Archivo: main.cpp Proyecto: CCJY/coliru
    void add_junction(std::string repID, ptree& pt) const {
        std::string juncs  = _roadID;
        std::size_t pos    = juncs.find_last_of("j");
        std::string jstart = juncs.substr(0,pos);
        std::string jend   = juncs.substr(pos,juncs.length());

        pt.add(repID + ".startJunction", jstart);
        pt.add(repID + ".endJunction", jend);
    }
Ejemplo n.º 2
0
void CompPhysics::writeToPropertyTree(ptree& propTree) const
{
    // damping element

    if (getLinearDamping() != 0.0f || getAngularDamping() != 0.0f)
    {
        propTree.add("damping.linear", getLinearDamping());
        propTree.add("damping.angular", getAngularDamping());
    }

    if (m_localGravitationPoint != Vector2D(0.0f, 0.0f))
    {
        propTree.add("gravitationPoint.x", m_localGravitationPoint.x);
        propTree.add("gravitationPoint.y", m_localGravitationPoint.y);
    }

    if (isFixedRotation())
    {
        propTree.add("isFixedRotation", true);
    }

    if (isBullet())
    {
        propTree.add("isBullet", true);
    }

    for (ShapeInfoVec::const_iterator it = getShapeInfos().begin(); it != getShapeInfos().end(); ++it)
    {
        ptree shapePropTree;
        shapePropTree.add("comp_id", (*it)->compId);

        if ((*it)->density != 0)
            shapePropTree.add("density", (*it)->density);
        if ((*it)->friction != 0)
            shapePropTree.add("friction", (*it)->friction);
        if ((*it)->restitution != 0)
            shapePropTree.add("restitution", (*it)->restitution);

        if ((*it)->isSensor)
            shapePropTree.add("isSensor", true);
        propTree.add_child("shape", shapePropTree);
    }
}
Ejemplo n.º 3
0
HotKey* read_hotkey(string config_key)
{
	string config_value = read_config_value(config_key);
	if (config_value.compare("") != 0)
	{
		return new HotKey(config_value);
	}
	else
	{
		// read from default config
		try
		{
			config_value = def_config_pt.get<string>(config_key);
			config_pt.add(config_key, config_value);
			save_config();
			return new HotKey(config_value);
		}
		catch (std::exception e)
		{
			return NULL;
		}
	}
}
Ejemplo n.º 4
0
void CompShapeCircle::writeToPropertyTree(ptree& propTree) const
{
    propTree.add("circle.x", m_center.x);
    propTree.add("circle.y", m_center.y);
    propTree.add("circle.r", m_radius);
}