vrshoot
annotate src/enemy.cc @ 1:e7ca128b8713
looks nice :)
author | John Tsiombikas <nuclear@member.fsf.org> |
---|---|
date | Sun, 02 Feb 2014 00:35:22 +0200 |
parents | |
children |
rev | line source |
---|---|
nuclear@0 | 1 #include "enemy.h" |
nuclear@0 | 2 #include "object.h" |
nuclear@0 | 3 #include "scene.h" |
nuclear@0 | 4 |
nuclear@0 | 5 Enemy::Enemy() |
nuclear@0 | 6 { |
nuclear@0 | 7 root = 0; |
nuclear@0 | 8 scn = 0; |
nuclear@0 | 9 } |
nuclear@0 | 10 |
nuclear@0 | 11 Enemy::~Enemy() |
nuclear@0 | 12 { |
nuclear@0 | 13 delete root; |
nuclear@0 | 14 delete scn; |
nuclear@0 | 15 } |
nuclear@0 | 16 |
nuclear@0 | 17 bool Enemy::load(const char *fname) |
nuclear@0 | 18 { |
nuclear@0 | 19 if(!scn->load(fname)) { |
nuclear@0 | 20 return false; |
nuclear@0 | 21 } |
nuclear@0 | 22 |
nuclear@0 | 23 // reparent all root objects |
nuclear@0 | 24 root = new XFormNode; |
nuclear@0 | 25 for(size_t i=0; i<scn->objects.size(); i++) { |
nuclear@0 | 26 if(!scn->objects[i]->get_parent()) { |
nuclear@0 | 27 root->add_child(scn->objects[i]); |
nuclear@0 | 28 } |
nuclear@0 | 29 } |
nuclear@0 | 30 return true; |
nuclear@0 | 31 } |
nuclear@0 | 32 |
nuclear@0 | 33 void Enemy::update(long tm) |
nuclear@0 | 34 { |
nuclear@0 | 35 } |
nuclear@0 | 36 |
nuclear@0 | 37 void Enemy::draw() const |
nuclear@0 | 38 { |
nuclear@0 | 39 root->draw(); |
nuclear@0 | 40 } |