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

Last change on this file since 6724 was 1907, checked in by tbretz, 22 years ago
*** empty log message ***
File size: 2.1 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
63 void Paint(Option_t *option="");
64 void Draw(Option_t *option="");
65 void ExecuteEvent(Int_t event, Int_t px, Int_t py);
66 Int_t DistancetoPrimitive(Int_t px, Int_t py) { return 0; }
67
68public:
69 MineSweeper();
70 ~MineSweeper();
71
72 void Reset(); //*MENU*
73 void ChangeCamera(); //*MENU*
74
75 ClassDef(MineSweeper, 0) // Magic Camera Games: Mine Sweeper
76};
77
78#endif
Note: See TracBrowser for help on using the repository browser.