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

Last change on this file since 9029 was 8756, checked in by tbretz, 17 years ago
*** empty log message ***
File size: 2.3 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 MGeomCam *fGeomCam; // pointer to camera geometry
22
23 UInt_t fNumPixels; // number of pixels in the present geometry
24 Float_t fRange; // the range in millimeters of the present geometry
25
26 TClonesArray *fPixels; // array of all hexagons
27 TClonesArray *fText; // array of all texts
28 TClonesArray *fFlags; // array of all texts
29
30 TText *fDone; // TText showing the 'Game over'
31 TText *fUsrTxt[6]; // TText showing the numbers of pixels and bombs
32
33 UInt_t fW; // Width of canvas
34 UInt_t fH; // Height of canvas
35 TVirtualPad *fDrawingPad; // pad in which we are drawing
36 Bool_t fIsAllocated;
37
38 Int_t fNumUsers;
39 Int_t fNumUser;
40 Int_t fUsrPts[6];
41
42 enum
43 {
44 kEmpty = 50,
45 kIsVisible = BIT(16),
46 kHasBomb = BIT(17),
47 kHasFlag = BIT(18),
48 kUserBits = 0x7fc000 // 14-23 are allowed
49 };
50
51 MHexagon &operator[](int i) { return *((MHexagon*)fPixels->At(i)); }
52
53 TText *GetText(Int_t i) { return (TText*)fText->At(i); }
54 TMarker *GetFlag(Int_t i) { return (TMarker*)fFlags->At(i); }
55
56 void Remove(TObject *);
57 void Done();
58 void Update();
59 void SetNewCamera(MGeomCam *);
60 void DrawHexagons();
61 void Free();
62 void Init();
63
64 Bool_t Flip(Int_t idx, Bool_t flip);
65 Bool_t CheckMoves();
66
67 void Paint(Option_t *option="");
68 void Draw(Option_t *option="");
69 void ExecuteEvent(Int_t event, Int_t px, Int_t py);
70 Int_t DistancetoPrimitive(Int_t px, Int_t py) { return 0; }
71
72public:
73 MagicReversi();
74 MagicReversi(const MGeomCam &geom);
75 ~MagicReversi();
76
77 void Reset(); //*MENU*
78 void ChangeCamera(); //*MENU*
79 void TwoPlayer(); //*MENU*
80 void ThreePlayer(); //*MENU*
81 void FourPlayer(); //*MENU*
82 void FivePlayer(); //*MENU*
83 void SixPlayer(); //*MENU*
84
85 ClassDef(MagicReversi, 0) // Magic Camera Games: Reversi
86};
87
88#endif
Note: See TracBrowser for help on using the repository browser.