Jump to content

Using SpriterEngine::Variable in SpriterPlusPlus


Alejandro Ramirez

Recommended Posts

I am working around with metadata in spriterplusplus in the hopes that I can alter rendering style based on a variable inlaid into spritermodels.

This is my code thus far:

        SpriterEngine::Variable *myIdentity = new SpriterEngine::Variable("myId", SpriterEngine::Variable::VariableType::VARIABLETYPE_INT);

        myIdentity->getDefaultValue()->setIntValue(1);

        Avatar->getVariables()->pushBackVariable(myIdentity);

        std::cout<<Avatar->getIntValue("myId")<<"\n";

However, what I get back is a 0 when I was expecting a 1. If this worked my hopes would have been to do something like this in the render code:

    void SfmlImageFile::renderSprite(UniversalObjectInterface * spriteInfo) {

        if (spriteInfo->getIntValue("myId") == 1){

            //...

        } else {

            //...

        }

Can anyone offer insight into my dilemma?

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...