/Users/craigcornelius/Projects/SPRING Mac Release 0.2/springCore.h

Go to the documentation of this file.
00001 #ifndef SPRINGCORE_H
00002 #define SPRINGCORE_H
00003 
00004 // $Id: springCore.h,v 1.8 2006/05/24 16:52:40 sean Exp $
00005 // $Copyright: (c)2001 National Biocomputation Center, Stanford University $
00006 
00007 // springCore.h
00008 
00009 // Encapsulates the global variables of the SPRING core application.
00010 //
00011 // Developers of specialized applications are encouraged to derive 
00012 // subclasses of this in order to cleanly separate the general values
00013 // from specialized instances of SPRING.
00014 
00015 // History:
00016 // 04-Oct-2005  cwc             Started this file for SPRING 0.1  Mostly to get 
00017 //                                              gameBase into this version. 
00018 
00019 
00020 
00021 // GLUI/MUI/GLUT headers
00022 //#include <glui.h>
00023 
00024 #include <mui.h>
00025 #include <GLUT/glut.h>
00026 #include "objectarray.h"
00027 #include "object.h"
00028 #include "sensorarray.h"
00029 #include "markers.h"
00030 
00031 #include "displayreplicator.h"
00032 #include "geometryreplicator.h"
00033 
00034 
00035 #include "rasterfont.h"
00036 #include "camera.h"
00037 #include "voice.h"
00038 #include "lightarray.h"
00039 
00040 // Defining two levels of customization of SPRING
00041 #include "gameBase.h"
00042 
00043 
00044 // The class that (will, in next version) be the main SPRING program.
00045 // Global variables and main functions of the program will be in this class.
00046 
00047 class springCore
00048 {
00049 
00050 public:
00051 
00052         // *** PUBLIC CONSTRUCTOR *** 
00053         
00054         // Constructor optionally takes global arguments 
00055         springCore(int argc = 0, char* argv[] = NULL);
00056         virtual ~springCore();
00057 
00058 
00059         // *** PUBLIC/GLOBAL ENUMS ***
00060 
00061         // Available collision detection and response algorithms 
00062         enum CollisionAlgorithmEnum { 
00063                         BOUNDING_SPHERE_CD, 
00064                         AABB_CD,
00065         };
00066 
00067 
00068         // *** PUBLIC/GLOBAL FUNCTIONS ***
00069 
00070         // Sets up values of the global variables.  May be called to reset state.
00071         void InitVariables(void);
00072 
00073         // Accessor methods for collision detection and response
00074         bool isCollisionsOn() { return collisionsOn; }
00075         void setCollisionsOn(bool on) { collisionsOn = on; }
00076         CollisionAlgorithmEnum getCollisionAlgorithm() { return currentCollisionAlgorithm; }
00077         void setCollisionAlgorithm(CollisionAlgorithmEnum collisionAlgorithm_) { newCollisionAlgorithm = collisionAlgorithm_; }
00078 
00079         // Accessor methods for active game
00080         gameBase* getActiveGame() { return activeGame; }
00081         void setActiveGame(gameBase* activeGame_) { activeGame = activeGame_; }
00082 
00083         // Accessor methods for on-screen info displays
00084         bool isDoInfoDisplay() { return doInfoDisplay; }
00085         void setDoInfoDisplay(bool doInfoDisplay_) { doInfoDisplay = doInfoDisplay_; }
00086         bool isDoTimeDisplay() { return doTimeDisplay; }
00087         void setDoTimeDisplay(bool doTimeDisplay_) { doTimeDisplay = doTimeDisplay_; }
00088 
00089         // Accessor methods for time spent
00090         double getIdleTime() { return idleTime; }
00091         void setIdleTime(double idleTime_) { idleTime = idleTime_; }
00092         double getHandleBehaviorTime() { return handleBehaviorTime; }
00093         void setHandleBehaviorTime(double handleBehaviorTime_) { handleBehaviorTime = handleBehaviorTime_; }
00094         double getUpdateLoopTime() { return updateLoopTime; }
00095         void setUpdateLoopTime(double updateLoopTime_) { updateLoopTime = updateLoopTime_; }
00096         double getCollisionDetectionTime() { return collisionDetectionTime; }
00097         void setCollisionDetectionTime(double collisionDetectionTime_) { collisionDetectionTime = collisionDetectionTime_; }
00098         double getCDResetTime() { return cdResetTime; }
00099         void setCDResetTime(double cdResetTime_) { cdResetTime = cdResetTime_; }
00100         double getCDDetectTime() { return cdDetectTime; }
00101         void setCDDetectTime(double cdDetectTime_) { cdDetectTime = cdDetectTime_; }
00102         double getCDResolveTime() { return cdResolveTime; }
00103         void setCDResolveTime(double cdResolveTime_) { cdResolveTime = cdResolveTime_; }
00104         double getGameTime() { return gameTime; }
00105         void setGameTime(double gameTime_) { gameTime = gameTime_; }
00106 
00107 private:
00108 
00109         // *** PRIVATE VARIABLES ***
00110 
00111         // If collision detection is on or off
00112         bool collisionsOn;
00113 
00114         // Based on the class for games / scenarios.
00115         gameBase* activeGame;    // the currently active game or null for none
00116 
00117         // Time for one idle loop
00118         double idleTime;
00119         // Time to handle behaviors
00120         double handleBehaviorTime;
00121         // Time for loop which calls universe.update several times
00122         double updateLoopTime;
00123         // Time for collision detection
00124         double collisionDetectionTime;
00125         // Time to reset collisions OR prepare for next loop
00126         double cdResetTime;
00127         // Time to detect collisions
00128         double cdDetectTime;
00129         // Time to resolve collisions
00130         double cdResolveTime;
00131         // Time for game
00132         double gameTime;
00133 
00134 public:
00135         // CHRIS: this "font_p" should not be in springCore at all
00136         //   -> objects that want to output text, just create their own font_p
00137         //   -> also, there should be NO global variables be public
00138         RasterFont* font_p;
00139 
00140         
00141         
00142         // CHRIS: move to private!
00143         
00144         // The collision algorithm that is currently used
00145         CollisionAlgorithmEnum currentCollisionAlgorithm;
00146         // The collision algorithm to take for the next iteration
00147         CollisionAlgorithmEnum newCollisionAlgorithm;
00148 
00149         // If tool info + status info (running OR paused) should be display on-screen
00150         int doInfoDisplay;
00151         // Displays times spent (computational) on-screen
00152         int doTimeDisplay;
00153 
00154 
00155 };
00156 
00157 #endif // SPRINGCORE_H

Generated on Thu Aug 30 11:03:16 2007 for SPRING Mac by  doxygen 1.5.3