Skip to content
Snippets Groups Projects
Select Git revision
  • 01397d5f0246efe94f5975fac76529e42ed898f9
  • main default protected
  • leveleditor
  • david-author
  • clang-tidy-cleanup
  • architecture-refactoring
  • cleanUpMenus
  • doxygen-cleanup
  • project-structure-refactoring
  • interpolation
  • buildingFeatures
  • win_end_screen
  • helpMenu
  • leveleditor-placement
  • text-rendering
  • updated_unit_contextmenu
  • level-from-commandline
  • unit_contextmenu
  • player
  • engine-scaling
  • clang-tidy
21 results

LevelScene.hpp

Blame
  • LevelScene.hpp 1.10 KiB
    #ifndef LEVELSCENE_HPP
    #define LEVELSCENE_HPP
    
    #include <QGraphicsScene>
    #include <QMouseEvent>
    #include <QWidget>
    #include <QGraphicsRectItem>
    #include <QGraphicsSceneMouseEvent>
    #include "EventBroker.hpp"
    #include "Tile.hpp"
    
    class LevelScene : public QGraphicsScene, public EventBroker {
    public:
        LevelScene(const std::string& name, int width, int height, std::vector<Tile*> tiles, const std::string& file_path, QWidget *parent = nullptr);
        static LevelScene* empty(const std::string& name, int width, int height, QWidget *parent = nullptr);
        static LevelScene* fromFile(const std::string& file_path, QWidget *parent = nullptr);
        std::string getName();
        int getWidth();
        int getHeight();
    
    protected:
        void mousePressEvent(QGraphicsSceneMouseEvent *event) override;
    private:
        void onLevelNameUpdated(std::string new_name) override;
        void onLevelWriteRequested() override;
        QGraphicsRectItem* active_tile_marker;
        QGraphicsRectItem* hovered_tile_marker;
        std::string name;
        int width;
        int height;
        std::vector<Tile*> tiles;
        std::string file_path;
    };
    
    #endif // LEVELSCENE_HPP