#ifndef MAPVIEW_H #define MAPVIEW_H #include #include #include "scenelayer.h" #include "../lib/int3.h" class CGObjectInstance; class MainWindow; class MapController; class MapSceneBase : public QGraphicsScene { public: MapSceneBase(int lvl); const int level; virtual void updateViews(); virtual void initialize(MapController &); protected: virtual std::list getAbstractLayers() = 0; }; class MinimapScene : public MapSceneBase { public: MinimapScene(int lvl); void updateViews() override; MinimapLayer minimapView; protected: virtual std::list getAbstractLayers(); }; class MapScene : public MapSceneBase { public: MapScene(int lvl); void updateViews() override; GridLayer gridView; PassabilityLayer passabilityView; SelectionTerrainLayer selectionTerrainView; TerrainLayer terrainView; ObjectsLayer objectsView; SelectionObjectsLayer selectionObjectsView; protected: std::list getAbstractLayers() override; }; class MapView : public QGraphicsView { Q_OBJECT public: enum class SelectionTool { None, Brush, Brush2, Brush4, Area, Lasso }; public: MapView(QWidget * parent); void setController(MapController *); SelectionTool selectionTool; public slots: void mouseMoveEvent(QMouseEvent * mouseEvent) override; void mousePressEvent(QMouseEvent *event) override; void mouseReleaseEvent(QMouseEvent *event) override; signals: void openObjectProperties(CGObjectInstance *); private: MapController * controller = nullptr; QPointF mouseStart; int3 tileStart; int3 tilePrev; bool pressedOnSelected; }; class MinimapView : public QGraphicsView { Q_OBJECT public: MinimapView(QWidget * parent); void setController(MapController *); void dimensions(); public slots: void mousePressEvent(QMouseEvent *event) override; void cameraPositionChange(const QPoint & newPosition); signals: void cameraPositionChanged(const QPoint & newPosition); private: MapController * controller = nullptr; int displayWidth = 192; int displayHeight = 192; }; #endif // MAPVIEW_H