src/Engine.hh
branchnew_graphics
changeset 417 c503e0c6a740
parent 411 106aaf6eadfe
child 418 194bc810a570
equal deleted inserted replaced
416:38cba347a3a9 417:c503e0c6a740
     3 
     3 
     4 // forward-declare
     4 // forward-declare
     5 class Engine;
     5 class Engine;
     6 
     6 
     7 #include "GameState.hh"
     7 #include "GameState.hh"
     8 #include "Graphics/Graphics.hh"
     8 #include "Configuration.hh"
     9 #include "Network/Server.hh"
     9 #include "Logger.hh"
    10 #include "Network/Client.hh"
       
    11 
    10 
    12 #include "Logger.hh"
    11 // forward-declare component pointer types
       
    12 // XXX: move to some kind of Components.hh file?
       
    13 namespace graphics { class Graphics; }
       
    14 class NetworkServer;
       
    15 class NetworkClientConnect;
       
    16 class NetworkClient;
    13 
    17 
    14 /**
    18 /**
    15  * This is the core class that glues all the other components together and runs the main loop
    19  * This is the core class that glues all the other components together and runs the main loop
    16  */
    20  */
    17 class Engine {
    21 class Engine {
    49          * Setup game world using given terrain configuration
    53          * Setup game world using given terrain configuration
    50          */
    54          */
    51         void setupGame (const TerrainConfig &config);
    55         void setupGame (const TerrainConfig &config);
    52 
    56 
    53         /**
    57         /**
    54          * Enable graphics
    58          * Enable graphics. 
       
    59          *
       
    60          * Requires: GRAPHICS_ENABLED
    55          */
    61          */
    56         void setupGraphics (const graphics::DisplayConfig &config);
    62         void setupGraphics (const DisplayConfig &config);
    57         
    63         
    58         /**
    64         /**
    59          * Setup server, must call setupGame first
    65          * Setup server, must call setupGame first
       
    66          *
       
    67          * Requires: NETWORK_ENABLED
    60          */
    68          */
    61         void setupNetworkServer (const std::string &listen_port);
    69         void setupNetworkServer (const std::string &listen_port);
    62 
    70 
    63         /**
    71         /**
    64          * Setup client, do *not* call setupGame, configuration comes from the server
    72          * Setup client, do *not* call setupGame, configuration comes from the server
       
    73          *
       
    74          * Requires: NETWORK_ENABLED
    65          */
    75          */
    66         void setupNetworkClient (const std::string &connect_host, const std::string &connect_port);
    76         void setupNetworkClient (const std::string &connect_host, const std::string &connect_port);
    67 
    77 
    68         /**
    78         /**
    69          * Setup singleplayer, must call setupGame first
    79          * Setup singleplayer, must call setupGame first
    80          */
    90          */
    81         void stop (void);
    91         void stop (void);
    82 
    92 
    83     private:
    93     private:
    84         /**
    94         /**
    85          * Actually start graphics, requires that game_state is now set
    95          * Puts graphics into GameView mode, using our GameState and the given player
    86          */
    96          */
    87         void startGraphics (void);
    97         void startGameView (LocalPlayer *player);
    88 
    98 
    89     public:
    99     public:
    90         // get a pointer to our resource manager
   100         // get a pointer to our resource manager
    91         CL_ResourceManager* getResourceManager (void);
   101         CL_ResourceManager* getResourceManager (void);
    92 
   102