src/proto2/Engine.hh
author saiam
Fri, 28 Nov 2008 22:26:23 +0000
changeset 128 890ac82cdcc0
parent 58 a53f5ad69500
permissions -rw-r--r--
Documenting more, cleaning variables. This code needs some serious
rewriting. (And we havent too many features either)
25
af75a1894a32 simple proto *almost* works
terom
parents: 24
diff changeset
     1
#ifndef ENGINE_HH
af75a1894a32 simple proto *almost* works
terom
parents: 24
diff changeset
     2
#define ENGINE_HH
21
32c6cc55256a change proto2 network code to use CL_NetSession
terom
parents:
diff changeset
     3
25
af75a1894a32 simple proto *almost* works
terom
parents: 24
diff changeset
     4
// XXX: forward-declare Engine for other components
af75a1894a32 simple proto *almost* works
terom
parents: 24
diff changeset
     5
class Engine;
af75a1894a32 simple proto *almost* works
terom
parents: 24
diff changeset
     6
af75a1894a32 simple proto *almost* works
terom
parents: 24
diff changeset
     7
#include "GameState.hh"
af75a1894a32 simple proto *almost* works
terom
parents: 24
diff changeset
     8
#include "Graphics.hh"
21
32c6cc55256a change proto2 network code to use CL_NetSession
terom
parents:
diff changeset
     9
#include "NetworkServer.hh"
32c6cc55256a change proto2 network code to use CL_NetSession
terom
parents:
diff changeset
    10
#include "NetworkClient.hh"
32c6cc55256a change proto2 network code to use CL_NetSession
terom
parents:
diff changeset
    11
23
8d802b573cf0 fixed more network code, there's actually a high probability of it working now
terom
parents: 22
diff changeset
    12
#include "Logger.hh"
8d802b573cf0 fixed more network code, there's actually a high probability of it working now
terom
parents: 22
diff changeset
    13
21
32c6cc55256a change proto2 network code to use CL_NetSession
terom
parents:
diff changeset
    14
class Engine {
24
b81cb670e6b2 the great :retab
terom
parents: 23
diff changeset
    15
    private:
b81cb670e6b2 the great :retab
terom
parents: 23
diff changeset
    16
        // game state
b81cb670e6b2 the great :retab
terom
parents: 23
diff changeset
    17
        GameState game_state;
b81cb670e6b2 the great :retab
terom
parents: 23
diff changeset
    18
        
25
af75a1894a32 simple proto *almost* works
terom
parents: 24
diff changeset
    19
        // Graphics/Input
af75a1894a32 simple proto *almost* works
terom
parents: 24
diff changeset
    20
        Graphics *graphics;
af75a1894a32 simple proto *almost* works
terom
parents: 24
diff changeset
    21
24
b81cb670e6b2 the great :retab
terom
parents: 23
diff changeset
    22
        // network server/client
b81cb670e6b2 the great :retab
terom
parents: 23
diff changeset
    23
        NetworkServer *net_server;
b81cb670e6b2 the great :retab
terom
parents: 23
diff changeset
    24
        NetworkClient *net_client;
21
32c6cc55256a change proto2 network code to use CL_NetSession
terom
parents:
diff changeset
    25
24
b81cb670e6b2 the great :retab
terom
parents: 23
diff changeset
    26
        // to exit the mainloop
b81cb670e6b2 the great :retab
terom
parents: 23
diff changeset
    27
        bool is_running;
25
af75a1894a32 simple proto *almost* works
terom
parents: 24
diff changeset
    28
    
af75a1894a32 simple proto *almost* works
terom
parents: 24
diff changeset
    29
    public:    
24
b81cb670e6b2 the great :retab
terom
parents: 23
diff changeset
    30
        // default constructor
b81cb670e6b2 the great :retab
terom
parents: 23
diff changeset
    31
        Engine (void);
21
32c6cc55256a change proto2 network code to use CL_NetSession
terom
parents:
diff changeset
    32
25
af75a1894a32 simple proto *almost* works
terom
parents: 24
diff changeset
    33
        // setup graphics
af75a1894a32 simple proto *almost* works
terom
parents: 24
diff changeset
    34
        void setupGraphics (void);
24
b81cb670e6b2 the great :retab
terom
parents: 23
diff changeset
    35
        
25
af75a1894a32 simple proto *almost* works
terom
parents: 24
diff changeset
    36
        // set up network server/client
af75a1894a32 simple proto *almost* works
terom
parents: 24
diff changeset
    37
        // setting up both of these will lead to odd behaviour :)
af75a1894a32 simple proto *almost* works
terom
parents: 24
diff changeset
    38
        void setupNetworkServer (const std::string &listen_port);
af75a1894a32 simple proto *almost* works
terom
parents: 24
diff changeset
    39
        void setupNetworkClient (const std::string &connect_host, const std::string &connect_port);
58
a53f5ad69500 "working" singleplayer
terom
parents: 56
diff changeset
    40
		void setupSinglePlayer (void);
25
af75a1894a32 simple proto *almost* works
terom
parents: 24
diff changeset
    41
        
af75a1894a32 simple proto *almost* works
terom
parents: 24
diff changeset
    42
        // run the main loop
af75a1894a32 simple proto *almost* works
terom
parents: 24
diff changeset
    43
        void run (void);
af75a1894a32 simple proto *almost* works
terom
parents: 24
diff changeset
    44
af75a1894a32 simple proto *almost* works
terom
parents: 24
diff changeset
    45
        // terminate the main loop
af75a1894a32 simple proto *almost* works
terom
parents: 24
diff changeset
    46
        void stop (void);
af75a1894a32 simple proto *almost* works
terom
parents: 24
diff changeset
    47
af75a1894a32 simple proto *almost* works
terom
parents: 24
diff changeset
    48
    public:
af75a1894a32 simple proto *almost* works
terom
parents: 24
diff changeset
    49
        // logging utility
24
b81cb670e6b2 the great :retab
terom
parents: 23
diff changeset
    50
        static Logger log (enum LogLevel level, const char *type);
22
b70d30e1b0fe all the network code is now there, although it doesn't quite work
terom
parents: 21
diff changeset
    51
21
32c6cc55256a change proto2 network code to use CL_NetSession
terom
parents:
diff changeset
    52
};
23
8d802b573cf0 fixed more network code, there's actually a high probability of it working now
terom
parents: 22
diff changeset
    53
25
af75a1894a32 simple proto *almost* works
terom
parents: 24
diff changeset
    54
#endif /* ENGINE_HH */