Main Page   Class Hierarchy   Compound List   File List   Compound Members  

gameengine.h

00001 #ifndef __GAMEENGINE_H
00002 #define __GAMEENGINE_H
00003 //Jeremiah Jilk
00004 //jeremiahjilk@adelphia.net
00005 //Perihelion Group
00006 //perihelion-develop@lists.sourceforge.net
00007 //
00008 //Created:                      5-6-02
00009 //Last Modified:        5-13-02
00010 //By:                           Jeremiah Jilk
00011 //
00012 //gameengine.h
00013 //
00014 //
00015 
00016 #include "util.h"
00017 #include "world.h"
00018 //#include "networking.h"
00019 #include "sound.h"
00020 #include "graphics.h"
00021 #include "menu.h"
00022 #include "infomenu.h"
00023 #include "SDL.h"
00024 #include <iostream>
00025 #include <string>
00026 #include "netmanagerclient.h"
00027 
00028 using namespace std;
00029 
00033 class GameEngine
00034 {
00035  public:
00036   GameEngine(Graphics& g, NetManagerClient& n, Sound& s, string const & name, char color, char race);
00037   void run();
00038   ~GameEngine();
00039 
00040  private:
00041   enum gameState{PLAY, TRADE, MENU};
00042 
00043   Graphics& graphics;
00044   NetManagerClient& networking;
00045   Sound& sound;
00046 
00047   World world;
00048   bool quitProgram;
00049   gameState currentState;
00050   Menu gameOptionsMenu;
00051   InfoMenu helpMenu;
00052   Menu* currentMenu;
00053   bool chatting;
00054   string typedMessage;
00055   bool serverAcknowledged;
00056 
00057   void processInput();
00058   void processMessage(string msg);
00059   void processMoving(Player& CPlayer, int oldX, int oldY);
00060   
00061   // Arrow Processors
00062   void processUpKey();
00063   void processDownKey();
00064   void processRightKey();
00065   void processLeftKey();
00066 
00067   // Other key processors
00068   void processActionKey();
00069   void processMenuKey();
00070   void processAccessKey();
00071 
00077   void processChatKey(const SDL_keysym& key);
00078 
00079   void processDropKey();
00080   void processInvScrollUpKey();
00081   void processInvScrollDownKey();
00082   void processHelpKey();
00083   void processDebugKey();
00084 
00085   // Network messages parsing
00086   string buildMessagea(int p, int x, int y, int d) const;
00087   string buildMessageb(int p, Resource r, int x, int y, int n) const;
00088   string buildMessagec(int p, int x, int y) const;
00089   string buildMessagef(int p, BuildingType t, int x, int y) const;
00090   string buildMessageg(int p, Resource r, int a, int x, int y) const;
00091   string buildMessagem(int p);
00092   string buildMessageq(int p) const;
00093   string buildMessager() const;
00094   string buildMessages() const;
00095   string buildMessagex() const;
00096 
00097   bool processMessageA(string c);
00098   bool processMessageB(string c);
00099   bool processMessageC(string c);
00100   bool processMessageD(string c);
00101   bool processMessageE(string c);
00102   bool processMessageF(string c);
00103   bool processMessageG(string c);
00104   bool processMessageI(string c);
00105   bool processMessageM(string c);
00106   bool processMessageR(string c);
00107   bool processMessageS(string c);
00108   bool processMessageU(string c);
00109 
00113   bool processMessageT(string c);
00114 
00118   bool processMessageO();
00119   bool processMessageX(string c);
00120 
00125   void printDebugInfo();
00126 };
00127 
00128 #endif

Generated on Thu Jun 6 17:22:20 2002 for Perihelion by doxygen1.2.15