Walls And Holes  1
abstractshapebrushtool.h
Go to the documentation of this file.
1 #ifndef ABSTRACTSHAPEBRUSHTOOL_H
2 #define ABSTRACTSHAPEBRUSHTOOL_H
3 
4 #include <QVector>
5 #include <QPoint>
6 #include <QUndoStack>
7 
8 #include "array2d.h"
9 #include "abstracttilemaptool.h"
10 #include "tilemap.h"
11 #include "tiletemplate.h"
12 #include "mapview.h"
14 
16 {
17 public:
18  AbstractShapeBrushTool(TileMapPreviewGraphicsItem *previewItem, QUndoStack *undoStack);
19 
20  void cellClicked(int x, int y, QMouseEvent *) override;
21  void cellActivated(int x, int y, QMouseEvent *) override;
22  void cellReleased(int x, int y, QMouseEvent *) override;
23 
24  void deactivate() override;
25 
38  virtual QRegion getShape(QPoint start, QPoint end) const = 0;
39 
40 private:
41  int mStartX;
42  int mStartY;
43 
45  MapView *mMapView;
46 
48  QUndoStack *mUndoStack;
49 
51  void drawOverlay(int endX, int endY);
52 
54  void clearOverlay();
55 
57  void placeShape(int endX, int endY);
58 };
59 
60 #endif // ABSTRACTSHAPEBRUSHTOOL_H
void deactivate() override
Deactivates the tool. This is called before the tool stops being used.
Definition: abstractshapebrushtool.cpp:28
virtual QRegion getShape(QPoint start, QPoint end) const =0
This function should output a QVector of points that should be filled in.
AbstractShapeBrushTool(TileMapPreviewGraphicsItem *previewItem, QUndoStack *undoStack)
Definition: abstractshapebrushtool.cpp:3
Definition: abstracttilemaptool.h:9
void cellActivated(int x, int y, QMouseEvent *) override
Called when the left mouse button is down over a new cell.
Definition: abstractshapebrushtool.cpp:16
void cellClicked(int x, int y, QMouseEvent *) override
Called the first time the left mouse button is pressed over a cell.
Definition: abstractshapebrushtool.cpp:7
void cellReleased(int x, int y, QMouseEvent *) override
Called when the left mouse button is released over a cell.
Definition: abstractshapebrushtool.cpp:22
Definition: abstractshapebrushtool.h:15
The MapView class Handles display of TileMap.
Definition: mapview.h:20
Definition: tilemappreviewgraphicsitem.h:9