-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrobotgriditem.cpp
More file actions
36 lines (28 loc) · 1.09 KB
/
robotgriditem.cpp
File metadata and controls
36 lines (28 loc) · 1.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#include "robotgriditem.h"
RobotGridItem::RobotGridItem(const QPixmap &pixmap, QGraphicsItem *parent) : QGraphicsPixmapItem(pixmap, parent){
qDebug("RobotGridItem::RobotGridItem() => called...");
setCacheMode(NoCache);
qDebug("RobotGridItem::RobotGridItem() => initialized without errors...");
}
RobotGridItem::RobotGridItem(const QPixmap &pixmap, QGraphicsItem *parent, QPoint Coord) : QGraphicsPixmapItem(pixmap,parent){
qDebug("RobotGridItem::RobotGridItem() => called...");
setCacheMode(NoCache);
SetCoords(Coord);
qDebug("RobotGridItem::RobotGridItem() => initialized without errors...");
}
void RobotGridItem::SetTerrain(QString terrain){
this->setPixmap(terrain);
}
void RobotGridItem::SetPosition(QPoint position){
this->setPos(position);
}
void RobotGridItem::SetCoords(QPoint coords){
QPoint tmp;
this->Coords = coords;
if(coords.x() % 2 == 0)
this->Position = tmp = QPoint(coords.x()*54,coords.y()*71);
else
this->Position = tmp = QPoint(coords.x()*54,(coords.y()*71)+35);
this->setPos(tmp);
}
RobotGridItem::~RobotGridItem(){}