mirror of
https://github.com/huderlem/porymap.git
synced 2026-08-13 04:15:45 -05:00
Add player view rectangle option
This commit is contained in:
@@ -20,6 +20,7 @@
|
||||
#include "collisionpixmapitem.h"
|
||||
#include "mappixmapitem.h"
|
||||
#include "settings.h"
|
||||
#include "playerviewrect.h"
|
||||
|
||||
class DraggablePixmapItem;
|
||||
class MetatilesPixmapItem;
|
||||
@@ -94,6 +95,7 @@ public:
|
||||
QGraphicsItemGroup *events_group = nullptr;
|
||||
QList<QGraphicsPixmapItem*> borderItems;
|
||||
QList<QGraphicsLineItem*> gridLines;
|
||||
PlayerViewRect *playerViewRect = nullptr;
|
||||
|
||||
QGraphicsScene *scene_metatiles = nullptr;
|
||||
QGraphicsScene *scene_current_metatile_selection = nullptr;
|
||||
|
||||
@@ -74,6 +74,7 @@ private slots:
|
||||
void on_actionZoom_In_triggered();
|
||||
void on_actionZoom_Out_triggered();
|
||||
void on_actionBetter_Cursors_triggered();
|
||||
void on_actionPlayer_View_Rectangle_triggered();
|
||||
void on_actionPencil_triggered();
|
||||
void on_actionPointer_triggered();
|
||||
void on_actionFlood_Fill_triggered();
|
||||
|
||||
@@ -10,6 +10,7 @@ public:
|
||||
bool smartPathsEnabled;
|
||||
bool betterCursors;
|
||||
QCursor mapCursor;
|
||||
bool playerViewRectEnabled;
|
||||
};
|
||||
|
||||
#endif // SETTINGS_H
|
||||
|
||||
@@ -13,8 +13,10 @@ public:
|
||||
this->map = map_;
|
||||
this->metatileSelector = metatileSelector;
|
||||
this->settings = settings;
|
||||
this->paintingEnabled = true;
|
||||
setAcceptHoverEvents(true);
|
||||
}
|
||||
bool paintingEnabled;
|
||||
Map *map;
|
||||
MetatileSelector *metatileSelector;
|
||||
Settings *settings;
|
||||
|
||||
35
include/ui/playerviewrect.h
Normal file
35
include/ui/playerviewrect.h
Normal file
@@ -0,0 +1,35 @@
|
||||
#ifndef PLAYERVIEWRECT_H
|
||||
#define PLAYERVIEWRECT_H
|
||||
|
||||
#include <QGraphicsItem>
|
||||
#include <QPainter>
|
||||
|
||||
class PlayerViewRect : public QGraphicsItem
|
||||
{
|
||||
public:
|
||||
PlayerViewRect(bool *enabled);
|
||||
QRectF boundingRect() const override
|
||||
{
|
||||
qreal penWidth = 4;
|
||||
return QRectF(-penWidth,
|
||||
-penWidth,
|
||||
30 * 8 + penWidth * 2,
|
||||
20 * 8 + penWidth * 2);
|
||||
}
|
||||
|
||||
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
|
||||
QWidget *widget) override
|
||||
{
|
||||
int width = 30 * 8;
|
||||
int height = 20 * 8;
|
||||
painter->setPen(QColor(0xff, 0xff, 0xff));
|
||||
painter->drawRect(-2, -2, width + 3, height + 3);
|
||||
painter->setPen(QColor(0, 0, 0));
|
||||
painter->drawRect(-3, -3, width + 5, height + 5);
|
||||
painter->drawRect(-1, -1, width + 1, height + 1);
|
||||
}
|
||||
void updateLocation(int x, int y);
|
||||
bool *enabled;
|
||||
};
|
||||
|
||||
#endif // PLAYERVIEWRECT_H
|
||||
Reference in New Issue
Block a user