Drawing in Layers


Groupwork

For Dragonfly, we’d like to provide the ability to draw in layers - for the game programmer to control order of Objects to be drawn. i.e., Draw these Objects first (in the background), then these objects second (on top), …

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.
    void WorldManager::draw(void) {

      for (int i=0; i < m_updates.getCount(); i++) {

        Object *p_o = m_updates[i] 
        p_o -> draw();

      }

    }

This code doesn’t do what we want yet. Update it, providing code that does.


Hand-in

Each person in a group should submit their answers:

https://wpi.qualtrics.com/jfe/form/SV_039eHUbBuJmHorA

Make sure to include the names of all group members.

Happy layer-ing!

– Mark