Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | Related Pages

Actor.cpp

00001 /*************************************************************************** 00002 * This file is part of OpenCAL: Open Computer Animation Library * 00003 * I created OpenCAL as my master's thesis Computer Science (multimedia) * 00004 * at the tUL university in Diepenbeek, Belgium * 00005 * * 00006 * Copyright (C) 2003-2004 by Jeroen Dierckx * 00007 * jeroen.dierckx@student.luc.ac.be * 00008 * * 00009 ***************************************************************************/ 00010 00011 // Includes 00012 #include "Actor.h" 00013 #include <OpenCAL/System.h> 00014 using namespace OpenCAL; 00015 00016 #include <OpenCAL/NullParentException.h> 00017 using Exceptions::NullParentException; 00018 00019 00020 /****************************** 00021 * Constructors and destructor * 00022 ******************************/ 00023 00024 Actor::Actor(System *parent) 00025 : m_parent(parent), m_initialized(false), m_draw(false), m_enabled(true) 00026 { 00027 #ifdef VERBOSE 00028 Debug::print("Actor constructor", 2); 00029 #endif // VERBOSE 00030 00031 if(!parent) 00032 throw NullParentException(__FILE__, __LINE__); 00033 00034 #ifdef VERBOSE 00035 Debug::print("Parent is given, adding to the the parent's actor list...", 2); 00036 #endif // VERBOSE 00037 00038 parent->addActor(this); 00039 } 00040 00041 Actor::~Actor() 00042 { 00043 #ifdef VERBOSE 00044 Debug::print("Actor destructor", 2); 00045 #endif // VERBOSE 00046 00047 m_parent->deleteActor(this); 00048 } 00049 00050 00051 /******************** 00052 * General functions * 00053 ********************/ 00054 00055 void Actor::initialize() 00056 { 00057 #ifdef VERBOSE 00058 Debug::print("Actor initialize", 2); 00059 #endif // VERBOSE 00060 00061 m_initialized = true; 00062 } 00063 00064 void Actor::execute(float seconds) 00065 { 00066 #ifdef VERBOSE 00067 Debug::stream << "Actor execute (" << seconds << " seconds)" << endl; 00068 Debug::printStream(Debug::maxLevel); 00069 #endif // VERBOSE 00070 00071 if(!isInitialized()) 00072 { 00073 #ifdef VERBOSE 00074 Debug::initWarning("actor"); 00075 #endif // VERBOSE 00076 initialize(); 00077 } 00078 }

Generated on Sun Aug 15 19:19:21 2004 for OpenCAL: Open Computer Animation Library by doxygen 1.3.8