Files
GDevelop/Extensions/DestroyOutsideBehavior/DestroyOutsideBehavior.cpp
T
Florian Rival 9b178bc985 Fix "Remove Unused Images" removing images used by BBText object
Don't show the rest in changelog:
* More generally, fix resources exposed by any object declared in JavaScript
* Refactored GetProperties (and UpdateProperty) across behavior/object/behavior shared data to remove the dependency on gd::Project.
2020-06-23 22:40:38 +01:00

45 lines
1.2 KiB
C++

/**
GDevelop - DestroyOutside Behavior Extension
Copyright (c) 2014-2016 Florian Rival (Florian.Rival@gmail.com)
This project is released under the MIT License.
*/
#include "DestroyOutsideBehavior.h"
#include "GDCore/CommonTools.h"
#include "GDCore/Project/PropertyDescriptor.h"
#include "GDCore/Serialization/SerializerElement.h"
#include "GDCore/Tools/Localization.h"
void DestroyOutsideBehavior::InitializeContent(gd::SerializerElement& content) {
content.SetAttribute("extraBorder", 0);
}
#if defined(GD_IDE_ONLY)
std::map<gd::String, gd::PropertyDescriptor>
DestroyOutsideBehavior::GetProperties(
const gd::SerializerElement& behaviorContent) const {
std::map<gd::String, gd::PropertyDescriptor> properties;
properties["extraBorder"]
.SetValue(gd::String::From(
behaviorContent.GetDoubleAttribute("extraBorder", 0)))
.SetType("Number")
.SetLabel(_("Margin before deleting the object, in pixels"));
return properties;
}
bool DestroyOutsideBehavior::UpdateProperty(
gd::SerializerElement& behaviorContent,
const gd::String& name,
const gd::String& value) {
if (name == "extraBorder")
behaviorContent.SetAttribute("extraBorder", value.To<double>());
else
return false;
return true;
}
#endif