mirror of
https://github.com/Heretek-AI/GDevelop.git
synced 2026-07-21 17:45:25 -04:00
77320ce12e
* Tilemaps made with [LDtk](https://ldtk.io/), a modern 2D level editor, can be now used directly. Make sure to save your map made in LDtk as a JSON file, create a new Tilemap object in GDevelop and in the Tilemap field, choose the LDtk file. * Tilesets used by the LDtk Tilemap are automatically imported in your game - you don't need to import them separately. * For more information, read about the [Tilemap object on the wiki](https://wiki.gdevelop.io/gdevelop5/objects/tilemap). Co-authored-by: Davy Hélard <davy.helard@gmail.com> Co-authored-by: Florian Rival <Florian.Rival@gmail.com>
62 lines
1.9 KiB
C++
62 lines
1.9 KiB
C++
/**
|
|
|
|
GDevelop - Panel Sprite Extension
|
|
Copyright (c) 2012-2016 Victor Levasseur (victorlevasseur01@orange.fr)
|
|
This project is released under the MIT License.
|
|
*/
|
|
|
|
#include "GDCore/Tools/Localization.h"
|
|
#include "GDCore/CommonTools.h"
|
|
#include "GDCore/Project/InitialInstance.h"
|
|
#include "GDCore/Project/Object.h"
|
|
#include "GDCore/Project/Project.h"
|
|
#include "GDCore/Serialization/SerializerElement.h"
|
|
#include "PanelSpriteObject.h"
|
|
|
|
#if defined(GD_IDE_ONLY)
|
|
#include "GDCore/IDE/Project/ArbitraryResourceWorker.h"
|
|
#endif
|
|
|
|
using namespace std;
|
|
|
|
PanelSpriteObject::PanelSpriteObject()
|
|
: textureName(""),
|
|
width(32),
|
|
height(32),
|
|
leftMargin(0),
|
|
topMargin(0),
|
|
rightMargin(0),
|
|
bottomMargin(0) {}
|
|
|
|
PanelSpriteObject::~PanelSpriteObject() {}
|
|
|
|
void PanelSpriteObject::DoUnserializeFrom(
|
|
gd::Project& project, const gd::SerializerElement& element) {
|
|
textureName = element.GetStringAttribute("texture");
|
|
width = element.GetIntAttribute("width", 32);
|
|
height = element.GetIntAttribute("height", 32);
|
|
leftMargin = element.GetIntAttribute("leftMargin");
|
|
topMargin = element.GetIntAttribute("topMargin");
|
|
rightMargin = element.GetIntAttribute("rightMargin");
|
|
bottomMargin = element.GetIntAttribute("bottomMargin");
|
|
tiled = element.GetBoolAttribute("tiled");
|
|
}
|
|
|
|
#if defined(GD_IDE_ONLY)
|
|
void PanelSpriteObject::DoSerializeTo(gd::SerializerElement& element) const {
|
|
element.SetAttribute("texture", textureName);
|
|
element.SetAttribute("width", width);
|
|
element.SetAttribute("height", height);
|
|
element.SetAttribute("leftMargin", leftMargin);
|
|
element.SetAttribute("topMargin", topMargin);
|
|
element.SetAttribute("rightMargin", rightMargin);
|
|
element.SetAttribute("bottomMargin", bottomMargin);
|
|
element.SetAttribute("tiled", tiled);
|
|
}
|
|
|
|
void PanelSpriteObject::ExposeResources(
|
|
gd::ArbitraryResourceWorker& worker) {
|
|
worker.ExposeImage(textureName);
|
|
}
|
|
#endif
|