Last change
on this file since 376 was
369,
checked in by scheusso, 17 years ago
|
PacketDecoder:
Extended Class to make inheriting easier…
-added virtual function, that can be implemented by lower classes
Client:
Added some function, changed some things (input, gamestate, connectionhandling)
Server:
same as client
|
File size:
1.1 KB
|
Rev | Line | |
---|
[229] | 1 | // |
---|
| 2 | // C++ Interface: Client |
---|
| 3 | // |
---|
[285] | 4 | // Description: |
---|
[229] | 5 | // |
---|
| 6 | // |
---|
[230] | 7 | // Author: Oliver Scheuss, (C) 2007 |
---|
[229] | 8 | // |
---|
| 9 | // Copyright: See COPYING file that comes with this distribution |
---|
| 10 | // |
---|
| 11 | // |
---|
| 12 | |
---|
| 13 | #ifndef NETWORK_CLIENT_H |
---|
| 14 | #define NETWORK_CLIENT_H |
---|
| 15 | |
---|
| 16 | #include <string> |
---|
| 17 | |
---|
[285] | 18 | #include "ClientConnection.h" |
---|
| 19 | #include "PacketManager.h" |
---|
[369] | 20 | #include "GameStateManager.h" |
---|
[229] | 21 | |
---|
| 22 | |
---|
| 23 | namespace network{ |
---|
| 24 | |
---|
| 25 | /** |
---|
| 26 | * The network/Client class |
---|
| 27 | * This class implements all necessary function for the network communication |
---|
| 28 | * It is the root class of the network module |
---|
[285] | 29 | * |
---|
[229] | 30 | */ |
---|
| 31 | class Client : PacketDecoder{ |
---|
| 32 | public: |
---|
| 33 | Client(); |
---|
| 34 | Client(std::string address, int port); |
---|
| 35 | Client(const char *address, int port); |
---|
[285] | 36 | |
---|
[229] | 37 | bool establishConnection(); |
---|
| 38 | bool closeConnection(); |
---|
[285] | 39 | |
---|
[229] | 40 | bool sendMouse(double x, double y); |
---|
| 41 | bool sendKeyboard(char key_code); |
---|
[285] | 42 | |
---|
[229] | 43 | bool addMouse(double x, double y); |
---|
| 44 | bool addKeyboard(char key_code); |
---|
[285] | 45 | |
---|
[369] | 46 | bool sendPackets(); |
---|
| 47 | |
---|
[229] | 48 | void update(); |
---|
[285] | 49 | |
---|
[229] | 50 | private: |
---|
| 51 | ClientConnection client_connection; |
---|
| 52 | PacketGenerator pck_gen; |
---|
[369] | 53 | GameStateManager gamestate; |
---|
[229] | 54 | bool isConnected; |
---|
[369] | 55 | |
---|
| 56 | // implement data processing functions of PacketDecoder |
---|
| 57 | void processGamestate( GameState *data); |
---|
[229] | 58 | }; |
---|
| 59 | |
---|
| 60 | } |
---|
| 61 | |
---|
| 62 | #endif |
---|
Note: See
TracBrowser
for help on using the repository browser.