source: trunk/MagicSoft/Mars/mtools/MagicDomino.h@ 1440

Last change on this file since 1440 was 1440, checked in by tbretz, 22 years ago
*** empty log message ***
File size: 2.7 KB
Line 
1#ifndef MARS_MagicDomino
2#define MARS_MagicDomino
3
4#ifndef MARS_MAGIC
5#include "MAGIC.h"
6#endif
7
8#ifndef ROOT_TText
9#include <TText.h>
10#endif
11#ifndef ROOT_TClonesArray
12#include <TClonesArray.h>
13#endif
14
15class TMarker;
16class TVirtualPad;
17
18class MGeomCam;
19class MHexagon;
20
21class MagicDomino : public TObject
22{
23private:
24 enum
25 {
26 kBackground = 50,
27 kIsTile = BIT(16),
28 kRight = BIT(17),
29 kLeft = BIT(18),
30 kTop = BIT(19),
31 kBottom = BIT(20),
32 kUserBits = 0x7fc000, // 14-23 are allowed
33
34 kBottomLeft = kBottom|kLeft,
35 kBottomRight = kBottom|kRight,
36 kTopLeft = kTop|kLeft,
37 kTopRight = kTop|kRight
38
39 };
40
41 MGeomCam *fGeomCam; // pointer to camera geometry
42
43 UShort_t fNumPixels; // number of pixels in the present geometry
44 Short_t fNumPixel; // number of actual pixel
45 Int_t fNumTile; // number of setteled tiles
46 Float_t fRange; // the range in millimeters of the present geometry
47
48 Int_t fPoints; // points you got
49
50 Int_t fDir; // direction you move the tile
51
52 Int_t fOldColors[7]; // colors of hexagons which are under the tile
53 Int_t fNewColors[6]; // colors of the tile itself
54 Byte_t fPosition; // rotation position of colors in tile
55 Byte_t fSkipped; // number of skipped tiles
56
57 TText fDomino; // TText showing status informations
58 TText *fText[6]; // ttext showing the six numbers in the tile
59 TText *fDone; // game over text
60
61 UInt_t fW; // Width of canvas
62 UInt_t fH; // Height of canvas
63
64 TClonesArray *fPixels; // array of all hexagons
65 TVirtualPad *fDrawingPad; // pad in which we are drawing
66
67 MHexagon &operator[](int i) { return *((MHexagon*)fPixels->At(i)); }
68
69 Bool_t CheckTile();
70 void NewTile();
71 void NewColors();
72 void HideTile();
73 void ShowTile();
74 void RotateTile(Int_t add);
75 void Update();
76 void Free();
77 void Done();
78 void RemoveNumbers();
79 void DrawHexagons();
80 void SetNewCamera(MGeomCam *);
81 void ChangePixel(Int_t add);
82 void Step(Int_t dir);
83 Short_t AnalysePixel(Int_t dir);
84 void GetSortedNeighbors(Int_t indices[6]);
85
86 void Draw(Option_t *option="");
87 void Paint(Option_t *option="");
88 void ExecuteEvent(Int_t event, Int_t px, Int_t py);
89 Int_t DistancetoPrimitive(Int_t px, Int_t py) { return 0; }
90
91public:
92 MagicDomino();
93 ~MagicDomino();
94
95 void Reset(); //*MENU*
96 void ChangeCamera(); //*MENU*
97
98 ClassDef(MagicDomino, 0) // Tool to visualize next neighbours
99};
100
101#endif
Note: See TracBrowser for help on using the repository browser.