Make events (besides objects with valid sprites) partially transparent (#86)
* Make events transparent * Change which events are transparent
This commit is contained in:
parent
a31f6053c9
commit
a04db82c2b
4 changed files with 7 additions and 0 deletions
|
@ -79,6 +79,7 @@ public:
|
|||
QPixmap pixmap;
|
||||
int spriteWidth;
|
||||
int spriteHeight;
|
||||
bool usingSprite;
|
||||
};
|
||||
|
||||
#endif // EVENT_H
|
||||
|
|
|
@ -14,6 +14,7 @@ Event::Event()
|
|||
{
|
||||
this->spriteWidth = 16;
|
||||
this->spriteHeight = 16;
|
||||
this->usingSprite = false;
|
||||
}
|
||||
|
||||
Event* Event::createNewEvent(QString event_type, QString map_name)
|
||||
|
@ -242,4 +243,5 @@ void Event::setPixmapFromSpritesheet(QImage spritesheet, int spriteWidth, int sp
|
|||
pixmap = QPixmap::fromImage(img);
|
||||
this->spriteWidth = spriteWidth;
|
||||
this->spriteHeight = spriteHeight;
|
||||
this->usingSprite = true;
|
||||
}
|
||||
|
|
|
@ -711,6 +711,9 @@ void Editor::displayMapEvents() {
|
|||
|
||||
DraggablePixmapItem *Editor::addMapEvent(Event *event) {
|
||||
DraggablePixmapItem *object = new DraggablePixmapItem(event, this);
|
||||
if (!event->usingSprite) {
|
||||
object->setOpacity(0.7);
|
||||
}
|
||||
events_group->addToGroup(object);
|
||||
return object;
|
||||
}
|
||||
|
|
|
@ -1616,6 +1616,7 @@ void Project::loadEventPixmaps(QList<Event*> objects) {
|
|||
|
||||
object->spriteWidth = 16;
|
||||
object->spriteHeight = 16;
|
||||
object->usingSprite = false;
|
||||
QString event_type = object->get("event_type");
|
||||
if (event_type == EventType::Object) {
|
||||
object->pixmap = QPixmap(":/images/Entities_16x16.png").copy(0, 0, 16, 16);
|
||||
|
|
Loading…
Reference in a new issue