Ejemplo n.º 1
0
wxString EffectManager::GetEffectDescription(const PluginID & ID)
{
   Effect *effect = GetEffect(ID);

   if (effect)
   {
      return wxString::Format(_("Applied effect: %s"), effect->GetName().c_str());
   }

   return wxEmptyString;
}
Ejemplo n.º 2
0
/**
*  @brief
*    Copy constructor
*/
Effect::Effect(const Effect &cOther) : Control(cOther.GetController(), ControlEffect, cOther.GetName(), cOther.GetDescription()),
	m_fValue(cOther.m_fValue)
{
}
Ejemplo n.º 3
0
    Effect* PugiXMLLoader::LoadEffect( pugi::xml_node& node, const std::list<AnimImage*>& sprites, Emitter *parent, const char *folderPath /*= ""*/ )
    {
        Effect *e = new Effect();

        e->SetClass            (node.attribute("TYPE").as_int());
        e->SetEmitAtPoints     (node.attribute("EMITATPOINTS").as_bool());
        e->SetMGX              (node.attribute("MAXGX").as_int());
        e->SetMGY              (node.attribute("MAXGY").as_int());
        e->SetEmissionType     (node.attribute("EMISSION_TYPE").as_int());
        e->SetEllipseArc       (node.attribute("ELLIPSE_ARC").as_float());
        e->SetEffectLength     (node.attribute("EFFECT_LENGTH").as_int());
        e->SetLockAspect       (node.attribute("UNIFORM").as_bool());
        e->SetName             (node.attribute("NAME").as_string());
        e->SetHandleCenter     (node.attribute("HANDLE_CENTER").as_bool());
        e->SetHandleX          (node.attribute("HANDLE_X").as_int());
        e->SetHandleY          (node.attribute("HANDLE_Y").as_int());
        e->SetTraverseEdge     (node.attribute("TRAVERSE_EDGE").as_bool());
        e->SetEndBehavior      (node.attribute("END_BEHAVIOUR").as_int());
        e->SetDistanceSetByLife(node.attribute("DISTANCE_SET_BY_LIFE").as_bool());
        e->SetReverseSpawn     (node.attribute("REVERSE_SPAWN_DIRECTION").as_bool());
        e->SetParentEmitter(parent);

        std::string path;
        if (parent)
            path = parent->GetPath();
        else
            path = folderPath;
        if (!path.empty())
            path += "/";
        path += e->GetName();
        e->SetPath(path.c_str());

        pugi::xml_node animation = node.child("ANIMATION_PROPERTIES");
        if (animation)
        {
            e->SetFrames     (animation.attribute("FRAMES").as_int());
            e->SetAnimWidth  (animation.attribute("WIDTH").as_int());
            e->SetAnimHeight (animation.attribute("HEIGHT").as_int());
            e->SetAnimX      (animation.attribute("X").as_int());
            e->SetAnimY      (animation.attribute("Y").as_int());
            e->SetSeed       (animation.attribute("SEED").as_int());
            e->SetLooped     (animation.attribute("LOOPED").as_bool());
            e->SetZoom       (animation.attribute("ZOOM").as_float());
            e->SetFrameOffset(animation.attribute("LOOPED").as_bool());
        }

        AttributeNode *attr = NULL;
        pugi::xml_node attrnode;

        for (attrnode = node.child("AMOUNT"); attrnode; attrnode = attrnode.next_sibling("AMOUNT"))
        {
            attr = e->AddAmount(attrnode.attribute("FRAME").as_float(), attrnode.attribute("VALUE").as_float());
            LoadAttributeNode(attrnode, attr);
        }

        for (attrnode = node.child("LIFE"); attrnode; attrnode = attrnode.next_sibling("LIFE"))
        {
            attr = e->AddLife(attrnode.attribute("FRAME").as_float(), attrnode.attribute("VALUE").as_float());
            LoadAttributeNode(attrnode, attr);
        }

        for (attrnode = node.child("SIZEX"); attrnode; attrnode = attrnode.next_sibling("SIZEX"))
        {
            attr = e->AddSizeX(attrnode.attribute("FRAME").as_float(), attrnode.attribute("VALUE").as_float());
            LoadAttributeNode(attrnode, attr);
        }

        for (attrnode = node.child("SIZEY"); attrnode; attrnode = attrnode.next_sibling("SIZEY"))
        {
            attr = e->AddSizeY(attrnode.attribute("FRAME").as_float(), attrnode.attribute("VALUE").as_float());
            LoadAttributeNode(attrnode, attr);
        }

        for (attrnode = node.child("VELOCITY"); attrnode; attrnode = attrnode.next_sibling("VELOCITY"))
        {
            attr = e->AddVelocity(attrnode.attribute("FRAME").as_float(), attrnode.attribute("VALUE").as_float());
            LoadAttributeNode(attrnode, attr);
        }

        for (attrnode = node.child("WEIGHT"); attrnode; attrnode = attrnode.next_sibling("WEIGHT"))
        {
            attr = e->AddWeight(attrnode.attribute("FRAME").as_float(), attrnode.attribute("VALUE").as_float());
            LoadAttributeNode(attrnode, attr);
        }

        for (attrnode = node.child("SPIN"); attrnode; attrnode = attrnode.next_sibling("SPIN"))
        {
            attr = e->AddSpin(attrnode.attribute("FRAME").as_float(), attrnode.attribute("VALUE").as_float());
            LoadAttributeNode(attrnode, attr);
        }

        for (attrnode = node.child("ALPHA"); attrnode; attrnode = attrnode.next_sibling("ALPHA"))
        {
            attr = e->AddAlpha(attrnode.attribute("FRAME").as_float(), attrnode.attribute("VALUE").as_float());
            LoadAttributeNode(attrnode, attr);
        }

        for (attrnode = node.child("EMISSIONANGLE"); attrnode; attrnode = attrnode.next_sibling("EMISSIONANGLE"))
        {
            attr = e->AddEmissionAngle(attrnode.attribute("FRAME").as_float(), attrnode.attribute("VALUE").as_float());
            LoadAttributeNode(attrnode, attr);
        }

        for (attrnode = node.child("EMISSIONRANGE"); attrnode; attrnode = attrnode.next_sibling("EMISSIONRANGE"))
        {
            attr = e->AddEmissionRange(attrnode.attribute("FRAME").as_float(), attrnode.attribute("VALUE").as_float());
            LoadAttributeNode(attrnode, attr);
        }

        for (attrnode = node.child("AREA_WIDTH"); attrnode; attrnode = attrnode.next_sibling("AREA_WIDTH"))
        {
            attr = e->AddWidth(attrnode.attribute("FRAME").as_float(), attrnode.attribute("VALUE").as_float());
            LoadAttributeNode(attrnode, attr);
        }

        for (attrnode = node.child("AREA_HEIGHT"); attrnode; attrnode = attrnode.next_sibling("AREA_HEIGHT"))
        {
            attr = e->AddHeight(attrnode.attribute("FRAME").as_float(), attrnode.attribute("VALUE").as_float());
            LoadAttributeNode(attrnode, attr);
        }

        for (attrnode = node.child("ANGLE"); attrnode; attrnode = attrnode.next_sibling("ANGLE"))
        {
            attr = e->AddAngle(attrnode.attribute("FRAME").as_float(), attrnode.attribute("VALUE").as_float());
            LoadAttributeNode(attrnode, attr);
        }

        for (attrnode = node.child("STRETCH"); attrnode; attrnode = attrnode.next_sibling("STRETCH"))
        {
            attr = e->AddStretch(attrnode.attribute("FRAME").as_float(), attrnode.attribute("VALUE").as_float());
            LoadAttributeNode(attrnode, attr);
        }
        
        if (!node.child("STRETCH"))
        {
            e->AddStretch(0, 1.0f);
        }

        for (attrnode = node.child("GLOBAL_ZOOM"); attrnode; attrnode = attrnode.next_sibling("GLOBAL_ZOOM"))
        {
            attr = e->AddGlobalZ(attrnode.attribute("FRAME").as_float(), attrnode.attribute("VALUE").as_float());
            LoadAttributeNode(attrnode, attr);
        }

        for (pugi::xml_node particle = node.child("PARTICLE"); particle; particle = particle.next_sibling("PARTICLE"))
        {
            e->AddChild(LoadEmitter(particle, sprites, e));
        }

        return e;
    }