Skip to content
Snippets Groups Projects
Select Git revision
  • 5709f48c3eebb2fc36dbe6f7c20aaa7cb34aaff0
  • 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 926 B
    #ifndef LEVELSCENE_HPP
    #define LEVELSCENE_HPP
    
    #include <QGraphicsScene>
    #include <QMouseEvent>
    #include <QWidget>
    #include <QGraphicsSceneMouseEvent>
    #include "EventBroker.hpp"
    
    class LevelScene : public QGraphicsScene, public EventBroker {
    public:
        LevelScene(const std::string& name, int width, int height, std::vector<uint8_t> 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);
    
    protected:
        void mousePressEvent(QGraphicsSceneMouseEvent *event) override;
    private:
        void onLevelNameUpdated(std::string new_name) override;
        void onLevelWriteRequested() override;
        std::string name;
        int width;
        int height;
        std::vector<uint8_t> tiles;
        std::string file_path;
    };
    
    #endif // LEVELSCENE_HPP