vrshoot

diff src/enemy.cc @ 0:b2f14e535253

initial commit
author John Tsiombikas <nuclear@member.fsf.org>
date Sat, 01 Feb 2014 19:58:19 +0200
parents
children
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/src/enemy.cc	Sat Feb 01 19:58:19 2014 +0200
     1.3 @@ -0,0 +1,40 @@
     1.4 +#include "enemy.h"
     1.5 +#include "object.h"
     1.6 +#include "scene.h"
     1.7 +
     1.8 +Enemy::Enemy()
     1.9 +{
    1.10 +	root = 0;
    1.11 +	scn = 0;
    1.12 +}
    1.13 +
    1.14 +Enemy::~Enemy()
    1.15 +{
    1.16 +	delete root;
    1.17 +	delete scn;
    1.18 +}
    1.19 +
    1.20 +bool Enemy::load(const char *fname)
    1.21 +{
    1.22 +	if(!scn->load(fname)) {
    1.23 +		return false;
    1.24 +	}
    1.25 +
    1.26 +	// reparent all root objects
    1.27 +	root = new XFormNode;
    1.28 +	for(size_t i=0; i<scn->objects.size(); i++) {
    1.29 +		if(!scn->objects[i]->get_parent()) {
    1.30 +			root->add_child(scn->objects[i]);
    1.31 +		}
    1.32 +	}
    1.33 +	return true;
    1.34 +}
    1.35 +
    1.36 +void Enemy::update(long tm)
    1.37 +{
    1.38 +}
    1.39 +
    1.40 +void Enemy::draw() const
    1.41 +{
    1.42 +	root->draw();
    1.43 +}