kgameprocess.h
00001 /* 00002 This file is part of the TDE games library 00003 Copyright (C) 2001 Martin Heni (martin@heni-online.de) 00004 Copyright (C) 2001 Andreas Beckermann (b_mann@gmx.de) 00005 00006 This library is free software; you can redistribute it and/or 00007 modify it under the terms of the GNU Library General Public 00008 License version 2 as published by the Free Software Foundation. 00009 00010 This library is distributed in the hope that it will be useful, 00011 but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00013 Library General Public License for more details. 00014 00015 You should have received a copy of the GNU Library General Public License 00016 along with this library; see the file COPYING.LIB. If not, write to 00017 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 00018 Boston, MA 02110-1301, USA. 00019 */ 00020 /* 00021 $Id$ 00022 */ 00023 #ifndef __KGAMEPROCESS_H_ 00024 #define __KGAMEPROCESS_H_ 00025 00026 #include <tqstring.h> 00027 #include <tqobject.h> 00028 #include <tqfile.h> 00029 00030 #include "kgameproperty.h" 00031 #include <krandomsequence.h> 00032 #include <kdemacros.h> 00033 class KPlayer; 00034 class KMessageFilePipe; 00035 00042 class KDE_EXPORT KGameProcess: public TQObject 00043 { 00044 Q_OBJECT 00045 00046 00047 public: 00074 KGameProcess(); 00078 ~KGameProcess(); 00079 00084 bool exec(int argc, char *argv[]); 00085 00092 bool terminate() const {return mTerminate;} 00093 00100 void setTerminate(bool b) {mTerminate=b;} 00101 00111 void sendMessage(TQDataStream &stream,int msgid,TQ_UINT32 receiver=0); 00112 00132 void sendSystemMessage(TQDataStream &stream,int msgid,TQ_UINT32 receiver=0); 00133 00143 KRandomSequence *random() {return mRandom;} 00144 00145 protected: 00150 void processArgs(int argc, char *argv[]); 00151 00152 protected slots: 00157 void receivedMessage(const TQByteArray& receiveBuffer); 00158 00159 signals: 00181 void signalCommand(TQDataStream &inputStream,int msgid,int receiver,int sender); 00182 00220 void signalTurn(TQDataStream &stream,bool turn); 00221 00233 void signalInit(TQDataStream &stream,int userid); 00234 00235 protected: 00236 bool mTerminate; 00237 KMessageFilePipe *mMessageIO; 00238 private: 00239 TQFile rFile; 00240 TQFile wFile; 00241 KRandomSequence* mRandom; 00242 }; 00243 #endif