No puede seleccionar más de 25 temas
Los temas deben comenzar con una letra o número, pueden incluir guiones ('-') y pueden tener hasta 35 caracteres de largo.
93 líneas
2.1 KiB
93 líneas
2.1 KiB
/* VierGewinnt - A simple 4-in-a-row network game
|
|
*
|
|
* Copyright (c) 2008 by Sebastian Lohff, seba@seba-geek.de
|
|
* http://www.seba-geek.de
|
|
*
|
|
* This file is part of VierGewinnt.
|
|
*
|
|
* VierGewinnt is free software: you can redistribute it and/or modify
|
|
* it under the terms of the GNU General Public License as published by
|
|
* the Free Software Foundation, either version 2 of the License, or
|
|
* (at your option) any later version.
|
|
*
|
|
* VierGewinnt is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
* GNU General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU General Public License
|
|
* along with VierGewinnt. If not, see <http://www.gnu.org/licenses/>.
|
|
*/
|
|
|
|
#ifndef __VIERGEWINNT_H
|
|
#define __VIERGEWINNT_H
|
|
|
|
#include <QDialog>
|
|
#include <QWidget>
|
|
#include <QTcpSocket>
|
|
#include <QPushButton>
|
|
#include <QLCDNumber>
|
|
#include <QVBoxLayout>
|
|
#include <QHBoxLayout>
|
|
#include <QMessageBox>
|
|
#include <QLabel>
|
|
#include <QDebug>
|
|
#include <queue>
|
|
|
|
#include "newgame.h"
|
|
#include "playerwait.h"
|
|
|
|
class RenderArea;
|
|
|
|
class VierGewinntWidget : public QDialog {
|
|
Q_OBJECT
|
|
|
|
public:
|
|
VierGewinntWidget(QTcpSocket *tcpsock, QWidget *parent);
|
|
~VierGewinntWidget();
|
|
|
|
enum Stein {n=0, x, o};
|
|
|
|
void init(int _x, int _y);
|
|
void startGame();
|
|
void add(int row, Stein st);
|
|
void cleanFeld();
|
|
void setScore(int a, int b);
|
|
|
|
// called by networkstuff
|
|
void setTurn(bool _myturn);
|
|
void clientExited();
|
|
void ackAdd(bool valid);
|
|
void ackNewGame();
|
|
void newGame(bool won);
|
|
|
|
private slots:
|
|
void closeGame();
|
|
void netAdd(int row);
|
|
|
|
private:
|
|
void dealloc();
|
|
|
|
int fx, fy;
|
|
Stein **feld;
|
|
QTcpSocket *mysock;
|
|
bool myturn;
|
|
std::queue<int> pendingadd;
|
|
|
|
// guistuff
|
|
QVBoxLayout *layout;
|
|
QHBoxLayout *upperrow;
|
|
QHBoxLayout *underrow;
|
|
PlayerWaitDialog *waitforplayer;
|
|
NewGameDialog *newgame;
|
|
|
|
QLabel *status;
|
|
RenderArea *rarea;
|
|
QLCDNumber *myscore;
|
|
QLabel *vs;
|
|
QLCDNumber *youscore;
|
|
QPushButton *exit;
|
|
};
|
|
|
|
#endif
|