summaryrefslogtreecommitdiffstats
path: root/knights/board_base.h
blob: a09630921b2d10167f7f82860754ea4f1674a90f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
/***************************************************************************
                          board_base.h  -  description
                             -------------------
    begin                : Fri Feb 28 2003
    copyright            : (C) 2003 by The Knights Project
    email                : knights-general@lists.sourceforge.net
 ***************************************************************************/

/***************************************************************************
 *                                                                         *
 *   This program 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.                                   *
 *                                                                         *
 ***************************************************************************/

#ifndef BOARD_BASE_H
#define BOARD_BASE_H

#include <stdlib.h>
#include <tqwidget.h>
#include "definitions.h"

/**
  *@author The Knights Project
  */

class resource;
class logic;

class board_base : public TQWidget
{
	Q_OBJECT
  

	public: 
											board_base(TQWidget *parent=0, const char *name=0, resource *Rsrc=0, logic *Lgc=0);
		virtual						~board_base();
		virtual void			drawMove( const ChessMove &chessMove, const bool &reverse=FALSE );
		virtual void			setPremovePositions( const int&, const int& );
		virtual void			redrawLights( void );

	public slots:
		virtual void 			resizeBoard( void );
		virtual void			redrawAll( void );
		virtual void			setPaused( const bool& );
		virtual void			setLocalArmy( const bool& );
		virtual void			drawPosition( const int& );
		virtual void			commit( void );
		void							flipBoard( void );

	signals:
		void							leftClick( int );
		void							rightClick( int );

	protected:
		resource					*myResource;
		logic							*myLogic;
		bool							paused;
		bool							localArmy;
		bool							flip;

	protected:
		inline bool				color( const int &rank, const int &file )
														{ return abs( ( rank % 2 ) - ( file % 2 ) ); }
};

#endif