Something went wrong on our end
Select Git revision
CMakeLists.txt
-
Fabian Lennartz authoredFabian Lennartz authored
CenterGrid.hpp 4.59 KiB
#pragma once
#include <QGraphicsScene>
#include <QGraphicsView>
#include <QMessageBox>
#include <QPixmap>
#include <QTimer>
#include <QVBoxLayout>
#include <QWidget>
#include "GridItem.hpp"
namespace editor
{
/**
* @brief Central widget of the Editor, contains editable grid representing a room
*/
class CenterGrid : public QWidget
{
Q_OBJECT
public:
/**
* @brief Creates a new CenterGrid
* @param parent parent widget of CenterGrid
*/
CenterGrid(QWidget *parent = nullptr);
/**
* @brief Setter function to update which sprite is currently selected and needs to be places when grid clicked
* @param message TEMPORARY message that is shown when tile is clicked replace with sprite data
*/
void setCurrentSprite(const QPixmap pixmap, const int id);
/**
* @brief Function for drawing the currently selected sprite on a tile when tile is clicked
* @param row row of the clicked tile (y coordiante)
* @param col column of the clicked tile (x coordinate)
*/
void onTileClicked(int row, int col);
/**
* @brief draws room presets on the grid
* @param index index of room preset that needs to be drawn
*/
void drawPreset(int index);
/**
* @brief gets GridItem by row and column
* @param row row (y coordinate) of the GridItem to return
* @param col column (x coordinate) of the GridItem to return
* @return GridItem* of the GridItem at row/col, or nullptr when out of bounds
*/
GridItem *getTile(int row, int col) const;
/**
* @brief getter function for Vector of TileIDs
* @return QVector<QVector<int>> of TileIDs
*/
QVector<QVector<int>> getTileIDs();
/**
* @brief getter function for Vector of MobIDs
* @return QVector<QVector<int>> of MobIDs
*/
QVector<QVector<int>> getMobIDs();
/**
* @brief getter function for Vector of ObjectsIDs
* @return QVector<QVector<int>> of ObjectIDs