mirror of
https://github.com/Heretek-AI/GDevelop.git
synced 2026-07-22 01:55:25 -04:00
43f5bd1c0e
* When an object is selected (or when "Edit object" button is clicked in the properties panel after choosing an instance), the properties panel will show the properties of the object. * This allows for fast edition of most elements of an object: appearance, properties, but also behaviors, variables and effects. Most workflow and iterations on your game should be faster, from adapting the appearance of a text to tweaking behaviors and updating the preview to check the result in realtime.
47 lines
1.3 KiB
C++
47 lines
1.3 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")
|
|
.SetMeasurementUnit(gd::MeasurementUnit::GetPixel())
|
|
.SetLabel(_("Deletion margin"))
|
|
.SetDescription(_("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
|