1/***************************************************************************
2* KBlocks, a falling blocks game for KDE *
3* Copyright (C) 2010 Zhongjie Cai <squall.leonhart.cai@gmail.com> *
4* *
5* This program is free software; you can redistribute it and/or modify *
6* it under the terms of the GNU General Public License as published by *
7* the Free Software Foundation; either version 2 of the License, or *
8* (at your option) any later version. *
9***************************************************************************/
10#ifndef KBLOCKSNETPLAYER_H
11#define KBLOCKSNETPLAYER_H
12
13#include "KBlocksNetClient.h"
14#include "KBlocksSingleGame.h"
15#include "GamePlayerInterface.h"
16
17class KBlocksNetPlayer
18{
19 public:
20 KBlocksNetPlayer(GamePlayerInterface * player, const string& serverIP, int localPort);
21 ~KBlocksNetPlayer();
22
23 public:
24 void joinGame(int gameIndex);
25 void quitGame();
26
27 void startGame(KBlocksSingleGame * p);
28 void stopGame();
29
30 bool execute();
31
32 private:
33 int formIntFromByte(char * data);
34
35 private:
36 GamePlayerInterface* mpPlayer;
37 KBlocksSingleGame* mpGame;
38 KBlocksNetClient* mpNetClient;
39
40 int mSendLength;
41
42 GamePlayer_ActionList mActionList;
43};
44
45#endif
46
47