conworlds
view src/scene.cc @ 17:c814f77d177e
moved to SDL2
author | John Tsiombikas <nuclear@member.fsf.org> |
---|---|
date | Mon, 25 Aug 2014 22:02:08 +0300 |
parents | |
children |
line source
1 #include "scene.h"
2 #include "opengl.h"
4 Scene::~Scene()
5 {
6 destroy();
7 }
9 void Scene::destroy()
10 {
11 for(size_t i=0; i<objects.size(); i++) {
12 delete objects[i];
13 }
14 objects.clear();
16 for(size_t i=0; i<meshes.size(); i++) {
17 delete meshes[i];
18 }
19 meshes.clear();
20 }
22 void Scene::draw(long msec) const
23 {
24 for(size_t i=0; i<objects.size(); i++) {
25 objects[i]->draw(msec);
26 }
28 // if there are no objects in the scene, just draw the meshes instead
29 if(objects.empty()) {
30 for(size_t i=0; i<meshes.size(); i++) {
31 meshes[i]->draw();
32 }
33 }
34 }