source: trunk/MagicSoft/Mars/mtools/MagicReversi.h@ 3191

Last change on this file since 3191 was 1907, checked in by tbretz, 22 years ago
*** empty log message ***
File size: 2.5 KB
Line 
1#ifndef MARS_MagicReversi
2#define MARS_MagicReversi
3
4#ifndef MARS_MAGIC
5#include "MAGIC.h"
6#endif
7#ifndef ROOT_TClonesArray
8#include <TClonesArray.h>
9#endif
10
11class TText;
12class TMarker;
13class TVirtualPad;
14
15class MGeomCam;
16class MHexagon;
17
18class MagicReversi : public TObject
19{
20private:
21 enum {
22 kRightTop,
23 kRight,
24 kRightBottom,
25 kLeftBottom,
26 kLeft,
27 kLeftTop
28 };
29// static const Int_t fColorBombs[7]; // colors for the hexagons
30
31 MGeomCam *fGeomCam; // pointer to camera geometry
32
33 UInt_t fNumPixels; // number of pixels in the present geometry
34 Float_t fRange; // the range in millimeters of the present geometry
35
36 TClonesArray *fPixels; // array of all hexagons
37 TClonesArray *fText; // array of all texts
38 TClonesArray *fFlags; // array of all texts
39
40 TText *fDone; // TText showing the 'Game over'
41 TText *fUsrTxt[6]; // TText showing the numbers of pixels and bombs
42
43 UInt_t fW; // Width of canvas
44 UInt_t fH; // Height of canvas
45 TVirtualPad *fDrawingPad; // pad in which we are drawing
46 Bool_t fIsAllocated;
47
48 Int_t fNumUsers;
49 Int_t fNumUser;
50 Int_t fUsrPts[6];
51
52 enum
53 {
54 kEmpty = 50,
55 kIsVisible = BIT(16),
56 kHasBomb = BIT(17),
57 kHasFlag = BIT(18),
58 kUserBits = 0x7fc000 // 14-23 are allowed
59 };
60
61 MHexagon &operator[](int i) { return *((MHexagon*)fPixels->At(i)); }
62
63 TText *GetText(Int_t i) { return (TText*)fText->At(i); }
64 TMarker *GetFlag(Int_t i) { return (TMarker*)fFlags->At(i); }
65
66 void Remove(TObject *);
67 void Done();
68 void Update();
69 void SetNewCamera(MGeomCam *);
70 void DrawHexagons();
71 void Free();
72
73 Bool_t Flip(Int_t idx, Bool_t flip);
74 Int_t GetDirection(Int_t src, Int_t dst) const;
75 Int_t GetNeighbor(Int_t idx, Int_t dir) const;
76 Bool_t CheckMoves();
77
78 void Paint(Option_t *option="");
79 void Draw(Option_t *option="");
80 void ExecuteEvent(Int_t event, Int_t px, Int_t py);
81 Int_t DistancetoPrimitive(Int_t px, Int_t py) { return 0; }
82
83public:
84 MagicReversi();
85 ~MagicReversi();
86
87 void Reset(); //*MENU*
88 void ChangeCamera(); //*MENU*
89 void TwoPlayer(); //*MENU*
90 void ThreePlayer(); //*MENU*
91 void FourPlayer(); //*MENU*
92 void FivePlayer(); //*MENU*
93 void SixPlayer(); //*MENU*
94
95 ClassDef(MagicReversi, 0) // Magic Camera Games: Reversi
96};
97
98#endif
Note: See TracBrowser for help on using the repository browser.