mirror of
https://github.com/huderlem/porymap.git
synced 2026-10-02 21:06:37 -05:00
region map ui updates and other fixes
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
#define HISTORYITEM_H
|
||||
|
||||
#include "blockdata.h"
|
||||
//#include "regionmap.h"
|
||||
|
||||
class HistoryItem {
|
||||
public:
|
||||
@@ -15,15 +16,19 @@ public:
|
||||
enum RegionMapEditorBox {
|
||||
BackgroundImage = 1,
|
||||
CityMapImage = 2,
|
||||
BackroundResize = 3,
|
||||
};
|
||||
|
||||
class RegionMapHistoryItem {
|
||||
public:
|
||||
int which;// region map or city map
|
||||
int index;
|
||||
unsigned tile;
|
||||
unsigned prev;
|
||||
RegionMapHistoryItem(int type, int index, unsigned prev, unsigned tile);
|
||||
int which;
|
||||
int mapWidth;
|
||||
int mapHeight;
|
||||
QVector<uint8_t> tiles;
|
||||
QString cityMap;
|
||||
RegionMapHistoryItem(int type, QVector<uint8_t> tiles);
|
||||
RegionMapHistoryItem(int type, QVector<uint8_t> tiles, QString cityMap);
|
||||
RegionMapHistoryItem(int type, QVector<uint8_t> tiles, int width, int height);
|
||||
~RegionMapHistoryItem();
|
||||
};
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
#ifndef REGIONMAP_H
|
||||
#define REGIONMAP_H
|
||||
|
||||
#include "project.h"
|
||||
#include "map.h"
|
||||
#include "project.h"
|
||||
#include "tilemaptileselector.h"
|
||||
#include "history.h"
|
||||
#include "historyitem.h"
|
||||
@@ -94,6 +94,7 @@ public:
|
||||
|
||||
QString newAbbr(QString);// makes a *unique* 5 character abbreviation from mapname to add to mapname_abbr
|
||||
|
||||
// TODO: did I use these like, at all?
|
||||
// editing functions
|
||||
// if they are booleans, returns true if successful?
|
||||
bool placeTile(char, int, int);// place tile at x, y
|
||||
@@ -111,12 +112,16 @@ public:
|
||||
void resize(int, int);
|
||||
void setWidth(int);
|
||||
void setHeight(int);
|
||||
void setBackgroundImageData(QVector<uint8_t> *);
|
||||
int width();
|
||||
int height();
|
||||
QSize imgSize();
|
||||
unsigned getTileId(int, int);
|
||||
int getMapSquareIndex(int, int);
|
||||
|
||||
QVector<uint8_t> getTiles();
|
||||
void setTiles(QVector<uint8_t>);
|
||||
|
||||
void resetSquare(int);
|
||||
|
||||
// TODO: move read / write functions to private (and others)
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
|
||||
#include <QGraphicsPixmapItem>
|
||||
#include <QByteArray>
|
||||
#include <QVector>
|
||||
|
||||
class CityMapPixmapItem : public QObject, public QGraphicsPixmapItem {
|
||||
Q_OBJECT
|
||||
@@ -30,6 +31,9 @@ public:
|
||||
int width();
|
||||
int height();
|
||||
|
||||
QVector<uint8_t> getTiles();
|
||||
void setTiles(QVector<uint8_t>);
|
||||
|
||||
private:
|
||||
int width_;
|
||||
int height_;
|
||||
@@ -41,6 +45,8 @@ signals:
|
||||
|
||||
protected:
|
||||
void mousePressEvent(QGraphicsSceneMouseEvent*);
|
||||
void mouseMoveEvent(QGraphicsSceneMouseEvent*);
|
||||
void mouseReleaseEvent(QGraphicsSceneMouseEvent*);
|
||||
};
|
||||
|
||||
#endif // CITYMAPPIXMAPITEM_H
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
#include <QMainWindow>
|
||||
#include <QGraphicsSceneMouseEvent>
|
||||
#include <QCloseEvent>
|
||||
#include <QResizeEvent>
|
||||
|
||||
namespace Ui {
|
||||
class RegionMapEditor;
|
||||
@@ -53,13 +54,15 @@ private:
|
||||
unsigned selectedCityTile;
|
||||
unsigned selectedImageTile;
|
||||
|
||||
bool hasUnsavedChanges = false;
|
||||
|
||||
double scaleUpFactor = 2.0;
|
||||
double scaleDownFactor = 1.0 / scaleUpFactor;
|
||||
|
||||
double scaleRegionMapTiles = 1.0;
|
||||
double scaleRegionMapImage = 1.0;
|
||||
double scaleCityMapTiles = 1.0;
|
||||
double scaleCityMapImage = 1.0;
|
||||
int scaleRegionMapTiles = 1;
|
||||
int scaleRegionMapImage = 1;
|
||||
int scaleCityMapTiles = 1;
|
||||
int scaleCityMapImage = 1;
|
||||
|
||||
QGraphicsScene *scene_region_map_image = nullptr;
|
||||
QGraphicsScene *scene_city_map_image = nullptr;
|
||||
@@ -85,6 +88,8 @@ private:
|
||||
|
||||
bool createCityMap(QString);
|
||||
|
||||
void closeEvent(QCloseEvent*);
|
||||
|
||||
private slots:
|
||||
void on_action_RegionMap_Save_triggered();
|
||||
void on_action_RegionMap_Undo_triggered();
|
||||
@@ -92,21 +97,17 @@ private slots:
|
||||
void on_action_RegionMap_Resize_triggered();
|
||||
void on_action_RegionMap_Generate_triggered();
|
||||
void on_tabWidget_Region_Map_currentChanged(int);
|
||||
void on_pushButton_RM_Options_save_clicked();
|
||||
void on_pushButton_RM_Options_delete_clicked();
|
||||
void on_pushButton_CityMap_save_clicked();
|
||||
void on_comboBox_RM_ConnectedMap_activated(const QString &);
|
||||
void on_pushButton_CityMap_add_clicked();
|
||||
void on_pushButton_Zoom_In_Image_Tiles_clicked();
|
||||
void on_pushButton_Zoom_Out_Image_Tiles_clicked();
|
||||
void on_pushButton_Zoom_In_City_Tiles_clicked();
|
||||
void on_pushButton_Zoom_Out_City_Tiles_clicked();
|
||||
void on_pushButton_Zoom_In_City_Map_clicked();
|
||||
void on_pushButton_Zoom_Out_City_Map_clicked();
|
||||
void on_pushButton_Zoom_In_Map_Image_clicked();
|
||||
void on_pushButton_Zoom_Out_Map_Image_clicked();
|
||||
void on_verticalSlider_Zoom_Map_Image_valueChanged(int);
|
||||
void on_verticalSlider_Zoom_Image_Tiles_valueChanged(int);
|
||||
void on_verticalSlider_Zoom_City_Map_valueChanged(int);
|
||||
void on_verticalSlider_Zoom_City_Tiles_valueChanged(int);
|
||||
void on_comboBox_CityMap_picker_currentTextChanged(const QString &);
|
||||
void on_spinBox_RM_Options_x_valueChanged(int);
|
||||
void on_spinBox_RM_Options_y_valueChanged(int);
|
||||
void on_lineEdit_RM_MapName_textEdited(const QString &);
|
||||
void onHoveredRegionMapTileChanged(int, int);
|
||||
void onHoveredRegionMapTileCleared();
|
||||
void mouseEvent_region_map(QGraphicsSceneMouseEvent *, RegionMapPixmapItem *);
|
||||
|
||||
@@ -19,7 +19,7 @@ public:
|
||||
int pixelWidth;
|
||||
int pixelHeight;
|
||||
|
||||
unsigned selectedTile;
|
||||
unsigned selectedTile = 0;
|
||||
|
||||
// TODO: which of these need to be made public?
|
||||
// call this tilemap? or is tilemap the binary file?
|
||||
|
||||
Reference in New Issue
Block a user