// cGame.h
// 2/28/04
// Forrest Briggs
// cGame stores the world, handles user input and manages
// setting up opengl

#ifndef cgame_h
#define cgame_h

#include "ForwardDeclarations.h"
#include "OGLPlatformSpecific.h"
#include "cWorld.h"
#include "cTimer.h"

#include <iostream>
#include <String>
using namespace std;

class cGame
{   
public:
    static cGame* instance();
    
    // since we use the game as a global variable and objects 
    // are constructed that require opengl already to be initialized,
    // delay allocating the world until we call init.
    void init(); 
    
    void display(void);
    void idle();
    void keyboard(unsigned char key, int x, int y);
    void mouseClick(int button, int state, int x, int y); 
    void mouseMove(int x, int y);
    
    void updateParticleSystem(); 	// updates and draws the particle syste
                                        // independent of the world, so loader can animate
    
    int screenWidth_, screenHeight_;
    int lastX_, lastY_;
    
    cWorld *world_;
    cTimer timer_;
    
	void loadIce();
    void loadMushroom();
    void loadMaze();
    void loadCastle();
    void loadVolcano();
    void loadEmpty();
    
    int octreeProgress_;		// used to help octree update loading progress bar
    
private:
    static cGame* instance_;
    cGame(); // do nothing
    
    int frameRate_;		// used to calculate frame rate
    float timeInSecond_;
    int level_;
    
    int numFrames_;
    
    cParticleSystem *particleSystem_; // we want this to display loader so it cant be in world
};

#endif // end define cgame_h
