Example #1
0
void CompositeAnimation::styleAvailable()
{
    if (m_numStyleAvailableWaiters == 0)
        return;
    
    // We have to go through animations in the order in which they appear in
    // the style, because order matters for additivity.
    Vector<KeyframeAnimation*> animations(m_keyframeAnimations.size());
    AnimationNameMap::const_iterator kfend = m_keyframeAnimations.end();
    size_t i = 0;
    for (AnimationNameMap::const_iterator it = m_keyframeAnimations.begin(); it != kfend; ++it) {
        KeyframeAnimation* anim = it->second;
        // We can't just insert based on anim->index() because invalid animations don't
        // make it into the hash.
        animations[i++] = anim;
    }

    if (animations.size() > 1)
        std::stable_sort(animations.begin(), animations.end(), compareAnimationIndices);
    
    for (i = 0; i < animations.size(); ++i) {
        KeyframeAnimation* anim = animations[i];
        if (anim && anim->waitingForStyleAvailable())
            anim->updateStateMachine(AnimationBase::STATE_INPUT_STYLE_AVAILABLE, -1);
    }
    
    CSSPropertyTransitionsMap::const_iterator end = m_transitions.end();
    for (CSSPropertyTransitionsMap::const_iterator it = m_transitions.begin(); it != end; ++it) {
        ImplicitAnimation* anim = it->second;
        if (anim && anim->waitingForStyleAvailable())
            anim->updateStateMachine(AnimationBase::STATE_INPUT_STYLE_AVAILABLE, -1);
    }
}
Example #2
0
void TestShapeAnimations::timeHelperMethods()
{
    MockDocument doc;
    KPrShapeAnimations animations(&doc);
    new ModelTest(&animations, this);
    createAnimationTree(&animations);

    //Previous animation Begin
    QCOMPARE(animations.animationStart(animations.index(0, 0)), 0);
    QCOMPARE(animations.animationStart(animations.index(1, 0)), 0);
    QCOMPARE(animations.animationStart(animations.index(2, 0)), 0);
    QCOMPARE(animations.animationStart(animations.index(3, 0)), 5000);
    QCOMPARE(animations.animationStart(animations.index(4, 0)), 5000);
    QCOMPARE(animations.animationStart(animations.index(5, 0)), 1000);
    QCOMPARE(animations.animationStart(animations.index(6, 0)), 3000);
    QCOMPARE(animations.animationStart(animations.index(7, 0)), 0);
    QCOMPARE(animations.animationStart(animations.index(8, 0)), 0);

    //Previous animation End
    QCOMPARE(animations.animationEnd(animations.index(0, 0)), 4000);
    QCOMPARE(animations.animationEnd(animations.index(1, 0)), 2000);
    QCOMPARE(animations.animationEnd(animations.index(2, 0)), 5000);
    QCOMPARE(animations.animationEnd(animations.index(3, 0)), 6000);
    QCOMPARE(animations.animationEnd(animations.index(4, 0)), 6000);
    QCOMPARE(animations.animationEnd(animations.index(5, 0)), 3000);
    QCOMPARE(animations.animationEnd(animations.index(6, 0)), 6000);
    QCOMPARE(animations.animationEnd(animations.index(7, 0)), 5000);
    QCOMPARE(animations.animationEnd(animations.index(8, 0)), 6000);
}
Example #3
0
void TestShapeAnimations::helperMethods()
{
    MockDocument doc;
    KPrShapeAnimations animations(&doc);
    new ModelTest(&animations, this);
    cleanStepSubStepData();
    animations.add(m_animation[1]);
    animations.add(m_animation[2]);
    animations.add(m_animation[4]);

    //Test shapeByIndex
    QCOMPARE(animations.shapeByIndex(animations.index(0, 0)), m_animation[1]->shape());
    QCOMPARE(animations.shapeByIndex(animations.index(1, 0)), m_animation[2]->shape());
    QCOMPARE(animations.shapeByIndex(animations.index(2, 0)), m_animation[4]->shape());

    //Test indexByShape
    QVERIFY(animations.indexByShape(m_animation[1]->shape()).isValid());
    QCOMPARE(animations.index(0, 0), animations.indexByShape(m_animation[1]->shape()));

    QVERIFY(animations.indexByShape(m_animation[2]->shape()).isValid());
    QCOMPARE(animations.index(1, 0), animations.indexByShape(m_animation[2]->shape()));

    QVERIFY(animations.indexByShape(m_animation[4]->shape()).isValid());
    QCOMPARE(animations.index(2, 0), animations.indexByShape(m_animation[4]->shape()));

    //Test indexByAnimation
    QVERIFY(animations.indexByAnimation(m_animation[1]).isValid());
    QCOMPARE(animations.index(0, 0), animations.indexByAnimation(m_animation[1]));
    QVERIFY(animations.indexByAnimation(m_animation[2]).isValid());
    QCOMPARE(animations.index(1, 0), animations.indexByAnimation(m_animation[2]));
    QVERIFY(animations.indexByAnimation(m_animation[4]).isValid());
    QCOMPARE(animations.index(2, 0), animations.indexByAnimation(m_animation[4]));
}
void CompositeAnimationPrivate::styleAvailable()
{
    if (m_numStyleAvailableWaiters == 0)
        return;

    // We have to go through animations in the order in which they appear in
    // the style, because order matters for additivity.
    Vector<RefPtr<KeyframeAnimation> > animations(m_keyframeAnimations.size());
    copyValuesToVector(m_keyframeAnimations, animations);

    if (animations.size() > 1)
        std::stable_sort(animations.begin(), animations.end(), compareAnimationIndices);

    for (size_t i = 0; i < animations.size(); ++i) {
        KeyframeAnimation* anim = animations[i].get();
        if (anim && anim->waitingForStyleAvailable())
            anim->updateStateMachine(AnimationBase::AnimationStateInputStyleAvailable, -1);
    }

    CSSPropertyTransitionsMap::const_iterator end = m_transitions.end();
    for (CSSPropertyTransitionsMap::const_iterator it = m_transitions.begin(); it != end; ++it) {
        ImplicitAnimation* anim = it->second.get();
        if (anim && anim->waitingForStyleAvailable())
            anim->updateStateMachine(AnimationBase::AnimationStateInputStyleAvailable, -1);
    }
}
Example #5
0
void KPrDocument::replaceAnimation(KPrShapeAnimation *oldAnimation, KPrShapeAnimation *newAnimation)
{
    KoShape *shape = oldAnimation->shape();
    KPrShapeAnimations &animations(animationsByPage(pageByShape(shape)));

    // remove animation from the list of animations
    animations.replaceAnimation(oldAnimation, newAnimation);
}
void VariableAnimationSignalTransition::clearAnimations()
{
	QList<QAbstractAnimation *> list = animations();
	Q_FOREACH(QAbstractAnimation * pAnim , list)
	{
		removeAnimation(pAnim);
		delete pAnim;
	}
String AnimatableDecorator::defaultFrame() const {
  String defaultFrame;
  for (Value animationValue : animations()) {      
    {
      if (defaultAnimation() == animationValue.mapValue()["name"].string()) {
        defaultFrame = animationValue.mapValue()["frames"].arrayValue().first().string();
      }
    }
  }
  return defaultFrame;
}
Animation* GameCritterObject::setActionAnimation(std::string action)
{
    Animation* animation = new Animation("art/critters/" + _generateArmorFrmString() + action + ".frm", orientation());
    animation->play();
    auto queue = new AnimationQueue();
    queue->setRepeat(true);
    queue->animations()->push_back(animation);
    queue->start();
    setUI(queue);
    return animation;
}
Example #9
0
    //____________________________________________________________________________________________
    gboolean Animations::sizeAllocationHook( GSignalInvocationHint*, guint, const GValue* params, gpointer data )
    {

        // get widget from params
        GtkWidget* widget( GTK_WIDGET( g_value_get_object( params ) ) );

        // check type
        if( !GTK_IS_WIDGET( widget ) ) return FALSE;

        // cast data
        Animations& animations( *static_cast<Animations*>(data) );

        // groupbox labels
        #if ENABLE_GROUPBOX_HACK
        if( animations.groupBoxLabelEngine().contains( widget ) )
        {
            animations.groupBoxLabelEngine().adjustSize( widget );
            return TRUE;
        }
        #endif

        #if ENABLE_COMBOBOX_LIST_RESIZE
        // comboboxes
        if( !GTK_IS_WINDOW( widget ) ) return TRUE;

        GtkWindow* window( GTK_WINDOW( widget ) );
        if( gtk_window_get_type_hint( window ) != GDK_WINDOW_TYPE_HINT_COMBO ) return TRUE;

        GtkWidget* combobox = animations.comboBoxEngine().find( widget );
        if( !combobox ) combobox = animations.comboBoxEntryEngine().find( widget );
        if( !combobox ) combobox = animations.comboEngine().find( widget );
        if( !combobox ) return true;

        int w, h;
        gtk_window_get_size( window, &w, &h );

        gint targetX, dummy, y;
        gtk_window_get_position( window, &dummy, &y );
        gdk_window_get_origin( gtk_widget_get_window( combobox ), &targetX, &dummy );

        const GtkAllocation comboAllocation( Gtk::gtk_widget_get_allocation( combobox ) );
        int uglyShadowWidth=!Gtk::gdk_default_screen_is_composited();
        gtk_window_move( window, targetX + comboAllocation.x + 3 - uglyShadowWidth, y );

        const GtkAllocation widgetAllocation( Gtk::gtk_widget_get_allocation( widget ) );
        gtk_widget_set_size_request( widget, comboAllocation.width - 6 + 2*uglyShadowWidth, widgetAllocation.height );
        #endif

        return TRUE;

    }
Example #10
0
    //____________________________________________________________________________________________
    gboolean Animations::innerShadowHook( GSignalInvocationHint*, guint, const GValue* params, gpointer data )
    {

        #if GTK_CHECK_VERSION(2,24,2)

        // get widget from params
        GtkWidget* widget( GTK_WIDGET( g_value_get_object( params ) ) );

        // check type
        if( !GTK_IS_WIDGET( widget ) ) return FALSE;

        // check enabled state
        Animations& animations( *static_cast<Animations*>(data) );
        if( !animations.innerShadowsEnabled() ) return TRUE;

        // blacklist
        if( Gtk::g_object_is_a( G_OBJECT( widget ), "SwtFixed" ) ) return TRUE;
        if( Gtk::g_object_is_a( G_OBJECT( widget ), "GtkPizza" ) ) return TRUE;

        GtkWidget* parent(gtk_widget_get_parent(widget));
        if( !GTK_IS_SCROLLED_WINDOW( parent ) ) return TRUE;

        GtkWidget* child(gtk_bin_get_child(GTK_BIN(parent)));
        if(child!=widget) return TRUE;

        #if OXYGEN_DEBUG
        std::cerr
            << "Oxygen::Animations::innerShadowHook -"
            << " widget: " << widget << " (" << G_OBJECT_TYPE_NAME(widget) << ")"
            << " parent: " << parent << " (" << G_OBJECT_TYPE_NAME(parent) << ")"
            << " widget path: " << Gtk::gtk_widget_path( widget )
            << " isTreeView: " << (GTK_IS_TREE_VIEW(widget)?"true":"false")
            << " isTextView: " << (GTK_IS_TEXT_VIEW(widget)?"true":"false")
            << std::endl;
        #endif

        // force shadow type on known windows
        if( Gtk::gtk_scrolled_window_force_sunken( parent ) )
        { gtk_scrolled_window_set_shadow_type( GTK_SCROLLED_WINDOW( parent ), GTK_SHADOW_IN ); }

        animations.innerShadowEngine().registerWidget( parent );
        animations.innerShadowEngine().registerChild( parent, widget );

        #endif  // Gtk version
        return TRUE;

    }
Example #11
0
void LoaderXml::root()
{
    auto doc = requireElement(xml,"document");
    builder.beginDocument();
    id(doc);
    document_ = builder.currentDocument();
    /// \todo file format version
    document_->setImageSize(QSize(
        doc.attribute("width","32").toInt(),
        doc.attribute("height","32").toInt()
                            ));
    metadata(doc.firstChildElement("metadata"));
    animations(doc.firstChildElement("animations"));
    formats(doc.firstChildElement("formats"));
    layers(doc);
    builder.endDocument();
}
Example #12
0
void KPrDocument::removeAnimation( KPrShapeAnimation * animation, bool removeFromApplicationData )
{
    KoShape * shape = animation->shape();

    KPrShapeAnimations & animations( animationsByPage( pageByShape( shape ) ) );

    // remove animation from the list of animations
    animations.remove( animation );

    KPrShapeApplicationData *applicationData = dynamic_cast<KPrShapeApplicationData*>(shape->applicationData());
    Q_ASSERT(applicationData);
    if (removeFromApplicationData) {
        // remove animation from the shape animation data
        applicationData->animations().remove(animation);
    } else {
        applicationData->setDeleteAnimations(true);
    }
}
Example #13
0
void KPrDocument::addAnimation( KPrShapeAnimation * animation )
{
    KoShape * shape = animation->shape();

    KPrShapeAnimations & animations( animationsByPage( pageByShape( shape ) ) );

    // add animation to the list of animations
    animations.add( animation );

    // add animation to the shape animation data so that it can be regenerated on delete shape and undo
    KPrShapeApplicationData * applicationData = dynamic_cast<KPrShapeApplicationData*>( shape->applicationData() );
    if ( applicationData == 0 ) {
        applicationData = new KPrShapeApplicationData();
        shape->setApplicationData( applicationData );
    }
    applicationData->animations().insert( animation );
    applicationData->setDeleteAnimations(false);
}
Example #14
0
    //____________________________________________________________________________________________
    gboolean Animations::realizationHook( GSignalInvocationHint*, guint, const GValue* params, gpointer data )
    {

        // get widget from params
        GtkWidget* widget( GTK_WIDGET( g_value_get_object( params ) ) );

        // check type
        if( !GTK_IS_WIDGET( widget ) ) return FALSE;

        if( GTK_IS_NOTEBOOK( widget ) )
        { gtk_notebook_set_show_border( GTK_NOTEBOOK(widget), FALSE ); }

        #if ENABLE_GROUPBOX_HACK
        if( GTK_IS_LABEL( widget ) &&  GTK_IS_FRAME( gtk_widget_get_parent( widget ) ) )
        {

            GtkFrame *frame( GTK_FRAME( gtk_widget_get_parent( widget ) ) );
            if( widget == gtk_frame_get_label_widget( frame ) && !Gtk::gtk_widget_find_parent( widget, "GtkPizza" ) )
            {
                #if OXYGEN_DEBUG
                std::cout
                    << "Oxygen::Animations::realizationHook -"
                    << " widget: " << widget << " (" << G_OBJECT_TYPE_NAME( widget ) << ")"
                    << " parent: " << frame << " (" << G_OBJECT_TYPE_NAME( frame ) << ")"
                    << std::endl;
                #endif

                // modify alignment
                gtk_frame_set_label_align( frame, 0.5, 0.0 );
                gtk_frame_set_shadow_type( frame, GTK_SHADOW_OUT );

                // register to engine
                Animations& animations( *static_cast<Animations*>(data) );
                animations.groupBoxLabelEngine().registerWidget( widget );
                animations.groupBoxLabelEngine().adjustSize( widget );

            }

        }
        #endif

        return TRUE;

    }
void AnimatableDecorator::cacheAnimations() const {
  for (Value animationValue : animations()) {      
    {
      Array<Value> frames = animationValue.mapValue()["frames"].arrayValue();
      
      CCMutableArray<CCSpriteFrame*>* spriteFrames = new CCMutableArray<CCSpriteFrame*>();
      spriteFrames->autorelease();
      
      for (Value frame : frames) {
        CCSpriteFrame* spriteFrame = CCSpriteFrameCache::sharedSpriteFrameCache()->spriteFrameByName(frame.string().c_str());
        spriteFrames->addObject(spriteFrame);
      }
      
      float delay = animationValue.mapValue()["delay"].floatValue();
      CCAnimation* animation = CCAnimation::animationWithFrames(spriteFrames, delay);
      CCAnimationCache::sharedAnimationCache()->addAnimation(animation, animationValue.mapValue()["name"].string().c_str());
    }
  }
}
Example #16
0
bool SCPage::loadOdf(const KXmlElement &element, KShapeLoadingContext &context)
{
    if (!KoPAPage::loadOdf(element, context)) {
        return false;
    }
    SCPageApplicationData * data = dynamic_cast<SCPageApplicationData *>(applicationData());
    Q_ASSERT(data);

    KXmlElement animation = KoXml::namedItemNS(element, KOdfXmlNS::anim, "par");

    bool loadOldTransition = true;
    if (!animation.isNull()) {
        KXmlElement animationElement;
        forEachElement(animationElement, animation) {
            if (animationElement.namespaceURI() == KOdfXmlNS::anim) {
                if (animationElement.tagName() == "par") {
                    QString begin(animationElement.attributeNS(KOdfXmlNS::smil, "begin"));
                    if (begin.endsWith("begin")) {
                        KXmlElement transitionElement(KoXml::namedItemNS(animationElement, KOdfXmlNS::anim, "transitionFilter"));
                        data->setPageEffect(SCPageEffectRegistry::instance()->createPageEffect(transitionElement));
                        kDebug() << "XXXXXXX found page transition";
                        loadOldTransition = false;
                    }
                    // check that the id is the correct one.

                }
                if (animationElement.tagName() == "seq") {
                    QString nodeType(animationElement.attributeNS(KOdfXmlNS::presentation, "node-type"));
                    if (nodeType == "main-sequence") {
                        SCAnimationLoader al;
                        al.loadOdf(animationElement, context);
                        animations().init(al.animations());
                    }
                    else {
                        // not yet supported
                    }
                }
            }
        }
    }
Example #17
0
void TestShapeAnimations::getTriggerEvent()
{
    MockDocument doc;
    KPrShapeAnimations animations(&doc);
    new ModelTest(&animations, this);
    createAnimationTree(&animations);
    // Test Trigger Event
    QCOMPARE(animations.data(animations.index(0, KPrShapeAnimations::NodeType)).toInt(),
             (int)KPrShapeAnimation::OnClick);
    QCOMPARE(animations.data(animations.index(1, KPrShapeAnimations::NodeType)).toInt(),
             (int)KPrShapeAnimation::WithPrevious);
    QCOMPARE(animations.data(animations.index(2, KPrShapeAnimations::NodeType)).toInt(),
             (int)KPrShapeAnimation::WithPrevious);
    QCOMPARE(animations.data(animations.index(3, KPrShapeAnimations::NodeType)).toInt(),
             (int)KPrShapeAnimation::AfterPrevious);
    QCOMPARE(animations.data(animations.index(4, KPrShapeAnimations::NodeType)).toInt(),
             (int)KPrShapeAnimation::WithPrevious);
    QCOMPARE(animations.data(animations.index(5, KPrShapeAnimations::NodeType)).toInt(),
             (int)KPrShapeAnimation::OnClick);
    QCOMPARE(animations.data(animations.index(6, KPrShapeAnimations::NodeType)).toInt(),
             (int)KPrShapeAnimation::AfterPrevious);
    QCOMPARE(animations.data(animations.index(7, KPrShapeAnimations::NodeType)).toInt(),
             (int)KPrShapeAnimation::OnClick);
    QCOMPARE(animations.data(animations.index(8, KPrShapeAnimations::NodeType)).toInt(),
             (int)KPrShapeAnimation::WithPrevious);
    // Test group
    QCOMPARE(animations.data(animations.index(0, KPrShapeAnimations::Group)).toInt(), 1);
    QCOMPARE(animations.data(animations.index(1, KPrShapeAnimations::Group)).toInt(), 1);
    QCOMPARE(animations.data(animations.index(2, KPrShapeAnimations::Group)).toInt(), 1);
    QCOMPARE(animations.data(animations.index(3, KPrShapeAnimations::Group)).toInt(), 1);
    QCOMPARE(animations.data(animations.index(4, KPrShapeAnimations::Group)).toInt(), 1);
    QCOMPARE(animations.data(animations.index(5, KPrShapeAnimations::Group)).toInt(), 2);
    QCOMPARE(animations.data(animations.index(6, KPrShapeAnimations::Group)).toInt(), 2);
    QCOMPARE(animations.data(animations.index(7, KPrShapeAnimations::Group)).toInt(), 3);
    QCOMPARE(animations.data(animations.index(8, KPrShapeAnimations::Group)).toInt(), 3);

    checkOrder(&animations);
}
Example #18
0
void TestShapeAnimations::replaceSwap()
{
    MockDocument doc;
    KPrShapeAnimations animations(&doc);
    new ModelTest(&animations, this);
    cleanStepSubStepData();
    animations.add(m_animation[1]);
    animations.add(m_animation[2]);
    animations.add(m_animation[3]);

    //Test swap animations
    animations.swapAnimations(m_animation[1], m_animation[3]);
    QCOMPARE (animations.animationByRow(0), m_animation[3]);
    QCOMPARE (animations.animationByRow(2), m_animation[1]);
    QVERIFY(animations.rowCount() == 3);

    //Test replace animation
    animations.replaceAnimation(m_animation[2], m_animation[5]);
    QCOMPARE(animations.animationByRow(1), m_animation[5]);
    QCOMPARE(m_animation[2]->step(), m_animation[5]->step());
    QCOMPARE(m_animation[2]->subStep(), m_animation[5]->subStep());
    QVERIFY(animations.rowCount() == 3);
}
Example #19
0
void TestShapeAnimations::addRemove()
{
    MockDocument doc;
    KPrShapeAnimations animations(&doc);
    new ModelTest(&animations, this);
    cleanStepSubStepData();
    animations.add(m_animation[1]);
    animations.add(m_animation[2]);
    animations.add(m_animation[3]);
    animations.add(m_animation[4]);
    animations.add(m_animation[6]);

    // Test animationByRowOutPut
    QCOMPARE (animations.animationByRow(0), m_animation[1]);
    QCOMPARE (animations.animationByRow(1), m_animation[2]);
    QCOMPARE (animations.animationByRow(2), m_animation[3]);
    QCOMPARE (animations.animationByRow(3), m_animation[4]);
    QCOMPARE (animations.animationByRow(4), m_animation[6]);

    //Test Order is updated
    animations.remove(m_animation[1]);
    animations.remove(m_animation[3]);

    QCOMPARE (animations.animationByRow(0), m_animation[2]);
    QCOMPARE (animations.animationByRow(1), m_animation[4]);
    QCOMPARE (animations.animationByRow(2), m_animation[6]);

    QVERIFY(animations.rowCount() == 3);

    //Remove all animations
    animations.remove(m_animation[2]);
    animations.remove(m_animation[4]);
    animations.remove(m_animation[6]);

    QVERIFY(animations.rowCount() == 0);
}
Example #20
0
bool EditorObject::build(ResourceFile & resources)
{
    // create the container to hold the graphic ids
    delete m_compiledGraphics;
    m_compiledGraphics = new Array3<QString>(tileCountX(), tileCountY(), layerCount());

    Array3< QList<QImage> * > animations(tileCountX(), tileCountY(), layerCount());
    // initialize animation list
    for (int z=0; z<layerCount(); z++) {
        for (int y=0; y<tileCountY(); ++y) {
            for (int x=0; x<tileCountX(); ++x) {
                animations.set(x,y,z,new QList<QImage>());
            }
        }
    }

    // find out the greatest frames per second
    int fps = 0;
    for (int layerIndex=0; layerIndex<m_graphics.size(); ++layerIndex) {
        QList<ObjectGraphic *> * layer = m_graphics.at(layerIndex);
        for (int i=0; i<layer->size(); ++i) {
            ObjectGraphic * graphicInstance = layer->at(i);
            if (graphicInstance->graphic->framesPerSecond() > fps)
                fps = graphicInstance->graphic->framesPerSecond();
        }
    }

    // for each animation frame
    int frame = 0;
    while (true) {
        if (frame > 0) {
            // check if the animation has looped yet.
            bool firstFrame = true;
            for (int layerIndex=0; layerIndex<m_graphics.size(); ++layerIndex) {
                QList<ObjectGraphic *> * layer = m_graphics.at(layerIndex);
                for (int i=0; i<layer->size(); ++i) {
                    ObjectGraphic * graphicInstance = layer->at(i);
                    if ((frame+1) % graphicInstance->graphic->frameCount() != 0) {
                        firstFrame = false;
                        break;
                    }
                }
                if (! firstFrame)
                    break;
            }

            // this means all animations have looped and we're done
            // collecting frames
            if (firstFrame)
                break;
        }

        for (int z=0; z<layerCount(); ++z) {
            // render the layer once into a QImage
            QImage layerImage(tileCountX() * Tile::sizeInt, tileCountY() * Tile::sizeInt, QImage::Format_ARGB32);
            layerImage.fill(Qt::transparent);
            QPainter layerPainter(&layerImage);
            render(layerPainter, z, frame, fps);

            // for each tile, draw that tile into a different QImage
            for (int y=0; y<tileCountY(); ++y) {
                for (int x=0; x<tileCountX(); ++x) {
                    QImage tileImage(Tile::sizeInt, Tile::sizeInt, QImage::Format_ARGB32);
                    tileImage.fill(Qt::transparent);
                    QPainter p(&tileImage);
                    p.drawImage(0, 0, layerImage, x * Tile::sizeInt, y * Tile::sizeInt, Tile::sizeInt, Tile::sizeInt);

                    QList<QImage> * frames = animations.get(x,y,z);
                    frames->append(tileImage);
                }
            }
        }

        ++frame;
    }
    int frameCount = frame;

    // create a spritesheet for each tile
    for (int z=0; z<layerCount(); ++z) {
        for (int y=0; y<tileCountY(); ++y) {
            for (int x=0; x<tileCountX(); ++x ) {
                // create the spritesheet
                QList<QImage> * frames = animations.get(x,y,z);
                QImage spritesheet(Tile::sizeInt * frameCount, Tile::sizeInt, QImage::Format_ARGB32);
                spritesheet.fill(Qt::transparent);
                QPainter p(&spritesheet);
                for (int i=0; i<frameCount; ++i)
                    p.drawImage(i * Tile::sizeInt, 0, frames->at(i % frames->size()));

                // create the binary data
                QByteArray tile;
                // magic character
                tile.append("G");

                int codeVersion = 1;
                tile.append((char *) &codeVersion, 4);

                int graphicType = Graphic::gtAnimation;
                tile.append((char *) &graphicType, 4);

                int storageType = Graphic::stPNG;
                tile.append((char *) &storageType, 4);

                // color key: hardcode magenta
                char red = 255;
                char green = 0;
                char blue = 255;
                tile.append(&red, 1);
                tile.append(&green, 1);
                tile.append(&blue, 1);

                tile.append((char *) &frameCount, 4);
                tile.append((char *) &fps, 4);

                // frame width and height
                tile.append((char *) &Tile::sizeInt, 4);
                tile.append((char *) &Tile::sizeInt, 4);

                // save spritesheet into memory
                QByteArray imageData;
                QBuffer buffer(&imageData);
                buffer.open(QIODevice::WriteOnly);
                spritesheet.save(&buffer, "PNG");

                int imageDataSize = imageData.size();
                tile.append((char *) &imageDataSize, 4);

                tile.append(imageData);

                // come up with a name
                QString dash = "-";
                QString ext = ".ani";
                QString graphicName = m_name + dash + QString::number(x) +
                    dash + QString::number(y) + dash + QString::number(z) + ext;

                resources.updateResource(graphicName.toStdString(), tile.constData(), tile.size());
                m_compiledGraphics->set(x,y,z,graphicName);
            }
        }
    }

    // cleanup animation list
    for (int z=0; z<layerCount(); z++) {
        for (int y=0; y<tileCountY(); ++y) {
            for (int x=0; x<tileCountX(); ++x) {
                delete animations.get(x,y,z);
            }
        }
    }

    return true;
}
Example #21
0
 void Mouse::_setType(Cursor state)
 {
     if (this->state() == state) return;
     _ui.reset(nullptr);
     switch (state)
     {
         case Cursor::BIG_ARROW:
             _ui = std::make_unique<UI::Image>("art/intrface/stdarrow.frm");
             break;
         case Cursor::SCROLL_W:
             _ui = std::make_unique<UI::Image>("art/intrface/scrwest.frm");
             _ui->setOffset(0, -_ui->size().height() / 2);
             break;
         case Cursor::SCROLL_W_X:
             _ui = std::make_unique<UI::Image>("art/intrface/scrwx.frm");
             _ui->setOffset(0, -_ui->size().height() / 2);
             break;
         case Cursor::SCROLL_N:
             _ui = std::make_unique<UI::Image>("art/intrface/scrnorth.frm");
             _ui->setOffset( -_ui->size().width() / 2, 0);
             break;
         case Cursor::SCROLL_N_X:
             _ui = std::make_unique<UI::Image>("art/intrface/scrnx.frm");
             _ui->setOffset( -_ui->size().width() / 2, 0);
             break;
         case Cursor::SCROLL_S:
             _ui = std::make_unique<UI::Image>("art/intrface/scrsouth.frm");
             _ui->setOffset( -_ui->size().width() / 2, -_ui->size().height());
             break;
         case Cursor::SCROLL_S_X:
             _ui = std::make_unique<UI::Image>("art/intrface/scrsx.frm");
             _ui->setOffset(-_ui->size().width() / 2, -_ui->size().height());
             break;
         case Cursor::SCROLL_E:
             _ui = std::make_unique<UI::Image>("art/intrface/screast.frm");
             _ui->setOffset( -_ui->size().width(), -_ui->size().height() / 2);
             break;
         case Cursor::SCROLL_E_X:
             _ui = std::make_unique<UI::Image>("art/intrface/screx.frm");
             _ui->setOffset(-_ui->size().width(), -_ui->size().height() / 2);
             break;
         case Cursor::SCROLL_NW:
             _ui = std::make_unique<UI::Image>("art/intrface/scrnwest.frm");
             break;
         case Cursor::SCROLL_NW_X:
             _ui = std::make_unique<UI::Image>("art/intrface/scrnwx.frm");
             break;
         case Cursor::SCROLL_SW:
             _ui = std::make_unique<UI::Image>("art/intrface/scrswest.frm");
             _ui->setOffset(0, -_ui->size().height());
             break;
         case Cursor::SCROLL_SW_X:
             _ui = std::make_unique<UI::Image>("art/intrface/scrswx.frm");
             _ui->setOffset(0, -_ui->size().height());
             break;
         case Cursor::SCROLL_NE:
             _ui = std::make_unique<UI::Image>("art/intrface/scrneast.frm");
             _ui->setOffset(-_ui->size().width(), 0);
             break;
         case Cursor::SCROLL_NE_X:
             _ui = std::make_unique<UI::Image>("art/intrface/scrnex.frm");
             _ui->setOffset(-_ui->size().width(), 0);
             break;
         case Cursor::SCROLL_SE:
             _ui = std::make_unique<UI::Image>("art/intrface/scrseast.frm");
             _ui->setOffset(-_ui->size().width(), -_ui->size().height());
             break;
         case Cursor::SCROLL_SE_X:
             _ui = std::make_unique<UI::Image>("art/intrface/scrsex.frm");
             _ui->setOffset(-_ui->size().width(), -_ui->size().height());
             break;
         case Cursor::HEXAGON_RED:
             _ui = std::make_unique<UI::Image>("art/intrface/msef000.frm");
             _ui->setOffset(- _ui->size().width() / 2, - _ui->size().height() / 2);
             break;
         case Cursor::ACTION:
             _ui = std::make_unique<UI::Image>("art/intrface/actarrow.frm");
             break;
         case Cursor::HAND:
             _ui = std::make_unique<UI::Image>("art/intrface/hand.frm");
             break;
         case Cursor::SMALL_DOWN_ARROW:
             _ui = std::make_unique<UI::Image>("art/intrface/sdnarrow.frm");
             _ui->setOffset(-5, -10);
             break;
         case Cursor::SMALL_UP_ARROW:
             _ui = std::make_unique<UI::Image>("art/intrface/suparrow.frm");
             _ui->setOffset(-5, 0);
             break;
         case Cursor::WAIT:
         {
             auto queue = std::make_unique<UI::AnimationQueue>();
             queue->animations().push_back(std::make_unique<UI::Animation>("art/intrface/wait.frm"));
             queue->setRepeat(true);
             queue->start();
             _ui = std::move(queue);
             _ui->setOffset(Point() - _ui->size() / 2);
             break;
         }
         case Cursor::USE:
         {
             _ui = std::make_unique<UI::Image>("art/intrface/crossuse.frm");
             _ui->setOffset(-10, -10);
             break;
         }
         case Cursor::NONE:
             break;
         default:
             break;
     }
 }
Example #22
0
void TestShapeAnimations::setTriggerEvent()
{
    MockDocument doc;
    KPrShapeAnimations animations(&doc);
    new ModelTest(&animations, this);
    createAnimationTree(&animations);
    // From On click
    // To After Previous
    animations.setNodeType(m_animation[5], KPrShapeAnimation::AfterPrevious);
    QCOMPARE(animations.data(animations.index(0, KPrShapeAnimations::NodeType)).toInt(),
             (int)KPrShapeAnimation::OnClick);
    QCOMPARE(animations.data(animations.index(1, KPrShapeAnimations::NodeType)).toInt(),
             (int)KPrShapeAnimation::WithPrevious);
    QCOMPARE(animations.data(animations.index(2, KPrShapeAnimations::NodeType)).toInt(),
             (int)KPrShapeAnimation::WithPrevious);
    QCOMPARE(animations.data(animations.index(3, KPrShapeAnimations::NodeType)).toInt(),
             (int)KPrShapeAnimation::AfterPrevious);
    QCOMPARE(animations.data(animations.index(4, KPrShapeAnimations::NodeType)).toInt(),
             (int)KPrShapeAnimation::WithPrevious);
    QCOMPARE(animations.data(animations.index(5, KPrShapeAnimations::NodeType)).toInt(),
             (int)KPrShapeAnimation::AfterPrevious);
    QCOMPARE(animations.data(animations.index(6, KPrShapeAnimations::NodeType)).toInt(),
             (int)KPrShapeAnimation::AfterPrevious);
    QCOMPARE(animations.data(animations.index(7, KPrShapeAnimations::NodeType)).toInt(),
             (int)KPrShapeAnimation::OnClick);
    QCOMPARE(animations.data(animations.index(8, KPrShapeAnimations::NodeType)).toInt(),
             (int)KPrShapeAnimation::WithPrevious);
    checkOrder(&animations);
    QVERIFY(animations.rowCount() == ANIMATIONS_COUNT);

    // To With Previous
    animations.setNodeType(m_animation[7], KPrShapeAnimation::WithPrevious);
    QCOMPARE(animations.data(animations.index(0, KPrShapeAnimations::NodeType)).toInt(),
             (int)KPrShapeAnimation::OnClick);
    QCOMPARE(animations.data(animations.index(1, KPrShapeAnimations::NodeType)).toInt(),
             (int)KPrShapeAnimation::WithPrevious);
    QCOMPARE(animations.data(animations.index(2, KPrShapeAnimations::NodeType)).toInt(),
             (int)KPrShapeAnimation::WithPrevious);
    QCOMPARE(animations.data(animations.index(3, KPrShapeAnimations::NodeType)).toInt(),
             (int)KPrShapeAnimation::AfterPrevious);
    QCOMPARE(animations.data(animations.index(4, KPrShapeAnimations::NodeType)).toInt(),
             (int)KPrShapeAnimation::WithPrevious);
    QCOMPARE(animations.data(animations.index(5, KPrShapeAnimations::NodeType)).toInt(),
             (int)KPrShapeAnimation::AfterPrevious);
    QCOMPARE(animations.data(animations.index(6, KPrShapeAnimations::NodeType)).toInt(),
             (int)KPrShapeAnimation::AfterPrevious);
    QCOMPARE(animations.data(animations.index(7, KPrShapeAnimations::NodeType)).toInt(),
             (int)KPrShapeAnimation::WithPrevious);
    QCOMPARE(animations.data(animations.index(8, KPrShapeAnimations::NodeType)).toInt(),
             (int)KPrShapeAnimation::WithPrevious);
    checkOrder(&animations);
    QVERIFY(animations.rowCount() == ANIMATIONS_COUNT);

    // From After Previous
    // To On click
    animations.setNodeType(m_animation[3], KPrShapeAnimation::OnClick);
    QCOMPARE(animations.data(animations.index(0, KPrShapeAnimations::NodeType)).toInt(),
             (int)KPrShapeAnimation::OnClick);
    QCOMPARE(animations.data(animations.index(1, KPrShapeAnimations::NodeType)).toInt(),
             (int)KPrShapeAnimation::WithPrevious);
    QCOMPARE(animations.data(animations.index(2, KPrShapeAnimations::NodeType)).toInt(),
             (int)KPrShapeAnimation::WithPrevious);
    QCOMPARE(animations.data(animations.index(3, KPrShapeAnimations::NodeType)).toInt(),
             (int)KPrShapeAnimation::OnClick);
    QCOMPARE(animations.data(animations.index(4, KPrShapeAnimations::NodeType)).toInt(),
             (int)KPrShapeAnimation::WithPrevious);
    QCOMPARE(animations.data(animations.index(5, KPrShapeAnimations::NodeType)).toInt(),
             (int)KPrShapeAnimation::AfterPrevious);
    QCOMPARE(animations.data(animations.index(6, KPrShapeAnimations::NodeType)).toInt(),
             (int)KPrShapeAnimation::AfterPrevious);
    QCOMPARE(animations.data(animations.index(7, KPrShapeAnimations::NodeType)).toInt(),
             (int)KPrShapeAnimation::WithPrevious);
    QCOMPARE(animations.data(animations.index(8, KPrShapeAnimations::NodeType)).toInt(),
             (int)KPrShapeAnimation::WithPrevious);
    checkOrder(&animations);
    QVERIFY(animations.rowCount() == ANIMATIONS_COUNT);

    // To With previous
    animations.setNodeType(m_animation[6], KPrShapeAnimation::WithPrevious);
    QCOMPARE(animations.data(animations.index(0, KPrShapeAnimations::NodeType)).toInt(),
             (int)KPrShapeAnimation::OnClick);
    QCOMPARE(animations.data(animations.index(1, KPrShapeAnimations::NodeType)).toInt(),
             (int)KPrShapeAnimation::WithPrevious);
    QCOMPARE(animations.data(animations.index(2, KPrShapeAnimations::NodeType)).toInt(),
             (int)KPrShapeAnimation::WithPrevious);
    QCOMPARE(animations.data(animations.index(3, KPrShapeAnimations::NodeType)).toInt(),
             (int)KPrShapeAnimation::OnClick);
    QCOMPARE(animations.data(animations.index(4, KPrShapeAnimations::NodeType)).toInt(),
             (int)KPrShapeAnimation::WithPrevious);
    QCOMPARE(animations.data(animations.index(5, KPrShapeAnimations::NodeType)).toInt(),
             (int)KPrShapeAnimation::AfterPrevious);
    QCOMPARE(animations.data(animations.index(6, KPrShapeAnimations::NodeType)).toInt(),
             (int)KPrShapeAnimation::WithPrevious);
    QCOMPARE(animations.data(animations.index(7, KPrShapeAnimations::NodeType)).toInt(),
             (int)KPrShapeAnimation::WithPrevious);
    QCOMPARE(animations.data(animations.index(8, KPrShapeAnimations::NodeType)).toInt(),
             (int)KPrShapeAnimation::WithPrevious);
    checkOrder(&animations);
    QVERIFY(animations.rowCount() == ANIMATIONS_COUNT);

    // From with previous
    // To On click
    animations.setNodeType(m_animation[1], KPrShapeAnimation::OnClick);
    QCOMPARE(animations.data(animations.index(0, KPrShapeAnimations::NodeType)).toInt(),
             (int)KPrShapeAnimation::OnClick);
    QCOMPARE(animations.data(animations.index(1, KPrShapeAnimations::NodeType)).toInt(),
             (int)KPrShapeAnimation::OnClick);
    QCOMPARE(animations.data(animations.index(2, KPrShapeAnimations::NodeType)).toInt(),
             (int)KPrShapeAnimation::WithPrevious);
    QCOMPARE(animations.data(animations.index(3, KPrShapeAnimations::NodeType)).toInt(),
             (int)KPrShapeAnimation::OnClick);
    QCOMPARE(animations.data(animations.index(4, KPrShapeAnimations::NodeType)).toInt(),
             (int)KPrShapeAnimation::WithPrevious);
    QCOMPARE(animations.data(animations.index(5, KPrShapeAnimations::NodeType)).toInt(),
             (int)KPrShapeAnimation::AfterPrevious);
    QCOMPARE(animations.data(animations.index(6, KPrShapeAnimations::NodeType)).toInt(),
             (int)KPrShapeAnimation::WithPrevious);
    QCOMPARE(animations.data(animations.index(7, KPrShapeAnimations::NodeType)).toInt(),
             (int)KPrShapeAnimation::WithPrevious);
    QCOMPARE(animations.data(animations.index(8, KPrShapeAnimations::NodeType)).toInt(),
             (int)KPrShapeAnimation::WithPrevious);
    checkOrder(&animations);
    QVERIFY(animations.rowCount() == ANIMATIONS_COUNT);

    // To after previous
    animations.setNodeType(m_animation[6], KPrShapeAnimation::AfterPrevious);
    QCOMPARE(animations.data(animations.index(0, KPrShapeAnimations::NodeType)).toInt(),
             (int)KPrShapeAnimation::OnClick);
    QCOMPARE(animations.data(animations.index(1, KPrShapeAnimations::NodeType)).toInt(),
             (int)KPrShapeAnimation::OnClick);
    QCOMPARE(animations.data(animations.index(2, KPrShapeAnimations::NodeType)).toInt(),
             (int)KPrShapeAnimation::WithPrevious);
    QCOMPARE(animations.data(animations.index(3, KPrShapeAnimations::NodeType)).toInt(),
             (int)KPrShapeAnimation::OnClick);
    QCOMPARE(animations.data(animations.index(4, KPrShapeAnimations::NodeType)).toInt(),
             (int)KPrShapeAnimation::WithPrevious);
    QCOMPARE(animations.data(animations.index(5, KPrShapeAnimations::NodeType)).toInt(),
             (int)KPrShapeAnimation::AfterPrevious);
    QCOMPARE(animations.data(animations.index(6, KPrShapeAnimations::NodeType)).toInt(),
             (int)KPrShapeAnimation::AfterPrevious);
    QCOMPARE(animations.data(animations.index(7, KPrShapeAnimations::NodeType)).toInt(),
             (int)KPrShapeAnimation::WithPrevious);
    QCOMPARE(animations.data(animations.index(8, KPrShapeAnimations::NodeType)).toInt(),
             (int)KPrShapeAnimation::WithPrevious);
    checkOrder(&animations);
    QVERIFY(animations.rowCount() == ANIMATIONS_COUNT);

    // From On click
    // To After Previous (with childrem)
    animations.setNodeType(m_animation[3], KPrShapeAnimation::AfterPrevious);
    QCOMPARE(animations.data(animations.index(0, KPrShapeAnimations::NodeType)).toInt(),
             (int)KPrShapeAnimation::OnClick);
    QCOMPARE(animations.data(animations.index(1, KPrShapeAnimations::NodeType)).toInt(),
             (int)KPrShapeAnimation::OnClick);
    QCOMPARE(animations.data(animations.index(2, KPrShapeAnimations::NodeType)).toInt(),
             (int)KPrShapeAnimation::WithPrevious);
    QCOMPARE(animations.data(animations.index(3, KPrShapeAnimations::NodeType)).toInt(),
             (int)KPrShapeAnimation::AfterPrevious);
    QCOMPARE(animations.data(animations.index(4, KPrShapeAnimations::NodeType)).toInt(),
             (int)KPrShapeAnimation::WithPrevious);
    QCOMPARE(animations.data(animations.index(5, KPrShapeAnimations::NodeType)).toInt(),
             (int)KPrShapeAnimation::AfterPrevious);
    QCOMPARE(animations.data(animations.index(6, KPrShapeAnimations::NodeType)).toInt(),
             (int)KPrShapeAnimation::AfterPrevious);
    QCOMPARE(animations.data(animations.index(7, KPrShapeAnimations::NodeType)).toInt(),
             (int)KPrShapeAnimation::WithPrevious);
    QCOMPARE(animations.data(animations.index(8, KPrShapeAnimations::NodeType)).toInt(),
             (int)KPrShapeAnimation::WithPrevious);
    checkOrder(&animations);
    QVERIFY(animations.rowCount() == ANIMATIONS_COUNT);

    //From On Click
    // To after previous (invald for the first animation)
    animations.setNodeType(m_animation[0], KPrShapeAnimation::AfterPrevious);
    QCOMPARE(animations.data(animations.index(0, KPrShapeAnimations::NodeType)).toInt(),
             (int)KPrShapeAnimation::OnClick);
    QCOMPARE(animations.data(animations.index(1, KPrShapeAnimations::NodeType)).toInt(),
             (int)KPrShapeAnimation::OnClick);
    QCOMPARE(animations.data(animations.index(2, KPrShapeAnimations::NodeType)).toInt(),
             (int)KPrShapeAnimation::WithPrevious);
    QCOMPARE(animations.data(animations.index(3, KPrShapeAnimations::NodeType)).toInt(),
             (int)KPrShapeAnimation::AfterPrevious);
    QCOMPARE(animations.data(animations.index(4, KPrShapeAnimations::NodeType)).toInt(),
             (int)KPrShapeAnimation::WithPrevious);
    QCOMPARE(animations.data(animations.index(5, KPrShapeAnimations::NodeType)).toInt(),
             (int)KPrShapeAnimation::AfterPrevious);
    QCOMPARE(animations.data(animations.index(6, KPrShapeAnimations::NodeType)).toInt(),
             (int)KPrShapeAnimation::AfterPrevious);
    QCOMPARE(animations.data(animations.index(7, KPrShapeAnimations::NodeType)).toInt(),
             (int)KPrShapeAnimation::WithPrevious);
    QCOMPARE(animations.data(animations.index(8, KPrShapeAnimations::NodeType)).toInt(),
             (int)KPrShapeAnimation::WithPrevious);
    checkOrder(&animations);
    QVERIFY(animations.rowCount() == ANIMATIONS_COUNT);

    //To with previous (invalid for the first item)
    animations.setNodeType(m_animation[0], KPrShapeAnimation::WithPrevious);
    QCOMPARE(animations.data(animations.index(0, KPrShapeAnimations::NodeType)).toInt(),
             (int)KPrShapeAnimation::OnClick);
    QCOMPARE(animations.data(animations.index(1, KPrShapeAnimations::NodeType)).toInt(),
             (int)KPrShapeAnimation::OnClick);
    QCOMPARE(animations.data(animations.index(2, KPrShapeAnimations::NodeType)).toInt(),
             (int)KPrShapeAnimation::WithPrevious);
    QCOMPARE(animations.data(animations.index(3, KPrShapeAnimations::NodeType)).toInt(),
             (int)KPrShapeAnimation::AfterPrevious);
    QCOMPARE(animations.data(animations.index(4, KPrShapeAnimations::NodeType)).toInt(),
             (int)KPrShapeAnimation::WithPrevious);
    QCOMPARE(animations.data(animations.index(5, KPrShapeAnimations::NodeType)).toInt(),
             (int)KPrShapeAnimation::AfterPrevious);
    QCOMPARE(animations.data(animations.index(6, KPrShapeAnimations::NodeType)).toInt(),
             (int)KPrShapeAnimation::AfterPrevious);
    QCOMPARE(animations.data(animations.index(7, KPrShapeAnimations::NodeType)).toInt(),
             (int)KPrShapeAnimation::WithPrevious);
    QCOMPARE(animations.data(animations.index(8, KPrShapeAnimations::NodeType)).toInt(),
             (int)KPrShapeAnimation::WithPrevious);
    checkOrder(&animations);
    QVERIFY(animations.rowCount() == ANIMATIONS_COUNT);
}
Example #23
0
void Mouse::_setType(unsigned int state)
{
    if (this->state() == state) return;
    delete _ui; _ui = 0;
    switch(state)
    {
        case BIG_ARROW:
            _ui = new Image("art/intrface/stdarrow.frm");
            break;
        case SCROLL_W:
            _ui = new Image("art/intrface/scrwest.frm");
            _ui->setYOffset( -_ui->height()*0.5);
            break;
        case SCROLL_W_X:
            _ui = new Image("art/intrface/scrwx.frm");
            _ui->setYOffset( -_ui->height()*0.5);
            break;
        case SCROLL_N:
            _ui = new Image("art/intrface/scrnorth.frm");
            _ui->setXOffset( -_ui->width()*0.5);
            break;
        case SCROLL_N_X:
            _ui = new Image("art/intrface/scrnx.frm");
            _ui->setXOffset( -_ui->width()*0.5);
            break;
        case SCROLL_S:
            _ui = new Image("art/intrface/scrsouth.frm");
            _ui->setXOffset( -_ui->width()*0.5);
            _ui->setYOffset( -_ui->height());
            break;
        case SCROLL_S_X:
            _ui = new Image("art/intrface/scrsx.frm");
            _ui->setXOffset(-_ui->width()*0.5);
            _ui->setYOffset(-_ui->height());
            break;
        case SCROLL_E:
            _ui = new Image("art/intrface/screast.frm");
            _ui->setXOffset( -_ui->width());
            _ui->setYOffset( -_ui->height()*0.5);
            break;
        case SCROLL_E_X:
            _ui = new Image("art/intrface/screx.frm");
            _ui->setXOffset(-_ui->width());
            _ui->setYOffset(-_ui->height()*0.5);
            break;
        case SCROLL_NW:
            _ui = new Image("art/intrface/scrnwest.frm");
            break;
        case SCROLL_NW_X:
            _ui = new Image("art/intrface/scrnwx.frm");
            break;
        case SCROLL_SW:
            _ui = new Image("art/intrface/scrswest.frm");
            _ui->setYOffset(-_ui->height());
            break;
        case SCROLL_SW_X:
            _ui = new Image("art/intrface/scrswx.frm");
            _ui->setYOffset(-_ui->height());
            break;
        case SCROLL_NE:
            _ui = new Image("art/intrface/scrneast.frm");
            _ui->setXOffset(-_ui->width());
            break;
        case SCROLL_NE_X:
            _ui = new Image("art/intrface/scrnex.frm");
            _ui->setXOffset(-_ui->width());
            break;
        case SCROLL_SE:
            _ui = new Image("art/intrface/scrseast.frm");
            _ui->setXOffset(-_ui->width());
            _ui->setYOffset(-_ui->height());
            break;
        case SCROLL_SE_X:
            _ui = new Image("art/intrface/scrsex.frm");
            _ui->setXOffset(-_ui->width());
            _ui->setYOffset(-_ui->height());
            break;
        case HEXAGON_RED:
            _ui = new Image("art/intrface/msef000.frm");
            _ui->setXOffset(- _ui->width()/2);
            _ui->setYOffset(- _ui->height()/2);
            break;
        case ACTION:
            _ui = new Image("art/intrface/actarrow.frm");
            break;
        case HAND:
            _ui = new Image("art/intrface/hand.frm");
            break;
        case WAIT:
        {
            auto queue = new AnimationQueue();
            queue->animations()->push_back(new Animation("art/intrface/wait.frm"));
            queue->setRepeat(true);
            queue->start();
            _ui = queue;
            _ui->setXOffset(-_ui->width()*0.5);
            _ui->setYOffset(-_ui->height()*0.5);
            break;
        }
        case NONE:
            break;
    }
}