(Temporarily) set "animate" to "none" by default (broken feature).
[gf1.git] / fl_board.h
blob884fb8905be08ecb2344fa1431f90a6c1db58a00
1 /*
2 ** $Id$
3 */
4 /*
5 ** Copyright (C) 1998 Kurt Van den Branden
6 **
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.
11 **
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.
16 **
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.
22 #ifndef _fl_board_h_
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>
28 #include "board.h"
29 #include "linklist.h"
30 #include "fl_pile.h"
32 enum {
33 BOARD_EDIT,
34 BOARD_PLAY,
35 BOARD_NONE
38 const int FL_DAMAGE_ANIM = 0x10;
40 class fl_board : public Fl_Widget {
41 private:
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
52 int yoffset;
53 int base;
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
61 int maxstep;
62 int step;
63 int clip_x, clip_y, clip_w, clip_h;
65 Fl_Output * wpieces;
66 Fl_Output * wlost;
67 fl_pile * wpile;
68 Fl_Output * bpieces;
69 Fl_Output * blost;
70 fl_pile * bpile;
72 Fl_Output * t_from;
73 Fl_Output * t_to;
75 Fl_Return_Button * execbutton;
77 void calcsizes ();
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);
86 int checkfrompush ();
87 int checktopush ();
88 int checkeditpush ();
89 ::position * getmousepos ();
90 void drawanimpieces (void);
91 void calc_clipping (void );
93 protected:
94 void draw();
96 public:
97 fl_board (int, int, int, int, const char * = 0);
98 virtual ~fl_board();
99 int handle (int);
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);
113 void setstate (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); };
127 #endif