Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Container
- std::list< GameObject* > objects;
- // Step
- for ( std::list< GameObject* >::iterator it = objects.begin(); it != objects.end(); ++it )
- {
- ( * it )->StepEvent();
- }
- SortObjectsByDepth(); // Just one of my functions, you don't need to worry about that. :P
- // Events
- for ( std::list< GameObject* >::iterator it = objects.begin(); it != objects.end(); ++it )
- {
- ( * it )->StepEvent( event );
- }
- // Draw
- for ( std::list< GameObject* >::iterator it = objects.begin(); it != objects.end(); ++it )
- {
- ( * it )->Draw( window );
- }
- // Termination
- for ( std::list< GameObject* >::iterator it = objects.begin(); it != objects.end(); ++it )
- {
- delete ( * it );
- }
- objects.clear();
- // Adding objects - Example 1
- objects.push_back( new Block( Scene, pos, theme, blockType ) );
- // Adding objects - Example 2
- objects.push_back( new Player( Scene, pos, drawingStyle ) );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement