mirror of
https://github.com/Heretek-AI/GDevelop.git
synced 2026-07-22 10:05:37 -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>
45 lines
1.3 KiB
C++
45 lines
1.3 KiB
C++
/**
|
|
|
|
GDevelop - Tiled Sprite Extension
|
|
Copyright (c) 2012-2016 Victor Levasseur (victorlevasseur01@orange.fr)
|
|
Copyright (c) 2014-2016 Florian Rival (Florian.Rival@gmail.com)
|
|
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 "TiledSpriteObject.h"
|
|
|
|
#if defined(GD_IDE_ONLY)
|
|
#include "GDCore/IDE/Project/ArbitraryResourceWorker.h"
|
|
#endif
|
|
|
|
using namespace std;
|
|
|
|
TiledSpriteObject::TiledSpriteObject()
|
|
: textureName(""), width(32), height(32) {}
|
|
|
|
void TiledSpriteObject::DoUnserializeFrom(
|
|
gd::Project& project, const gd::SerializerElement& element) {
|
|
textureName = element.GetStringAttribute("texture");
|
|
width = element.GetDoubleAttribute("width", 128);
|
|
height = element.GetDoubleAttribute("height", 128);
|
|
}
|
|
|
|
#if defined(GD_IDE_ONLY)
|
|
void TiledSpriteObject::DoSerializeTo(gd::SerializerElement& element) const {
|
|
element.SetAttribute("texture", textureName);
|
|
element.SetAttribute("width", width);
|
|
element.SetAttribute("height", height);
|
|
}
|
|
|
|
void TiledSpriteObject::ExposeResources(
|
|
gd::ArbitraryResourceWorker& worker) {
|
|
worker.ExposeImage(textureName);
|
|
}
|
|
#endif
|