source: trunk/MagicSoft/Mars/mtools/MineSweeper.h@ 9366

Last change on this file since 9366 was 8755, checked in by tbretz, 17 years ago
*** empty log message ***
File size: 2.2 KB
Line 
1#ifndef MARS_MineSweeper
2#define MARS_MineSweeper
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 MineSweeper : public TObject
19{
20private:
21 static const Int_t fColorBombs[7]; // colors for the hexagons
22
23 MGeomCam *fGeomCam; // pointer to camera geometry
24
25 UInt_t fNumPixels; // number of pixels in the present geometry
26 Int_t fNumBombs; // number of bombs in total
27 Float_t fRange; // the range in millimeters of the present geometry
28
29 TClonesArray *fPixels; // array of all hexagons
30 TClonesArray *fText; // array of all texts
31 TClonesArray *fFlags; // array of all texts
32
33 TText *fDone; // TText showing the 'Game over'
34 TText *fShow; // TText showing the numbers of pixels and bombs
35
36 UInt_t fW; // Width of canvas
37 UInt_t fH; // Height of canvas
38 TVirtualPad *fDrawingPad; // pad in which we are drawing
39 Bool_t fIsAllocated;
40
41 enum
42 {
43 kHidden = 50,
44 kIsVisible = BIT(16),
45 kHasBomb = BIT(17),
46 kHasFlag = BIT(18),
47 kUserBits = 0x7fc000 // 14-23 are allowed
48 };
49
50 MHexagon &operator[](int i) { return *((MHexagon*)fPixels->At(i)); }
51
52 TText *GetText(Int_t i) { return (TText*)fText->At(i); }
53 TMarker *GetFlag(Int_t i) { return (TMarker*)fFlags->At(i); }
54
55 void Remove(TObject *);
56 void OpenHexagon(Int_t idx);
57 void Done(TString, Int_t);
58 void Update(Int_t);
59 void SetNewCamera(MGeomCam *);
60 void DrawHexagons();
61 void Free();
62 void Init();
63
64 void Paint(Option_t *option="");
65 void Draw(Option_t *option="");
66 void ExecuteEvent(Int_t event, Int_t px, Int_t py);
67 Int_t DistancetoPrimitive(Int_t px, Int_t py) { return 0; }
68
69public:
70 MineSweeper();
71 MineSweeper(const MGeomCam &geom);
72 ~MineSweeper();
73
74 void Reset(); //*MENU*
75 void ChangeCamera(); //*MENU*
76
77 ClassDef(MineSweeper, 0) // Magic Camera Games: Mine Sweeper
78};
79
80#endif
Note: See TracBrowser for help on using the repository browser.