mirror of
https://github.com/Heretek-AI/GDevelop.git
synced 2026-07-22 10:05:37 -04:00
132 lines
6.2 KiB
C++
132 lines
6.2 KiB
C++
/**
|
|
|
|
GDevelop - Text Object Extension
|
|
Copyright (c) 2008-2014 Florian Rival (Florian.Rival@gmail.com)
|
|
|
|
This software is provided 'as-is', without any express or implied
|
|
warranty. In no event will the authors be held liable for any damages
|
|
arising from the use of this software.
|
|
|
|
Permission is granted to anyone to use this software for any purpose,
|
|
including commercial applications, and to alter it and redistribute it
|
|
freely, subject to the following restrictions:
|
|
|
|
1. The origin of this software must not be misrepresented; you must not
|
|
claim that you wrote the original software. If you use this software
|
|
in a product, an acknowledgment in the product documentation would be
|
|
appreciated but is not required.
|
|
|
|
2. Altered source versions must be plainly marked as such, and must not be
|
|
misrepresented as being the original software.
|
|
|
|
3. This notice may not be removed or altered from any source
|
|
distribution.
|
|
|
|
*/
|
|
#if defined(GD_IDE_ONLY)
|
|
#include "GDCore/PlatformDefinition/PlatformExtension.h"
|
|
#include "GDCore/Tools/Version.h"
|
|
#include "TextObject.h"
|
|
#include <boost/version.hpp>
|
|
#include <iostream>
|
|
#include "GDCore/Tools/Localization.h"
|
|
|
|
void DeclareTextObjectExtension(gd::PlatformExtension & extension);
|
|
|
|
/**
|
|
* \brief This class declares information about the JS extension.
|
|
*/
|
|
class TextObjectJsExtension : public gd::PlatformExtension
|
|
{
|
|
public:
|
|
|
|
/**
|
|
* Constructor of an extension declares everything the extension contains : Objects, actions, conditions and expressions.
|
|
*/
|
|
TextObjectJsExtension()
|
|
{
|
|
SetExtensionInformation("TextObject",
|
|
_("Text object"),
|
|
_("Extension allowing to use an object displaying a text."),
|
|
"Compil Games",
|
|
"zlib/libpng License (Open Source)");
|
|
|
|
DeclareTextObjectExtension(*this);
|
|
|
|
GetObjectMetadata("TextObject::Text").SetIncludeFile("TextObject/textruntimeobject.js");
|
|
|
|
GetAllActionsForObject("TextObject::Text")["TextObject::String"].codeExtraInformation
|
|
.SetFunctionName("setString").SetAssociatedGetter("getString").SetIncludeFile("TextObject/textruntimeobject.js");
|
|
GetAllConditionsForObject("TextObject::Text")["TextObject::String"].codeExtraInformation
|
|
.SetFunctionName("getString").SetIncludeFile("TextObject/textruntimeobject.js");
|
|
GetAllActionsForObject("TextObject::Text")["TextObject::Size"].codeExtraInformation
|
|
.SetFunctionName("setCharacterSize").SetAssociatedGetter("getCharacterSize").SetIncludeFile("TextObject/textruntimeobject.js");
|
|
GetAllConditionsForObject("TextObject::Text")["TextObject::Size"].codeExtraInformation
|
|
.SetFunctionName("getCharacterSize").SetIncludeFile("TextObject/textruntimeobject.js");
|
|
GetAllActionsForObject("TextObject::Text")["TextObject::Angle"].codeExtraInformation
|
|
.SetFunctionName("setAngle").SetAssociatedGetter("getAngle").SetIncludeFile("TextObject/textruntimeobject.js");
|
|
GetAllConditionsForObject("TextObject::Text")["TextObject::Angle"].codeExtraInformation
|
|
.SetFunctionName("getAngle").SetIncludeFile("TextObject/textruntimeobject.js");
|
|
GetAllActionsForObject("TextObject::Text")["TextObject::Opacity"].codeExtraInformation
|
|
.SetFunctionName("setOpacity").SetAssociatedGetter("getOpacity").SetIncludeFile("TextObject/textruntimeobject.js");
|
|
GetAllConditionsForObject("TextObject::Text")["TextObject::Opacity"].codeExtraInformation
|
|
.SetFunctionName("getOpacity").SetIncludeFile("TextObject/textruntimeobject.js");
|
|
|
|
GetAllActionsForObject("TextObject::Text")["TextObject::SetBold"].codeExtraInformation
|
|
.SetFunctionName("setBold").SetIncludeFile("TextObject/textruntimeobject.js");
|
|
GetAllConditionsForObject("TextObject::Text")["TextObject::IsBold"].codeExtraInformation
|
|
.SetFunctionName("isBold").SetIncludeFile("TextObject/textruntimeobject.js");
|
|
|
|
GetAllActionsForObject("TextObject::Text")["TextObject::SetItalic"].codeExtraInformation
|
|
.SetFunctionName("setItalic").SetIncludeFile("TextObject/textruntimeobject.js");
|
|
GetAllConditionsForObject("TextObject::Text")["TextObject::IsItalic"].codeExtraInformation
|
|
.SetFunctionName("isItalic").SetIncludeFile("TextObject/textruntimeobject.js");
|
|
|
|
GetAllExpressionsForObject("TextObject::Text")["Opacity"].codeExtraInformation
|
|
.SetFunctionName("getOpacity").SetIncludeFile("TextObject/textruntimeobject.js");
|
|
GetAllExpressionsForObject("TextObject::Text")["Angle"].codeExtraInformation
|
|
.SetFunctionName("getAngle").SetIncludeFile("TextObject/textruntimeobject.js");
|
|
GetAllStrExpressionsForObject("TextObject::Text")["String"].codeExtraInformation
|
|
.SetFunctionName("getString").SetIncludeFile("TextObject/textruntimeobject.js");
|
|
|
|
GetAllActionsForObject("TextObject::Text")["TextObject::ChangeColor"].codeExtraInformation
|
|
.SetFunctionName("setColor").SetIncludeFile("TextObject/textruntimeobject.js");
|
|
|
|
//Unimplemented actions and conditions:
|
|
GetAllActionsForObject("TextObject::Text")["TextObject::Font"].codeExtraInformation
|
|
.SetFunctionName("");
|
|
GetAllActionsForObject("TextObject::Text")["TextObject::SetUnderlined"].codeExtraInformation
|
|
.SetFunctionName("");
|
|
GetAllConditionsForObject("TextObject::Text")["TextObject::IsUnderlined"].codeExtraInformation
|
|
.SetFunctionName("");
|
|
|
|
StripUnimplementedInstructionsAndExpressions();
|
|
|
|
GD_COMPLETE_EXTENSION_COMPILATION_INFORMATION();
|
|
};
|
|
virtual ~TextObjectJsExtension() {};
|
|
};
|
|
|
|
#if defined(EMSCRIPTEN)
|
|
extern "C" gd::PlatformExtension * CreateGDJSTextObjectExtension() {
|
|
return new TextObjectJsExtension;
|
|
}
|
|
#else
|
|
/**
|
|
* Used by GDevelop to create the extension class
|
|
* -- Do not need to be modified. --
|
|
*/
|
|
extern "C" gd::PlatformExtension * GD_EXTENSION_API CreateGDJSExtension() {
|
|
return new TextObjectJsExtension;
|
|
}
|
|
|
|
/**
|
|
* Used by GDevelop to destroy the extension class
|
|
* -- Do not need to be modified. --
|
|
*/
|
|
extern "C" void GD_EXTENSION_API DestroyGDJSExtension(gd::PlatformExtension * p) {
|
|
delete p;
|
|
}
|
|
#endif
|
|
#endif
|