Quantcast
Channel: beginners - openFrameworks
Viewing all articles
Browse latest Browse all 4929

xmlExample from 0.9.8 to 0.10.0

$
0
0

@Regi wrote:

Hi,

I’m trying to understand the change in code from the older version of OF to the newest one. Specifically how to reproduce the exact steps below in the new version.

Thanks!

// If we have STROKE nodes that we've already created, then we can go ahead and
// load them into the dragPts so they're drawn to the screen
if(XML.exists("STROKE"))
{
    // This gets the first stroke (notice the [0], it's just like an array)
    XML.setTo("STROKE[0]");
    
    
    do {
        // set our "current" PT to the first one
        if(XML.getName() == "STROKE" && XML.setTo("PT[0]"))
        {
            // get each individual x,y for each point
            do {
                int x = XML.getValue<int>("X");
                int y = XML.getValue<int>("Y");
                ofVec2f v(x, y);

                dragPts.push_back(v);
            }
            while(XML.setToSibling()); // go the next PT
            
            // go back up
            XML.setToParent();
        }
        
    }
    while( XML.setToSibling() ); // go to the next STROKE
}

Posts: 2

Participants: 2

Read full topic


Viewing all articles
Browse latest Browse all 4929

Trending Articles