You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
tdegames/q15/src/gameboard.h

77 lines
1.2 KiB

/*
* $Id: gameboard.h,v 0.1 2005/08/14 12:10:05 denis Exp $
*
* Author: Denis Kozadaev (denis@tambov.ru)
* Description:
*
* See also: style(9)
*
* Hacked by:
*/
#ifndef __GAME_BOARD_H__
#define __GAME_BOARD_H__
#include <stdlib.h>
#include <ntqwidget.h>
#include <ntqlabel.h>
#include <ntqpixmap.h>
#include <ntqtimer.h>
class BoardItem:public TQLabel
{
public:
BoardItem(int, TQWidget *parent = NULL, const char *name = NULL);
~BoardItem();
int item()const{return (num);}
private:
int num;
protected:
void paintEvent(TQPaintEvent *);
};
//------------------------------------------------------------------------------
class GameBoard:public TQWidget
{
Q_OBJECT
public:
GameBoard(TQWidget *parent = NULL, const char *name = NULL);
~GameBoard();
void newGame();
void loadImage();
private:
int n, nt, xt, yt, dx, dy;
BoardItem *map[16];
TQTimer *tmr;
TQPixmap origin;
void initMap();
void startMoving(int, int);
void checkEndGame();
void newTask();
int index(int, int);
int mayMove(int);
int step(int, int);
int sign(int);
protected:
void resizeEvent(TQResizeEvent *);
void mousePressEvent(TQMouseEvent *);
private slots:
void moveItem();
};
#endif /* __GAME_BOARD_H__ */