source: trunk/MagicSoft/Mars/mgui/MineSweeper.h@ 1406

Last change on this file since 1406 was 1402, checked in by tbretz, 23 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 MGeomCam *fGeomCam; // pointer to camera geometry
22
23 UInt_t fNumPixels; // number of pixels in the present geometry
24 Int_t fNumBombs; // number of bombs in total
25 Float_t fRange; // the range in millimeters of the present geometry
26
27 TClonesArray *fPixels; // array of all hexagons
28 TClonesArray *fText; // array of all texts
29 TClonesArray *fFlags; // array of all texts
30
31 TText *fDone; // TText showing the 'Game over'
32 TText *fShow; // TText showing the numbers of pixels and bombs
33
34 Int_t fColorBombs[7]; // colors for the hexagons
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 kBlack = 1, // schwarz
44 kWhite = 10,
45 kHidden = 50,
46 kIsVisible = BIT(15),
47 kHasBomb = BIT(16),
48 kHasFlag = BIT(17)
49 };
50
51 TText *GetText(Int_t i) { return (TText*)fText->At(i); }
52 TMarker *GetFlag(Int_t i) { return (TMarker*)fFlags->At(i); }
53
54 MHexagon &operator[](int i) { return *((MHexagon*)fPixels->At(i)); }
55
56 void Paint(Option_t *option="");
57
58 void Remove(TObject *);
59 void OpenHexagon(Int_t idx);
60 void Done(TString, Int_t);
61 void Update(Int_t);
62 void SetNewCamera(MGeomCam *);
63 void DrawHexagons();
64 void Free();
65
66public:
67 MineSweeper();
68 ~MineSweeper();
69
70 virtual Int_t DistancetoPrimitive(Int_t px, Int_t py) { return 0; }
71 virtual void ExecuteEvent(Int_t event, Int_t px, Int_t py);
72
73 void ChangeCamera(); //*MENU*
74 void Reset(); //*MENU*
75
76 virtual void Draw(Option_t *option="");
77
78 ClassDef(MineSweeper, 0) // Magic Camera Games
79};
80
81#endif
Note: See TracBrowser for help on using the repository browser.