porymap/event.h

47 lines
848 B
C
Raw Normal View History

2016-09-07 04:50:47 +01:00
#ifndef EVENT_H
#define EVENT_H
#include <QString>
#include <QPixmap>
2017-11-28 04:46:27 +00:00
#include <QMap>
2016-09-07 04:50:47 +01:00
class Event
{
public:
Event();
public:
int x() {
2017-11-28 04:46:27 +00:00
return getInt("x");
2016-09-07 04:50:47 +01:00
}
int y() {
2017-11-28 04:46:27 +00:00
return getInt("y");
2016-09-07 04:50:47 +01:00
}
int elevation() {
2017-11-28 04:46:27 +00:00
return getInt("elevation");
2016-09-07 04:50:47 +01:00
}
void setX(int x) {
2017-11-28 04:46:27 +00:00
put("x", x);
2016-09-07 04:50:47 +01:00
}
void setY(int y) {
2017-11-28 04:46:27 +00:00
put("y", y);
2016-09-07 04:50:47 +01:00
}
2017-11-28 04:46:27 +00:00
QString get(QString key) {
return values.value(key);
}
int getInt(QString key) {
return values.value(key).toInt(nullptr, 0);
}
void put(QString key, int value) {
put(key, QString("%1").arg(value));
}
void put(QString key, QString value) {
values.insert(key, value);
2016-09-07 04:50:47 +01:00
}
2017-11-28 04:46:27 +00:00
QMap<QString, QString> values;
QPixmap pixmap;
2016-09-07 04:50:47 +01:00
};
#endif // EVENT_H