| 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 | #ifndef ROOT_TArrayI | 
|---|
| 11 | #include <TArrayI.h> | 
|---|
| 12 | #endif | 
|---|
| 13 |  | 
|---|
| 14 | class TText; | 
|---|
| 15 | class TMarker; | 
|---|
| 16 | class TVirtualPad; | 
|---|
| 17 |  | 
|---|
| 18 | class MGeom; | 
|---|
| 19 | class MGeomCam; | 
|---|
| 20 | class MHexagon; | 
|---|
| 21 |  | 
|---|
| 22 | class MineSweeper : public TObject | 
|---|
| 23 | { | 
|---|
| 24 | private: | 
|---|
| 25 | static const Int_t fColorBombs[7]; // colors for the hexagons | 
|---|
| 26 |  | 
|---|
| 27 | MGeomCam      *fGeomCam;       // pointer to camera geometry | 
|---|
| 28 |  | 
|---|
| 29 | UInt_t         fNumPixels;     // number of pixels in the present geometry | 
|---|
| 30 | Int_t          fNumBombs;      // number of bombs in total | 
|---|
| 31 | Float_t        fRange;         // the range in millimeters of the present geometry | 
|---|
| 32 |  | 
|---|
| 33 | TClonesArray  *fText;          // array of all texts | 
|---|
| 34 | TClonesArray  *fFlags;         // array of all texts | 
|---|
| 35 |  | 
|---|
| 36 | TArrayI fColors; | 
|---|
| 37 |  | 
|---|
| 38 | TText         *fDone;          // TText showing the 'Game over' | 
|---|
| 39 | TText         *fShow;          // TText showing the numbers of pixels and bombs | 
|---|
| 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 | TText   *GetText(Int_t i) { return (TText*)fText->At(i); } | 
|---|
| 51 | TMarker *GetFlag(Int_t i) { return (TMarker*)fFlags->At(i); } | 
|---|
| 52 |  | 
|---|
| 53 | void  OpenHexagon(Int_t idx); | 
|---|
| 54 | void  Done(TString, Int_t); | 
|---|
| 55 | void  Update(Int_t); | 
|---|
| 56 | void  SetNewCamera(MGeomCam *); | 
|---|
| 57 | void  PaintPrimitives(); | 
|---|
| 58 | void  Free(); | 
|---|
| 59 | void  Init(); | 
|---|
| 60 |  | 
|---|
| 61 | void  Paint(Option_t *option=""); | 
|---|
| 62 | void  Draw(Option_t *option=""); | 
|---|
| 63 | void  ExecuteEvent(Int_t event, Int_t px, Int_t py); | 
|---|
| 64 | Int_t DistancetoPrimitive(Int_t px, Int_t py) { return 0; } | 
|---|
| 65 |  | 
|---|
| 66 | public: | 
|---|
| 67 | MineSweeper(); | 
|---|
| 68 | MineSweeper(const MGeomCam &geom); | 
|---|
| 69 | ~MineSweeper(); | 
|---|
| 70 |  | 
|---|
| 71 | void Reset();        //*MENU* | 
|---|
| 72 | void ChangeCamera(); //*MENU* | 
|---|
| 73 |  | 
|---|
| 74 | ClassDef(MineSweeper, 0) // Magic Camera Games: Mine Sweeper | 
|---|
| 75 | }; | 
|---|
| 76 |  | 
|---|
| 77 | #endif | 
|---|