5 ** Copyright (C) 1998 Kurt Van den Branden
7 ** This program is free software; you can redistribute it and/or modify
8 ** it under the terms of the GNU General Public License as published by
9 ** the Free Software Foundation; either version 2 of the License, or
10 ** (at your option) any later version.
12 ** This program is distributed in the hope that it will be useful,
13 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
14 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 ** GNU General Public License for more details.
17 ** You should have received a copy of the GNU General Public License
18 ** along with this program; if not, write to the Free Software
19 ** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
23 #define _fl_board_h_ 1
25 #include <FL/Fl_Widget.H>
26 #include <FL/Fl_Output.H>
27 #include <FL/Fl_Return_Button.H>
38 const int FL_DAMAGE_ANIM
= 0x10;
40 class fl_board
: public Fl_Widget
{
42 board
* theboard
; // the most important
43 ::position
* from
; // from-::position for a new move
44 ::position
* to
; // to-::position for a new move
45 listheader
* row
; // list of pieces when removing a row
46 int fromtype
; // type of piece a player wants to move
47 int gipfpossible
; // flag to show if a player can enter a gipf-piece
48 int state
; // BOARD_EDIT, BOARD_PLAY, BOARD_NONE
49 char editpiece
; // piece to add when editing a board
51 int xoffset
; // variables for drawing
54 uchar lyellow
; // save the color-index
56 int positionhints
; // set to 1 to show the ::position names on the board
57 ::position
* showpos
; // variables for showing at what
58 int showflag
; // ::position the mouse is situated
60 listheader
* animlist
; // variables for move-animation
63 int clip_x
, clip_y
, clip_w
, clip_h
;
75 Fl_Return_Button
* execbutton
;
78 inline void pos2coor (const ::position
*, int&, int&);
79 void changecountervalues ();
80 void changefromtovalues ();
82 void drawpiece (::position
*, char);
83 void drawpiece (int, int, char);
84 void drawcross (int, int);
89 ::position
* getmousepos ();
90 void drawanimpieces (void);
91 void calc_clipping (void );
97 fl_board (int, int, int, int, const char * = 0);
100 void resize (int, int, int, int);
101 void setoutputwidgets (Fl_Output
*, Fl_Output
*, fl_pile
*,
102 Fl_Output
*, Fl_Output
*, fl_pile
*,
103 Fl_Output
*, Fl_Output
*);
104 void setexecbutton (Fl_Return_Button
* rbutton
)
105 { execbutton
= rbutton
; };
106 void setboard (board
*);
107 void setfrom (const ::position
*);
108 void setto (const ::position
*);
109 void setrow (listheader
*);
110 void seteditpiece (char);
111 int setlostwhite (int);
112 int setlostblack (int);
114 void setgipfpossible (int flag
);
115 void showmousepos ();
116 void setshowposname (int value
) { positionhints
= value
; };
118 board
* getboard (void) { return (theboard
); };
119 ::position
* getfrom (void) { return (from
); };
120 ::position
* getto (void) { return (to
); };
121 int getptype (void) { return (fromtype
); };
123 void initanim (int st
, listheader
* al
);
124 void animstep (int st
) { step
= st
; damage (FL_DAMAGE_ANIM
); };