Drawing in Layers


Groupwork

Need ability to draw in layers - control order of Object to be drawn first, object to be drawn second, ...

Assume this is called altitude.

  1. What code needs to be added to Dragonfly to keep track of an Object's altitude?

  2. Consider the below code:

    // Draw world bottom up, from 0 to MAX_ALTITUDE.
    WorldManager::draw() {

      std::vector<Object*> ol = m_updates;
      std::vector<Object*>::iterator li;

      for (li = ol.begin(); li != m_updates.end(); li++) {

        for (int i=0; i < MAX_ALTITUDE; i++)
          (*li) -> draw(i);

      }
    }
  1. Why won't this code do what we want?

  2. Fix it, providing code that does.


Hand-in

Have ONE person from each group submit the group's answers:

http://wpi.qualtrics.com/jfe/form/SV_6mKlYb74OeyOhKZ

Make sure to include the names of all group members.

Happy layer-ing!

-- Mark