Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/network/src/network/Client.h @ 917

Last change on this file since 917 was 917, checked in by rgrieder, 16 years ago
  • merged all changes in the input branch into this one
  • moved Tickable to core (would have created circular library dependencies)
  • exported OrxListener to a separate file, soon to be deleted
changed
, &&, XOR back to or, and, xor because I found the necessary include file for VC++
  • created abortRequest() in Orxonox.cc to call for a smooth end of the game (an alternative would be to make tick() return a boolean, like it is with frameStarted())
File size: 1.4 KB
Line 
1//
2// C++ Interface: Client
3//
4// Description:
5//
6//
7// Author:  Oliver Scheuss, (C) 2007
8//
9// Copyright: See COPYING file that comes with this distribution
10//
11//
12
13#ifndef _Client_H__
14#define _Client_H__
15
16#include <string>
17
18#include "core/Tickable.h"
19
20#include "NetworkPrereqs.h"
21#include "ClientConnection.h"
22#include "PacketManager.h"
23#include "GameStateClient.h"
24//#include "NetworkFrameListener.h"
25
26
27
28namespace network
29{
30  /**
31  network::Client *client;
32  * The network/Client class
33  * This class implements all necessary function for the network communication
34  * It is the root class of the network module
35  *
36  */
37  class _NetworkExport Client : PacketDecoder, public orxonox::Tickable{
38  public:
39    Client();
40    Client(std::string address, int port);
41    Client(const char *address, int port);
42
43    bool establishConnection();
44    bool closeConnection();
45
46    bool sendMouse(double x, double y);
47    bool sendKeyboard(char key_code);
48    bool sendChat( std::string message );
49
50    bool addMouse(double x, double y);
51    bool addKeyboard(char key_code);
52
53    bool sendPackets();
54
55    void tick(float time);
56
57  private:
58    ClientConnection client_connection;
59    PacketGenerator pck_gen;
60    GameStateClient gamestate;
61    bool isConnected;
62
63    // implement data processing functions of PacketDecoder
64    void processGamestate( GameStateCompressed *data);
65    void processClassid(classid *clid);
66    void processChat( chat *data);
67  };
68
69
70}
71
72#endif /* _Client_H__ */
Note: See TracBrowser for help on using the repository browser.