mirror of
https://github.com/4ian/GDevelop.git
synced 2025-10-15 10:19:04 +00:00
Compare commits
84 Commits
v5.0.0-bet
...
v5.0.0-bet
Author | SHA1 | Date | |
---|---|---|---|
![]() |
b9ba8e1b7b | ||
![]() |
84ea9a9643 | ||
![]() |
13c44250f2 | ||
![]() |
a5907a6883 | ||
![]() |
5902906bcc | ||
![]() |
4db041bf10 | ||
![]() |
cc1d26201e | ||
![]() |
aa71e78507 | ||
![]() |
ee49ca6c14 | ||
![]() |
a649789f4c | ||
![]() |
61e8e95d5b | ||
![]() |
cc158a9250 | ||
![]() |
a91ccacb89 | ||
![]() |
bb9e8a2ea9 | ||
![]() |
3bf40cd46c | ||
![]() |
aa823c1287 | ||
![]() |
24a666ab83 | ||
![]() |
9e652b228d | ||
![]() |
09bedc6ce5 | ||
![]() |
91e57340d4 | ||
![]() |
c385aae845 | ||
![]() |
460b582ab9 | ||
![]() |
3a9f896f04 | ||
![]() |
2851a20787 | ||
![]() |
9077c5d4f7 | ||
![]() |
693b64cddf | ||
![]() |
661d329170 | ||
![]() |
66ce941d46 | ||
![]() |
d4023efe0f | ||
![]() |
815bd92469 | ||
![]() |
8685defaa8 | ||
![]() |
ad89af6ad5 | ||
![]() |
0428417295 | ||
![]() |
54c0424785 | ||
![]() |
f316d28fe3 | ||
![]() |
104b6c2800 | ||
![]() |
0ac504c0ab | ||
![]() |
0508da60e5 | ||
![]() |
2e511c75bf | ||
![]() |
b76df0247d | ||
![]() |
816fb242be | ||
![]() |
a4b452b037 | ||
![]() |
0d5fbdabc9 | ||
![]() |
268beb256a | ||
![]() |
e33e61d2fd | ||
![]() |
07d770148f | ||
![]() |
2a5b5ee4a2 | ||
![]() |
0420ad8888 | ||
![]() |
0e69a87eec | ||
![]() |
9b178bc985 | ||
![]() |
85cfb644c3 | ||
![]() |
2ba2b3b509 | ||
![]() |
a23a8904f6 | ||
![]() |
1311a8b4c5 | ||
![]() |
e8a1af0ef1 | ||
![]() |
bc1095759e | ||
![]() |
125e76bd20 | ||
![]() |
758afea620 | ||
![]() |
cf63960282 | ||
![]() |
deffe37013 | ||
![]() |
0f30c2d614 | ||
![]() |
9d015b9cd1 | ||
![]() |
fc5905b7f4 | ||
![]() |
18be9f5450 | ||
![]() |
31c8d04def | ||
![]() |
77eff757cd | ||
![]() |
c2fedf23b9 | ||
![]() |
6870a53aed | ||
![]() |
92015e8182 | ||
![]() |
2704c654d8 | ||
![]() |
e1242e5397 | ||
![]() |
51d306f98f | ||
![]() |
689904bda5 | ||
![]() |
5b53ffe015 | ||
![]() |
eb2da55504 | ||
![]() |
38cd264bf8 | ||
![]() |
c179730dc4 | ||
![]() |
8109621920 | ||
![]() |
bd0aaa73c7 | ||
![]() |
6d21753288 | ||
![]() |
6993a2f2f9 | ||
![]() |
8e538425c4 | ||
![]() |
3e7e45da41 | ||
![]() |
15eec269c3 |
3
.vscode/settings.json
vendored
3
.vscode/settings.json
vendored
@@ -84,7 +84,8 @@
|
||||
"any": "cpp",
|
||||
"array": "cpp",
|
||||
"cinttypes": "cpp",
|
||||
"numeric": "cpp"
|
||||
"numeric": "cpp",
|
||||
"__memory": "cpp"
|
||||
},
|
||||
"files.exclude": {
|
||||
"Binaries/*build*": true,
|
||||
|
@@ -75,6 +75,11 @@ else()
|
||||
message(FATAL_ERROR "The compiler ${CMAKE_CXX_COMPILER} has no C++11 support (with GNU extensions). Please use a different C++ compiler.")
|
||||
endif()
|
||||
|
||||
# Mark some warnings as errors
|
||||
if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror=return-stack-address")
|
||||
endif()
|
||||
|
||||
#Define common directories:
|
||||
set(GD_base_dir ${CMAKE_CURRENT_SOURCE_DIR})
|
||||
|
||||
|
@@ -541,7 +541,6 @@ gd::String EventsCodeGenerator::GenerateActionCode(
|
||||
if (MetadataProvider::HasBehaviorAction(
|
||||
platform, behaviorType, action.GetType()) &&
|
||||
instrInfos.parameters.size() >= 2) {
|
||||
|
||||
std::vector<gd::String> realObjects =
|
||||
ExpandObjectsName(objectName, context);
|
||||
for (std::size_t i = 0; i < realObjects.size(); ++i) {
|
||||
@@ -1112,6 +1111,33 @@ gd::String EventsCodeGenerator::GenerateBehaviorAction(
|
||||
}
|
||||
}
|
||||
|
||||
size_t EventsCodeGenerator::GenerateSingleUsageUniqueIdForEventsList() {
|
||||
return eventsListNextUniqueId++;
|
||||
}
|
||||
|
||||
size_t EventsCodeGenerator::GenerateSingleUsageUniqueIdFor(
|
||||
const Instruction* instruction) {
|
||||
if (!instruction) {
|
||||
std::cout << "ERROR: During code generation, a null pointer was passed to "
|
||||
"GenerateSingleUsageUniqueIdFor."
|
||||
<< std::endl;
|
||||
}
|
||||
|
||||
// Base the unique id on the adress in memory so that the same instruction
|
||||
// in memory will get the same id across different code generations.
|
||||
size_t uniqueId = (size_t)instruction;
|
||||
|
||||
// While in most case this function is called a single time for each instruction,
|
||||
// it's possible for an instruction to be appearing more than once in the events,
|
||||
// if we used links. In this case, simply increment the unique id to be sure that
|
||||
// ids are effectively uniques, and stay stable (given the same order of links).
|
||||
while (instructionUniqueIds.find(uniqueId) != instructionUniqueIds.end()) {
|
||||
uniqueId++;
|
||||
}
|
||||
instructionUniqueIds.insert(uniqueId);
|
||||
return uniqueId;
|
||||
}
|
||||
|
||||
gd::String EventsCodeGenerator::GetObjectListName(
|
||||
const gd::String& name, const gd::EventsCodeGenerationContext& context) {
|
||||
return ManObjListName(name);
|
||||
@@ -1140,7 +1166,8 @@ EventsCodeGenerator::EventsCodeGenerator(gd::Project& project_,
|
||||
errorOccurred(false),
|
||||
compilationForRuntime(false),
|
||||
maxCustomConditionsDepth(0),
|
||||
maxConditionsListsSize(0){};
|
||||
maxConditionsListsSize(0),
|
||||
eventsListNextUniqueId(0){};
|
||||
|
||||
EventsCodeGenerator::EventsCodeGenerator(
|
||||
const gd::Platform& platform_,
|
||||
@@ -1155,6 +1182,7 @@ EventsCodeGenerator::EventsCodeGenerator(
|
||||
errorOccurred(false),
|
||||
compilationForRuntime(false),
|
||||
maxCustomConditionsDepth(0),
|
||||
maxConditionsListsSize(0){};
|
||||
maxConditionsListsSize(0),
|
||||
eventsListNextUniqueId(0){};
|
||||
|
||||
} // namespace gd
|
||||
|
@@ -9,6 +9,7 @@
|
||||
#include <set>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
#include "GDCore/Events/Event.h"
|
||||
#include "GDCore/Events/Instruction.h"
|
||||
#include "GDCore/String.h"
|
||||
@@ -123,7 +124,7 @@ class GD_CORE_API EventsCodeGenerator {
|
||||
*
|
||||
*/
|
||||
std::vector<gd::String> GenerateParametersCodes(
|
||||
const std::vector<gd::Expression> & parameters,
|
||||
const std::vector<gd::Expression>& parameters,
|
||||
const std::vector<gd::ParameterMetadata>& parametersInfo,
|
||||
EventsCodeGenerationContext& context,
|
||||
std::vector<std::pair<gd::String, gd::String> >*
|
||||
@@ -321,7 +322,7 @@ class GD_CORE_API EventsCodeGenerator {
|
||||
* group.
|
||||
*
|
||||
* Get a list containing the "real" objects name when the events refers to \a
|
||||
* objectName :<br> If \a objectName if really an object, the list will only
|
||||
* objectName :<br> If \a objectName is really an object, the list will only
|
||||
* contains \a objectName unchanged.<br> If \a objectName is a group, the list
|
||||
* will contains all the objects of the group.<br> If \a objectName is the
|
||||
* "current" object in the context ( i.e: The object being used for launching
|
||||
@@ -411,6 +412,29 @@ class GD_CORE_API EventsCodeGenerator {
|
||||
|
||||
enum VariableScope { LAYOUT_VARIABLE = 0, PROJECT_VARIABLE, OBJECT_VARIABLE };
|
||||
|
||||
/**
|
||||
* Generate a single unique number for the specified instruction.
|
||||
*
|
||||
* This is useful for instructions that need to identify themselves in the
|
||||
* generated code like the "Trigger Once" conditions. The id is stable across
|
||||
* code generations if the instructions are the same objects in memory.
|
||||
*
|
||||
* Note that if this function is called multiple times with the same
|
||||
* instruction, the unique number returned will be *different*. This is
|
||||
* because a single instruction might appear at multiple places in events due
|
||||
* to the usage of links.
|
||||
*/
|
||||
size_t GenerateSingleUsageUniqueIdFor(const gd::Instruction* instruction);
|
||||
|
||||
/**
|
||||
* Generate a single unique number for an events list.
|
||||
*
|
||||
* This is useful to create unique function names for events list, that are
|
||||
* stable across code generation given the exact same list of events. They are
|
||||
* *not* stable if events are moved/reorganized.
|
||||
*/
|
||||
size_t GenerateSingleUsageUniqueIdForEventsList();
|
||||
|
||||
protected:
|
||||
/**
|
||||
* \brief Generate the code for a single parameter.
|
||||
@@ -704,7 +728,8 @@ class GD_CORE_API EventsCodeGenerator {
|
||||
/**
|
||||
* Generate the getter to get the name of the specified behavior.
|
||||
*/
|
||||
virtual gd::String GenerateGetBehaviorNameCode(const gd::String& behaviorName);
|
||||
virtual gd::String GenerateGetBehaviorNameCode(
|
||||
const gd::String& behaviorName);
|
||||
|
||||
const gd::Platform& platform; ///< The platform being used.
|
||||
|
||||
@@ -732,6 +757,11 @@ class GD_CORE_API EventsCodeGenerator {
|
||||
size_t maxCustomConditionsDepth; ///< The maximum depth value for all the
|
||||
///< custom conditions created.
|
||||
size_t maxConditionsListsSize; ///< The maximum size of a list of conditions.
|
||||
|
||||
std::set<size_t>
|
||||
instructionUniqueIds; ///< The unique ids generated for instructions.
|
||||
size_t eventsListNextUniqueId; ///< The next identifier to use for an events
|
||||
///< list function name.
|
||||
};
|
||||
|
||||
} // namespace gd
|
||||
|
@@ -4,9 +4,12 @@
|
||||
* reserved. This project is released under the MIT License.
|
||||
*/
|
||||
#include "GDCore/Events/Instruction.h"
|
||||
|
||||
#include <assert.h>
|
||||
|
||||
#include <iostream>
|
||||
#include <vector>
|
||||
|
||||
#include "GDCore/Events/Expression.h"
|
||||
#include "GDCore/Events/InstructionsList.h"
|
||||
#include "GDCore/String.h"
|
||||
@@ -15,18 +18,14 @@ namespace gd {
|
||||
|
||||
gd::Expression Instruction::badExpression("");
|
||||
|
||||
Instruction::Instruction(gd::String type_)
|
||||
: type(type_),
|
||||
inverted(false) {
|
||||
Instruction::Instruction(gd::String type_) : type(type_), inverted(false) {
|
||||
parameters.reserve(8);
|
||||
}
|
||||
|
||||
Instruction::Instruction(gd::String type_,
|
||||
const std::vector<gd::Expression>& parameters_,
|
||||
bool inverted_)
|
||||
: type(type_),
|
||||
inverted(inverted_),
|
||||
parameters(parameters_) {
|
||||
: type(type_), inverted(inverted_), parameters(parameters_) {
|
||||
parameters.reserve(8);
|
||||
}
|
||||
|
||||
@@ -56,4 +55,17 @@ void Instruction::SetParameter(std::size_t nb, const gd::Expression& val) {
|
||||
parameters[nb] = val;
|
||||
}
|
||||
|
||||
std::shared_ptr<Instruction> GD_CORE_API
|
||||
CloneRememberingOriginalElement(std::shared_ptr<Instruction> instruction) {
|
||||
std::shared_ptr<Instruction> copy =
|
||||
std::make_shared<Instruction>(*instruction);
|
||||
// Original instruction is either the original instruction of the copied
|
||||
// instruction, or the instruction copied.
|
||||
copy->originalInstruction = instruction->originalInstruction.expired()
|
||||
? instruction
|
||||
: instruction->originalInstruction;
|
||||
|
||||
return copy;
|
||||
}
|
||||
|
||||
} // namespace gd
|
||||
|
@@ -5,7 +5,9 @@
|
||||
*/
|
||||
#ifndef INSTRUCTION_H
|
||||
#define INSTRUCTION_H
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
|
||||
#include "GDCore/Events/Expression.h"
|
||||
#include "GDCore/Events/InstructionsList.h"
|
||||
#include "GDCore/String.h"
|
||||
@@ -131,6 +133,17 @@ class GD_CORE_API Instruction {
|
||||
*/
|
||||
inline gd::InstructionsList& GetSubInstructions() { return subInstructions; };
|
||||
|
||||
/**
|
||||
* \brief Return the original instruction this instruction was copied from.
|
||||
*
|
||||
* Useful to get reference to the original instruction in memory during code
|
||||
* generation, to ensure stable unique identifiers.
|
||||
*/
|
||||
std::weak_ptr<Instruction> GetOriginalInstruction() { return originalInstruction; };
|
||||
|
||||
friend std::shared_ptr<Instruction> CloneRememberingOriginalElement(
|
||||
std::shared_ptr<Instruction> instruction);
|
||||
|
||||
private:
|
||||
gd::String type; ///< Instruction type
|
||||
bool inverted; ///< True if the instruction if inverted. Only applicable for
|
||||
@@ -139,9 +152,23 @@ class GD_CORE_API Instruction {
|
||||
parameters; ///< Vector containing the parameters
|
||||
gd::InstructionsList subInstructions; ///< Sub instructions, if applicable.
|
||||
|
||||
std::weak_ptr<Instruction>
|
||||
originalInstruction; ///< Pointer used to remember which gd::Instruction
|
||||
///< this instruction was copied from. Useful to
|
||||
///< ensure the stability of code generation (as
|
||||
///< some part of code generation uses the pointer
|
||||
///< to the instruction as a unique identifier).
|
||||
|
||||
static gd::Expression badExpression;
|
||||
};
|
||||
|
||||
/**
|
||||
* Clone the given instruction, returning an instruction for which
|
||||
* `GetOriginalInstruction()` returns the originally copied instruction.
|
||||
*/
|
||||
std::shared_ptr<Instruction> GD_CORE_API
|
||||
CloneRememberingOriginalElement(std::shared_ptr<Instruction> instruction);
|
||||
|
||||
} // namespace gd
|
||||
|
||||
#endif // INSTRUCTION_H
|
||||
|
@@ -107,8 +107,7 @@ void SpriteObject::DoSerializeTo(gd::SerializerElement& element) const {
|
||||
}
|
||||
}
|
||||
|
||||
std::map<gd::String, gd::PropertyDescriptor> SpriteObject::GetProperties(
|
||||
gd::Project& project) const {
|
||||
std::map<gd::String, gd::PropertyDescriptor> SpriteObject::GetProperties() const {
|
||||
std::map<gd::String, gd::PropertyDescriptor> properties;
|
||||
properties[_("Animate even if hidden or far from the screen")]
|
||||
.SetValue(updateIfNotVisible ? "true" : "false")
|
||||
@@ -119,8 +118,7 @@ std::map<gd::String, gd::PropertyDescriptor> SpriteObject::GetProperties(
|
||||
}
|
||||
|
||||
bool SpriteObject::UpdateProperty(const gd::String& name,
|
||||
const gd::String& value,
|
||||
gd::Project& project) {
|
||||
const gd::String& value) {
|
||||
if (name == _("Animate even if hidden or far from the screen"))
|
||||
updateIfNotVisible = value == "1";
|
||||
|
||||
|
@@ -48,11 +48,9 @@ class GD_CORE_API SpriteObject : public gd::Object {
|
||||
#if defined(GD_IDE_ONLY)
|
||||
void ExposeResources(gd::ArbitraryResourceWorker& worker) override;
|
||||
|
||||
std::map<gd::String, gd::PropertyDescriptor> GetProperties(
|
||||
gd::Project& project) const override;
|
||||
std::map<gd::String, gd::PropertyDescriptor> GetProperties() const override;
|
||||
bool UpdateProperty(const gd::String& name,
|
||||
const gd::String& value,
|
||||
gd::Project& project) override;
|
||||
const gd::String& value) override;
|
||||
|
||||
std::map<gd::String, gd::PropertyDescriptor> GetInitialInstanceProperties(
|
||||
const gd::InitialInstance& position,
|
||||
|
@@ -119,6 +119,18 @@ BuiltinExtensionsImplementer::ImplementsStringInstructionsExtension(
|
||||
_("Manipulation of text"),
|
||||
"res/conditions/toujours24.png")
|
||||
|
||||
.AddParameter("string", _("Text"))
|
||||
.AddParameter("string", _("Text to search for"))
|
||||
.SetHidden(); // Deprecated, see StrFindLast instead.
|
||||
|
||||
extension
|
||||
.AddExpression("StrFindLast",
|
||||
_("Search the last occurence in a text"),
|
||||
_("Search the last occurence in a string (return the position of "
|
||||
"the result, from the beginning of the string, or -1 if not found)"),
|
||||
_("Manipulation of text"),
|
||||
"res/conditions/toujours24.png")
|
||||
|
||||
.AddParameter("string", _("Text"))
|
||||
.AddParameter("string", _("Text to search for"));
|
||||
|
||||
@@ -145,6 +157,22 @@ BuiltinExtensionsImplementer::ImplementsStringInstructionsExtension(
|
||||
_("Manipulation of text"),
|
||||
"res/conditions/toujours24.png")
|
||||
|
||||
.AddParameter("string", _("Text"))
|
||||
.AddParameter("string", _("Text to search for"))
|
||||
.AddParameter("expression",
|
||||
_("Position of the last character in the string to be "
|
||||
"considered in the search"))
|
||||
.SetHidden(); // Deprecated, see StrFindLastFrom instead.
|
||||
|
||||
extension
|
||||
.AddExpression(
|
||||
"StrFindLastFrom",
|
||||
_("Search the last occurence in a text, starting from a position"),
|
||||
_("Search in a text the last occurence, starting from a position (return "
|
||||
" the position of the result, from the beginning of the string, or -1 if not found)"),
|
||||
_("Manipulation of text"),
|
||||
"res/conditions/toujours24.png")
|
||||
|
||||
.AddParameter("string", _("Text"))
|
||||
.AddParameter("string", _("Text to search for"))
|
||||
.AddParameter("expression",
|
||||
|
@@ -90,7 +90,7 @@ size_t ParameterMetadataTools::GetObjectParameterIndexFor(
|
||||
// the object in the list of parameters (if possible, just after).
|
||||
// Search "lastObjectName" in the codebase for other place where this
|
||||
// convention is enforced.
|
||||
for (std::size_t pNb = parameterIndex - 1; pNb < parametersMetadata.size();
|
||||
for (std::size_t pNb = parameterIndex; pNb < parametersMetadata.size();
|
||||
pNb--) {
|
||||
if (gd::ParameterMetadata::IsObject(parametersMetadata[pNb].GetType())) {
|
||||
return pNb;
|
||||
|
@@ -49,9 +49,15 @@ InstructionSentenceFormatter::GetAsFormattedText(
|
||||
|
||||
gd::String sentence = metadata.GetSentence();
|
||||
std::replace(sentence.Raw().begin(), sentence.Raw().end(), '\n', ' ');
|
||||
bool parse = true;
|
||||
|
||||
size_t loopCount = 0;
|
||||
bool parse = true;
|
||||
while (parse) {
|
||||
if (loopCount > 40) {
|
||||
break;
|
||||
}
|
||||
loopCount++;
|
||||
|
||||
// Search first parameter
|
||||
parse = false;
|
||||
size_t firstParamPosition = gd::String::npos;
|
||||
|
@@ -15,7 +15,7 @@ Behavior::~Behavior(){};
|
||||
|
||||
#if defined(GD_IDE_ONLY)
|
||||
std::map<gd::String, gd::PropertyDescriptor> Behavior::GetProperties(
|
||||
const gd::SerializerElement& behaviorContent, gd::Project& project) const {
|
||||
const gd::SerializerElement& behaviorContent) const {
|
||||
std::map<gd::String, gd::PropertyDescriptor> nothing;
|
||||
return nothing;
|
||||
}
|
||||
|
@@ -61,7 +61,7 @@ class GD_CORE_API Behavior {
|
||||
* \see gd::PropertyDescriptor
|
||||
*/
|
||||
virtual std::map<gd::String, gd::PropertyDescriptor> GetProperties(
|
||||
const gd::SerializerElement& behaviorContent, gd::Project& project) const;
|
||||
const gd::SerializerElement& behaviorContent) const;
|
||||
|
||||
/**
|
||||
* \brief Called when the IDE wants to update a custom property of the
|
||||
@@ -72,8 +72,7 @@ class GD_CORE_API Behavior {
|
||||
*/
|
||||
virtual bool UpdateProperty(gd::SerializerElement& behaviorContent,
|
||||
const gd::String& name,
|
||||
const gd::String& value,
|
||||
gd::Project& project) {
|
||||
const gd::String& value) {
|
||||
return false;
|
||||
};
|
||||
#endif
|
||||
|
@@ -16,7 +16,7 @@ BehaviorsSharedData::~BehaviorsSharedData(){};
|
||||
|
||||
#if defined(GD_IDE_ONLY)
|
||||
std::map<gd::String, gd::PropertyDescriptor> BehaviorsSharedData::GetProperties(
|
||||
const gd::SerializerElement& behaviorSharedDataContent, gd::Project& project) const {
|
||||
const gd::SerializerElement& behaviorSharedDataContent) const {
|
||||
std::map<gd::String, gd::PropertyDescriptor> nothing;
|
||||
return nothing;
|
||||
}
|
||||
|
@@ -64,8 +64,7 @@ class GD_CORE_API BehaviorsSharedData {
|
||||
* \see gd::PropertyDescriptor
|
||||
*/
|
||||
virtual std::map<gd::String, gd::PropertyDescriptor> GetProperties(
|
||||
const gd::SerializerElement& behaviorSharedDataContent,
|
||||
gd::Project& project) const;
|
||||
const gd::SerializerElement& behaviorSharedDataContent) const;
|
||||
|
||||
/**
|
||||
* \brief Called when the IDE wants to update a property of the shared data
|
||||
@@ -75,8 +74,7 @@ class GD_CORE_API BehaviorsSharedData {
|
||||
*/
|
||||
virtual bool UpdateProperty(gd::SerializerElement& behaviorSharedDataContent,
|
||||
const gd::String& name,
|
||||
const gd::String& value,
|
||||
gd::Project& project) {
|
||||
const gd::String& value) {
|
||||
return false;
|
||||
};
|
||||
#endif
|
||||
|
@@ -5,10 +5,12 @@
|
||||
*/
|
||||
|
||||
#include "GDCore/Project/InitialInstance.h"
|
||||
|
||||
#include "GDCore/Project/Layout.h"
|
||||
#include "GDCore/Project/Object.h"
|
||||
#include "GDCore/Project/Project.h"
|
||||
#include "GDCore/Serialization/SerializerElement.h"
|
||||
#include "GDCore/Tools/UUID/UUID.h"
|
||||
#if defined(GD_IDE_ONLY)
|
||||
#include "GDCore/Project/PropertyDescriptor.h"
|
||||
#endif
|
||||
@@ -27,7 +29,8 @@ InitialInstance::InitialInstance()
|
||||
personalizedSize(false),
|
||||
width(0),
|
||||
height(0),
|
||||
locked(false) {}
|
||||
locked(false),
|
||||
persistentUuid(UUID::MakeUuid4()) {}
|
||||
|
||||
void InitialInstance::UnserializeFrom(const SerializerElement& element) {
|
||||
SetObjectName(element.GetStringAttribute("name", "", "nom"));
|
||||
@@ -42,6 +45,9 @@ void InitialInstance::UnserializeFrom(const SerializerElement& element) {
|
||||
SetLayer(element.GetStringAttribute("layer"));
|
||||
SetLocked(element.GetBoolAttribute("locked", false));
|
||||
|
||||
persistentUuid = element.GetStringAttribute("persistentUuid");
|
||||
if (persistentUuid.empty()) ResetPersistentUuid();
|
||||
|
||||
floatInfos.clear();
|
||||
const SerializerElement& floatPropElement =
|
||||
element.GetChild("numberProperties", 0, "floatInfos");
|
||||
@@ -79,6 +85,9 @@ void InitialInstance::SerializeTo(SerializerElement& element) const {
|
||||
element.SetAttribute("height", GetCustomHeight());
|
||||
element.SetAttribute("locked", IsLocked());
|
||||
|
||||
if (persistentUuid.empty()) persistentUuid = UUID::MakeUuid4();
|
||||
element.SetStringAttribute("persistentUuid", persistentUuid);
|
||||
|
||||
SerializerElement& floatPropElement = element.AddChild("numberProperties");
|
||||
floatPropElement.ConsiderAsArrayOf("property");
|
||||
for (std::map<gd::String, float>::const_iterator floatInfo =
|
||||
@@ -104,6 +113,11 @@ void InitialInstance::SerializeTo(SerializerElement& element) const {
|
||||
GetVariables().SerializeTo(element.AddChild("initialVariables"));
|
||||
}
|
||||
|
||||
InitialInstance& InitialInstance::ResetPersistentUuid() {
|
||||
persistentUuid = UUID::MakeUuid4();
|
||||
return *this;
|
||||
}
|
||||
|
||||
#if defined(GD_IDE_ONLY)
|
||||
std::map<gd::String, gd::PropertyDescriptor>
|
||||
InitialInstance::GetCustomProperties(gd::Project& project, gd::Layout& layout) {
|
||||
@@ -146,13 +160,12 @@ const gd::String& InitialInstance::GetRawStringProperty(
|
||||
return it != stringInfos.end() ? it->second : *badStringProperyValue;
|
||||
}
|
||||
|
||||
void InitialInstance::SetRawFloatProperty(const gd::String& name, float value)
|
||||
{
|
||||
void InitialInstance::SetRawFloatProperty(const gd::String& name, float value) {
|
||||
floatInfos[name] = value;
|
||||
}
|
||||
|
||||
void InitialInstance::SetRawStringProperty(const gd::String& name, const gd::String& value)
|
||||
{
|
||||
void InitialInstance::SetRawStringProperty(const gd::String& name,
|
||||
const gd::String& value) {
|
||||
stringInfos[name] = value;
|
||||
}
|
||||
#endif
|
||||
|
@@ -200,7 +200,7 @@ class GD_CORE_API InitialInstance {
|
||||
/**
|
||||
* \brief Get the value of a float property stored in the instance.
|
||||
* \note Only use this when \a GetCustomProperties is too slow (when rendering
|
||||
* instances for example).
|
||||
* instances for example).
|
||||
* \return the value of the property, or 0 if it does
|
||||
* not exists.
|
||||
*/
|
||||
@@ -209,7 +209,7 @@ class GD_CORE_API InitialInstance {
|
||||
/**
|
||||
* \brief Get the value of a string property stored in the instance.
|
||||
* \note Only use this when \a GetCustomProperties is too slow (when rendering
|
||||
* instances for example).
|
||||
* instances for example).
|
||||
* \return the value of the propety, or an empty
|
||||
* string if it does not exists.
|
||||
*/
|
||||
@@ -240,6 +240,12 @@ class GD_CORE_API InitialInstance {
|
||||
* \brief Unserialize the instances container.
|
||||
*/
|
||||
virtual void UnserializeFrom(const SerializerElement& element);
|
||||
|
||||
/**
|
||||
* \brief Reset the persistent UUID used to recognize
|
||||
* the same initial instance between serialization.
|
||||
*/
|
||||
InitialInstance& ResetPersistentUuid();
|
||||
///@}
|
||||
|
||||
// More properties can be stored in floatInfos and stringInfos.
|
||||
@@ -260,6 +266,7 @@ class GD_CORE_API InitialInstance {
|
||||
float height; ///< Object custom height
|
||||
gd::VariablesContainer initialVariables; ///< Instance specific variables
|
||||
bool locked; ///< True if the instance is locked
|
||||
mutable gd::String persistentUuid; ///< A persistent random version 4 UUID, useful for hot reloading.
|
||||
|
||||
static gd::String*
|
||||
badStringProperyValue; ///< Empty string returned by GetRawStringProperty
|
||||
|
@@ -77,8 +77,7 @@ gd::BehaviorContent& Object::AddBehavior(
|
||||
}
|
||||
|
||||
#if defined(GD_IDE_ONLY)
|
||||
std::map<gd::String, gd::PropertyDescriptor> Object::GetProperties(
|
||||
gd::Project& project) const {
|
||||
std::map<gd::String, gd::PropertyDescriptor> Object::GetProperties() const {
|
||||
std::map<gd::String, gd::PropertyDescriptor> nothing;
|
||||
return nothing;
|
||||
}
|
||||
|
@@ -139,8 +139,7 @@ class GD_CORE_API Object {
|
||||
* \return a std::map with properties names as key.
|
||||
* \see gd::PropertyDescriptor
|
||||
*/
|
||||
virtual std::map<gd::String, gd::PropertyDescriptor> GetProperties(
|
||||
gd::Project& project) const;
|
||||
virtual std::map<gd::String, gd::PropertyDescriptor> GetProperties() const;
|
||||
|
||||
/**
|
||||
* \brief Called when the IDE wants to update a custom property of the object
|
||||
@@ -148,8 +147,7 @@ class GD_CORE_API Object {
|
||||
* \return false if the new value cannot be set
|
||||
*/
|
||||
virtual bool UpdateProperty(const gd::String& name,
|
||||
const gd::String& value,
|
||||
gd::Project& project) {
|
||||
const gd::String& value) {
|
||||
return false;
|
||||
};
|
||||
///@}
|
||||
|
@@ -99,14 +99,12 @@ std::vector<gd::String> ResourcesManager::GetAllResourceNames() const {
|
||||
}
|
||||
|
||||
#if defined(GD_IDE_ONLY)
|
||||
std::map<gd::String, gd::PropertyDescriptor> Resource::GetProperties(
|
||||
gd::Project& project) const {
|
||||
std::map<gd::String, gd::PropertyDescriptor> Resource::GetProperties() const {
|
||||
std::map<gd::String, gd::PropertyDescriptor> nothing;
|
||||
return nothing;
|
||||
}
|
||||
|
||||
std::map<gd::String, gd::PropertyDescriptor> ImageResource::GetProperties(
|
||||
gd::Project& project) const {
|
||||
std::map<gd::String, gd::PropertyDescriptor> ImageResource::GetProperties() const {
|
||||
std::map<gd::String, gd::PropertyDescriptor> properties;
|
||||
properties[_("Smooth the image")]
|
||||
.SetValue(smooth ? "true" : "false")
|
||||
@@ -119,8 +117,7 @@ std::map<gd::String, gd::PropertyDescriptor> ImageResource::GetProperties(
|
||||
}
|
||||
|
||||
bool ImageResource::UpdateProperty(const gd::String& name,
|
||||
const gd::String& value,
|
||||
gd::Project& project) {
|
||||
const gd::String& value) {
|
||||
if (name == _("Smooth the image"))
|
||||
smooth = value == "1";
|
||||
else if (name == _("Always loaded in memory"))
|
||||
@@ -563,8 +560,7 @@ void JsonResource::SerializeTo(SerializerElement& element) const {
|
||||
element.SetAttribute("disablePreload", IsPreloadDisabled());
|
||||
}
|
||||
|
||||
std::map<gd::String, gd::PropertyDescriptor> JsonResource::GetProperties(
|
||||
gd::Project& project) const {
|
||||
std::map<gd::String, gd::PropertyDescriptor> JsonResource::GetProperties() const {
|
||||
std::map<gd::String, gd::PropertyDescriptor> properties;
|
||||
properties["disablePreload"]
|
||||
.SetValue(disablePreload ? "true" : "false")
|
||||
@@ -575,8 +571,7 @@ std::map<gd::String, gd::PropertyDescriptor> JsonResource::GetProperties(
|
||||
}
|
||||
|
||||
bool JsonResource::UpdateProperty(const gd::String& name,
|
||||
const gd::String& value,
|
||||
gd::Project& project) {
|
||||
const gd::String& value) {
|
||||
if (name == "disablePreload") disablePreload = value == "1";
|
||||
|
||||
return true;
|
||||
|
@@ -8,6 +8,7 @@
|
||||
#include <map>
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
|
||||
#include "GDCore/String.h"
|
||||
namespace gd {
|
||||
class Project;
|
||||
@@ -112,8 +113,7 @@ class GD_CORE_API Resource {
|
||||
* \return a std::map with properties names as key.
|
||||
* \see gd::PropertyDescriptor
|
||||
*/
|
||||
virtual std::map<gd::String, gd::PropertyDescriptor> GetProperties(
|
||||
gd::Project& project) const;
|
||||
virtual std::map<gd::String, gd::PropertyDescriptor> GetProperties() const;
|
||||
|
||||
/**
|
||||
* \brief Called when the IDE wants to update a custom property of the
|
||||
@@ -122,8 +122,7 @@ class GD_CORE_API Resource {
|
||||
* \return false if the new value cannot be set
|
||||
*/
|
||||
virtual bool UpdateProperty(const gd::String& name,
|
||||
const gd::String& value,
|
||||
gd::Project& project) {
|
||||
const gd::String& value) {
|
||||
return false;
|
||||
};
|
||||
///@}
|
||||
@@ -178,11 +177,9 @@ class GD_CORE_API ImageResource : public Resource {
|
||||
#if defined(GD_IDE_ONLY)
|
||||
virtual bool UseFile() override { return true; }
|
||||
|
||||
std::map<gd::String, gd::PropertyDescriptor> GetProperties(
|
||||
gd::Project& project) const override;
|
||||
std::map<gd::String, gd::PropertyDescriptor> GetProperties() const override;
|
||||
bool UpdateProperty(const gd::String& name,
|
||||
const gd::String& value,
|
||||
gd::Project& project) override;
|
||||
const gd::String& value) override;
|
||||
|
||||
/**
|
||||
* \brief Serialize the object
|
||||
@@ -315,11 +312,9 @@ class GD_CORE_API JsonResource : public Resource {
|
||||
#if defined(GD_IDE_ONLY)
|
||||
virtual bool UseFile() override { return true; }
|
||||
|
||||
std::map<gd::String, gd::PropertyDescriptor> GetProperties(
|
||||
gd::Project& project) const override;
|
||||
std::map<gd::String, gd::PropertyDescriptor> GetProperties() const override;
|
||||
bool UpdateProperty(const gd::String& name,
|
||||
const gd::String& value,
|
||||
gd::Project& project) override;
|
||||
const gd::String& value) override;
|
||||
|
||||
void SerializeTo(SerializerElement& element) const override;
|
||||
#endif
|
||||
|
@@ -90,7 +90,7 @@ template <typename T>
|
||||
void SPtrList<T>::Init(const gd::SPtrList<T>& other) {
|
||||
elements.clear();
|
||||
for (size_t i = 0; i < other.elements.size(); ++i)
|
||||
elements.push_back(std::make_shared<T>(other[i]));
|
||||
elements.push_back(CloneRememberingOriginalElement(other.elements[i]));
|
||||
}
|
||||
|
||||
} // namespace gd
|
||||
|
24
Core/GDCore/Tools/UUID/UUID.h
Normal file
24
Core/GDCore/Tools/UUID/UUID.h
Normal file
@@ -0,0 +1,24 @@
|
||||
/*
|
||||
* GDevelop Core
|
||||
* Copyright 2008-present Florian Rival (Florian.Rival@gmail.com). All rights
|
||||
* reserved. This project is released under the MIT License.
|
||||
*/
|
||||
|
||||
#ifndef GDCORE_TOOLS_UUID_UUID_H
|
||||
#define GDCORE_TOOLS_UUID_UUID_H
|
||||
|
||||
#include "GDCore/String.h"
|
||||
#include "sole.h"
|
||||
|
||||
namespace gd {
|
||||
namespace UUID {
|
||||
|
||||
/**
|
||||
* Generate a random UUID v4
|
||||
*/
|
||||
inline gd::String MakeUuid4() { return gd::String::From(sole::uuid4()); }
|
||||
|
||||
} // namespace UUID
|
||||
} // namespace gd
|
||||
|
||||
#endif
|
249
Core/GDCore/Tools/UUID/sole.h
Normal file
249
Core/GDCore/Tools/UUID/sole.h
Normal file
@@ -0,0 +1,249 @@
|
||||
/**
|
||||
* Modified version of sole (https://github.com/r-lyeh-archived/sole) C++11 library
|
||||
* to only generate UUID v4.
|
||||
*
|
||||
* Sole is a lightweight C++11 library to generate universally unique identificators.
|
||||
* Sole provides interface for UUID versions 0, 1 and 4.
|
||||
*
|
||||
* https://github.com/r-lyeh/sole
|
||||
* Copyright (c) 2013,2014,2015 r-lyeh. zlib/libpng licensed.
|
||||
*
|
||||
* Based on code by Dmitri Bouianov, Philip O'Toole, Poco C++ libraries and anonymous
|
||||
* code found on the net. Thanks guys!
|
||||
*
|
||||
* Theory: (see Hoylen's answer at [1])
|
||||
* - UUID version 1 (48-bit MAC address + 60-bit clock with a resolution of 100ns)
|
||||
* Clock wraps in 3603 A.D.
|
||||
* Up to 10000000 UUIDs per second.
|
||||
* MAC address revealed.
|
||||
*
|
||||
* - UUID Version 4 (122-bits of randomness)
|
||||
* See [2] or other analysis that describe how very unlikely a duplicate is.
|
||||
*
|
||||
* - Use v1 if you need to sort or classify UUIDs per machine.
|
||||
* Use v1 if you are worried about leaving it up to probabilities (e.g. your are the
|
||||
* type of person worried about the earth getting destroyed by a large asteroid in your
|
||||
* lifetime). Just use a v1 and it is guaranteed to be unique till 3603 AD.
|
||||
*
|
||||
* - Use v4 if you are worried about security issues and determinism. That is because
|
||||
* v1 UUIDs reveal the MAC address of the machine it was generated on and they can be
|
||||
* predictable. Use v4 if you need more than 10 million uuids per second, or if your
|
||||
* application wants to live past 3603 A.D.
|
||||
* Additionally a custom UUID v0 is provided:
|
||||
* - 16-bit PID + 48-bit MAC address + 60-bit clock with a resolution of 100ns since Unix epoch
|
||||
* - Format is EPOCH_LOW-EPOCH_MID-VERSION(0)|EPOCH_HI-PID-MAC
|
||||
* - Clock wraps in 3991 A.D.
|
||||
* - Up to 10000000 UUIDs per second.
|
||||
* - MAC address and PID revealed.
|
||||
* References:
|
||||
* - [1] http://stackoverflow.com/questions/1155008/how-unique-is-uuid
|
||||
* - [2] http://en.wikipedia.org/wiki/UUID#Random%5FUUID%5Fprobability%5Fof%5Fduplicates
|
||||
* - http://en.wikipedia.org/wiki/Universally_unique_identifier
|
||||
* - http://en.cppreference.com/w/cpp/numeric/random/random_device
|
||||
* - http://www.itu.int/ITU-T/asn1/uuid.html f81d4fae-7dec-11d0-a765-00a0c91e6bf6
|
||||
* - rlyeh ~~ listening to Hedon Cries / Until The Sun Goes up
|
||||
*/
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#pragma once
|
||||
#include <stdint.h>
|
||||
#include <stdio.h> // for size_t; should be stddef.h instead; however, clang+archlinux fails when compiling it (@Travis-Ci)
|
||||
#include <sys/types.h> // for uint32_t; should be stdint.h instead; however, GCC 5 on OSX fails when compiling it (See issue #11)
|
||||
#include <functional>
|
||||
#include <string>
|
||||
|
||||
// public API
|
||||
|
||||
namespace sole
|
||||
{
|
||||
// 128-bit basic UUID type that allows comparison and sorting.
|
||||
// Use .str() for printing and .pretty() for pretty printing.
|
||||
// Also, ostream friendly.
|
||||
struct uuid
|
||||
{
|
||||
uint64_t ab;
|
||||
uint64_t cd;
|
||||
|
||||
bool operator==( const uuid &other ) const;
|
||||
bool operator!=( const uuid &other ) const;
|
||||
bool operator <( const uuid &other ) const;
|
||||
|
||||
std::string base62() const;
|
||||
std::string str() const;
|
||||
|
||||
template<typename ostream>
|
||||
inline friend ostream &operator<<( ostream &os, const uuid &self ) {
|
||||
return os << self.str(), os;
|
||||
}
|
||||
};
|
||||
|
||||
// Generators
|
||||
uuid uuid4(); // UUID v4, pros: anonymous, fast; con: uuids "can clash"
|
||||
|
||||
// Rebuilders
|
||||
uuid rebuild( uint64_t ab, uint64_t cd );
|
||||
uuid rebuild( const std::string &uustr );
|
||||
}
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable:4127)
|
||||
#endif
|
||||
|
||||
namespace std {
|
||||
template<>
|
||||
struct hash< sole::uuid > {
|
||||
public:
|
||||
// hash functor: hash uuid to size_t value by pseudorandomizing transform
|
||||
size_t operator()( const sole::uuid &uuid ) const {
|
||||
if( sizeof(size_t) > 4 ) {
|
||||
return size_t( uuid.ab ^ uuid.cd );
|
||||
} else {
|
||||
uint64_t hash64 = uuid.ab ^ uuid.cd;
|
||||
return size_t( uint32_t( hash64 >> 32 ) ^ uint32_t( hash64 ) );
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(pop)
|
||||
#endif
|
||||
|
||||
// implementation
|
||||
|
||||
#include <memory.h>
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include <time.h>
|
||||
|
||||
#include <cstring>
|
||||
#include <ctime>
|
||||
|
||||
#include <iomanip>
|
||||
#include <random>
|
||||
#include <sstream>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include <unistd.h>
|
||||
|
||||
inline bool sole::uuid::operator==( const sole::uuid &other ) const {
|
||||
return ab == other.ab && cd == other.cd;
|
||||
}
|
||||
inline bool sole::uuid::operator!=( const sole::uuid &other ) const {
|
||||
return !operator==(other);
|
||||
}
|
||||
inline bool sole::uuid::operator<( const sole::uuid &other ) const {
|
||||
if( ab < other.ab ) return true;
|
||||
if( ab > other.ab ) return false;
|
||||
if( cd < other.cd ) return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
namespace sole {
|
||||
|
||||
inline std::string uuid::str() const {
|
||||
std::stringstream ss;
|
||||
ss << std::hex << std::nouppercase << std::setfill('0');
|
||||
|
||||
uint32_t a = (ab >> 32);
|
||||
uint32_t b = (ab & 0xFFFFFFFF);
|
||||
uint32_t c = (cd >> 32);
|
||||
uint32_t d = (cd & 0xFFFFFFFF);
|
||||
|
||||
ss << std::setw(8) << (a) << '-';
|
||||
ss << std::setw(4) << (b >> 16) << '-';
|
||||
ss << std::setw(4) << (b & 0xFFFF) << '-';
|
||||
ss << std::setw(4) << (c >> 16 ) << '-';
|
||||
ss << std::setw(4) << (c & 0xFFFF);
|
||||
ss << std::setw(8) << d;
|
||||
|
||||
return ss.str();
|
||||
}
|
||||
|
||||
inline std::string uuid::base62() const {
|
||||
int base62len = 10 + 26 + 26;
|
||||
const char base62[] =
|
||||
"0123456789"
|
||||
"ABCDEFGHIJKLMNOPQRSTUVWXYZ"
|
||||
"abcdefghijklmnopqrstuvwxyz";
|
||||
char res[24], *end = &res[24]; *(--end) = '\0';
|
||||
uint64_t rem, AB = ab, CD = cd;
|
||||
do {
|
||||
rem = CD % base62len;
|
||||
*--end = base62[int(rem)];
|
||||
CD /= base62len;
|
||||
} while (CD > 0);
|
||||
*--end = '-';
|
||||
do {
|
||||
rem = AB % base62len;
|
||||
*--end = base62[int(rem)];
|
||||
AB /= base62len;
|
||||
} while (AB > 0);
|
||||
return end;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////
|
||||
// UUID implementations
|
||||
|
||||
inline uuid uuid4() {
|
||||
static std::random_device rd;
|
||||
static std::uniform_int_distribution<uint64_t> dist(0, (uint64_t)(~0));
|
||||
|
||||
uuid my;
|
||||
|
||||
my.ab = dist(rd);
|
||||
my.cd = dist(rd);
|
||||
|
||||
my.ab = (my.ab & 0xFFFFFFFFFFFF0FFFULL) | 0x0000000000004000ULL;
|
||||
my.cd = (my.cd & 0x3FFFFFFFFFFFFFFFULL) | 0x8000000000000000ULL;
|
||||
|
||||
return my;
|
||||
}
|
||||
|
||||
inline uuid rebuild( uint64_t ab, uint64_t cd ) {
|
||||
uuid u;
|
||||
u.ab = ab; u.cd = cd;
|
||||
return u;
|
||||
}
|
||||
|
||||
inline uuid rebuild( const std::string &uustr ) {
|
||||
char sep;
|
||||
uint64_t a,b,c,d,e;
|
||||
uuid u = { 0, 0 };
|
||||
auto idx = uustr.find_first_of("-");
|
||||
if( idx != std::string::npos ) {
|
||||
// single separator, base62 notation
|
||||
if( uustr.find_first_of("-",idx+1) == std::string::npos ) {
|
||||
auto rebase62 = [&]( const char *input, size_t limit ) -> uint64_t {
|
||||
int base62len = 10 + 26 + 26;
|
||||
auto strpos = []( char ch ) -> size_t {
|
||||
if( ch >= 'a' ) return ch - 'a' + 10 + 26;
|
||||
if( ch >= 'A' ) return ch - 'A' + 10;
|
||||
return ch - '0';
|
||||
};
|
||||
uint64_t res = strpos( input[0] );
|
||||
for( size_t i = 1; i < limit; ++i )
|
||||
res = base62len * res + strpos( input[i] );
|
||||
return res;
|
||||
};
|
||||
u.ab = rebase62( &uustr[0], idx );
|
||||
u.cd = rebase62( &uustr[idx+1], uustr.size() - (idx+1) );
|
||||
}
|
||||
// else classic hex notation
|
||||
else {
|
||||
std::stringstream ss( uustr );
|
||||
if( ss >> std::hex >> a >> sep >> b >> sep >> c >> sep >> d >> sep >> e ) {
|
||||
if( ss.eof() ) {
|
||||
u.ab = (a << 32) | (b << 16) | c;
|
||||
u.cd = (d << 48) | e;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return u;
|
||||
}
|
||||
|
||||
} // ::sole
|
@@ -1,8 +1,9 @@
|
||||
// @flow
|
||||
/**
|
||||
* This is a declaration of an extension for GDevelop 5.
|
||||
*
|
||||
* ℹ️ Run `node import-GDJS-Runtime.js` (in newIDE/app/scripts) if you make any change
|
||||
* to this extension file or to any other *.js file that you reference inside.
|
||||
* ℹ️ Changes in this file are watched and automatically imported if the editor
|
||||
* is running. You can also manually run `node import-GDJS-Runtime.js` (in newIDE/app/scripts).
|
||||
*
|
||||
* The file must be named "JsExtension.js", otherwise GDevelop won't load it.
|
||||
* ⚠️ If you make a change and the extension is not loaded, open the developer console
|
||||
@@ -10,8 +11,16 @@
|
||||
*
|
||||
* More information on https://github.com/4ian/GDevelop/blob/master/newIDE/README-extensions.md
|
||||
*/
|
||||
|
||||
/*::
|
||||
// Import types to allow Flow to do static type checking on this file.
|
||||
// Extensions declaration are typed using Flow (like the editor), but the files
|
||||
// for the game engine are checked with TypeScript annotations.
|
||||
import { type ObjectsRenderingService, type ObjectsEditorService } from '../JsExtensionTypes.flow.js'
|
||||
*/
|
||||
|
||||
module.exports = {
|
||||
createExtension: function(_, gd) {
|
||||
createExtension: function(_/*: (string) => string */, gd/*: libGDevelop */) {
|
||||
const extension = new gd.PlatformExtension();
|
||||
extension.setExtensionInformation(
|
||||
'AdMob',
|
||||
@@ -355,7 +364,7 @@ module.exports = {
|
||||
|
||||
return extension;
|
||||
},
|
||||
runExtensionSanityTests: function(gd, extension) {
|
||||
runExtensionSanityTests: function(gd /*: libGDevelop */, extension /*: gdPlatformExtension*/) {
|
||||
return [];
|
||||
},
|
||||
};
|
||||
|
@@ -48,7 +48,7 @@ gd::String GetAnchorAsString(AnchorBehavior::VerticalAnchor anchor) {
|
||||
} // namespace
|
||||
|
||||
std::map<gd::String, gd::PropertyDescriptor> AnchorBehavior::GetProperties(
|
||||
const gd::SerializerElement& behaviorContent, gd::Project& project) const {
|
||||
const gd::SerializerElement& behaviorContent) const {
|
||||
std::map<gd::String, gd::PropertyDescriptor> properties;
|
||||
|
||||
properties[_("relativeToOriginalWindowSize")]
|
||||
@@ -129,8 +129,7 @@ AnchorBehavior::VerticalAnchor GetVerticalAnchorFromString(
|
||||
|
||||
bool AnchorBehavior::UpdateProperty(gd::SerializerElement& behaviorContent,
|
||||
const gd::String& name,
|
||||
const gd::String& value,
|
||||
gd::Project& project) {
|
||||
const gd::String& value) {
|
||||
if (name == _("relativeToOriginalWindowSize"))
|
||||
behaviorContent.SetAttribute("relativeToOriginalWindowSize", value == "1");
|
||||
else if (name == _("Left edge anchor"))
|
||||
|
@@ -38,12 +38,10 @@ class GD_EXTENSION_API AnchorBehavior : public Behavior {
|
||||
|
||||
#if defined(GD_IDE_ONLY)
|
||||
virtual std::map<gd::String, gd::PropertyDescriptor> GetProperties(
|
||||
const gd::SerializerElement& behaviorContent,
|
||||
gd::Project& project) const override;
|
||||
const gd::SerializerElement& behaviorContent) const override;
|
||||
virtual bool UpdateProperty(gd::SerializerElement& behaviorContent,
|
||||
const gd::String& name,
|
||||
const gd::String& value,
|
||||
gd::Project& project) override;
|
||||
const gd::String& value) override;
|
||||
#endif
|
||||
|
||||
virtual void InitializeContent(
|
||||
|
@@ -40,6 +40,26 @@ gdjs.AnchorRuntimeBehavior.VerticalAnchor = {
|
||||
PROPORTIONAL: 3
|
||||
};
|
||||
|
||||
gdjs.AnchorRuntimeBehavior.prototype.updateFromBehaviorData = function(oldBehaviorData, newBehaviorData) {
|
||||
if (oldBehaviorData.leftEdgeAnchor !== newBehaviorData.leftEdgeAnchor) {
|
||||
this._leftEdgeAnchor = newBehaviorData.leftEdgeAnchor;
|
||||
}
|
||||
if (oldBehaviorData.rightEdgeAnchor !== newBehaviorData.rightEdgeAnchor) {
|
||||
this._rightEdgeAnchor = newBehaviorData.rightEdgeAnchor;
|
||||
}
|
||||
if (oldBehaviorData.topEdgeAnchor !== newBehaviorData.topEdgeAnchor) {
|
||||
this._topEdgeAnchor = newBehaviorData.topEdgeAnchor;
|
||||
}
|
||||
if (oldBehaviorData.bottomEdgeAnchor !== newBehaviorData.bottomEdgeAnchor) {
|
||||
this._bottomEdgeAnchor = newBehaviorData.bottomEdgeAnchor;
|
||||
}
|
||||
if (oldBehaviorData.relativeToOriginalWindowSize !== newBehaviorData.relativeToOriginalWindowSize) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
gdjs.AnchorRuntimeBehavior.prototype.onActivate = function() {
|
||||
this._invalidDistances = true;
|
||||
};
|
||||
|
@@ -1,8 +1,9 @@
|
||||
// @flow
|
||||
/**
|
||||
* This is a declaration of an extension for GDevelop 5.
|
||||
*
|
||||
* ℹ️ Run `node import-GDJS-Runtime.js` (in newIDE/app/scripts) if you make any change
|
||||
* to this extension file or to any other *.js file that you reference inside.
|
||||
* ℹ️ Changes in this file are watched and automatically imported if the editor
|
||||
* is running. You can also manually run `node import-GDJS-Runtime.js` (in newIDE/app/scripts).
|
||||
*
|
||||
* The file must be named "JsExtension.js", otherwise GDevelop won't load it.
|
||||
* ⚠️ If you make a change and the extension is not loaded, open the developer console
|
||||
@@ -11,8 +12,18 @@
|
||||
* More information on https://github.com/4ian/GDevelop/blob/master/newIDE/README-extensions.md
|
||||
*/
|
||||
|
||||
/*::
|
||||
// Import types to allow Flow to do static type checking on this file.
|
||||
// Extensions declaration are typed using Flow (like the editor), but the files
|
||||
// for the game engine are checked with TypeScript annotations.
|
||||
import { type ObjectsRenderingService, type ObjectsEditorService } from '../JsExtensionTypes.flow.js'
|
||||
*/
|
||||
|
||||
module.exports = {
|
||||
createExtension: function(_, gd) {
|
||||
createExtension: function (
|
||||
_ /*: (string) => string */,
|
||||
gd /*: libGDevelop */
|
||||
) {
|
||||
const extension = new gd.PlatformExtension();
|
||||
extension
|
||||
.setExtensionInformation(
|
||||
@@ -27,7 +38,8 @@ module.exports = {
|
||||
.setExtensionHelpPath('/objects/bbtext');
|
||||
|
||||
var objectBBText = new gd.ObjectJsImplementation();
|
||||
objectBBText.updateProperty = function(
|
||||
// $FlowExpectedError
|
||||
objectBBText.updateProperty = function (
|
||||
objectContent,
|
||||
propertyName,
|
||||
newValue
|
||||
@@ -43,68 +55,61 @@ module.exports = {
|
||||
|
||||
return false;
|
||||
};
|
||||
objectBBText.getProperties = function(objectContent) {
|
||||
var objectProperties = new gd.MapStringPropertyDescriptor();
|
||||
// $FlowExpectedError
|
||||
objectBBText.getProperties = function (objectContent) {
|
||||
const objectProperties = new gd.MapStringPropertyDescriptor();
|
||||
|
||||
objectProperties.set(
|
||||
'text',
|
||||
new gd.PropertyDescriptor(objectContent.text)
|
||||
.setType('textarea')
|
||||
.setLabel(_('BBCode text'))
|
||||
);
|
||||
objectProperties
|
||||
.getOrCreate('text')
|
||||
.setValue(objectContent.text)
|
||||
.setType('textarea')
|
||||
.setLabel(_('BBCode text'));
|
||||
|
||||
objectProperties.set(
|
||||
'color',
|
||||
new gd.PropertyDescriptor(objectContent.color)
|
||||
.setType('color')
|
||||
.setLabel(_('Base color'))
|
||||
);
|
||||
objectProperties
|
||||
.getOrCreate('color')
|
||||
.setValue(objectContent.color)
|
||||
.setType('color')
|
||||
.setLabel(_('Base color'));
|
||||
|
||||
objectProperties.set(
|
||||
'opacity',
|
||||
new gd.PropertyDescriptor(objectContent.opacity.toString())
|
||||
.setType('number')
|
||||
.setLabel(_('Opacity (0-255)'))
|
||||
);
|
||||
objectProperties
|
||||
.getOrCreate('opacity')
|
||||
.setValue(objectContent.opacity.toString())
|
||||
.setType('number')
|
||||
.setLabel(_('Opacity (0-255)'));
|
||||
|
||||
objectProperties.set(
|
||||
'fontSize',
|
||||
new gd.PropertyDescriptor(objectContent.fontSize.toString())
|
||||
.setType('number')
|
||||
.setLabel(_('Base size'))
|
||||
);
|
||||
objectProperties
|
||||
.getOrCreate('fontSize')
|
||||
.setValue(objectContent.fontSize.toString())
|
||||
.setType('number')
|
||||
.setLabel(_('Base size'));
|
||||
|
||||
objectProperties.set(
|
||||
'align',
|
||||
new gd.PropertyDescriptor(objectContent.align)
|
||||
.setType('choice')
|
||||
.addExtraInfo('left')
|
||||
.addExtraInfo('center')
|
||||
.addExtraInfo('right')
|
||||
.setLabel(_('Base alignment'))
|
||||
);
|
||||
objectProperties
|
||||
.getOrCreate('align')
|
||||
.setValue(objectContent.align)
|
||||
.setType('choice')
|
||||
.addExtraInfo('left')
|
||||
.addExtraInfo('center')
|
||||
.addExtraInfo('right')
|
||||
.setLabel(_('Base alignment'));
|
||||
|
||||
objectProperties.set(
|
||||
'fontFamily',
|
||||
new gd.PropertyDescriptor(objectContent.fontFamily)
|
||||
.setType('resource')
|
||||
.addExtraInfo('font')
|
||||
.setLabel(_('Base font family'))
|
||||
);
|
||||
objectProperties
|
||||
.getOrCreate('fontFamily')
|
||||
.setValue(objectContent.fontFamily)
|
||||
.setType('resource')
|
||||
.addExtraInfo('font')
|
||||
.setLabel(_('Base font family'));
|
||||
|
||||
objectProperties.set(
|
||||
'wordWrap',
|
||||
new gd.PropertyDescriptor(objectContent.wordWrap ? 'true' : 'false')
|
||||
.setType('boolean')
|
||||
.setLabel(_('Word wrapping'))
|
||||
);
|
||||
objectProperties
|
||||
.getOrCreate('wordWrap')
|
||||
.setValue(objectContent.wordWrap ? 'true' : 'false')
|
||||
.setType('boolean')
|
||||
.setLabel(_('Word wrapping'));
|
||||
|
||||
objectProperties.set(
|
||||
'visible',
|
||||
new gd.PropertyDescriptor(objectContent.visible ? 'true' : 'false')
|
||||
.setType('boolean')
|
||||
.setLabel(_('Visible on start'))
|
||||
);
|
||||
objectProperties
|
||||
.getOrCreate('visible')
|
||||
.setValue(objectContent.visible ? 'true' : 'false')
|
||||
.setType('boolean')
|
||||
.setLabel(_('Visible on start'));
|
||||
|
||||
return objectProperties;
|
||||
};
|
||||
@@ -122,7 +127,8 @@ module.exports = {
|
||||
})
|
||||
);
|
||||
|
||||
objectBBText.updateInitialInstanceProperty = function(
|
||||
// $FlowExpectedError
|
||||
objectBBText.updateInitialInstanceProperty = function (
|
||||
objectContent,
|
||||
instance,
|
||||
propertyName,
|
||||
@@ -132,7 +138,8 @@ module.exports = {
|
||||
) {
|
||||
return false;
|
||||
};
|
||||
objectBBText.getInitialInstanceProperties = function(
|
||||
// $FlowExpectedError
|
||||
objectBBText.getInitialInstanceProperties = function (
|
||||
content,
|
||||
instance,
|
||||
project,
|
||||
@@ -163,7 +170,7 @@ module.exports = {
|
||||
* Useful for setting multiple generic properties.
|
||||
*/
|
||||
const addSettersAndGettersToObject = (gdObject, properties, objectName) => {
|
||||
properties.forEach(property => {
|
||||
properties.forEach((property) => {
|
||||
const parameterType =
|
||||
property.type === 'boolean' ? 'yesorno' : property.type;
|
||||
|
||||
@@ -175,8 +182,6 @@ module.exports = {
|
||||
property.expressionLabel,
|
||||
property.expressionDescription,
|
||||
'',
|
||||
'',
|
||||
property.iconPath,
|
||||
property.iconPath
|
||||
)
|
||||
.addParameter('object', objectName, objectName, false)
|
||||
@@ -189,8 +194,6 @@ module.exports = {
|
||||
property.expressionLabel,
|
||||
property.expressionDescription,
|
||||
'',
|
||||
'',
|
||||
property.iconPath,
|
||||
property.iconPath
|
||||
)
|
||||
.addParameter('object', objectName, objectName, false)
|
||||
@@ -394,13 +397,15 @@ module.exports = {
|
||||
* of your extension behaviors/objects by instanciating behaviors/objects
|
||||
* and setting the property to a given value.
|
||||
*
|
||||
* If you don't have any tests, you can simply return an empty array like this:
|
||||
* `runExtensionSanityTests: function(gd, extension) { return []; }`
|
||||
* If you don't have any tests, you can simply return an empty array.
|
||||
*
|
||||
* But it is recommended to create tests for the behaviors/objects properties you created
|
||||
* to avoid mistakes.
|
||||
*/
|
||||
runExtensionSanityTests: function(gd, extension) {
|
||||
runExtensionSanityTests: function (
|
||||
gd /*: libGDevelop */,
|
||||
extension /*: gdPlatformExtension*/
|
||||
) {
|
||||
return [];
|
||||
},
|
||||
/**
|
||||
@@ -408,7 +413,9 @@ module.exports = {
|
||||
*
|
||||
* ℹ️ Run `node import-GDJS-Runtime.js` (in newIDE/app/scripts) if you make any change.
|
||||
*/
|
||||
registerEditorConfigurations: function(objectsEditorService) {
|
||||
registerEditorConfigurations: function (
|
||||
objectsEditorService /*: ObjectsEditorService */
|
||||
) {
|
||||
objectsEditorService.registerEditorConfiguration(
|
||||
'BBText::BBText',
|
||||
objectsEditorService.getDefaultObjectJsImplementationPropertiesEditor({
|
||||
@@ -421,7 +428,9 @@ module.exports = {
|
||||
*
|
||||
* ℹ️ Run `node import-GDJS-Runtime.js` (in newIDE/app/scripts) if you make any change.
|
||||
*/
|
||||
registerInstanceRenderers: function(objectsRenderingService) {
|
||||
registerInstanceRenderers: function (
|
||||
objectsRenderingService /*: ObjectsRenderingService */
|
||||
) {
|
||||
const RenderedInstance = objectsRenderingService.RenderedInstance;
|
||||
const PIXI = objectsRenderingService.PIXI;
|
||||
const MultiStyleText = objectsRenderingService.requireModule(
|
||||
@@ -456,6 +465,7 @@ module.exports = {
|
||||
|
||||
const bbTextStyles = {
|
||||
default: {
|
||||
// Use a default font family the time for the resource font to be loaded.
|
||||
fontFamily: 'Arial',
|
||||
fontSize: '24px',
|
||||
fill: '#cccccc',
|
||||
@@ -480,7 +490,7 @@ module.exports = {
|
||||
/**
|
||||
* Return the path to the thumbnail of the specified object.
|
||||
*/
|
||||
RenderedBBTextInstance.getThumbnail = function(
|
||||
RenderedBBTextInstance.getThumbnail = function (
|
||||
project,
|
||||
resourcesLoader,
|
||||
object
|
||||
@@ -491,66 +501,51 @@ module.exports = {
|
||||
/**
|
||||
* This is called to update the PIXI object on the scene editor
|
||||
*/
|
||||
RenderedBBTextInstance.prototype.update = function() {
|
||||
const rawText = this._associatedObject
|
||||
.getProperties(this.project)
|
||||
.get('text')
|
||||
.getValue();
|
||||
RenderedBBTextInstance.prototype.update = function () {
|
||||
const properties = this._associatedObject.getProperties();
|
||||
|
||||
const rawText = properties.get('text').getValue();
|
||||
if (rawText !== this._pixiObject.text) {
|
||||
this._pixiObject.setText(rawText);
|
||||
this._pixiObject.text = rawText;
|
||||
}
|
||||
|
||||
const opacity = this._associatedObject
|
||||
.getProperties(this.project)
|
||||
.get('opacity')
|
||||
.getValue();
|
||||
const opacity = properties.get('opacity').getValue();
|
||||
this._pixiObject.alpha = opacity / 255;
|
||||
|
||||
const color = this._associatedObject
|
||||
.getProperties(this.project)
|
||||
.get('color')
|
||||
.getValue();
|
||||
const color = properties.get('color').getValue();
|
||||
this._pixiObject.textStyles.default.fill = color;
|
||||
|
||||
const fontSize = this._associatedObject
|
||||
.getProperties(this.project)
|
||||
.get('fontSize')
|
||||
.getValue();
|
||||
const fontSize = properties.get('fontSize').getValue();
|
||||
this._pixiObject.textStyles.default.fontSize = `${fontSize}px`;
|
||||
|
||||
const fontResourceName = this._associatedObject
|
||||
.getProperties(this.project)
|
||||
.get('fontFamily')
|
||||
.getValue();
|
||||
const fontResourceName = properties.get('fontFamily').getValue();
|
||||
|
||||
if (this._fontResourceName !== fontResourceName) {
|
||||
this._fontResourceName = fontResourceName;
|
||||
|
||||
this._pixiResourcesLoader
|
||||
.loadFontFamily(this._project, fontResourceName)
|
||||
.then(fontFamily => {
|
||||
.then((fontFamily) => {
|
||||
// Once the font is loaded, we can use the given fontFamily.
|
||||
this._pixiObject.textStyles.default.fontFamily = fontFamily;
|
||||
this._pixiObject.dirty = true;
|
||||
})
|
||||
.catch(err => {
|
||||
.catch((err) => {
|
||||
// Ignore errors
|
||||
console.warn('Unable to load font family', err);
|
||||
console.warn(
|
||||
'Unable to load font family for RenderedBBTextInstance',
|
||||
err
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
const wordWrap = this._associatedObject
|
||||
.getProperties(this.project)
|
||||
.get('wordWrap')
|
||||
.getValue();
|
||||
const wordWrap = properties.get('wordWrap').getValue() === 'true';
|
||||
if (wordWrap !== this._pixiObject._style.wordWrap) {
|
||||
this._pixiObject._style.wordWrap = wordWrap === 'true';
|
||||
this._pixiObject._style.wordWrap = wordWrap;
|
||||
this._pixiObject.dirty = true;
|
||||
}
|
||||
|
||||
const align = this._associatedObject
|
||||
.getProperties(this.project)
|
||||
.get('align')
|
||||
.getValue();
|
||||
const align = properties.get('align').getValue();
|
||||
if (align !== this._pixiObject._style.align) {
|
||||
this._pixiObject._style.align = align;
|
||||
this._pixiObject.dirty = true;
|
||||
@@ -568,7 +563,7 @@ module.exports = {
|
||||
const customWidth = this._instance.getCustomWidth();
|
||||
if (
|
||||
this._pixiObject &&
|
||||
this._pixiObject.textStyles.default.wordWrapWidth !== customWidth
|
||||
this._pixiObject._style.wordWrapWidth !== customWidth
|
||||
) {
|
||||
this._pixiObject._style.wordWrapWidth = customWidth;
|
||||
this._pixiObject.dirty = true;
|
||||
@@ -579,14 +574,14 @@ module.exports = {
|
||||
/**
|
||||
* Return the width of the instance, when it's not resized.
|
||||
*/
|
||||
RenderedBBTextInstance.prototype.getDefaultWidth = function() {
|
||||
RenderedBBTextInstance.prototype.getDefaultWidth = function () {
|
||||
return this._pixiObject.width;
|
||||
};
|
||||
|
||||
/**
|
||||
* Return the height of the instance, when it's not resized.
|
||||
*/
|
||||
RenderedBBTextInstance.prototype.getDefaultHeight = function() {
|
||||
RenderedBBTextInstance.prototype.getDefaultHeight = function () {
|
||||
return this._pixiObject.height;
|
||||
};
|
||||
|
||||
|
@@ -6,7 +6,7 @@
|
||||
* @param {gdjs.BBTextRuntimeObject} runtimeObject The object to render
|
||||
* @param {gdjs.RuntimeScene} runtimeScene The gdjs.RuntimeScene in which the object is
|
||||
*/
|
||||
gdjs.BBTextRuntimeObjectPixiRenderer = function(runtimeObject, runtimeScene) {
|
||||
gdjs.BBTextRuntimeObjectPixiRenderer = function (runtimeObject, runtimeScene) {
|
||||
this._object = runtimeObject;
|
||||
|
||||
// Load (or reset) the text
|
||||
@@ -25,8 +25,6 @@ gdjs.BBTextRuntimeObjectPixiRenderer = function(runtimeObject, runtimeScene) {
|
||||
align: runtimeObject._align,
|
||||
},
|
||||
});
|
||||
|
||||
this._object.hidden = !runtimeObject._visible;
|
||||
} else {
|
||||
this.updateColor();
|
||||
this.updateAlignment();
|
||||
@@ -48,71 +46,69 @@ gdjs.BBTextRuntimeObjectPixiRenderer = function(runtimeObject, runtimeScene) {
|
||||
this.updatePosition();
|
||||
this.updateAngle();
|
||||
this.updateOpacity();
|
||||
this.updateVisible();
|
||||
};
|
||||
|
||||
gdjs.BBTextRuntimeObjectRenderer = gdjs.BBTextRuntimeObjectPixiRenderer;
|
||||
|
||||
gdjs.BBTextRuntimeObjectPixiRenderer.prototype.getRendererObject = function() {
|
||||
gdjs.BBTextRuntimeObjectPixiRenderer.prototype.getRendererObject = function () {
|
||||
return this._pixiObject;
|
||||
};
|
||||
|
||||
gdjs.BBTextRuntimeObjectPixiRenderer.prototype.updateWordWrap = function() {
|
||||
gdjs.BBTextRuntimeObjectPixiRenderer.prototype.updateWordWrap = function () {
|
||||
this._pixiObject._style.wordWrap = this._object._wordWrap;
|
||||
this._pixiObject.dirty = true;
|
||||
this.updatePosition();
|
||||
};
|
||||
|
||||
gdjs.BBTextRuntimeObjectPixiRenderer.prototype.updateWrappingWidth = function() {
|
||||
gdjs.BBTextRuntimeObjectPixiRenderer.prototype.updateWrappingWidth = function () {
|
||||
this._pixiObject._style.wordWrapWidth = this._object._wrappingWidth;
|
||||
this._pixiObject.dirty = true;
|
||||
this.updatePosition();
|
||||
};
|
||||
|
||||
gdjs.BBTextRuntimeObjectPixiRenderer.prototype.updateText = function() {
|
||||
this._pixiObject.setText(this._object._text);
|
||||
gdjs.BBTextRuntimeObjectPixiRenderer.prototype.updateText = function () {
|
||||
this._pixiObject.text = this._object._text;
|
||||
this.updatePosition();
|
||||
};
|
||||
|
||||
gdjs.BBTextRuntimeObjectPixiRenderer.prototype.updateColor = function() {
|
||||
gdjs.BBTextRuntimeObjectPixiRenderer.prototype.updateColor = function () {
|
||||
this._pixiObject.textStyles.default.fill = this._object._color;
|
||||
this._pixiObject.dirty = true;
|
||||
};
|
||||
|
||||
gdjs.BBTextRuntimeObjectPixiRenderer.prototype.updateAlignment = function() {
|
||||
gdjs.BBTextRuntimeObjectPixiRenderer.prototype.updateAlignment = function () {
|
||||
this._pixiObject._style.align = this._object._align;
|
||||
this._pixiObject.dirty = true;
|
||||
};
|
||||
gdjs.BBTextRuntimeObjectPixiRenderer.prototype.updateFontFamily = function() {
|
||||
this._pixiObject.textStyles.default.fontFamily = this._object._runtimeScene.getGame().getFontManager().getFontFamily(this._object._fontFamily);
|
||||
gdjs.BBTextRuntimeObjectPixiRenderer.prototype.updateFontFamily = function () {
|
||||
this._pixiObject.textStyles.default.fontFamily = this._object._runtimeScene
|
||||
.getGame()
|
||||
.getFontManager()
|
||||
.getFontFamily(this._object._fontFamily);
|
||||
this._pixiObject.dirty = true;
|
||||
};
|
||||
gdjs.BBTextRuntimeObjectPixiRenderer.prototype.updateFontSize = function() {
|
||||
gdjs.BBTextRuntimeObjectPixiRenderer.prototype.updateFontSize = function () {
|
||||
this._pixiObject.textStyles.default.fontSize = this._object._fontSize + 'px';
|
||||
this._pixiObject.dirty = true;
|
||||
};
|
||||
|
||||
gdjs.BBTextRuntimeObjectPixiRenderer.prototype.updatePosition = function() {
|
||||
gdjs.BBTextRuntimeObjectPixiRenderer.prototype.updatePosition = function () {
|
||||
this._pixiObject.position.x = this._object.x + this._pixiObject.width / 2;
|
||||
this._pixiObject.position.y = this._object.y + this._pixiObject.height / 2;
|
||||
};
|
||||
|
||||
gdjs.BBTextRuntimeObjectPixiRenderer.prototype.updateVisible = function() {
|
||||
this._pixiObject.hidden = !this._object._visible;
|
||||
};
|
||||
|
||||
gdjs.BBTextRuntimeObjectPixiRenderer.prototype.updateAngle = function() {
|
||||
gdjs.BBTextRuntimeObjectPixiRenderer.prototype.updateAngle = function () {
|
||||
this._pixiObject.rotation = gdjs.toRad(this._object.angle);
|
||||
};
|
||||
|
||||
gdjs.BBTextRuntimeObjectPixiRenderer.prototype.updateOpacity = function() {
|
||||
gdjs.BBTextRuntimeObjectPixiRenderer.prototype.updateOpacity = function () {
|
||||
this._pixiObject.alpha = this._object._opacity / 255;
|
||||
};
|
||||
|
||||
gdjs.BBTextRuntimeObjectPixiRenderer.prototype.getWidth = function() {
|
||||
gdjs.BBTextRuntimeObjectPixiRenderer.prototype.getWidth = function () {
|
||||
return this._pixiObject.width;
|
||||
};
|
||||
|
||||
gdjs.BBTextRuntimeObjectPixiRenderer.prototype.getHeight = function() {
|
||||
gdjs.BBTextRuntimeObjectPixiRenderer.prototype.getHeight = function () {
|
||||
return this._pixiObject.height;
|
||||
};
|
||||
|
@@ -2,7 +2,7 @@
|
||||
* @typedef {Object} BBTextObjectDataType Base parameters for {@link gdjs.BBTextRuntimeObject}
|
||||
* @property {Object} content The base parameters of the BBText
|
||||
* @property {number} content.opacity The opacity of the BBText
|
||||
* @property {boolean} content.visible Is the text visible?
|
||||
* @property {boolean} content.visible Deprecated - Is the text visible?
|
||||
* @property {string} content.text Content of the text
|
||||
* @property {string} content.color The color of the text
|
||||
* @property {string} content.fontFamily The font of the text
|
||||
@@ -27,8 +27,6 @@ gdjs.BBTextRuntimeObject = function(runtimeScene, objectData) {
|
||||
/** @type {number} */
|
||||
this._opacity = parseFloat(objectData.content.opacity);
|
||||
// parseFloat should not be required, but GDevelop 5.0 beta 92 and below were storing it as a string.
|
||||
/** @type {boolean} */
|
||||
this._visible = objectData.content.visible;
|
||||
/** @type {string} */
|
||||
this._text = objectData.content.text;
|
||||
/** @type {string} */
|
||||
@@ -48,9 +46,12 @@ gdjs.BBTextRuntimeObject = function(runtimeScene, objectData) {
|
||||
if (this._renderer)
|
||||
gdjs.BBTextRuntimeObjectRenderer.call(this._renderer, this, runtimeScene);
|
||||
else
|
||||
/** @type {gdjs.BBTextRuntimeObjectRenderer} */
|
||||
this._renderer = new gdjs.BBTextRuntimeObjectRenderer(this, runtimeScene);
|
||||
|
||||
// While this should rather be exposed as a property for all objects, honor the "visible"
|
||||
// property that is specific to this object.
|
||||
this.hidden = !objectData.content.visible;
|
||||
|
||||
// *ALWAYS* call `this.onCreated()` at the very end of your object constructor.
|
||||
this.onCreated();
|
||||
};
|
||||
@@ -64,14 +65,49 @@ gdjs.BBTextRuntimeObject.prototype.getRendererObject = function() {
|
||||
return this._renderer.getRendererObject();
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {BBTextObjectDataType} oldObjectData
|
||||
* @param {BBTextObjectDataType} newObjectData
|
||||
*/
|
||||
gdjs.BBTextRuntimeObject.prototype.updateFromObjectData = function(oldObjectData, newObjectData) {
|
||||
if (oldObjectData.content.opacity !== newObjectData.content.opacity) {
|
||||
this.setOpacity(newObjectData.content.opacity);
|
||||
}
|
||||
if (oldObjectData.content.visible !== newObjectData.content.visible) {
|
||||
this.hide(!newObjectData.content.visible);
|
||||
}
|
||||
if (oldObjectData.content.text !== newObjectData.content.text) {
|
||||
this.setBBText(newObjectData.content.text);
|
||||
}
|
||||
if (oldObjectData.content.color !== newObjectData.content.color) {
|
||||
this._color = newObjectData.content.color;
|
||||
this._renderer.updateColor();
|
||||
}
|
||||
if (oldObjectData.content.fontFamily !== newObjectData.content.fontFamily) {
|
||||
this.setFontFamily(newObjectData.content.fontFamily);
|
||||
}
|
||||
if (oldObjectData.content.fontSize !== newObjectData.content.fontSize) {
|
||||
this.setFontSize(newObjectData.content.fontSize);
|
||||
}
|
||||
if (oldObjectData.content.wordWrap !== newObjectData.content.wordWrap) {
|
||||
this.setWordWrap(newObjectData.content.wordWrap);
|
||||
}
|
||||
if (oldObjectData.content.align !== newObjectData.content.align) {
|
||||
this.setAlignment(newObjectData.content.align);
|
||||
}
|
||||
|
||||
return true;
|
||||
};
|
||||
|
||||
/**
|
||||
* Initialize the extra parameters that could be set for an instance.
|
||||
* @private
|
||||
*/
|
||||
gdjs.BBTextRuntimeObject.prototype.extraInitializationFromInitialInstance = function(initialInstanceData) {
|
||||
// The wrapping width value (this._wrappingWidth) is using the object's width as an innitial value
|
||||
if (initialInstanceData.customSize)
|
||||
this.setWrappingWidth(initialInstanceData.width);
|
||||
else
|
||||
this.setWrappingWidth(250); // This value is the default wrapping width of the runtime object.
|
||||
};
|
||||
|
||||
gdjs.BBTextRuntimeObject.prototype.onDestroyFromScene = function(runtimeScene) {
|
||||
@@ -79,13 +115,16 @@ gdjs.BBTextRuntimeObject.prototype.onDestroyFromScene = function(runtimeScene) {
|
||||
};
|
||||
|
||||
/**
|
||||
* Set/Get BBText base style properties
|
||||
* Set the markup text to display.
|
||||
*/
|
||||
gdjs.BBTextRuntimeObject.prototype.setBBText = function(text) {
|
||||
this._text = text;
|
||||
this._renderer.updateText();
|
||||
};
|
||||
|
||||
/**
|
||||
* Get the markup text displayed by the object.
|
||||
*/
|
||||
gdjs.BBTextRuntimeObject.prototype.getBBText = function() {
|
||||
return this._text;
|
||||
};
|
||||
|
@@ -1,9 +1,67 @@
|
||||
This extension is using release version 0.8.0 (commit 336bed0b206043e2c3e81c373b7ca02094ecabe7) of the pixi-multistyle-text library:
|
||||
https://github.com/tleunen/pixi-multistyle-text
|
||||
# pixi-multistyle-text
|
||||
|
||||
The BBcode tag feature was especially added for Gdevelop and this extension (commit 2a7be2084598933502c76419d7a86c0e6cd11719)
|
||||
[](https://nodei.co/npm/pixi-multistyle-text/)
|
||||
|
||||
README:
|
||||
Add a MultiStyleText object inside pixi.js to easily create text using different styles.
|
||||
Add a `MultiStyleText` object inside [pixi.js](https://github.com/GoodBoyDigital/pixi.js) to easily create text using different styles.
|
||||
|
||||
License: MIT
|
||||
## Example
|
||||
|
||||
In the example below, we are defining 4 text styles.
|
||||
`default` is the default style for the text, and the others matches the tags inside the text.
|
||||
|
||||
```js
|
||||
let text = new MultiStyleText("Let's make some <ml>multiline</ml>\nand <ms>multistyle</ms> text for\n<pixi>Pixi.js!</pixi>",
|
||||
{
|
||||
"default": {
|
||||
fontFamily: "Arial",
|
||||
fontSize: "24px",
|
||||
fill: "#cccccc",
|
||||
align: "center"
|
||||
},
|
||||
"ml": {
|
||||
fontStyle: "italic",
|
||||
fill: "#ff8888"
|
||||
},
|
||||
"ms": {
|
||||
fontStyle: "italic",
|
||||
fill: "#4488ff"
|
||||
},
|
||||
"pixi": {
|
||||
fontSize: "64px",
|
||||
fill: "#efefef"
|
||||
}
|
||||
});
|
||||
```
|
||||
## Build instructions
|
||||
|
||||
```
|
||||
$ yarn install
|
||||
$ yarn build
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
### `text = new MultiStyleText(text, textStyles)`
|
||||
|
||||
Creates a new `MultiStyleText` with the given text and styles.
|
||||
|
||||
#### `textStyles`
|
||||
Type: `{ [key: string]: ExtendedTextStyle }`
|
||||
|
||||
Each key of this dictionary should match with a tag in the text. Use the key `default` for the default style.
|
||||
|
||||
Each `ExtendedTextStyle` object can have [any of the properties of a standard PIXI text style](http://pixijs.download/release/docs/PIXI.TextStyle.html), in addition to a `valign` property that allows you to specify where text is rendered relative to larger text on the same line (`"top"`, `"middle"`, or `"bottom"`).
|
||||
|
||||
The `align`, `wordWrap`, `wordWrapWidth`, and `breakWord` properties are ignored on all styles _except for the `default` style_, which controls those properties for the entire text object.
|
||||
|
||||
If text is rendered without any value assigned to a given parameter, Pixi's defaults are used.
|
||||
|
||||
## Demo
|
||||
```
|
||||
$ yarn demo
|
||||
```
|
||||
|
||||
|
||||
## License
|
||||
|
||||
MIT, see [LICENSE.md](http://github.com/tleunen/pixi-multistyle-text/blob/master/LICENSE.md) for details.
|
||||
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
58
Extensions/DebuggerTools/JsExtension.js
Normal file
58
Extensions/DebuggerTools/JsExtension.js
Normal file
@@ -0,0 +1,58 @@
|
||||
// @flow
|
||||
/**
|
||||
* This is a declaration of an extension for GDevelop 5.
|
||||
*
|
||||
* ℹ️ Changes in this file are watched and automatically imported if the editor
|
||||
* is running. You can also manually run `node import-GDJS-Runtime.js` (in newIDE/app/scripts).
|
||||
*
|
||||
* The file must be named "JsExtension.js", otherwise GDevelop won't load it.
|
||||
* ⚠️ If you make a change and the extension is not loaded, open the developer console
|
||||
* and search for any errors.
|
||||
*
|
||||
* More information on https://github.com/4ian/GDevelop/blob/master/newIDE/README-extensions.md
|
||||
*/
|
||||
|
||||
/*::
|
||||
// Import types to allow Flow to do static type checking on this file.
|
||||
// Extensions declaration are typed using Flow (like the editor), but the files
|
||||
// for the game engine are checked with TypeScript annotations.
|
||||
import { type ObjectsRenderingService, type ObjectsEditorService } from '../JsExtensionTypes.flow.js'
|
||||
*/
|
||||
|
||||
module.exports = {
|
||||
createExtension: function(_/*: (string) => string */, gd/*: libGDevelop */) {
|
||||
const extension = new gd.PlatformExtension();
|
||||
extension.setExtensionInformation(
|
||||
'DebuggerTools',
|
||||
_('Debugger Tools'),
|
||||
_(
|
||||
'Allow to interact with the editor debugger from the game.'
|
||||
),
|
||||
'Arthur Pacaud (arthuro555)',
|
||||
'MIT'
|
||||
);
|
||||
|
||||
extension
|
||||
.addAction(
|
||||
'Pause',
|
||||
_('Pause game execution'),
|
||||
_(
|
||||
'This pauses the game, useful for inspecting the game state through the debugger. ' +
|
||||
'Note that events will be still executed until the end before the game is paused.'
|
||||
),
|
||||
_('Pause game execution'),
|
||||
_('Debugger Tools'),
|
||||
'res/actions/bug32.png',
|
||||
'res/actions/bug32.png'
|
||||
)
|
||||
.addCodeOnlyParameter("currentScene", "")
|
||||
.getCodeExtraInformation()
|
||||
.setIncludeFile('Extensions/DebuggerTools/debuggertools.js')
|
||||
.setFunctionName('gdjs.evtTools.debugger.pause');
|
||||
|
||||
return extension;
|
||||
},
|
||||
runExtensionSanityTests: function(gd /*: libGDevelop */, extension /*: gdPlatformExtension*/) {
|
||||
return [];
|
||||
},
|
||||
}
|
19
Extensions/DebuggerTools/debuggertools.js
Normal file
19
Extensions/DebuggerTools/debuggertools.js
Normal file
@@ -0,0 +1,19 @@
|
||||
/**
|
||||
* @file
|
||||
* Tools for interacting with the debugger.
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* The namespace containing tools to interact with the debugger.
|
||||
* @namespace
|
||||
*/
|
||||
gdjs.evtTools.debugger = {};
|
||||
|
||||
/**
|
||||
* Stop the game execution.
|
||||
* @param {gdjs.RuntimeScene} runtimeScene - The current scene.
|
||||
*/
|
||||
gdjs.evtTools.debugger.pause = function(runtimeScene) {
|
||||
runtimeScene.getGame().pause(true);
|
||||
}
|
@@ -18,7 +18,7 @@ void DestroyOutsideBehavior::InitializeContent(gd::SerializerElement& content) {
|
||||
#if defined(GD_IDE_ONLY)
|
||||
std::map<gd::String, gd::PropertyDescriptor>
|
||||
DestroyOutsideBehavior::GetProperties(
|
||||
const gd::SerializerElement& behaviorContent, gd::Project& project) const {
|
||||
const gd::SerializerElement& behaviorContent) const {
|
||||
std::map<gd::String, gd::PropertyDescriptor> properties;
|
||||
|
||||
properties["extraBorder"]
|
||||
@@ -33,8 +33,7 @@ DestroyOutsideBehavior::GetProperties(
|
||||
bool DestroyOutsideBehavior::UpdateProperty(
|
||||
gd::SerializerElement& behaviorContent,
|
||||
const gd::String& name,
|
||||
const gd::String& value,
|
||||
gd::Project& project) {
|
||||
const gd::String& value) {
|
||||
if (name == "extraBorder")
|
||||
behaviorContent.SetAttribute("extraBorder", value.To<double>());
|
||||
else
|
||||
|
@@ -21,16 +21,14 @@ class GD_EXTENSION_API DestroyOutsideBehavior : public gd::Behavior {
|
||||
public:
|
||||
DestroyOutsideBehavior(){};
|
||||
virtual ~DestroyOutsideBehavior(){};
|
||||
virtual Behavior* Clone() const { return new DestroyOutsideBehavior(*this); }
|
||||
virtual Behavior* Clone() const override { return new DestroyOutsideBehavior(*this); }
|
||||
|
||||
#if defined(GD_IDE_ONLY)
|
||||
virtual std::map<gd::String, gd::PropertyDescriptor> GetProperties(
|
||||
const gd::SerializerElement& behaviorContent,
|
||||
gd::Project& project) const override;
|
||||
const gd::SerializerElement& behaviorContent) const override;
|
||||
virtual bool UpdateProperty(gd::SerializerElement& behaviorContent,
|
||||
const gd::String& name,
|
||||
const gd::String& value,
|
||||
gd::Project& project) override;
|
||||
const gd::String& value) override;
|
||||
#endif
|
||||
|
||||
virtual void InitializeContent(
|
||||
|
@@ -20,6 +20,14 @@ gdjs.DestroyOutsideRuntimeBehavior = function(runtimeScene, behaviorData, owner)
|
||||
gdjs.DestroyOutsideRuntimeBehavior.prototype = Object.create( gdjs.RuntimeBehavior.prototype );
|
||||
gdjs.registerBehavior("DestroyOutsideBehavior::DestroyOutside", gdjs.DestroyOutsideRuntimeBehavior);
|
||||
|
||||
gdjs.DestroyOutsideRuntimeBehavior.prototype.updateFromBehaviorData = function(oldBehaviorData, newBehaviorData) {
|
||||
if (oldBehaviorData.extraBorder !== newBehaviorData.extraBorder) {
|
||||
this._extraBorder = newBehaviorData.extraBorder;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
gdjs.DestroyOutsideRuntimeBehavior.prototype.doStepPostEvents = function(runtimeScene) {
|
||||
|
||||
// TODO: This would better be done using the object AABB (getAABB), as (`getCenterX`;`getCenterY`) point
|
||||
|
@@ -1,17 +1,26 @@
|
||||
// @flow
|
||||
/**
|
||||
* This is a declaration of an extension for GDevelop 5.
|
||||
*
|
||||
* ℹ️ Run `node import-GDJS-Runtime.js` (in newIDE/app/scripts) if you make any change
|
||||
* to this extension file or to any other *.js file that you reference inside.
|
||||
*
|
||||
* The file must be named "JsExtension.js", otherwise GDevelop won't load it.
|
||||
*
|
||||
* ℹ️ Changes in this file are watched and automatically imported if the editor
|
||||
* is running. You can also manually run `node import-GDJS-Runtime.js` (in newIDE/app/scripts).
|
||||
*
|
||||
* The file must be named "JsExtension.js", otherwise GDevelop won't load it.
|
||||
* ⚠️ If you make a change and the extension is not loaded, open the developer console
|
||||
* and search for any errors.
|
||||
*
|
||||
*
|
||||
* More information on https://github.com/4ian/GDevelop/blob/master/newIDE/README-extensions.md
|
||||
*/
|
||||
|
||||
/*::
|
||||
// Import types to allow Flow to do static type checking on this file.
|
||||
// Extensions declaration are typed using Flow (like the editor), but the files
|
||||
// for the game engine are checked with TypeScript annotations.
|
||||
import { type ObjectsRenderingService, type ObjectsEditorService } from '../JsExtensionTypes.flow.js'
|
||||
*/
|
||||
|
||||
module.exports = {
|
||||
createExtension: function(_, gd) {
|
||||
createExtension: function(_/*: (string) => string */, gd/*: libGDevelop */) {
|
||||
const extension = new gd.PlatformExtension();
|
||||
extension.setExtensionInformation(
|
||||
"DeviceSensors",
|
||||
@@ -445,5 +454,5 @@ module.exports = {
|
||||
|
||||
return extension;
|
||||
},
|
||||
runExtensionSanityTests: function(gd, extension) { return []; },
|
||||
runExtensionSanityTests: function(gd /*: libGDevelop */, extension /*: gdPlatformExtension*/) { return []; },
|
||||
};
|
||||
|
@@ -1,17 +1,26 @@
|
||||
// @flow
|
||||
/**
|
||||
* This is a declaration of an extension for GDevelop 5.
|
||||
*
|
||||
* ℹ️ Run `node import-GDJS-Runtime.js` (in newIDE/app/scripts) if you make any change
|
||||
* to this extension file or to any other *.js file that you reference inside.
|
||||
*
|
||||
* The file must be named "JsExtension.js", otherwise GDevelop won't load it.
|
||||
*
|
||||
* ℹ️ Changes in this file are watched and automatically imported if the editor
|
||||
* is running. You can also manually run `node import-GDJS-Runtime.js` (in newIDE/app/scripts).
|
||||
*
|
||||
* The file must be named "JsExtension.js", otherwise GDevelop won't load it.
|
||||
* ⚠️ If you make a change and the extension is not loaded, open the developer console
|
||||
* and search for any errors.
|
||||
*
|
||||
*
|
||||
* More information on https://github.com/4ian/GDevelop/blob/master/newIDE/README-extensions.md
|
||||
*/
|
||||
|
||||
/*::
|
||||
// Import types to allow Flow to do static type checking on this file.
|
||||
// Extensions declaration are typed using Flow (like the editor), but the files
|
||||
// for the game engine are checked with TypeScript annotations.
|
||||
import { type ObjectsRenderingService, type ObjectsEditorService } from '../JsExtensionTypes.flow.js'
|
||||
*/
|
||||
|
||||
module.exports = {
|
||||
createExtension: function(_, gd) {
|
||||
createExtension: function(_/*: (string) => string */, gd/*: libGDevelop */) {
|
||||
const extension = new gd.PlatformExtension();
|
||||
extension.setExtensionInformation(
|
||||
"DeviceVibration",
|
||||
@@ -75,5 +84,5 @@ module.exports = {
|
||||
|
||||
return extension;
|
||||
},
|
||||
runExtensionSanityTests: function(gd, extension) { return []; },
|
||||
runExtensionSanityTests: function(gd /*: libGDevelop */, extension /*: gdPlatformExtension*/) { return []; },
|
||||
};
|
||||
|
@@ -1,8 +1,9 @@
|
||||
// @flow
|
||||
/**
|
||||
* This is a declaration of an extension for GDevelop 5.
|
||||
*
|
||||
* ℹ️ Run `node import-GDJS-Runtime.js` (in newIDE/app/scripts) if you make any change
|
||||
* to this extension file or to any other *.js file that you reference inside.
|
||||
* ℹ️ Changes in this file are watched and automatically imported if the editor
|
||||
* is running. You can also manually run `node import-GDJS-Runtime.js` (in newIDE/app/scripts).
|
||||
*
|
||||
* The file must be named "JsExtension.js", otherwise GDevelop won't load it.
|
||||
* ⚠️ If you make a change and the extension is not loaded, open the developer console
|
||||
@@ -10,8 +11,16 @@
|
||||
*
|
||||
* More information on https://github.com/4ian/GDevelop/blob/master/newIDE/README-extensions.md
|
||||
*/
|
||||
|
||||
/*::
|
||||
// Import types to allow Flow to do static type checking on this file.
|
||||
// Extensions declaration are typed using Flow (like the editor), but the files
|
||||
// for the game engine are checked with TypeScript annotations.
|
||||
import { type ObjectsRenderingService, type ObjectsEditorService } from '../JsExtensionTypes.flow.js'
|
||||
*/
|
||||
|
||||
module.exports = {
|
||||
createExtension: function(_, gd) {
|
||||
createExtension: function(_/*: (string) => string */, gd/*: libGDevelop */) {
|
||||
const extension = new gd.PlatformExtension();
|
||||
extension
|
||||
.setExtensionInformation(
|
||||
@@ -240,7 +249,7 @@ module.exports = {
|
||||
.addParameter('expression', _('Variable number value'), '', true)
|
||||
.getCodeExtraInformation()
|
||||
.setFunctionName('gdjs.dialogueTree.setVariable');
|
||||
|
||||
|
||||
extension
|
||||
.addAction(
|
||||
'SetBooleanVariable',
|
||||
@@ -257,7 +266,7 @@ module.exports = {
|
||||
.addParameter('trueorfalse', _('Variable boolean value'), '', false)
|
||||
.getCodeExtraInformation()
|
||||
.setFunctionName('gdjs.dialogueTree.setVariable');
|
||||
|
||||
|
||||
extension
|
||||
.addAction(
|
||||
'SaveState',
|
||||
@@ -311,7 +320,6 @@ module.exports = {
|
||||
_('Get the current dialogue line text'),
|
||||
_('Returns the current dialogue line text'),
|
||||
_('Dialogue Tree (experimental)'),
|
||||
'JsPlatform/Extensions/yarn24.png',
|
||||
'JsPlatform/Extensions/yarn32.png'
|
||||
)
|
||||
.getCodeExtraInformation()
|
||||
@@ -323,7 +331,6 @@ module.exports = {
|
||||
_('Get the number of options in an options line type'),
|
||||
_('Get the number of options in an options line type'),
|
||||
_('Dialogue Tree (experimental)'),
|
||||
'JsPlatform/Extensions/yarn24.png',
|
||||
'JsPlatform/Extensions/yarn32.png'
|
||||
)
|
||||
.getCodeExtraInformation()
|
||||
@@ -337,7 +344,6 @@ module.exports = {
|
||||
"Get the text of an option from an Options line type, using the option's Number. The numbers start from 0."
|
||||
),
|
||||
_('Dialogue Tree (experimental)'),
|
||||
'JsPlatform/Extensions/yarn24.png',
|
||||
'JsPlatform/Extensions/yarn32.png'
|
||||
)
|
||||
.addParameter('expression', _('Option Index Number'), '', false)
|
||||
@@ -352,7 +358,6 @@ module.exports = {
|
||||
"Get the text of all available options from an Options line type as a horizontal list. You can also pass the selected option's cursor string, which by default is ->"
|
||||
),
|
||||
_('Dialogue Tree (experimental)'),
|
||||
'JsPlatform/Extensions/yarn24.png',
|
||||
'JsPlatform/Extensions/yarn32.png'
|
||||
)
|
||||
.addParameter('string', _('Options Selection Cursor'), '', false)
|
||||
@@ -368,7 +373,6 @@ module.exports = {
|
||||
"Get the text of all available options from an Options line type as a vertical list. You can also pass the selected option's cursor string, which by default is ->"
|
||||
),
|
||||
_('Dialogue Tree (experimental)'),
|
||||
'JsPlatform/Extensions/yarn24.png',
|
||||
'JsPlatform/Extensions/yarn32.png'
|
||||
)
|
||||
.addParameter('string', _('Options Selection Cursor'), '', false)
|
||||
@@ -384,7 +388,6 @@ module.exports = {
|
||||
'Get the number of the currently selected option. Use this to help you render the option selection marker at the right place.'
|
||||
),
|
||||
_('Dialogue Tree (experimental)'),
|
||||
'JsPlatform/Extensions/yarn24.png',
|
||||
'JsPlatform/Extensions/yarn32.png'
|
||||
)
|
||||
.getCodeExtraInformation()
|
||||
@@ -398,7 +401,6 @@ module.exports = {
|
||||
'Get dialogue line text clipped by the typewriter effect. Use the "Scroll clipped text" action to control the typewriter effect.'
|
||||
),
|
||||
_('Dialogue Tree (experimental)'),
|
||||
'JsPlatform/Extensions/yarn24.png',
|
||||
'JsPlatform/Extensions/yarn32.png'
|
||||
)
|
||||
.getCodeExtraInformation()
|
||||
@@ -410,7 +412,6 @@ module.exports = {
|
||||
_('Get the title of the current branch of the running dialogue'),
|
||||
_('Get the title of the current branch of the running dialogue'),
|
||||
_('Dialogue Tree (experimental)'),
|
||||
'JsPlatform/Extensions/yarn24.png',
|
||||
'JsPlatform/Extensions/yarn32.png'
|
||||
)
|
||||
.getCodeExtraInformation()
|
||||
@@ -422,7 +423,6 @@ module.exports = {
|
||||
_('Get the tags of the current branch of the running dialogue'),
|
||||
_('Get the tags of the current branch of the running dialogue'),
|
||||
_('Dialogue Tree (experimental)'),
|
||||
'JsPlatform/Extensions/yarn24.png',
|
||||
'JsPlatform/Extensions/yarn32.png'
|
||||
)
|
||||
.getCodeExtraInformation()
|
||||
@@ -434,7 +434,6 @@ module.exports = {
|
||||
_('Get a tag of the current branch of the running dialogue via its index'),
|
||||
_('Get a tag of the current branch of the running dialogue via its index'),
|
||||
_('Dialogue Tree (experimental)'),
|
||||
'JsPlatform/Extensions/yarn24.png',
|
||||
'JsPlatform/Extensions/yarn32.png'
|
||||
)
|
||||
.addParameter('expression', _('Tag Index Number'), '', false)
|
||||
@@ -449,7 +448,6 @@ module.exports = {
|
||||
'Get the parameters of a command call - <<command withParameter anotherParameter>>'
|
||||
),
|
||||
_('Dialogue Tree (experimental)'),
|
||||
'JsPlatform/Extensions/yarn24.png',
|
||||
'JsPlatform/Extensions/yarn32.png'
|
||||
)
|
||||
.addParameter('expression', _('parameter Index Number'), '', true)
|
||||
@@ -462,7 +460,6 @@ module.exports = {
|
||||
_('Get the number of parameters in the currently passed command'),
|
||||
_('Get the number of parameters in the currently passed command'),
|
||||
_('Dialogue Tree (experimental)'),
|
||||
'JsPlatform/Extensions/yarn24.png',
|
||||
'JsPlatform/Extensions/yarn32.png'
|
||||
)
|
||||
.getCodeExtraInformation()
|
||||
@@ -478,7 +475,6 @@ module.exports = {
|
||||
'Get parameter from a Tag found by the branch contains tag condition'
|
||||
),
|
||||
_('Dialogue Tree (experimental)'),
|
||||
'JsPlatform/Extensions/yarn24.png',
|
||||
'JsPlatform/Extensions/yarn32.png'
|
||||
)
|
||||
.addParameter('expression', _('parameter Index Number'), '', true)
|
||||
@@ -491,7 +487,6 @@ module.exports = {
|
||||
_('Get a list of all visited branches'),
|
||||
_('Get a list of all visited branches'),
|
||||
_('Dialogue Tree (experimental)'),
|
||||
'JsPlatform/Extensions/yarn24.png',
|
||||
'JsPlatform/Extensions/yarn32.png'
|
||||
)
|
||||
.getCodeExtraInformation()
|
||||
@@ -503,7 +498,6 @@ module.exports = {
|
||||
_('Get the full raw text of the current branch'),
|
||||
_('Get the full raw text of the current branch'),
|
||||
_('Dialogue Tree (experimental)'),
|
||||
'JsPlatform/Extensions/yarn24.png',
|
||||
'JsPlatform/Extensions/yarn32.png'
|
||||
)
|
||||
.getCodeExtraInformation()
|
||||
@@ -515,7 +509,6 @@ module.exports = {
|
||||
_('Get dialogue state value'),
|
||||
_('Get dialogue state value'),
|
||||
_('Dialogue Tree (experimental)'),
|
||||
'JsPlatform/Extensions/yarn24.png',
|
||||
'JsPlatform/Extensions/yarn32.png'
|
||||
)
|
||||
.addParameter('string', _('Variable Name'), '', false)
|
||||
@@ -719,7 +712,7 @@ module.exports = {
|
||||
|
||||
return extension;
|
||||
},
|
||||
runExtensionSanityTests: function(gd, extension) {
|
||||
runExtensionSanityTests: function(gd /*: libGDevelop */, extension /*: gdPlatformExtension*/) {
|
||||
return [];
|
||||
},
|
||||
};
|
||||
|
@@ -25,6 +25,11 @@ gdjs.DraggableRuntimeBehavior = function(runtimeScene, behaviorData, owner)
|
||||
gdjs.DraggableRuntimeBehavior.prototype = Object.create( gdjs.RuntimeBehavior.prototype );
|
||||
gdjs.registerBehavior("DraggableBehavior::Draggable", gdjs.DraggableRuntimeBehavior);
|
||||
|
||||
gdjs.DraggableRuntimeBehavior.prototype.updateFromBehaviorData = function(oldBehaviorData, newBehaviorData) {
|
||||
// Nothing to update.
|
||||
return true;
|
||||
}
|
||||
|
||||
gdjs.DraggableRuntimeBehavior.prototype.onDeActivate = function() {
|
||||
this._endDrag();
|
||||
};
|
||||
|
@@ -8,7 +8,7 @@ describe('gdjs.DraggableRuntimeBehavior', function() {
|
||||
});
|
||||
var runtimeScene = new gdjs.RuntimeScene(runtimeGame);
|
||||
runtimeScene.loadFromScene({
|
||||
layers:[{name:"", visibility: true}],
|
||||
layers:[{name:"", visibility: true, effects: []}],
|
||||
variables: [],
|
||||
behaviorsSharedData: [],
|
||||
objects: [],
|
||||
|
File diff suppressed because it is too large
Load Diff
@@ -20,10 +20,10 @@ gdjs.PixiFiltersTools.registerFilterCreator('Bevel', {
|
||||
},
|
||||
updateStringParameter: function(filter, parameterName, value) {
|
||||
if (parameterName === 'lightColor') {
|
||||
filter.lightColor = value.replace('#', '0x');
|
||||
filter.lightColor = gdjs.PixiFiltersTools.rgbOrHexToHexNumber(value);
|
||||
}
|
||||
if (parameterName === 'shadowColor') {
|
||||
filter.shadowColor = value.replace('#', '0x');
|
||||
filter.shadowColor = gdjs.PixiFiltersTools.rgbOrHexToHexNumber(value);
|
||||
}
|
||||
},
|
||||
updateBooleanParameter: function(filter, parameterName, value) {},
|
||||
|
@@ -11,11 +11,11 @@ gdjs.PixiFiltersTools.registerFilterCreator('ColorReplace', {
|
||||
}
|
||||
},
|
||||
updateStringParameter: function(filter, parameterName, value) {
|
||||
if (parameterName === 'originalColor') {
|
||||
filter.originalColor = parseInt(value.replace('#', '0x'), 16);
|
||||
if (parameterName === 'originalColor') {
|
||||
filter.originalColor = gdjs.PixiFiltersTools.rgbOrHexToHexNumber(value);
|
||||
}
|
||||
else if (parameterName === 'newColor') {
|
||||
filter.newColor = parseInt(value.replace('#', '0x'), 16);
|
||||
filter.newColor = gdjs.PixiFiltersTools.rgbOrHexToHexNumber(value);
|
||||
}
|
||||
},
|
||||
updateBooleanParameter: function(filter, parameterName, value) {},
|
||||
|
@@ -20,7 +20,7 @@ gdjs.PixiFiltersTools.registerFilterCreator('DropShadow', {
|
||||
},
|
||||
updateStringParameter: function(filter, parameterName, value) {
|
||||
if (parameterName === 'color') {
|
||||
filter.color = value.replace('#', '0x');
|
||||
filter.color = gdjs.PixiFiltersTools.rgbOrHexToHexNumber(value);
|
||||
}
|
||||
},
|
||||
updateBooleanParameter: function(filter, parameterName, value) {
|
||||
|
@@ -14,9 +14,9 @@ gdjs.PixiFiltersTools.registerFilterCreator('Glow', {
|
||||
filter.distance = value;
|
||||
}
|
||||
},
|
||||
updateStringParameter: function(filter, parameterName, value) {
|
||||
updateStringParameter: function(filter, parameterName, value) {
|
||||
if (parameterName === 'color') {
|
||||
filter.color = value.replace('#', '0x');
|
||||
filter.color = gdjs.PixiFiltersTools.rgbOrHexToHexNumber(value);
|
||||
}
|
||||
},
|
||||
updateBooleanParameter: function(filter, parameterName, value) {},
|
||||
|
@@ -12,7 +12,7 @@ gdjs.PixiFiltersTools.registerFilterCreator('Outline', {
|
||||
},
|
||||
updateStringParameter: function(filter, parameterName, value) {
|
||||
if (parameterName === 'color') {
|
||||
filter.color = value.replace('#', '0x');
|
||||
filter.color = gdjs.PixiFiltersTools.rgbOrHexToHexNumber(value);
|
||||
}
|
||||
},
|
||||
updateBooleanParameter: function(filter, parameterName, value) {},
|
||||
|
@@ -1,8 +1,8 @@
|
||||
/*!
|
||||
* @pixi/filter-adjustment - v2.5.0
|
||||
* Compiled Fri, 20 Dec 2019 18:59:17 UTC
|
||||
* @pixi/filter-adjustment - v3.1.1
|
||||
* Compiled Wed, 08 Apr 2020 11:09:37 UTC
|
||||
*
|
||||
* @pixi/filter-adjustment is licensed under the MIT License.
|
||||
* http://www.opensource.org/licenses/mit-license
|
||||
*/
|
||||
!function(t,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports,require("pixi.js")):"function"==typeof define&&define.amd?define(["exports","pixi.js"],n):n(t.__filters={},t.PIXI)}(this,function(t,n){"use strict";var r="attribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\n\nuniform mat3 projectionMatrix;\n\nvarying vec2 vTextureCoord;\n\nvoid main(void)\n{\n gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n vTextureCoord = aTextureCoord;\n}",e="varying vec2 vTextureCoord;\nuniform sampler2D uSampler;\n\nuniform float gamma;\nuniform float contrast;\nuniform float saturation;\nuniform float brightness;\nuniform float red;\nuniform float green;\nuniform float blue;\nuniform float alpha;\n\nvoid main(void)\n{\n vec4 c = texture2D(uSampler, vTextureCoord);\n\n if (c.a > 0.0) {\n c.rgb /= c.a;\n\n vec3 rgb = pow(c.rgb, vec3(1. / gamma));\n rgb = mix(vec3(.5), mix(vec3(dot(vec3(.2125, .7154, .0721), rgb)), rgb, saturation), contrast);\n rgb.r *= red;\n rgb.g *= green;\n rgb.b *= blue;\n c.rgb = rgb * brightness;\n\n c.rgb *= c.a;\n }\n\n gl_FragColor = c * alpha;\n}\n",i=function(t){function n(n){t.call(this,r,e),Object.assign(this,{gamma:1,saturation:1,contrast:1,brightness:1,red:1,green:1,blue:1,alpha:1},n)}return t&&(n.__proto__=t),n.prototype=Object.create(t&&t.prototype),n.prototype.constructor=n,n.prototype.apply=function(t,n,r,e){this.uniforms.gamma=Math.max(this.gamma,1e-4),this.uniforms.saturation=this.saturation,this.uniforms.contrast=this.contrast,this.uniforms.brightness=this.brightness,this.uniforms.red=this.red,this.uniforms.green=this.green,this.uniforms.blue=this.blue,this.uniforms.alpha=this.alpha,t.applyFilter(this,n,r,e)},n}(n.Filter);t.AdjustmentFilter=i,Object.defineProperty(t,"__esModule",{value:!0})}),Object.assign(PIXI.filters,this?this.__filters:__filters);
|
||||
var __filters=function(t,r){"use strict";var n="attribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\n\nuniform mat3 projectionMatrix;\n\nvarying vec2 vTextureCoord;\n\nvoid main(void)\n{\n gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n vTextureCoord = aTextureCoord;\n}",i="varying vec2 vTextureCoord;\nuniform sampler2D uSampler;\n\nuniform float gamma;\nuniform float contrast;\nuniform float saturation;\nuniform float brightness;\nuniform float red;\nuniform float green;\nuniform float blue;\nuniform float alpha;\n\nvoid main(void)\n{\n vec4 c = texture2D(uSampler, vTextureCoord);\n\n if (c.a > 0.0) {\n c.rgb /= c.a;\n\n vec3 rgb = pow(c.rgb, vec3(1. / gamma));\n rgb = mix(vec3(.5), mix(vec3(dot(vec3(.2125, .7154, .0721), rgb)), rgb, saturation), contrast);\n rgb.r *= red;\n rgb.g *= green;\n rgb.b *= blue;\n c.rgb = rgb * brightness;\n\n c.rgb *= c.a;\n }\n\n gl_FragColor = c * alpha;\n}\n",e=function(t){function r(r){t.call(this,n,i),Object.assign(this,{gamma:1,saturation:1,contrast:1,brightness:1,red:1,green:1,blue:1,alpha:1},r)}return t&&(r.__proto__=t),r.prototype=Object.create(t&&t.prototype),r.prototype.constructor=r,r.prototype.apply=function(t,r,n,i){this.uniforms.gamma=Math.max(this.gamma,1e-4),this.uniforms.saturation=this.saturation,this.uniforms.contrast=this.contrast,this.uniforms.brightness=this.brightness,this.uniforms.red=this.red,this.uniforms.green=this.green,this.uniforms.blue=this.blue,this.uniforms.alpha=this.alpha,t.applyFilter(this,r,n,i)},r}(r.Filter);return t.AdjustmentFilter=e,t}({},PIXI);Object.assign(PIXI.filters,__filters);
|
||||
|
@@ -1,8 +1,8 @@
|
||||
/*!
|
||||
* @pixi/filter-advanced-bloom - v2.6.0
|
||||
* Compiled Fri, 20 Dec 2019 18:59:17 UTC
|
||||
* @pixi/filter-advanced-bloom - v3.1.1
|
||||
* Compiled Wed, 08 Apr 2020 11:09:37 UTC
|
||||
*
|
||||
* @pixi/filter-advanced-bloom is licensed under the MIT License.
|
||||
* http://www.opensource.org/licenses/mit-license
|
||||
*/
|
||||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("pixi.js"),require("@pixi/filter-kawase-blur")):"function"==typeof define&&define.amd?define(["exports","pixi.js","@pixi/filter-kawase-blur"],t):t(e.__filters={},e.PIXI,e.PIXI.filters)}(this,function(e,t,r){"use strict";var o="attribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\n\nuniform mat3 projectionMatrix;\n\nvarying vec2 vTextureCoord;\n\nvoid main(void)\n{\n gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n vTextureCoord = aTextureCoord;\n}",i="\nuniform sampler2D uSampler;\nvarying vec2 vTextureCoord;\n\nuniform float threshold;\n\nvoid main() {\n vec4 color = texture2D(uSampler, vTextureCoord);\n\n // A simple & fast algorithm for getting brightness.\n // It's inaccuracy , but good enought for this feature.\n float _max = max(max(color.r, color.g), color.b);\n float _min = min(min(color.r, color.g), color.b);\n float brightness = (_max + _min) * 0.5;\n\n if(brightness > threshold) {\n gl_FragColor = color;\n } else {\n gl_FragColor = vec4(0.0, 0.0, 0.0, 0.0);\n }\n}\n",n=function(e){function t(t){void 0===t&&(t=.5),e.call(this,o,i),this.threshold=t}e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t;var r={threshold:{configurable:!0}};return r.threshold.get=function(){return this.uniforms.threshold},r.threshold.set=function(e){this.uniforms.threshold=e},Object.defineProperties(t.prototype,r),t}(t.Filter),l="uniform sampler2D uSampler;\nvarying vec2 vTextureCoord;\n\nuniform sampler2D bloomTexture;\nuniform float bloomScale;\nuniform float brightness;\n\nvoid main() {\n vec4 color = texture2D(uSampler, vTextureCoord);\n color.rgb *= brightness;\n vec4 bloomColor = vec4(texture2D(bloomTexture, vTextureCoord).rgb, 0.0);\n bloomColor.rgb *= bloomScale;\n gl_FragColor = color + bloomColor;\n}\n",s=function(e){function i(i){e.call(this,o,l),"number"==typeof i&&(i={threshold:i}),i=Object.assign({threshold:.5,bloomScale:1,brightness:1,kernels:null,blur:8,quality:4,pixelSize:1,resolution:t.settings.RESOLUTION},i),this.bloomScale=i.bloomScale,this.brightness=i.brightness;var s=i.kernels,u=i.blur,a=i.quality,c=i.pixelSize,h=i.resolution;this._extractFilter=new n(i.threshold),this._extractFilter.resolution=h,this._blurFilter=s?new r.KawaseBlurFilter(s):new r.KawaseBlurFilter(u,a),this.pixelSize=c,this.resolution=h}e&&(i.__proto__=e),i.prototype=Object.create(e&&e.prototype),i.prototype.constructor=i;var s={resolution:{configurable:!0},threshold:{configurable:!0},kernels:{configurable:!0},blur:{configurable:!0},quality:{configurable:!0},pixelSize:{configurable:!0}};return i.prototype.apply=function(e,t,r,o,i){var n=e.getRenderTarget(!0);this._extractFilter.apply(e,t,n,!0,i);var l=e.getRenderTarget(!0);this._blurFilter.apply(e,n,l,!0,i),this.uniforms.bloomScale=this.bloomScale,this.uniforms.brightness=this.brightness,this.uniforms.bloomTexture=l,e.applyFilter(this,t,r,o),e.returnRenderTarget(l),e.returnRenderTarget(n)},s.resolution.get=function(){return this._resolution},s.resolution.set=function(e){this._resolution=e,this._extractFilter&&(this._extractFilter.resolution=e),this._blurFilter&&(this._blurFilter.resolution=e)},s.threshold.get=function(){return this._extractFilter.threshold},s.threshold.set=function(e){this._extractFilter.threshold=e},s.kernels.get=function(){return this._blurFilter.kernels},s.kernels.set=function(e){this._blurFilter.kernels=e},s.blur.get=function(){return this._blurFilter.blur},s.blur.set=function(e){this._blurFilter.blur=e},s.quality.get=function(){return this._blurFilter.quality},s.quality.set=function(e){this._blurFilter.quality=e},s.pixelSize.get=function(){return this._blurFilter.pixelSize},s.pixelSize.set=function(e){this._blurFilter.pixelSize=e},Object.defineProperties(i.prototype,s),i}(t.Filter);e.AdvancedBloomFilter=s,Object.defineProperty(e,"__esModule",{value:!0})}),Object.assign(PIXI.filters,this?this.__filters:__filters);
|
||||
var __filters=function(t,e,r,o){"use strict";var i="attribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\n\nuniform mat3 projectionMatrix;\n\nvarying vec2 vTextureCoord;\n\nvoid main(void)\n{\n gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n vTextureCoord = aTextureCoord;\n}",l="\nuniform sampler2D uSampler;\nvarying vec2 vTextureCoord;\n\nuniform float threshold;\n\nvoid main() {\n vec4 color = texture2D(uSampler, vTextureCoord);\n\n // A simple & fast algorithm for getting brightness.\n // It's inaccuracy , but good enought for this feature.\n float _max = max(max(color.r, color.g), color.b);\n float _min = min(min(color.r, color.g), color.b);\n float brightness = (_max + _min) * 0.5;\n\n if(brightness > threshold) {\n gl_FragColor = color;\n } else {\n gl_FragColor = vec4(0.0, 0.0, 0.0, 0.0);\n }\n}\n",n=function(t){function e(e){void 0===e&&(e=.5),t.call(this,i,l),this.threshold=e}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var r={threshold:{configurable:!0}};return r.threshold.get=function(){return this.uniforms.threshold},r.threshold.set=function(t){this.uniforms.threshold=t},Object.defineProperties(e.prototype,r),e}(e.Filter),s="uniform sampler2D uSampler;\nvarying vec2 vTextureCoord;\n\nuniform sampler2D bloomTexture;\nuniform float bloomScale;\nuniform float brightness;\n\nvoid main() {\n vec4 color = texture2D(uSampler, vTextureCoord);\n color.rgb *= brightness;\n vec4 bloomColor = vec4(texture2D(bloomTexture, vTextureCoord).rgb, 0.0);\n bloomColor.rgb *= bloomScale;\n gl_FragColor = color + bloomColor;\n}\n",u=function(t){function e(e){t.call(this,i,s),"number"==typeof e&&(e={threshold:e}),e=Object.assign({threshold:.5,bloomScale:1,brightness:1,kernels:null,blur:8,quality:4,pixelSize:1,resolution:o.settings.RESOLUTION},e),this.bloomScale=e.bloomScale,this.brightness=e.brightness;var l=e.kernels,u=e.blur,a=e.quality,c=e.pixelSize,h=e.resolution;this._extractFilter=new n(e.threshold),this._extractFilter.resolution=h,this._blurFilter=l?new r.KawaseBlurFilter(l):new r.KawaseBlurFilter(u,a),this.pixelSize=c,this.resolution=h}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var l={resolution:{configurable:!0},threshold:{configurable:!0},kernels:{configurable:!0},blur:{configurable:!0},quality:{configurable:!0},pixelSize:{configurable:!0}};return e.prototype.apply=function(t,e,r,o,i){var l=t.getFilterTexture();this._extractFilter.apply(t,e,l,1,i);var n=t.getFilterTexture();this._blurFilter.apply(t,l,n,1,i),this.uniforms.bloomScale=this.bloomScale,this.uniforms.brightness=this.brightness,this.uniforms.bloomTexture=n,t.applyFilter(this,e,r,o),t.returnFilterTexture(n),t.returnFilterTexture(l)},l.resolution.get=function(){return this._resolution},l.resolution.set=function(t){this._resolution=t,this._extractFilter&&(this._extractFilter.resolution=t),this._blurFilter&&(this._blurFilter.resolution=t)},l.threshold.get=function(){return this._extractFilter.threshold},l.threshold.set=function(t){this._extractFilter.threshold=t},l.kernels.get=function(){return this._blurFilter.kernels},l.kernels.set=function(t){this._blurFilter.kernels=t},l.blur.get=function(){return this._blurFilter.blur},l.blur.set=function(t){this._blurFilter.blur=t},l.quality.get=function(){return this._blurFilter.quality},l.quality.set=function(t){this._blurFilter.quality=t},l.pixelSize.get=function(){return this._blurFilter.pixelSize},l.pixelSize.set=function(t){this._blurFilter.pixelSize=t},Object.defineProperties(e.prototype,l),e}(e.Filter);return t.AdvancedBloomFilter=u,t}({},PIXI,PIXI.filters,PIXI);Object.assign(PIXI.filters,__filters);
|
||||
|
@@ -1,8 +0,0 @@
|
||||
/*!
|
||||
* @pixi/filter-alpha - v5.2.1
|
||||
* Compiled Tue, 28 Jan 2020 23:33:11 UTC
|
||||
*
|
||||
* @pixi/filter-alpha is licensed under the MIT License.
|
||||
* http://www.opensource.org/licenses/mit-license
|
||||
*/
|
||||
this.PIXI=this.PIXI||{},this.PIXI.filters=this.PIXI.filters||{};var _pixi_filter_alpha=function(t,r){"use strict";var e="varying vec2 vTextureCoord;\n\nuniform sampler2D uSampler;\nuniform float uAlpha;\n\nvoid main(void)\n{\n gl_FragColor = texture2D(uSampler, vTextureCoord) * uAlpha;\n}\n",i=function(t){function i(i){void 0===i&&(i=1),t.call(this,r.defaultVertex,e,{uAlpha:1}),this.alpha=i}t&&(i.__proto__=t),i.prototype=Object.create(t&&t.prototype),i.prototype.constructor=i;var a={alpha:{configurable:!0}};return a.alpha.get=function(){return this.uniforms.uAlpha},a.alpha.set=function(t){this.uniforms.uAlpha=t},Object.defineProperties(i.prototype,a),i}(r.Filter);return t.AlphaFilter=i,t}({},PIXI);Object.assign(this.PIXI.filters,_pixi_filter_alpha);
|
@@ -1,8 +1,8 @@
|
||||
/*!
|
||||
* @pixi/filter-ascii - v2.5.0
|
||||
* Compiled Fri, 20 Dec 2019 18:59:17 UTC
|
||||
* @pixi/filter-ascii - v3.1.1
|
||||
* Compiled Wed, 08 Apr 2020 11:09:37 UTC
|
||||
*
|
||||
* @pixi/filter-ascii is licensed under the MIT License.
|
||||
* http://www.opensource.org/licenses/mit-license
|
||||
*/
|
||||
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports,require("pixi.js")):"function"==typeof define&&define.amd?define(["exports","pixi.js"],n):n(e.__filters={},e.PIXI)}(this,function(e,n){"use strict";var o="attribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\n\nuniform mat3 projectionMatrix;\n\nvarying vec2 vTextureCoord;\n\nvoid main(void)\n{\n gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n vTextureCoord = aTextureCoord;\n}",r="varying vec2 vTextureCoord;\n\nuniform vec4 filterArea;\nuniform float pixelSize;\nuniform sampler2D uSampler;\n\nvec2 mapCoord( vec2 coord )\n{\n coord *= filterArea.xy;\n coord += filterArea.zw;\n\n return coord;\n}\n\nvec2 unmapCoord( vec2 coord )\n{\n coord -= filterArea.zw;\n coord /= filterArea.xy;\n\n return coord;\n}\n\nvec2 pixelate(vec2 coord, vec2 size)\n{\n return floor( coord / size ) * size;\n}\n\nvec2 getMod(vec2 coord, vec2 size)\n{\n return mod( coord , size) / size;\n}\n\nfloat character(float n, vec2 p)\n{\n p = floor(p*vec2(4.0, -4.0) + 2.5);\n if (clamp(p.x, 0.0, 4.0) == p.x && clamp(p.y, 0.0, 4.0) == p.y)\n {\n if (int(mod(n/exp2(p.x + 5.0*p.y), 2.0)) == 1) return 1.0;\n }\n return 0.0;\n}\n\nvoid main()\n{\n vec2 coord = mapCoord(vTextureCoord);\n\n // get the rounded color..\n vec2 pixCoord = pixelate(coord, vec2(pixelSize));\n pixCoord = unmapCoord(pixCoord);\n\n vec4 color = texture2D(uSampler, pixCoord);\n\n // determine the character to use\n float gray = (color.r + color.g + color.b) / 3.0;\n\n float n = 65536.0; // .\n if (gray > 0.2) n = 65600.0; // :\n if (gray > 0.3) n = 332772.0; // *\n if (gray > 0.4) n = 15255086.0; // o\n if (gray > 0.5) n = 23385164.0; // &\n if (gray > 0.6) n = 15252014.0; // 8\n if (gray > 0.7) n = 13199452.0; // @\n if (gray > 0.8) n = 11512810.0; // #\n\n // get the mod..\n vec2 modd = getMod(coord, vec2(pixelSize));\n\n gl_FragColor = color * character( n, vec2(-1.0) + modd * 2.0);\n\n}",t=function(e){function n(n){void 0===n&&(n=8),e.call(this,o,r),this.size=n}e&&(n.__proto__=e),n.prototype=Object.create(e&&e.prototype),n.prototype.constructor=n;var t={size:{configurable:!0}};return t.size.get=function(){return this.uniforms.pixelSize},t.size.set=function(e){this.uniforms.pixelSize=e},Object.defineProperties(n.prototype,t),n}(n.Filter);e.AsciiFilter=t,Object.defineProperty(e,"__esModule",{value:!0})}),Object.assign(PIXI.filters,this?this.__filters:__filters);
|
||||
var __filters=function(n,e){"use strict";var o="attribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\n\nuniform mat3 projectionMatrix;\n\nvarying vec2 vTextureCoord;\n\nvoid main(void)\n{\n gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n vTextureCoord = aTextureCoord;\n}",r="varying vec2 vTextureCoord;\n\nuniform vec4 filterArea;\nuniform float pixelSize;\nuniform sampler2D uSampler;\n\nvec2 mapCoord( vec2 coord )\n{\n coord *= filterArea.xy;\n coord += filterArea.zw;\n\n return coord;\n}\n\nvec2 unmapCoord( vec2 coord )\n{\n coord -= filterArea.zw;\n coord /= filterArea.xy;\n\n return coord;\n}\n\nvec2 pixelate(vec2 coord, vec2 size)\n{\n return floor( coord / size ) * size;\n}\n\nvec2 getMod(vec2 coord, vec2 size)\n{\n return mod( coord , size) / size;\n}\n\nfloat character(float n, vec2 p)\n{\n p = floor(p*vec2(4.0, -4.0) + 2.5);\n\n if (clamp(p.x, 0.0, 4.0) == p.x)\n {\n if (clamp(p.y, 0.0, 4.0) == p.y)\n {\n if (int(mod(n/exp2(p.x + 5.0*p.y), 2.0)) == 1) return 1.0;\n }\n }\n return 0.0;\n}\n\nvoid main()\n{\n vec2 coord = mapCoord(vTextureCoord);\n\n // get the rounded color..\n vec2 pixCoord = pixelate(coord, vec2(pixelSize));\n pixCoord = unmapCoord(pixCoord);\n\n vec4 color = texture2D(uSampler, pixCoord);\n\n // determine the character to use\n float gray = (color.r + color.g + color.b) / 3.0;\n\n float n = 65536.0; // .\n if (gray > 0.2) n = 65600.0; // :\n if (gray > 0.3) n = 332772.0; // *\n if (gray > 0.4) n = 15255086.0; // o\n if (gray > 0.5) n = 23385164.0; // &\n if (gray > 0.6) n = 15252014.0; // 8\n if (gray > 0.7) n = 13199452.0; // @\n if (gray > 0.8) n = 11512810.0; // #\n\n // get the mod..\n vec2 modd = getMod(coord, vec2(pixelSize));\n\n gl_FragColor = color * character( n, vec2(-1.0) + modd * 2.0);\n\n}\n",t=function(n){function e(e){void 0===e&&(e=8),n.call(this,o,r),this.size=e}n&&(e.__proto__=n),e.prototype=Object.create(n&&n.prototype),e.prototype.constructor=e;var t={size:{configurable:!0}};return t.size.get=function(){return this.uniforms.pixelSize},t.size.set=function(n){this.uniforms.pixelSize=n},Object.defineProperties(e.prototype,t),e}(e.Filter);return n.AsciiFilter=t,n}({},PIXI);Object.assign(PIXI.filters,__filters);
|
||||
|
@@ -1,8 +1,8 @@
|
||||
/*!
|
||||
* @pixi/filter-bevel - v2.6.0
|
||||
* Compiled Fri, 20 Dec 2019 18:59:17 UTC
|
||||
* @pixi/filter-bevel - v3.1.1
|
||||
* Compiled Wed, 08 Apr 2020 11:09:37 UTC
|
||||
*
|
||||
* @pixi/filter-bevel is licensed under the MIT License.
|
||||
* http://www.opensource.org/licenses/mit-license
|
||||
*/
|
||||
!function(o,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("pixi.js")):"function"==typeof define&&define.amd?define(["exports","pixi.js"],t):t(o.__filters={},o.PIXI)}(this,function(o,t){"use strict";var r="attribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\n\nuniform mat3 projectionMatrix;\n\nvarying vec2 vTextureCoord;\n\nvoid main(void)\n{\n gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n vTextureCoord = aTextureCoord;\n}",i="precision mediump float;\n\nvarying vec2 vTextureCoord;\nuniform sampler2D uSampler;\nuniform vec4 filterArea;\n\nuniform float transformX;\nuniform float transformY;\nuniform vec3 lightColor;\nuniform float lightAlpha;\nuniform vec3 shadowColor;\nuniform float shadowAlpha;\n\nvoid main(void) {\n vec2 transform = vec2(1.0 / filterArea) * vec2(transformX, transformY);\n vec4 color = texture2D(uSampler, vTextureCoord);\n float light = texture2D(uSampler, vTextureCoord - transform).a;\n float shadow = texture2D(uSampler, vTextureCoord + transform).a;\n\n color.rgb = mix(color.rgb, lightColor, clamp((color.a - light) * lightAlpha, 0.0, 1.0));\n color.rgb = mix(color.rgb, shadowColor, clamp((color.a - shadow) * shadowAlpha, 0.0, 1.0));\n gl_FragColor = vec4(color.rgb * color.a, color.a);\n}\n",n=function(o){function n(t){void 0===t&&(t={}),o.call(this,r,i),this.uniforms.lightColor=new Float32Array(3),this.uniforms.shadowColor=new Float32Array(3),t=Object.assign({rotation:45,thickness:2,lightColor:16777215,lightAlpha:.7,shadowColor:0,shadowAlpha:.7},t),this.rotation=t.rotation,this.thickness=t.thickness,this.lightColor=t.lightColor,this.lightAlpha=t.lightAlpha,this.shadowColor=t.shadowColor,this.shadowAlpha=t.shadowAlpha}o&&(n.__proto__=o),n.prototype=Object.create(o&&o.prototype),n.prototype.constructor=n;var e={rotation:{configurable:!0},thickness:{configurable:!0},lightColor:{configurable:!0},lightAlpha:{configurable:!0},shadowColor:{configurable:!0},shadowAlpha:{configurable:!0}};return n.prototype._updateTransform=function(){this.uniforms.transformX=this._thickness*Math.cos(this._angle),this.uniforms.transformY=this._thickness*Math.sin(this._angle)},e.rotation.get=function(){return this._angle/t.DEG_TO_RAD},e.rotation.set=function(o){this._angle=o*t.DEG_TO_RAD,this._updateTransform()},e.thickness.get=function(){return this._thickness},e.thickness.set=function(o){this._thickness=o,this._updateTransform()},e.lightColor.get=function(){return t.utils.rgb2hex(this.uniforms.lightColor)},e.lightColor.set=function(o){t.utils.hex2rgb(o,this.uniforms.lightColor)},e.lightAlpha.get=function(){return this.uniforms.lightAlpha},e.lightAlpha.set=function(o){this.uniforms.lightAlpha=o},e.shadowColor.get=function(){return t.utils.rgb2hex(this.uniforms.shadowColor)},e.shadowColor.set=function(o){t.utils.hex2rgb(o,this.uniforms.shadowColor)},e.shadowAlpha.get=function(){return this.uniforms.shadowAlpha},e.shadowAlpha.set=function(o){this.uniforms.shadowAlpha=o},Object.defineProperties(n.prototype,e),n}(t.Filter);o.BevelFilter=n,Object.defineProperty(o,"__esModule",{value:!0})}),Object.assign(PIXI.filters,this?this.__filters:__filters);
|
||||
var __filters=function(o,t,r,i){"use strict";var n="attribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\n\nuniform mat3 projectionMatrix;\n\nvarying vec2 vTextureCoord;\n\nvoid main(void)\n{\n gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n vTextureCoord = aTextureCoord;\n}",e="precision mediump float;\n\nvarying vec2 vTextureCoord;\nuniform sampler2D uSampler;\nuniform vec4 filterArea;\n\nuniform float transformX;\nuniform float transformY;\nuniform vec3 lightColor;\nuniform float lightAlpha;\nuniform vec3 shadowColor;\nuniform float shadowAlpha;\n\nvoid main(void) {\n vec2 transform = vec2(1.0 / filterArea) * vec2(transformX, transformY);\n vec4 color = texture2D(uSampler, vTextureCoord);\n float light = texture2D(uSampler, vTextureCoord - transform).a;\n float shadow = texture2D(uSampler, vTextureCoord + transform).a;\n\n color.rgb = mix(color.rgb, lightColor, clamp((color.a - light) * lightAlpha, 0.0, 1.0));\n color.rgb = mix(color.rgb, shadowColor, clamp((color.a - shadow) * shadowAlpha, 0.0, 1.0));\n gl_FragColor = vec4(color.rgb * color.a, color.a);\n}\n",a=function(o){function t(t){void 0===t&&(t={}),o.call(this,n,e),this.uniforms.lightColor=new Float32Array(3),this.uniforms.shadowColor=new Float32Array(3),t=Object.assign({rotation:45,thickness:2,lightColor:16777215,lightAlpha:.7,shadowColor:0,shadowAlpha:.7},t),this.rotation=t.rotation,this.thickness=t.thickness,this.lightColor=t.lightColor,this.lightAlpha=t.lightAlpha,this.shadowColor=t.shadowColor,this.shadowAlpha=t.shadowAlpha}o&&(t.__proto__=o),t.prototype=Object.create(o&&o.prototype),t.prototype.constructor=t;var a={rotation:{configurable:!0},thickness:{configurable:!0},lightColor:{configurable:!0},lightAlpha:{configurable:!0},shadowColor:{configurable:!0},shadowAlpha:{configurable:!0}};return t.prototype._updateTransform=function(){this.uniforms.transformX=this._thickness*Math.cos(this._angle),this.uniforms.transformY=this._thickness*Math.sin(this._angle)},a.rotation.get=function(){return this._angle/r.DEG_TO_RAD},a.rotation.set=function(o){this._angle=o*r.DEG_TO_RAD,this._updateTransform()},a.thickness.get=function(){return this._thickness},a.thickness.set=function(o){this._thickness=o,this._updateTransform()},a.lightColor.get=function(){return i.rgb2hex(this.uniforms.lightColor)},a.lightColor.set=function(o){i.hex2rgb(o,this.uniforms.lightColor)},a.lightAlpha.get=function(){return this.uniforms.lightAlpha},a.lightAlpha.set=function(o){this.uniforms.lightAlpha=o},a.shadowColor.get=function(){return i.rgb2hex(this.uniforms.shadowColor)},a.shadowColor.set=function(o){i.hex2rgb(o,this.uniforms.shadowColor)},a.shadowAlpha.get=function(){return this.uniforms.shadowAlpha},a.shadowAlpha.set=function(o){this.uniforms.shadowAlpha=o},Object.defineProperties(t.prototype,a),t}(t.Filter);return o.BevelFilter=a,o}({},PIXI,PIXI,PIXI.utils);Object.assign(PIXI.filters,__filters);
|
||||
|
@@ -1,8 +1,8 @@
|
||||
/*!
|
||||
* @pixi/filter-bulge-pinch - v2.7.0
|
||||
* Compiled Sun, 13 Jan 2019 22:51:52 UTC
|
||||
* @pixi/filter-bulge-pinch - v3.1.1
|
||||
* Compiled Wed, 08 Apr 2020 11:09:37 UTC
|
||||
*
|
||||
* @pixi/filter-bulge-pinch is licensed under the MIT License.
|
||||
* http://www.opensource.org/licenses/mit-license
|
||||
*/
|
||||
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports,require("pixi.js")):"function"==typeof define&&define.amd?define(["exports","pixi.js"],n):n((e=e||self).__filters={},e.PIXI)}(this,function(e,n){"use strict";var t="attribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\n\nuniform mat3 projectionMatrix;\n\nvarying vec2 vTextureCoord;\n\nvoid main(void)\n{\n gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n vTextureCoord = aTextureCoord;\n}",r="uniform float radius;\nuniform float strength;\nuniform vec2 center;\nuniform sampler2D uSampler;\nvarying vec2 vTextureCoord;\n\nuniform vec4 filterArea;\nuniform vec4 filterClamp;\nuniform vec2 dimensions;\n\nvoid main()\n{\n vec2 coord = vTextureCoord * filterArea.xy;\n coord -= center * dimensions.xy;\n float distance = length(coord);\n if (distance < radius) {\n float percent = distance / radius;\n if (strength > 0.0) {\n coord *= mix(1.0, smoothstep(0.0, radius / distance, percent), strength * 0.75);\n } else {\n coord *= mix(1.0, pow(percent, 1.0 + strength * 0.75) * radius / distance, 1.0 - percent);\n }\n }\n coord += center * dimensions.xy;\n coord /= filterArea.xy;\n vec2 clampedCoord = clamp(coord, filterClamp.xy, filterClamp.zw);\n vec4 color = texture2D(uSampler, clampedCoord);\n if (coord != clampedCoord) {\n color *= max(0.0, 1.0 - length(coord - clampedCoord));\n }\n\n gl_FragColor = color;\n}\n",o=function(e){function n(n,o,i){e.call(this,t,r),this.uniforms.dimensions=new Float32Array(2),this.center=n||[.5,.5],this.radius="number"==typeof o?o:100,this.strength="number"==typeof i?i:1}e&&(n.__proto__=e),n.prototype=Object.create(e&&e.prototype),n.prototype.constructor=n;var o={radius:{configurable:!0},strength:{configurable:!0},center:{configurable:!0}};return n.prototype.apply=function(e,n,t,r){this.uniforms.dimensions[0]=n.sourceFrame.width,this.uniforms.dimensions[1]=n.sourceFrame.height,e.applyFilter(this,n,t,r)},o.radius.get=function(){return this.uniforms.radius},o.radius.set=function(e){this.uniforms.radius=e},o.strength.get=function(){return this.uniforms.strength},o.strength.set=function(e){this.uniforms.strength=e},o.center.get=function(){return this.uniforms.center},o.center.set=function(e){this.uniforms.center=e},Object.defineProperties(n.prototype,o),n}(n.Filter);e.BulgePinchFilter=o,Object.defineProperty(e,"__esModule",{value:!0})}),Object.assign(PIXI.filters,this?this.__filters:__filters);
|
||||
var __filters=function(e,r){"use strict";var n="attribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\n\nuniform mat3 projectionMatrix;\n\nvarying vec2 vTextureCoord;\n\nvoid main(void)\n{\n gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n vTextureCoord = aTextureCoord;\n}",t="uniform float radius;\nuniform float strength;\nuniform vec2 center;\nuniform sampler2D uSampler;\nvarying vec2 vTextureCoord;\n\nuniform vec4 filterArea;\nuniform vec4 filterClamp;\nuniform vec2 dimensions;\n\nvoid main()\n{\n vec2 coord = vTextureCoord * filterArea.xy;\n coord -= center * dimensions.xy;\n float distance = length(coord);\n if (distance < radius) {\n float percent = distance / radius;\n if (strength > 0.0) {\n coord *= mix(1.0, smoothstep(0.0, radius / distance, percent), strength * 0.75);\n } else {\n coord *= mix(1.0, pow(percent, 1.0 + strength * 0.75) * radius / distance, 1.0 - percent);\n }\n }\n coord += center * dimensions.xy;\n coord /= filterArea.xy;\n vec2 clampedCoord = clamp(coord, filterClamp.xy, filterClamp.zw);\n vec4 color = texture2D(uSampler, clampedCoord);\n if (coord != clampedCoord) {\n color *= max(0.0, 1.0 - length(coord - clampedCoord));\n }\n\n gl_FragColor = color;\n}\n",o=function(e){function r(r){if(e.call(this,n,t),"object"!=typeof r){var o=arguments[0],i=arguments[1],s=arguments[2];r={},void 0!==o&&(r.center=o),void 0!==i&&(r.radius=i),void 0!==s&&(r.strength=s)}this.uniforms.dimensions=new Float32Array(2),Object.assign(this,{center:[.5,.5],radius:100,strength:1},r)}e&&(r.__proto__=e),r.prototype=Object.create(e&&e.prototype),r.prototype.constructor=r;var o={radius:{configurable:!0},strength:{configurable:!0},center:{configurable:!0}};return r.prototype.apply=function(e,r,n,t){this.uniforms.dimensions[0]=r.filterFrame.width,this.uniforms.dimensions[1]=r.filterFrame.height,e.applyFilter(this,r,n,t)},o.radius.get=function(){return this.uniforms.radius},o.radius.set=function(e){this.uniforms.radius=e},o.strength.get=function(){return this.uniforms.strength},o.strength.set=function(e){this.uniforms.strength=e},o.center.get=function(){return this.uniforms.center},o.center.set=function(e){this.uniforms.center=e},Object.defineProperties(r.prototype,o),r}(r.Filter);return e.BulgePinchFilter=o,e}({},PIXI);Object.assign(PIXI.filters,__filters);
|
||||
|
@@ -1,6 +1,6 @@
|
||||
/*!
|
||||
* @pixi/filter-color-map - v3.0.3
|
||||
* Compiled Wed, 29 May 2019 03:04:05 UTC
|
||||
* @pixi/filter-color-map - v3.1.1
|
||||
* Compiled Wed, 08 Apr 2020 11:09:37 UTC
|
||||
*
|
||||
* @pixi/filter-color-map is licensed under the MIT License.
|
||||
* http://www.opensource.org/licenses/mit-license
|
||||
|
@@ -1,8 +1,8 @@
|
||||
/*!
|
||||
* @pixi/filter-color-replace - v2.7.0
|
||||
* Compiled Sun, 13 Jan 2019 22:51:52 UTC
|
||||
* @pixi/filter-color-replace - v3.1.1
|
||||
* Compiled Wed, 08 Apr 2020 11:09:37 UTC
|
||||
*
|
||||
* @pixi/filter-color-replace is licensed under the MIT License.
|
||||
* http://www.opensource.org/licenses/mit-license
|
||||
*/
|
||||
!function(o,r){"object"==typeof exports&&"undefined"!=typeof module?r(exports,require("pixi.js")):"function"==typeof define&&define.amd?define(["exports","pixi.js"],r):r((o=o||self).__filters={},o.PIXI)}(this,function(o,r){"use strict";var e="attribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\n\nuniform mat3 projectionMatrix;\n\nvarying vec2 vTextureCoord;\n\nvoid main(void)\n{\n gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n vTextureCoord = aTextureCoord;\n}",i="varying vec2 vTextureCoord;\nuniform sampler2D uSampler;\nuniform vec3 originalColor;\nuniform vec3 newColor;\nuniform float epsilon;\nvoid main(void) {\n vec4 currentColor = texture2D(uSampler, vTextureCoord);\n vec3 colorDiff = originalColor - (currentColor.rgb / max(currentColor.a, 0.0000000001));\n float colorDistance = length(colorDiff);\n float doReplace = step(colorDistance, epsilon);\n gl_FragColor = vec4(mix(currentColor.rgb, (newColor + colorDiff) * currentColor.a, doReplace), currentColor.a);\n}\n",n=function(o){function n(r,n,t){void 0===r&&(r=16711680),void 0===n&&(n=0),void 0===t&&(t=.4),o.call(this,e,i),this.uniforms.originalColor=new Float32Array(3),this.uniforms.newColor=new Float32Array(3),this.originalColor=r,this.newColor=n,this.epsilon=t}o&&(n.__proto__=o),n.prototype=Object.create(o&&o.prototype),n.prototype.constructor=n;var t={originalColor:{configurable:!0},newColor:{configurable:!0},epsilon:{configurable:!0}};return t.originalColor.set=function(o){var e=this.uniforms.originalColor;"number"==typeof o?(r.utils.hex2rgb(o,e),this._originalColor=o):(e[0]=o[0],e[1]=o[1],e[2]=o[2],this._originalColor=r.utils.rgb2hex(e))},t.originalColor.get=function(){return this._originalColor},t.newColor.set=function(o){var e=this.uniforms.newColor;"number"==typeof o?(r.utils.hex2rgb(o,e),this._newColor=o):(e[0]=o[0],e[1]=o[1],e[2]=o[2],this._newColor=r.utils.rgb2hex(e))},t.newColor.get=function(){return this._newColor},t.epsilon.set=function(o){this.uniforms.epsilon=o},t.epsilon.get=function(){return this.uniforms.epsilon},Object.defineProperties(n.prototype,t),n}(r.Filter);o.ColorReplaceFilter=n,Object.defineProperty(o,"__esModule",{value:!0})}),Object.assign(PIXI.filters,this?this.__filters:__filters);
|
||||
var __filters=function(o,r,n){"use strict";var e="attribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\n\nuniform mat3 projectionMatrix;\n\nvarying vec2 vTextureCoord;\n\nvoid main(void)\n{\n gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n vTextureCoord = aTextureCoord;\n}",i="varying vec2 vTextureCoord;\nuniform sampler2D uSampler;\nuniform vec3 originalColor;\nuniform vec3 newColor;\nuniform float epsilon;\nvoid main(void) {\n vec4 currentColor = texture2D(uSampler, vTextureCoord);\n vec3 colorDiff = originalColor - (currentColor.rgb / max(currentColor.a, 0.0000000001));\n float colorDistance = length(colorDiff);\n float doReplace = step(colorDistance, epsilon);\n gl_FragColor = vec4(mix(currentColor.rgb, (newColor + colorDiff) * currentColor.a, doReplace), currentColor.a);\n}\n",t=function(o){function r(r,n,t){void 0===r&&(r=16711680),void 0===n&&(n=0),void 0===t&&(t=.4),o.call(this,e,i),this.uniforms.originalColor=new Float32Array(3),this.uniforms.newColor=new Float32Array(3),this.originalColor=r,this.newColor=n,this.epsilon=t}o&&(r.__proto__=o),r.prototype=Object.create(o&&o.prototype),r.prototype.constructor=r;var t={originalColor:{configurable:!0},newColor:{configurable:!0},epsilon:{configurable:!0}};return t.originalColor.set=function(o){var r=this.uniforms.originalColor;"number"==typeof o?(n.hex2rgb(o,r),this._originalColor=o):(r[0]=o[0],r[1]=o[1],r[2]=o[2],this._originalColor=n.rgb2hex(r))},t.originalColor.get=function(){return this._originalColor},t.newColor.set=function(o){var r=this.uniforms.newColor;"number"==typeof o?(n.hex2rgb(o,r),this._newColor=o):(r[0]=o[0],r[1]=o[1],r[2]=o[2],this._newColor=n.rgb2hex(r))},t.newColor.get=function(){return this._newColor},t.epsilon.set=function(o){this.uniforms.epsilon=o},t.epsilon.get=function(){return this.uniforms.epsilon},Object.defineProperties(r.prototype,t),r}(r.Filter);return o.ColorReplaceFilter=t,o}({},PIXI,PIXI.utils);Object.assign(PIXI.filters,__filters);
|
||||
|
@@ -1,12 +1,8 @@
|
||||
/*!
|
||||
* @pixi/filter-crt - v3.0.3
|
||||
* Compiled Wed, 18 Dec 2019 19:58:07 UTC
|
||||
* @pixi/filter-crt - v3.1.1
|
||||
* Compiled Wed, 08 Apr 2020 11:09:37 UTC
|
||||
*
|
||||
* @pixi/filter-crt is licensed under the MIT License.
|
||||
* http://www.opensource.org/licenses/mit-license
|
||||
*/
|
||||
|
||||
/**
|
||||
* Modified the minified file to work on pixi4 by renaming filterFrame to sourceFrame below
|
||||
*/
|
||||
var __filters=function(n,i){"use strict";var t="attribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\n\nuniform mat3 projectionMatrix;\n\nvarying vec2 vTextureCoord;\n\nvoid main(void)\n{\n gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n vTextureCoord = aTextureCoord;\n}",e="varying vec2 vTextureCoord;\nuniform sampler2D uSampler;\n\nuniform vec4 filterArea;\nuniform vec2 dimensions;\n\nconst float SQRT_2 = 1.414213;\n\nconst float light = 1.0;\n\nuniform float curvature;\nuniform float lineWidth;\nuniform float lineContrast;\nuniform bool verticalLine;\nuniform float noise;\nuniform float noiseSize;\n\nuniform float vignetting;\nuniform float vignettingAlpha;\nuniform float vignettingBlur;\n\nuniform float seed;\nuniform float time;\n\nfloat rand(vec2 co) {\n return fract(sin(dot(co.xy, vec2(12.9898, 78.233))) * 43758.5453);\n}\n\nvoid main(void)\n{\n vec2 pixelCoord = vTextureCoord.xy * filterArea.xy;\n vec2 coord = pixelCoord / dimensions;\n\n vec2 dir = vec2(coord - vec2(0.5, 0.5));\n\n float _c = curvature > 0. ? curvature : 1.;\n float k = curvature > 0. ?(length(dir * dir) * 0.25 * _c * _c + 0.935 * _c) : 1.;\n vec2 uv = dir * k;\n\n gl_FragColor = texture2D(uSampler, vTextureCoord);\n vec3 rgb = gl_FragColor.rgb;\n\n\n if (noise > 0.0 && noiseSize > 0.0)\n {\n pixelCoord.x = floor(pixelCoord.x / noiseSize);\n pixelCoord.y = floor(pixelCoord.y / noiseSize);\n float _noise = rand(pixelCoord * noiseSize * seed) - 0.5;\n rgb += _noise * noise;\n }\n\n if (lineWidth > 0.0) {\n float v = (verticalLine ? uv.x * dimensions.x : uv.y * dimensions.y) * min(1.0, 2.0 / lineWidth ) / _c;\n float j = 1. + cos(v * 1.2 - time) * 0.5 * lineContrast;\n rgb *= j;\n float segment = verticalLine ? mod((dir.x + .5) * dimensions.x, 4.) : mod((dir.y + .5) * dimensions.y, 4.);\n rgb *= 0.99 + ceil(segment) * 0.015;\n }\n\n if (vignetting > 0.0)\n {\n float outter = SQRT_2 - vignetting * SQRT_2;\n float darker = clamp((outter - length(dir) * SQRT_2) / ( 0.00001 + vignettingBlur * SQRT_2), 0.0, 1.0);\n rgb *= darker + (1.0 - darker) * (1.0 - vignettingAlpha);\n }\n\n gl_FragColor.rgb = rgb;\n}\n",r=function(n){function i(i){n.call(this,t,e),this.uniforms.dimensions=new Float32Array(2),this.time=0,this.seed=0,Object.assign(this,{curvature:1,lineWidth:1,lineContrast:.25,verticalLine:!1,noise:0,noiseSize:1,seed:0,vignetting:.3,vignettingAlpha:1,vignettingBlur:.3,time:0},i)}n&&(i.__proto__=n),i.prototype=Object.create(n&&n.prototype),i.prototype.constructor=i;var r={curvature:{configurable:!0},lineWidth:{configurable:!0},lineContrast:{configurable:!0},verticalLine:{configurable:!0},noise:{configurable:!0},noiseSize:{configurable:!0},vignetting:{configurable:!0},vignettingAlpha:{configurable:!0},vignettingBlur:{configurable:!0}};return i.prototype.apply=function(n,i,t,e){this.uniforms.dimensions[0]=i.sourceFrame.width,this.uniforms.dimensions[1]=i.sourceFrame.height,this.uniforms.seed=this.seed,this.uniforms.time=this.time,n.applyFilter(this,i,t,e)},r.curvature.set=function(n){this.uniforms.curvature=n},r.curvature.get=function(){return this.uniforms.curvature},r.lineWidth.set=function(n){this.uniforms.lineWidth=n},r.lineWidth.get=function(){return this.uniforms.lineWidth},r.lineContrast.set=function(n){this.uniforms.lineContrast=n},r.lineContrast.get=function(){return this.uniforms.lineContrast},r.verticalLine.set=function(n){this.uniforms.verticalLine=n},r.verticalLine.get=function(){return this.uniforms.verticalLine},r.noise.set=function(n){this.uniforms.noise=n},r.noise.get=function(){return this.uniforms.noise},r.noiseSize.set=function(n){this.uniforms.noiseSize=n},r.noiseSize.get=function(){return this.uniforms.noiseSize},r.vignetting.set=function(n){this.uniforms.vignetting=n},r.vignetting.get=function(){return this.uniforms.vignetting},r.vignettingAlpha.set=function(n){this.uniforms.vignettingAlpha=n},r.vignettingAlpha.get=function(){return this.uniforms.vignettingAlpha},r.vignettingBlur.set=function(n){this.uniforms.vignettingBlur=n},r.vignettingBlur.get=function(){return this.uniforms.vignettingBlur},Object.defineProperties(i.prototype,r),i}(i.Filter);return n.CRTFilter=r,n}({},PIXI);Object.assign(PIXI.filters,__filters);
|
||||
var __filters=function(n,i){"use strict";var t="attribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\n\nuniform mat3 projectionMatrix;\n\nvarying vec2 vTextureCoord;\n\nvoid main(void)\n{\n gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n vTextureCoord = aTextureCoord;\n}",e="varying vec2 vTextureCoord;\nuniform sampler2D uSampler;\n\nuniform vec4 filterArea;\nuniform vec2 dimensions;\n\nconst float SQRT_2 = 1.414213;\n\nconst float light = 1.0;\n\nuniform float curvature;\nuniform float lineWidth;\nuniform float lineContrast;\nuniform bool verticalLine;\nuniform float noise;\nuniform float noiseSize;\n\nuniform float vignetting;\nuniform float vignettingAlpha;\nuniform float vignettingBlur;\n\nuniform float seed;\nuniform float time;\n\nfloat rand(vec2 co) {\n return fract(sin(dot(co.xy, vec2(12.9898, 78.233))) * 43758.5453);\n}\n\nvoid main(void)\n{\n vec2 pixelCoord = vTextureCoord.xy * filterArea.xy;\n vec2 coord = pixelCoord / dimensions;\n\n vec2 dir = vec2(coord - vec2(0.5, 0.5));\n\n float _c = curvature > 0. ? curvature : 1.;\n float k = curvature > 0. ?(length(dir * dir) * 0.25 * _c * _c + 0.935 * _c) : 1.;\n vec2 uv = dir * k;\n\n gl_FragColor = texture2D(uSampler, vTextureCoord);\n vec3 rgb = gl_FragColor.rgb;\n\n\n if (noise > 0.0 && noiseSize > 0.0)\n {\n pixelCoord.x = floor(pixelCoord.x / noiseSize);\n pixelCoord.y = floor(pixelCoord.y / noiseSize);\n float _noise = rand(pixelCoord * noiseSize * seed) - 0.5;\n rgb += _noise * noise;\n }\n\n if (lineWidth > 0.0) {\n float v = (verticalLine ? uv.x * dimensions.x : uv.y * dimensions.y) * min(1.0, 2.0 / lineWidth ) / _c;\n float j = 1. + cos(v * 1.2 - time) * 0.5 * lineContrast;\n rgb *= j;\n float segment = verticalLine ? mod((dir.x + .5) * dimensions.x, 4.) : mod((dir.y + .5) * dimensions.y, 4.);\n rgb *= 0.99 + ceil(segment) * 0.015;\n }\n\n if (vignetting > 0.0)\n {\n float outter = SQRT_2 - vignetting * SQRT_2;\n float darker = clamp((outter - length(dir) * SQRT_2) / ( 0.00001 + vignettingBlur * SQRT_2), 0.0, 1.0);\n rgb *= darker + (1.0 - darker) * (1.0 - vignettingAlpha);\n }\n\n gl_FragColor.rgb = rgb;\n}\n",r=function(n){function i(i){n.call(this,t,e),this.uniforms.dimensions=new Float32Array(2),this.time=0,this.seed=0,Object.assign(this,{curvature:1,lineWidth:1,lineContrast:.25,verticalLine:!1,noise:0,noiseSize:1,seed:0,vignetting:.3,vignettingAlpha:1,vignettingBlur:.3,time:0},i)}n&&(i.__proto__=n),i.prototype=Object.create(n&&n.prototype),i.prototype.constructor=i;var r={curvature:{configurable:!0},lineWidth:{configurable:!0},lineContrast:{configurable:!0},verticalLine:{configurable:!0},noise:{configurable:!0},noiseSize:{configurable:!0},vignetting:{configurable:!0},vignettingAlpha:{configurable:!0},vignettingBlur:{configurable:!0}};return i.prototype.apply=function(n,i,t,e){this.uniforms.dimensions[0]=i.filterFrame.width,this.uniforms.dimensions[1]=i.filterFrame.height,this.uniforms.seed=this.seed,this.uniforms.time=this.time,n.applyFilter(this,i,t,e)},r.curvature.set=function(n){this.uniforms.curvature=n},r.curvature.get=function(){return this.uniforms.curvature},r.lineWidth.set=function(n){this.uniforms.lineWidth=n},r.lineWidth.get=function(){return this.uniforms.lineWidth},r.lineContrast.set=function(n){this.uniforms.lineContrast=n},r.lineContrast.get=function(){return this.uniforms.lineContrast},r.verticalLine.set=function(n){this.uniforms.verticalLine=n},r.verticalLine.get=function(){return this.uniforms.verticalLine},r.noise.set=function(n){this.uniforms.noise=n},r.noise.get=function(){return this.uniforms.noise},r.noiseSize.set=function(n){this.uniforms.noiseSize=n},r.noiseSize.get=function(){return this.uniforms.noiseSize},r.vignetting.set=function(n){this.uniforms.vignetting=n},r.vignetting.get=function(){return this.uniforms.vignetting},r.vignettingAlpha.set=function(n){this.uniforms.vignettingAlpha=n},r.vignettingAlpha.get=function(){return this.uniforms.vignettingAlpha},r.vignettingBlur.set=function(n){this.uniforms.vignettingBlur=n},r.vignettingBlur.get=function(){return this.uniforms.vignettingBlur},Object.defineProperties(i.prototype,r),i}(i.Filter);return n.CRTFilter=r,n}({},PIXI);Object.assign(PIXI.filters,__filters);
|
||||
|
@@ -1,8 +1,8 @@
|
||||
/*!
|
||||
* @pixi/filter-dot - v2.7.0
|
||||
* Compiled Sun, 13 Jan 2019 22:51:52 UTC
|
||||
* @pixi/filter-dot - v3.1.1
|
||||
* Compiled Wed, 08 Apr 2020 11:09:37 UTC
|
||||
*
|
||||
* @pixi/filter-dot is licensed under the MIT License.
|
||||
* http://www.opensource.org/licenses/mit-license
|
||||
*/
|
||||
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports,require("pixi.js")):"function"==typeof define&&define.amd?define(["exports","pixi.js"],n):n((e=e||self).__filters={},e.PIXI)}(this,function(e,n){"use strict";var t="attribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\n\nuniform mat3 projectionMatrix;\n\nvarying vec2 vTextureCoord;\n\nvoid main(void)\n{\n gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n vTextureCoord = aTextureCoord;\n}",o="precision mediump float;\n\nvarying vec2 vTextureCoord;\nvarying vec4 vColor;\n\nuniform vec4 filterArea;\nuniform sampler2D uSampler;\n\nuniform float angle;\nuniform float scale;\n\nfloat pattern()\n{\n float s = sin(angle), c = cos(angle);\n vec2 tex = vTextureCoord * filterArea.xy;\n vec2 point = vec2(\n c * tex.x - s * tex.y,\n s * tex.x + c * tex.y\n ) * scale;\n return (sin(point.x) * sin(point.y)) * 4.0;\n}\n\nvoid main()\n{\n vec4 color = texture2D(uSampler, vTextureCoord);\n float average = (color.r + color.g + color.b) / 3.0;\n gl_FragColor = vec4(vec3(average * 10.0 - 5.0 + pattern()), color.a);\n}\n",r=function(e){function n(n,r){void 0===n&&(n=1),void 0===r&&(r=5),e.call(this,t,o),this.scale=n,this.angle=r}e&&(n.__proto__=e),n.prototype=Object.create(e&&e.prototype),n.prototype.constructor=n;var r={scale:{configurable:!0},angle:{configurable:!0}};return r.scale.get=function(){return this.uniforms.scale},r.scale.set=function(e){this.uniforms.scale=e},r.angle.get=function(){return this.uniforms.angle},r.angle.set=function(e){this.uniforms.angle=e},Object.defineProperties(n.prototype,r),n}(n.Filter);e.DotFilter=r,Object.defineProperty(e,"__esModule",{value:!0})}),Object.assign(PIXI.filters,this?this.__filters:__filters);
|
||||
var __filters=function(e,n){"use strict";var t="attribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\n\nuniform mat3 projectionMatrix;\n\nvarying vec2 vTextureCoord;\n\nvoid main(void)\n{\n gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n vTextureCoord = aTextureCoord;\n}",r="precision mediump float;\n\nvarying vec2 vTextureCoord;\nvarying vec4 vColor;\n\nuniform vec4 filterArea;\nuniform sampler2D uSampler;\n\nuniform float angle;\nuniform float scale;\n\nfloat pattern()\n{\n float s = sin(angle), c = cos(angle);\n vec2 tex = vTextureCoord * filterArea.xy;\n vec2 point = vec2(\n c * tex.x - s * tex.y,\n s * tex.x + c * tex.y\n ) * scale;\n return (sin(point.x) * sin(point.y)) * 4.0;\n}\n\nvoid main()\n{\n vec4 color = texture2D(uSampler, vTextureCoord);\n float average = (color.r + color.g + color.b) / 3.0;\n gl_FragColor = vec4(vec3(average * 10.0 - 5.0 + pattern()), color.a);\n}\n",o=function(e){function n(n,o){void 0===n&&(n=1),void 0===o&&(o=5),e.call(this,t,r),this.scale=n,this.angle=o}e&&(n.__proto__=e),n.prototype=Object.create(e&&e.prototype),n.prototype.constructor=n;var o={scale:{configurable:!0},angle:{configurable:!0}};return o.scale.get=function(){return this.uniforms.scale},o.scale.set=function(e){this.uniforms.scale=e},o.angle.get=function(){return this.uniforms.angle},o.angle.set=function(e){this.uniforms.angle=e},Object.defineProperties(n.prototype,o),n}(n.Filter);return e.DotFilter=o,e}({},PIXI);Object.assign(PIXI.filters,__filters);
|
||||
|
@@ -1,8 +1,8 @@
|
||||
/*!
|
||||
* @pixi/filter-drop-shadow - v2.6.2
|
||||
* Compiled Fri, 20 Dec 2019 18:59:17 UTC
|
||||
* @pixi/filter-drop-shadow - v3.1.1
|
||||
* Compiled Wed, 08 Apr 2020 11:09:37 UTC
|
||||
*
|
||||
* @pixi/filter-drop-shadow is licensed under the MIT License.
|
||||
* http://www.opensource.org/licenses/mit-license
|
||||
*/
|
||||
!function(t,i){"object"==typeof exports&&"undefined"!=typeof module?i(exports,require("@pixi/filter-kawase-blur"),require("pixi.js")):"function"==typeof define&&define.amd?define(["exports","@pixi/filter-kawase-blur","pixi.js"],i):i(t.__filters={},t.PIXI.filters,t.PIXI)}(this,function(t,i,e){"use strict";var r="attribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\n\nuniform mat3 projectionMatrix;\n\nvarying vec2 vTextureCoord;\n\nvoid main(void)\n{\n gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n vTextureCoord = aTextureCoord;\n}",n="varying vec2 vTextureCoord;\nuniform sampler2D uSampler;\nuniform float alpha;\nuniform vec3 color;\nvoid main(void){\n vec4 sample = texture2D(uSampler, vTextureCoord);\n\n // Un-premultiply alpha before applying the color\n if (sample.a > 0.0) {\n sample.rgb /= sample.a;\n }\n\n // Premultiply alpha again\n sample.rgb = color.rgb * sample.a;\n\n // alpha user alpha\n sample *= alpha;\n\n gl_FragColor = sample;\n}",o=function(t){function o(o){o&&o.constructor!==Object&&(console.warn("DropShadowFilter now uses options instead of (rotation, distance, blur, color, alpha)"),o={rotation:o},void 0!==arguments[1]&&(o.distance=arguments[1]),void 0!==arguments[2]&&(o.blur=arguments[2]),void 0!==arguments[3]&&(o.color=arguments[3]),void 0!==arguments[4]&&(o.alpha=arguments[4])),o=Object.assign({rotation:45,distance:5,color:0,alpha:.5,shadowOnly:!1,kernels:null,blur:2,quality:3,pixelSize:1,resolution:e.settings.RESOLUTION},o),t.call(this);var l=o.kernels,a=o.blur,s=o.quality,u=o.pixelSize,c=o.resolution;this._tintFilter=new e.Filter(r,n),this._tintFilter.uniforms.color=new Float32Array(4),this._tintFilter.resolution=c,this._blurFilter=l?new i.KawaseBlurFilter(l):new i.KawaseBlurFilter(a,s),this.pixelSize=u,this.resolution=c,this.targetTransform=new e.Matrix;var p=o.shadowOnly,h=o.rotation,f=o.distance,d=o.alpha,g=o.color;this.shadowOnly=p,this.rotation=h,this.distance=f,this.alpha=d,this.color=g,this._updatePadding()}t&&(o.__proto__=t),o.prototype=Object.create(t&&t.prototype),o.prototype.constructor=o;var l={resolution:{configurable:!0},distance:{configurable:!0},rotation:{configurable:!0},alpha:{configurable:!0},color:{configurable:!0},kernels:{configurable:!0},blur:{configurable:!0},quality:{configurable:!0},pixelSize:{configurable:!0}};return o.prototype.apply=function(t,i,e,r){var n=t.getRenderTarget();n.transform=this.targetTransform,this._tintFilter.apply(t,i,n,!0),n.transform=null,this._blurFilter.apply(t,n,e,r),!0!==this.shadowOnly&&t.applyFilter(this,i,e,!1),t.returnRenderTarget(n)},o.prototype._updatePadding=function(){this.padding=this.distance+2*this.blur},o.prototype._updateTargetTransform=function(){this.targetTransform.tx=this.distance*Math.cos(this.angle),this.targetTransform.ty=this.distance*Math.sin(this.angle)},l.resolution.get=function(){return this._resolution},l.resolution.set=function(t){this._resolution=t,this._tintFilter&&(this._tintFilter.resolution=t),this._blurFilter&&(this._blurFilter.resolution=t)},l.distance.get=function(){return this._distance},l.distance.set=function(t){this._distance=t,this._updatePadding(),this._updateTargetTransform()},l.rotation.get=function(){return this.angle/e.DEG_TO_RAD},l.rotation.set=function(t){this.angle=t*e.DEG_TO_RAD,this._updateTargetTransform()},l.alpha.get=function(){return this._tintFilter.uniforms.alpha},l.alpha.set=function(t){this._tintFilter.uniforms.alpha=t},l.color.get=function(){return e.utils.rgb2hex(this._tintFilter.uniforms.color)},l.color.set=function(t){e.utils.hex2rgb(t,this._tintFilter.uniforms.color)},l.kernels.get=function(){return this._blurFilter.kernels},l.kernels.set=function(t){this._blurFilter.kernels=t},l.blur.get=function(){return this._blurFilter.blur},l.blur.set=function(t){this._blurFilter.blur=t,this._updatePadding()},l.quality.get=function(){return this._blurFilter.quality},l.quality.set=function(t){this._blurFilter.quality=t},l.pixelSize.get=function(){return this._blurFilter.pixelSize},l.pixelSize.set=function(t){this._blurFilter.pixelSize=t},Object.defineProperties(o.prototype,l),o}(e.Filter);t.DropShadowFilter=o,Object.defineProperty(t,"__esModule",{value:!0})}),Object.assign(PIXI.filters,this?this.__filters:__filters);
|
||||
var __filters=function(t,i,e,r,n,o){"use strict";var l="attribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\n\nuniform mat3 projectionMatrix;\n\nvarying vec2 vTextureCoord;\n\nvoid main(void)\n{\n gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n vTextureCoord = aTextureCoord;\n}",s="varying vec2 vTextureCoord;\nuniform sampler2D uSampler;\nuniform float alpha;\nuniform vec3 color;\n\nuniform vec2 shift;\nuniform vec4 inputSize;\n\nvoid main(void){\n vec4 sample = texture2D(uSampler, vTextureCoord - shift * inputSize.zw);\n\n // Premultiply alpha\n sample.rgb = color.rgb * sample.a;\n\n // alpha user alpha\n sample *= alpha;\n\n gl_FragColor = sample;\n}",a=function(t){function e(e){e&&e.constructor!==Object&&(console.warn("DropShadowFilter now uses options instead of (rotation, distance, blur, color, alpha)"),e={rotation:e},void 0!==arguments[1]&&(e.distance=arguments[1]),void 0!==arguments[2]&&(e.blur=arguments[2]),void 0!==arguments[3]&&(e.color=arguments[3]),void 0!==arguments[4]&&(e.alpha=arguments[4])),e=Object.assign({rotation:45,distance:5,color:0,alpha:.5,shadowOnly:!1,kernels:null,blur:2,quality:3,pixelSize:1,resolution:r.settings.RESOLUTION},e),t.call(this);var o=e.kernels,a=e.blur,u=e.quality,c=e.pixelSize,h=e.resolution;this._tintFilter=new t(l,s),this._tintFilter.uniforms.color=new Float32Array(4),this._tintFilter.uniforms.shift=new n.Point,this._tintFilter.resolution=h,this._blurFilter=o?new i.KawaseBlurFilter(o):new i.KawaseBlurFilter(a,u),this.pixelSize=c,this.resolution=h;var p=e.shadowOnly,f=e.rotation,d=e.distance,_=e.alpha,b=e.color;this.shadowOnly=p,this.rotation=f,this.distance=d,this.alpha=_,this.color=b,this._updatePadding()}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var a={resolution:{configurable:!0},distance:{configurable:!0},rotation:{configurable:!0},alpha:{configurable:!0},color:{configurable:!0},kernels:{configurable:!0},blur:{configurable:!0},quality:{configurable:!0},pixelSize:{configurable:!0}};return e.prototype.apply=function(t,i,e,r){var n=t.getFilterTexture();this._tintFilter.apply(t,i,n,1),this._blurFilter.apply(t,n,e,r),!0!==this.shadowOnly&&t.applyFilter(this,i,e,0),t.returnFilterTexture(n)},e.prototype._updatePadding=function(){this.padding=this.distance+2*this.blur},e.prototype._updateShift=function(){this._tintFilter.uniforms.shift.set(this.distance*Math.cos(this.angle),this.distance*Math.sin(this.angle))},a.resolution.get=function(){return this._resolution},a.resolution.set=function(t){this._resolution=t,this._tintFilter&&(this._tintFilter.resolution=t),this._blurFilter&&(this._blurFilter.resolution=t)},a.distance.get=function(){return this._distance},a.distance.set=function(t){this._distance=t,this._updatePadding(),this._updateShift()},a.rotation.get=function(){return this.angle/n.DEG_TO_RAD},a.rotation.set=function(t){this.angle=t*n.DEG_TO_RAD,this._updateShift()},a.alpha.get=function(){return this._tintFilter.uniforms.alpha},a.alpha.set=function(t){this._tintFilter.uniforms.alpha=t},a.color.get=function(){return o.rgb2hex(this._tintFilter.uniforms.color)},a.color.set=function(t){o.hex2rgb(t,this._tintFilter.uniforms.color)},a.kernels.get=function(){return this._blurFilter.kernels},a.kernels.set=function(t){this._blurFilter.kernels=t},a.blur.get=function(){return this._blurFilter.blur},a.blur.set=function(t){this._blurFilter.blur=t,this._updatePadding()},a.quality.get=function(){return this._blurFilter.quality},a.quality.set=function(t){this._blurFilter.quality=t},a.pixelSize.get=function(){return this._blurFilter.pixelSize},a.pixelSize.set=function(t){this._blurFilter.pixelSize=t},Object.defineProperties(e.prototype,a),e}(e.Filter);return t.DropShadowFilter=a,t}({},PIXI.filters,PIXI,PIXI,PIXI,PIXI.utils);Object.assign(PIXI.filters,__filters);
|
||||
|
File diff suppressed because one or more lines are too long
@@ -1,8 +1,8 @@
|
||||
/*!
|
||||
* @pixi/filter-glow - v2.5.0
|
||||
* Compiled Fri, 20 Dec 2019 18:59:17 UTC
|
||||
* @pixi/filter-glow - v3.1.1
|
||||
* Compiled Wed, 08 Apr 2020 11:09:37 UTC
|
||||
*
|
||||
* @pixi/filter-glow is licensed under the MIT License.
|
||||
* http://www.opensource.org/licenses/mit-license
|
||||
*/
|
||||
!function(o,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("pixi.js")):"function"==typeof define&&define.amd?define(["exports","pixi.js"],t):t(o.__filters={},o.PIXI)}(this,function(o,t){"use strict";var n="attribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\n\nuniform mat3 projectionMatrix;\n\nvarying vec2 vTextureCoord;\n\nvoid main(void)\n{\n gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n vTextureCoord = aTextureCoord;\n}",e="varying vec2 vTextureCoord;\nvarying vec4 vColor;\n\nuniform sampler2D uSampler;\n\nuniform float distance;\nuniform float outerStrength;\nuniform float innerStrength;\nuniform vec4 glowColor;\nuniform vec4 filterArea;\nuniform vec4 filterClamp;\nconst float PI = 3.14159265358979323846264;\n\nvoid main(void) {\n vec2 px = vec2(1.0 / filterArea.x, 1.0 / filterArea.y);\n vec4 ownColor = texture2D(uSampler, vTextureCoord);\n vec4 curColor;\n float totalAlpha = 0.0;\n float maxTotalAlpha = 0.0;\n float cosAngle;\n float sinAngle;\n vec2 displaced;\n for (float angle = 0.0; angle <= PI * 2.0; angle += %QUALITY_DIST%) {\n cosAngle = cos(angle);\n sinAngle = sin(angle);\n for (float curDistance = 1.0; curDistance <= %DIST%; curDistance++) {\n displaced.x = vTextureCoord.x + cosAngle * curDistance * px.x;\n displaced.y = vTextureCoord.y + sinAngle * curDistance * px.y;\n curColor = texture2D(uSampler, clamp(displaced, filterClamp.xy, filterClamp.zw));\n totalAlpha += (distance - curDistance) * curColor.a;\n maxTotalAlpha += (distance - curDistance);\n }\n }\n maxTotalAlpha = max(maxTotalAlpha, 0.0001);\n\n ownColor.a = max(ownColor.a, 0.0001);\n ownColor.rgb = ownColor.rgb / ownColor.a;\n float outerGlowAlpha = (totalAlpha / maxTotalAlpha) * outerStrength * (1. - ownColor.a);\n float innerGlowAlpha = ((maxTotalAlpha - totalAlpha) / maxTotalAlpha) * innerStrength * ownColor.a;\n float resultAlpha = (ownColor.a + outerGlowAlpha);\n gl_FragColor = vec4(mix(mix(ownColor.rgb, glowColor.rgb, innerGlowAlpha / ownColor.a), glowColor.rgb, outerGlowAlpha / resultAlpha) * resultAlpha, resultAlpha);\n}\n",r=function(o){function r(t,r,i,l,a){void 0===t&&(t=10),void 0===r&&(r=4),void 0===i&&(i=0),void 0===l&&(l=16777215),void 0===a&&(a=.1),o.call(this,n,e.replace(/%QUALITY_DIST%/gi,""+(1/a/t).toFixed(7)).replace(/%DIST%/gi,""+t.toFixed(7))),this.uniforms.glowColor=new Float32Array([0,0,0,1]),this.distance=t,this.color=l,this.outerStrength=r,this.innerStrength=i}o&&(r.__proto__=o),r.prototype=Object.create(o&&o.prototype),r.prototype.constructor=r;var i={color:{configurable:!0},distance:{configurable:!0},outerStrength:{configurable:!0},innerStrength:{configurable:!0}};return i.color.get=function(){return t.utils.rgb2hex(this.uniforms.glowColor)},i.color.set=function(o){t.utils.hex2rgb(o,this.uniforms.glowColor)},i.distance.get=function(){return this.uniforms.distance},i.distance.set=function(o){this.uniforms.distance=o},i.outerStrength.get=function(){return this.uniforms.outerStrength},i.outerStrength.set=function(o){this.uniforms.outerStrength=o},i.innerStrength.get=function(){return this.uniforms.innerStrength},i.innerStrength.set=function(o){this.uniforms.innerStrength=o},Object.defineProperties(r.prototype,i),r}(t.Filter);o.GlowFilter=r,Object.defineProperty(o,"__esModule",{value:!0})}),Object.assign(PIXI.filters,this?this.__filters:__filters);
|
||||
var __filters=function(n,o,t){"use strict";var r="attribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\n\nuniform mat3 projectionMatrix;\n\nvarying vec2 vTextureCoord;\n\nvoid main(void)\n{\n gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n vTextureCoord = aTextureCoord;\n}",e="varying vec2 vTextureCoord;\nvarying vec4 vColor;\n\nuniform sampler2D uSampler;\n\nuniform float outerStrength;\nuniform float innerStrength;\n\nuniform vec4 glowColor;\n\nuniform vec4 filterArea;\nuniform vec4 filterClamp;\nuniform bool knockout;\n\nconst float PI = 3.14159265358979323846264;\n\nconst float DIST = __DIST__;\nconst float ANGLE_STEP_SIZE = min(__ANGLE_STEP_SIZE__, PI * 2.0);\nconst float ANGLE_STEP_NUM = ceil(PI * 2.0 / ANGLE_STEP_SIZE);\n\nconst float MAX_TOTAL_ALPHA = ANGLE_STEP_NUM * DIST * (DIST + 1.0) / 2.0;\n\nvoid main(void) {\n vec2 px = vec2(1.0 / filterArea.x, 1.0 / filterArea.y);\n\n float totalAlpha = 0.0;\n\n vec2 direction;\n vec2 displaced;\n vec4 curColor;\n\n for (float angle = 0.0; angle < PI * 2.0; angle += ANGLE_STEP_SIZE) {\n direction = vec2(cos(angle), sin(angle)) * px;\n\n for (float curDistance = 0.0; curDistance < DIST; curDistance++) {\n displaced = clamp(vTextureCoord + direction * \n (curDistance + 1.0), filterClamp.xy, filterClamp.zw);\n\n curColor = texture2D(uSampler, displaced);\n\n totalAlpha += (DIST - curDistance) * curColor.a;\n }\n }\n \n curColor = texture2D(uSampler, vTextureCoord);\n\n float alphaRatio = (totalAlpha / MAX_TOTAL_ALPHA);\n\n float innerGlowAlpha = (1.0 - alphaRatio) * innerStrength * curColor.a;\n float innerGlowStrength = min(1.0, innerGlowAlpha);\n \n vec4 innerColor = mix(curColor, glowColor, innerGlowStrength);\n\n float outerGlowAlpha = alphaRatio * outerStrength * (1. - curColor.a);\n float outerGlowStrength = min(1.0 - innerColor.a, outerGlowAlpha);\n\n vec4 outerGlowColor = outerGlowStrength * glowColor.rgba;\n \n if (knockout) {\n float resultAlpha = outerGlowAlpha + innerGlowAlpha;\n gl_FragColor = vec4(glowColor.rgb * resultAlpha, resultAlpha);\n }\n else {\n gl_FragColor = innerColor + outerGlowColor;\n }\n}\n",i=function(n){function o(t){var i=Object.assign({},o.defaults,t),l=i.distance,a=i.outerStrength,u=i.innerStrength,c=i.color,s=i.knockout,f=i.quality;l=Math.round(l),n.call(this,r,e.replace(/__ANGLE_STEP_SIZE__/gi,""+(1/f/l).toFixed(7)).replace(/__DIST__/gi,l.toFixed(0)+".0")),this.uniforms.glowColor=new Float32Array([0,0,0,1]),Object.assign(this,{color:c,outerStrength:a,innerStrength:u,padding:l,knockout:s})}n&&(o.__proto__=n),o.prototype=Object.create(n&&n.prototype),o.prototype.constructor=o;var i={color:{configurable:!0},outerStrength:{configurable:!0},innerStrength:{configurable:!0},knockout:{configurable:!0}};return i.color.get=function(){return t.rgb2hex(this.uniforms.glowColor)},i.color.set=function(n){t.hex2rgb(n,this.uniforms.glowColor)},i.outerStrength.get=function(){return this.uniforms.outerStrength},i.outerStrength.set=function(n){this.uniforms.outerStrength=n},i.innerStrength.get=function(){return this.uniforms.innerStrength},i.innerStrength.set=function(n){this.uniforms.innerStrength=n},i.knockout.get=function(){return this.uniforms.knockout},i.knockout.set=function(n){this.uniforms.knockout=n},Object.defineProperties(o.prototype,i),o}(o.Filter);return i.defaults={distance:10,outerStrength:4,innerStrength:0,color:16777215,quality:.1,knockout:!1},n.GlowFilter=i,n}({},PIXI,PIXI.utils);Object.assign(PIXI.filters,__filters);
|
||||
|
File diff suppressed because one or more lines are too long
@@ -1,8 +1,8 @@
|
||||
/*!
|
||||
* @pixi/filter-kawase-blur - v2.6.0
|
||||
* Compiled Fri, 20 Dec 2019 18:59:17 UTC
|
||||
* @pixi/filter-kawase-blur - v3.1.1
|
||||
* Compiled Wed, 08 Apr 2020 11:09:37 UTC
|
||||
*
|
||||
* @pixi/filter-kawase-blur is licensed under the MIT License.
|
||||
* http://www.opensource.org/licenses/mit-license
|
||||
*/
|
||||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("pixi.js")):"function"==typeof define&&define.amd?define(["exports","pixi.js"],t):t(e.__filters={},e.PIXI)}(this,function(e,t){"use strict";var r="attribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\n\nuniform mat3 projectionMatrix;\n\nvarying vec2 vTextureCoord;\n\nvoid main(void)\n{\n gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n vTextureCoord = aTextureCoord;\n}",i="\nvarying vec2 vTextureCoord;\nuniform sampler2D uSampler;\n\nuniform vec2 uOffset;\n\nvoid main(void)\n{\n vec4 color = vec4(0.0);\n\n // Sample top left pixel\n color += texture2D(uSampler, vec2(vTextureCoord.x - uOffset.x, vTextureCoord.y + uOffset.y));\n\n // Sample top right pixel\n color += texture2D(uSampler, vec2(vTextureCoord.x + uOffset.x, vTextureCoord.y + uOffset.y));\n\n // Sample bottom right pixel\n color += texture2D(uSampler, vec2(vTextureCoord.x + uOffset.x, vTextureCoord.y - uOffset.y));\n\n // Sample bottom left pixel\n color += texture2D(uSampler, vec2(vTextureCoord.x - uOffset.x, vTextureCoord.y - uOffset.y));\n\n // Average\n color *= 0.25;\n\n gl_FragColor = color;\n}",o="\nvarying vec2 vTextureCoord;\nuniform sampler2D uSampler;\n\nuniform vec2 uOffset;\nuniform vec4 filterClamp;\n\nvoid main(void)\n{\n vec4 color = vec4(0.0);\n\n // Sample top left pixel\n color += texture2D(uSampler, clamp(vec2(vTextureCoord.x - uOffset.x, vTextureCoord.y + uOffset.y), filterClamp.xy, filterClamp.zw));\n\n // Sample top right pixel\n color += texture2D(uSampler, clamp(vec2(vTextureCoord.x + uOffset.x, vTextureCoord.y + uOffset.y), filterClamp.xy, filterClamp.zw));\n\n // Sample bottom right pixel\n color += texture2D(uSampler, clamp(vec2(vTextureCoord.x + uOffset.x, vTextureCoord.y - uOffset.y), filterClamp.xy, filterClamp.zw));\n\n // Sample bottom left pixel\n color += texture2D(uSampler, clamp(vec2(vTextureCoord.x - uOffset.x, vTextureCoord.y - uOffset.y), filterClamp.xy, filterClamp.zw));\n\n // Average\n color *= 0.25;\n\n gl_FragColor = color;\n}\n",n=function(e){function n(n,l,u){void 0===n&&(n=4),void 0===l&&(l=3),void 0===u&&(u=!1),e.call(this,r,u?o:i),this.uniforms.uOffset=new Float32Array(2),this._pixelSize=new t.Point,this.pixelSize=1,this._clamp=u,this._kernels=null,Array.isArray(n)?this.kernels=n:(this._blur=n,this.quality=l)}e&&(n.__proto__=e),n.prototype=Object.create(e&&e.prototype),n.prototype.constructor=n;var l={kernels:{configurable:!0},clamp:{configurable:!0},pixelSize:{configurable:!0},quality:{configurable:!0},blur:{configurable:!0}};return n.prototype.apply=function(e,t,r,i){var o,n=this.pixelSize.x/t.size.width,l=this.pixelSize.y/t.size.height;if(1===this._quality||0===this._blur)o=this._kernels[0]+.5,this.uniforms.uOffset[0]=o*n,this.uniforms.uOffset[1]=o*l,e.applyFilter(this,t,r,i);else{for(var u,s=e.getRenderTarget(!0),f=t,a=s,p=this._quality-1,x=0;x<p;x++)o=this._kernels[x]+.5,this.uniforms.uOffset[0]=o*n,this.uniforms.uOffset[1]=o*l,e.applyFilter(this,f,a,!0),u=f,f=a,a=u;o=this._kernels[p]+.5,this.uniforms.uOffset[0]=o*n,this.uniforms.uOffset[1]=o*l,e.applyFilter(this,f,r,i),e.returnRenderTarget(s)}},n.prototype._generateKernels=function(){var e=this._blur,t=this._quality,r=[e];if(e>0)for(var i=e,o=e/t,n=1;n<t;n++)i-=o,r.push(i);this._kernels=r},l.kernels.get=function(){return this._kernels},l.kernels.set=function(e){Array.isArray(e)&&e.length>0?(this._kernels=e,this._quality=e.length,this._blur=Math.max.apply(Math,e)):(this._kernels=[0],this._quality=1)},l.clamp.get=function(){return this._clamp},l.pixelSize.set=function(e){"number"==typeof e?(this._pixelSize.x=e,this._pixelSize.y=e):Array.isArray(e)?(this._pixelSize.x=e[0],this._pixelSize.y=e[1]):e instanceof t.Point?(this._pixelSize.x=e.x,this._pixelSize.y=e.y):(this._pixelSize.x=1,this._pixelSize.y=1)},l.pixelSize.get=function(){return this._pixelSize},l.quality.get=function(){return this._quality},l.quality.set=function(e){this._quality=Math.max(1,Math.round(e)),this._generateKernels()},l.blur.get=function(){return this._blur},l.blur.set=function(e){this._blur=e,this._generateKernels()},Object.defineProperties(n.prototype,l),n}(t.Filter);e.KawaseBlurFilter=n,Object.defineProperty(e,"__esModule",{value:!0})}),Object.assign(PIXI.filters,this?this.__filters:__filters);
|
||||
var __filters=function(e,t,r){"use strict";var i="attribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\n\nuniform mat3 projectionMatrix;\n\nvarying vec2 vTextureCoord;\n\nvoid main(void)\n{\n gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n vTextureCoord = aTextureCoord;\n}",o="\nvarying vec2 vTextureCoord;\nuniform sampler2D uSampler;\n\nuniform vec2 uOffset;\n\nvoid main(void)\n{\n vec4 color = vec4(0.0);\n\n // Sample top left pixel\n color += texture2D(uSampler, vec2(vTextureCoord.x - uOffset.x, vTextureCoord.y + uOffset.y));\n\n // Sample top right pixel\n color += texture2D(uSampler, vec2(vTextureCoord.x + uOffset.x, vTextureCoord.y + uOffset.y));\n\n // Sample bottom right pixel\n color += texture2D(uSampler, vec2(vTextureCoord.x + uOffset.x, vTextureCoord.y - uOffset.y));\n\n // Sample bottom left pixel\n color += texture2D(uSampler, vec2(vTextureCoord.x - uOffset.x, vTextureCoord.y - uOffset.y));\n\n // Average\n color *= 0.25;\n\n gl_FragColor = color;\n}",n="\nvarying vec2 vTextureCoord;\nuniform sampler2D uSampler;\n\nuniform vec2 uOffset;\nuniform vec4 filterClamp;\n\nvoid main(void)\n{\n vec4 color = vec4(0.0);\n\n // Sample top left pixel\n color += texture2D(uSampler, clamp(vec2(vTextureCoord.x - uOffset.x, vTextureCoord.y + uOffset.y), filterClamp.xy, filterClamp.zw));\n\n // Sample top right pixel\n color += texture2D(uSampler, clamp(vec2(vTextureCoord.x + uOffset.x, vTextureCoord.y + uOffset.y), filterClamp.xy, filterClamp.zw));\n\n // Sample bottom right pixel\n color += texture2D(uSampler, clamp(vec2(vTextureCoord.x + uOffset.x, vTextureCoord.y - uOffset.y), filterClamp.xy, filterClamp.zw));\n\n // Sample bottom left pixel\n color += texture2D(uSampler, clamp(vec2(vTextureCoord.x - uOffset.x, vTextureCoord.y - uOffset.y), filterClamp.xy, filterClamp.zw));\n\n // Average\n color *= 0.25;\n\n gl_FragColor = color;\n}\n",l=function(e){function t(t,l,u){void 0===t&&(t=4),void 0===l&&(l=3),void 0===u&&(u=!1),e.call(this,i,u?n:o),this.uniforms.uOffset=new Float32Array(2),this._pixelSize=new r.Point,this.pixelSize=1,this._clamp=u,this._kernels=null,Array.isArray(t)?this.kernels=t:(this._blur=t,this.quality=l)}e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t;var l={kernels:{configurable:!0},clamp:{configurable:!0},pixelSize:{configurable:!0},quality:{configurable:!0},blur:{configurable:!0}};return t.prototype.apply=function(e,t,r,i){var o,n=this._pixelSize.x/t._frame.width,l=this._pixelSize.y/t._frame.height;if(1===this._quality||0===this._blur)o=this._kernels[0]+.5,this.uniforms.uOffset[0]=o*n,this.uniforms.uOffset[1]=o*l,e.applyFilter(this,t,r,i);else{for(var u,s=e.getFilterTexture(),a=t,f=s,p=this._quality-1,x=0;x<p;x++)o=this._kernels[x]+.5,this.uniforms.uOffset[0]=o*n,this.uniforms.uOffset[1]=o*l,e.applyFilter(this,a,f,1),u=a,a=f,f=u;o=this._kernels[p]+.5,this.uniforms.uOffset[0]=o*n,this.uniforms.uOffset[1]=o*l,e.applyFilter(this,a,r,i),e.returnFilterTexture(s)}},t.prototype._generateKernels=function(){var e=this._blur,t=this._quality,r=[e];if(e>0)for(var i=e,o=e/t,n=1;n<t;n++)i-=o,r.push(i);this._kernels=r},l.kernels.get=function(){return this._kernels},l.kernels.set=function(e){Array.isArray(e)&&e.length>0?(this._kernels=e,this._quality=e.length,this._blur=Math.max.apply(Math,e)):(this._kernels=[0],this._quality=1)},l.clamp.get=function(){return this._clamp},l.pixelSize.set=function(e){"number"==typeof e?(this._pixelSize.x=e,this._pixelSize.y=e):Array.isArray(e)?(this._pixelSize.x=e[0],this._pixelSize.y=e[1]):e instanceof r.Point?(this._pixelSize.x=e.x,this._pixelSize.y=e.y):(this._pixelSize.x=1,this._pixelSize.y=1)},l.pixelSize.get=function(){return this._pixelSize},l.quality.get=function(){return this._quality},l.quality.set=function(e){this._quality=Math.max(1,Math.round(e)),this._generateKernels()},l.blur.get=function(){return this._blur},l.blur.set=function(e){this._blur=e,this._generateKernels()},Object.defineProperties(t.prototype,l),t}(t.Filter);return e.KawaseBlurFilter=l,e}({},PIXI,PIXI);Object.assign(PIXI.filters,__filters);
|
||||
|
File diff suppressed because one or more lines are too long
@@ -1,8 +1,8 @@
|
||||
/*!
|
||||
* @pixi/filter-outline - v2.6.0
|
||||
* Compiled Fri, 20 Dec 2019 18:59:17 UTC
|
||||
* @pixi/filter-outline - v3.1.1
|
||||
* Compiled Wed, 08 Apr 2020 11:09:37 UTC
|
||||
*
|
||||
* @pixi/filter-outline is licensed under the MIT License.
|
||||
* http://www.opensource.org/licenses/mit-license
|
||||
*/
|
||||
!function(e,o){"object"==typeof exports&&"undefined"!=typeof module?o(exports,require("pixi.js")):"function"==typeof define&&define.amd?define(["exports","pixi.js"],o):o(e.__filters={},e.PIXI)}(this,function(e,o){"use strict";var t="attribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\n\nuniform mat3 projectionMatrix;\n\nvarying vec2 vTextureCoord;\n\nvoid main(void)\n{\n gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n vTextureCoord = aTextureCoord;\n}",r="varying vec2 vTextureCoord;\nuniform sampler2D uSampler;\n\nuniform vec2 thickness;\nuniform vec4 outlineColor;\nuniform vec4 filterClamp;\n\nconst float DOUBLE_PI = 3.14159265358979323846264 * 2.;\n\nvoid main(void) {\n vec4 ownColor = texture2D(uSampler, vTextureCoord);\n vec4 curColor;\n float maxAlpha = 0.;\n vec2 displaced;\n for (float angle = 0.; angle <= DOUBLE_PI; angle += ${angleStep}) {\n displaced.x = vTextureCoord.x + thickness.x * cos(angle);\n displaced.y = vTextureCoord.y + thickness.y * sin(angle);\n curColor = texture2D(uSampler, clamp(displaced, filterClamp.xy, filterClamp.zw));\n maxAlpha = max(maxAlpha, curColor.a);\n }\n float resultAlpha = max(maxAlpha, ownColor.a);\n gl_FragColor = vec4((ownColor.rgb + outlineColor.rgb * (1. - ownColor.a)) * resultAlpha, resultAlpha);\n}\n",n=function(e){function n(o,i,l){void 0===o&&(o=1),void 0===i&&(i=0),void 0===l&&(l=.1);var s=Math.max(l*n.MAX_SAMPLES,n.MIN_SAMPLES),a=(2*Math.PI/s).toFixed(7);e.call(this,t,r.replace(/\$\{angleStep\}/,a)),this.uniforms.thickness=new Float32Array([0,0]),this.thickness=o,this.uniforms.outlineColor=new Float32Array([0,0,0,1]),this.color=i,this.quality=l}e&&(n.__proto__=e),n.prototype=Object.create(e&&e.prototype),n.prototype.constructor=n;var i={color:{configurable:!0}};return n.prototype.apply=function(e,o,t,r){this.uniforms.thickness[0]=this.thickness/o.size.width,this.uniforms.thickness[1]=this.thickness/o.size.height,e.applyFilter(this,o,t,r)},i.color.get=function(){return o.utils.rgb2hex(this.uniforms.outlineColor)},i.color.set=function(e){o.utils.hex2rgb(e,this.uniforms.outlineColor)},Object.defineProperties(n.prototype,i),n}(o.Filter);n.MIN_SAMPLES=1,n.MAX_SAMPLES=100,e.OutlineFilter=n,Object.defineProperty(e,"__esModule",{value:!0})}),Object.assign(PIXI.filters,this?this.__filters:__filters);
|
||||
var __filters=function(o,e,t){"use strict";var r="attribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\n\nuniform mat3 projectionMatrix;\n\nvarying vec2 vTextureCoord;\n\nvoid main(void)\n{\n gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n vTextureCoord = aTextureCoord;\n}",n="varying vec2 vTextureCoord;\nuniform sampler2D uSampler;\n\nuniform vec2 thickness;\nuniform vec4 outlineColor;\nuniform vec4 filterClamp;\n\nconst float DOUBLE_PI = 3.14159265358979323846264 * 2.;\n\nvoid main(void) {\n vec4 ownColor = texture2D(uSampler, vTextureCoord);\n vec4 curColor;\n float maxAlpha = 0.;\n vec2 displaced;\n for (float angle = 0.; angle <= DOUBLE_PI; angle += ${angleStep}) {\n displaced.x = vTextureCoord.x + thickness.x * cos(angle);\n displaced.y = vTextureCoord.y + thickness.y * sin(angle);\n curColor = texture2D(uSampler, clamp(displaced, filterClamp.xy, filterClamp.zw));\n maxAlpha = max(maxAlpha, curColor.a);\n }\n float resultAlpha = max(maxAlpha, ownColor.a);\n gl_FragColor = vec4((ownColor.rgb + outlineColor.rgb * (1. - ownColor.a)) * resultAlpha, resultAlpha);\n}\n",i=function(o){function e(t,i,l){void 0===t&&(t=1),void 0===i&&(i=0),void 0===l&&(l=.1);var a=Math.max(l*e.MAX_SAMPLES,e.MIN_SAMPLES),s=(2*Math.PI/a).toFixed(7);o.call(this,r,n.replace(/\$\{angleStep\}/,s)),this.uniforms.thickness=new Float32Array([0,0]),this.thickness=t,this.uniforms.outlineColor=new Float32Array([0,0,0,1]),this.color=i,this.quality=l}o&&(e.__proto__=o),e.prototype=Object.create(o&&o.prototype),e.prototype.constructor=e;var i={color:{configurable:!0}};return e.prototype.apply=function(o,e,t,r){this.uniforms.thickness[0]=this.thickness/e._frame.width,this.uniforms.thickness[1]=this.thickness/e._frame.height,o.applyFilter(this,e,t,r)},i.color.get=function(){return t.rgb2hex(this.uniforms.outlineColor)},i.color.set=function(o){t.hex2rgb(o,this.uniforms.outlineColor)},Object.defineProperties(e.prototype,i),e}(e.Filter);return i.MIN_SAMPLES=1,i.MAX_SAMPLES=100,o.OutlineFilter=i,o}({},PIXI,PIXI.utils);Object.assign(PIXI.filters,__filters);
|
||||
|
@@ -1,6 +1,6 @@
|
||||
/*!
|
||||
* @pixi/filter-pixelate - v3.0.3
|
||||
* Compiled Wed, 29 May 2019 03:04:05 UTC
|
||||
* @pixi/filter-pixelate - v3.1.1
|
||||
* Compiled Wed, 08 Apr 2020 11:09:37 UTC
|
||||
*
|
||||
* @pixi/filter-pixelate is licensed under the MIT License.
|
||||
* http://www.opensource.org/licenses/mit-license
|
||||
|
@@ -1,8 +1,8 @@
|
||||
/*!
|
||||
* @pixi/filter-radial-blur - v2.7.0
|
||||
* Compiled Sun, 13 Jan 2019 22:51:52 UTC
|
||||
* @pixi/filter-radial-blur - v3.1.1
|
||||
* Compiled Wed, 08 Apr 2020 11:09:37 UTC
|
||||
*
|
||||
* @pixi/filter-radial-blur is licensed under the MIT License.
|
||||
* http://www.opensource.org/licenses/mit-license
|
||||
*/
|
||||
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports,require("pixi.js")):"function"==typeof define&&define.amd?define(["exports","pixi.js"],n):n((e=e||self).__filters={},e.PIXI)}(this,function(e,n){"use strict";var t="attribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\n\nuniform mat3 projectionMatrix;\n\nvarying vec2 vTextureCoord;\n\nvoid main(void)\n{\n gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n vTextureCoord = aTextureCoord;\n}",r="varying vec2 vTextureCoord;\nuniform sampler2D uSampler;\nuniform vec4 filterArea;\n\nuniform float uRadian;\nuniform vec2 uCenter;\nuniform float uRadius;\nuniform int uKernelSize;\n\nconst int MAX_KERNEL_SIZE = 2048;\n\nvoid main(void)\n{\n vec4 color = texture2D(uSampler, vTextureCoord);\n\n if (uKernelSize == 0)\n {\n gl_FragColor = color;\n return;\n }\n\n float aspect = filterArea.y / filterArea.x;\n vec2 center = uCenter.xy / filterArea.xy;\n float gradient = uRadius / filterArea.x * 0.3;\n float radius = uRadius / filterArea.x - gradient * 0.5;\n int k = uKernelSize - 1;\n\n vec2 coord = vTextureCoord;\n vec2 dir = vec2(center - coord);\n float dist = length(vec2(dir.x, dir.y * aspect));\n\n float radianStep = uRadian;\n if (radius >= 0.0 && dist > radius) {\n float delta = dist - radius;\n float gap = gradient;\n float scale = 1.0 - abs(delta / gap);\n if (scale <= 0.0) {\n gl_FragColor = color;\n return;\n }\n radianStep *= scale;\n }\n radianStep /= float(k);\n\n float s = sin(radianStep);\n float c = cos(radianStep);\n mat2 rotationMatrix = mat2(vec2(c, -s), vec2(s, c));\n\n for(int i = 0; i < MAX_KERNEL_SIZE - 1; i++) {\n if (i == k) {\n break;\n }\n\n coord -= center;\n coord.y *= aspect;\n coord = rotationMatrix * coord;\n coord.y /= aspect;\n coord += center;\n\n vec4 sample = texture2D(uSampler, coord);\n\n // switch to pre-multiplied alpha to correctly blur transparent images\n // sample.rgb *= sample.a;\n\n color += sample;\n }\n\n gl_FragColor = color / float(uKernelSize);\n}\n",i=function(e){function n(n,i,o,a){void 0===n&&(n=0),void 0===i&&(i=[0,0]),void 0===o&&(o=5),void 0===a&&(a=-1),e.call(this,t,r),this._angle=0,this.angle=n,this.center=i,this.kernelSize=o,this.radius=a}e&&(n.__proto__=e),n.prototype=Object.create(e&&e.prototype),n.prototype.constructor=n;var i={angle:{configurable:!0},center:{configurable:!0},radius:{configurable:!0}};return n.prototype.apply=function(e,n,t,r){this.uniforms.uKernelSize=0!==this._angle?this.kernelSize:0,e.applyFilter(this,n,t,r)},i.angle.set=function(e){this._angle=e,this.uniforms.uRadian=e*Math.PI/180},i.angle.get=function(){return this._angle},i.center.get=function(){return this.uniforms.uCenter},i.center.set=function(e){this.uniforms.uCenter=e},i.radius.get=function(){return this.uniforms.uRadius},i.radius.set=function(e){(e<0||e===1/0)&&(e=-1),this.uniforms.uRadius=e},Object.defineProperties(n.prototype,i),n}(n.Filter);e.RadialBlurFilter=i,Object.defineProperty(e,"__esModule",{value:!0})}),Object.assign(PIXI.filters,this?this.__filters:__filters);
|
||||
var __filters=function(n,e){"use strict";var r="attribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\n\nuniform mat3 projectionMatrix;\n\nvarying vec2 vTextureCoord;\n\nvoid main(void)\n{\n gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n vTextureCoord = aTextureCoord;\n}",t="varying vec2 vTextureCoord;\nuniform sampler2D uSampler;\nuniform vec4 filterArea;\n\nuniform float uRadian;\nuniform vec2 uCenter;\nuniform float uRadius;\nuniform int uKernelSize;\n\nconst int MAX_KERNEL_SIZE = 2048;\n\nvoid main(void)\n{\n vec4 color = texture2D(uSampler, vTextureCoord);\n\n if (uKernelSize == 0)\n {\n gl_FragColor = color;\n return;\n }\n\n float aspect = filterArea.y / filterArea.x;\n vec2 center = uCenter.xy / filterArea.xy;\n float gradient = uRadius / filterArea.x * 0.3;\n float radius = uRadius / filterArea.x - gradient * 0.5;\n int k = uKernelSize - 1;\n\n vec2 coord = vTextureCoord;\n vec2 dir = vec2(center - coord);\n float dist = length(vec2(dir.x, dir.y * aspect));\n\n float radianStep = uRadian;\n if (radius >= 0.0 && dist > radius) {\n float delta = dist - radius;\n float gap = gradient;\n float scale = 1.0 - abs(delta / gap);\n if (scale <= 0.0) {\n gl_FragColor = color;\n return;\n }\n radianStep *= scale;\n }\n radianStep /= float(k);\n\n float s = sin(radianStep);\n float c = cos(radianStep);\n mat2 rotationMatrix = mat2(vec2(c, -s), vec2(s, c));\n\n for(int i = 0; i < MAX_KERNEL_SIZE - 1; i++) {\n if (i == k) {\n break;\n }\n\n coord -= center;\n coord.y *= aspect;\n coord = rotationMatrix * coord;\n coord.y /= aspect;\n coord += center;\n\n vec4 sample = texture2D(uSampler, coord);\n\n // switch to pre-multiplied alpha to correctly blur transparent images\n // sample.rgb *= sample.a;\n\n color += sample;\n }\n\n gl_FragColor = color / float(uKernelSize);\n}\n",i=function(n){function e(e,i,o,a){void 0===e&&(e=0),void 0===i&&(i=[0,0]),void 0===o&&(o=5),void 0===a&&(a=-1),n.call(this,r,t),this._angle=0,this.angle=e,this.center=i,this.kernelSize=o,this.radius=a}n&&(e.__proto__=n),e.prototype=Object.create(n&&n.prototype),e.prototype.constructor=e;var i={angle:{configurable:!0},center:{configurable:!0},radius:{configurable:!0}};return e.prototype.apply=function(n,e,r,t){this.uniforms.uKernelSize=0!==this._angle?this.kernelSize:0,n.applyFilter(this,e,r,t)},i.angle.set=function(n){this._angle=n,this.uniforms.uRadian=n*Math.PI/180},i.angle.get=function(){return this._angle},i.center.get=function(){return this.uniforms.uCenter},i.center.set=function(n){this.uniforms.uCenter=n},i.radius.get=function(){return this.uniforms.uRadius},i.radius.set=function(n){(n<0||n===1/0)&&(n=-1),this.uniforms.uRadius=n},Object.defineProperties(e.prototype,i),e}(e.Filter);return n.RadialBlurFilter=i,n}({},PIXI);Object.assign(PIXI.filters,__filters);
|
||||
|
@@ -1,8 +1,8 @@
|
||||
/*!
|
||||
* @pixi/filter-reflection - v2.5.0
|
||||
* Compiled Wed, 10 Jan 2018 17:38:59 UTC
|
||||
* @pixi/filter-reflection - v3.1.1
|
||||
* Compiled Wed, 08 Apr 2020 11:09:37 UTC
|
||||
*
|
||||
* @pixi/filter-reflection is licensed under the MIT License.
|
||||
* http://www.opensource.org/licenses/mit-license
|
||||
*/
|
||||
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports,require("pixi.js")):"function"==typeof define&&define.amd?define(["exports","pixi.js"],n):n(e.__filters={},e.PIXI)}(this,function(e,n){"use strict";var r="attribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\n\nuniform mat3 projectionMatrix;\n\nvarying vec2 vTextureCoord;\n\nvoid main(void)\n{\n gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n vTextureCoord = aTextureCoord;\n}",t="varying vec2 vTextureCoord;\nuniform sampler2D uSampler;\n\nuniform vec4 filterArea;\nuniform vec4 filterClamp;\nuniform vec2 dimensions;\n\nuniform bool mirror;\nuniform float boundary;\nuniform vec2 amplitude;\nuniform vec2 waveLength;\nuniform vec2 alpha;\nuniform float time;\n\nfloat rand(vec2 co) {\n return fract(sin(dot(co.xy, vec2(12.9898, 78.233))) * 43758.5453);\n}\n\nvoid main(void)\n{\n vec2 pixelCoord = vTextureCoord.xy * filterArea.xy;\n vec2 coord = pixelCoord / dimensions;\n\n if (coord.y < boundary) {\n gl_FragColor = texture2D(uSampler, vTextureCoord);\n return;\n }\n\n float k = (coord.y - boundary) / (1. - boundary + 0.0001);\n float areaY = boundary * dimensions.y / filterArea.y;\n float v = areaY + areaY - vTextureCoord.y;\n float y = mirror ? v : vTextureCoord.y;\n\n float _amplitude = ((amplitude.y - amplitude.x) * k + amplitude.x ) / filterArea.x;\n float _waveLength = ((waveLength.y - waveLength.x) * k + waveLength.x) / filterArea.y;\n float _alpha = (alpha.y - alpha.x) * k + alpha.x;\n\n float x = vTextureCoord.x + cos(v * 6.28 / _waveLength - time) * _amplitude;\n x = clamp(x, filterClamp.x, filterClamp.z);\n\n vec4 color = texture2D(uSampler, vec2(x, y));\n\n gl_FragColor = color * _alpha;\n}\n",o=function(e){function n(n){e.call(this,r,t),Object.assign(this,{mirror:!0,boundary:.5,amplitude:[0,20],waveLength:[30,100],alpha:[1,1],time:0},n)}e&&(n.__proto__=e),n.prototype=Object.create(e&&e.prototype),n.prototype.constructor=n;var o={mirror:{configurable:!0},boundary:{configurable:!0},amplitude:{configurable:!0},waveLength:{configurable:!0},alpha:{configurable:!0}};return n.prototype.apply=function(e,n,r,t){this.uniforms.dimensions[0]=n.sourceFrame.width,this.uniforms.dimensions[1]=n.sourceFrame.height,this.uniforms.time=this.time,e.applyFilter(this,n,r,t)},o.mirror.set=function(e){this.uniforms.mirror=e},o.mirror.get=function(){return this.uniforms.mirror},o.boundary.set=function(e){this.uniforms.boundary=e},o.boundary.get=function(){return this.uniforms.boundary},o.amplitude.set=function(e){this.uniforms.amplitude[0]=e[0],this.uniforms.amplitude[1]=e[1]},o.amplitude.get=function(){return this.uniforms.amplitude},o.waveLength.set=function(e){this.uniforms.waveLength[0]=e[0],this.uniforms.waveLength[1]=e[1]},o.waveLength.get=function(){return this.uniforms.waveLength},o.alpha.set=function(e){this.uniforms.alpha[0]=e[0],this.uniforms.alpha[1]=e[1]},o.alpha.get=function(){return this.uniforms.alpha},Object.defineProperties(n.prototype,o),n}(n.Filter);e.ReflectionFilter=o,Object.defineProperty(e,"__esModule",{value:!0})}),Object.assign(PIXI.filters,this.__filters);
|
||||
var __filters=function(r,n){"use strict";var e="attribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\n\nuniform mat3 projectionMatrix;\n\nvarying vec2 vTextureCoord;\n\nvoid main(void)\n{\n gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n vTextureCoord = aTextureCoord;\n}",t="varying vec2 vTextureCoord;\nuniform sampler2D uSampler;\n\nuniform vec4 filterArea;\nuniform vec4 filterClamp;\nuniform vec2 dimensions;\n\nuniform bool mirror;\nuniform float boundary;\nuniform vec2 amplitude;\nuniform vec2 waveLength;\nuniform vec2 alpha;\nuniform float time;\n\nfloat rand(vec2 co) {\n return fract(sin(dot(co.xy, vec2(12.9898, 78.233))) * 43758.5453);\n}\n\nvoid main(void)\n{\n vec2 pixelCoord = vTextureCoord.xy * filterArea.xy;\n vec2 coord = pixelCoord / dimensions;\n\n if (coord.y < boundary) {\n gl_FragColor = texture2D(uSampler, vTextureCoord);\n return;\n }\n\n float k = (coord.y - boundary) / (1. - boundary + 0.0001);\n float areaY = boundary * dimensions.y / filterArea.y;\n float v = areaY + areaY - vTextureCoord.y;\n float y = mirror ? v : vTextureCoord.y;\n\n float _amplitude = ((amplitude.y - amplitude.x) * k + amplitude.x ) / filterArea.x;\n float _waveLength = ((waveLength.y - waveLength.x) * k + waveLength.x) / filterArea.y;\n float _alpha = (alpha.y - alpha.x) * k + alpha.x;\n\n float x = vTextureCoord.x + cos(v * 6.28 / _waveLength - time) * _amplitude;\n x = clamp(x, filterClamp.x, filterClamp.z);\n\n vec4 color = texture2D(uSampler, vec2(x, y));\n\n gl_FragColor = color * _alpha;\n}\n",o=function(r){function n(n){r.call(this,e,t),this.uniforms.amplitude=new Float32Array(2),this.uniforms.waveLength=new Float32Array(2),this.uniforms.alpha=new Float32Array(2),this.uniforms.dimensions=new Float32Array(2),Object.assign(this,{mirror:!0,boundary:.5,amplitude:[0,20],waveLength:[30,100],alpha:[1,1],time:0},n)}r&&(n.__proto__=r),n.prototype=Object.create(r&&r.prototype),n.prototype.constructor=n;var o={mirror:{configurable:!0},boundary:{configurable:!0},amplitude:{configurable:!0},waveLength:{configurable:!0},alpha:{configurable:!0}};return n.prototype.apply=function(r,n,e,t){this.uniforms.dimensions[0]=n.filterFrame.width,this.uniforms.dimensions[1]=n.filterFrame.height,this.uniforms.time=this.time,r.applyFilter(this,n,e,t)},o.mirror.set=function(r){this.uniforms.mirror=r},o.mirror.get=function(){return this.uniforms.mirror},o.boundary.set=function(r){this.uniforms.boundary=r},o.boundary.get=function(){return this.uniforms.boundary},o.amplitude.set=function(r){this.uniforms.amplitude[0]=r[0],this.uniforms.amplitude[1]=r[1]},o.amplitude.get=function(){return this.uniforms.amplitude},o.waveLength.set=function(r){this.uniforms.waveLength[0]=r[0],this.uniforms.waveLength[1]=r[1]},o.waveLength.get=function(){return this.uniforms.waveLength},o.alpha.set=function(r){this.uniforms.alpha[0]=r[0],this.uniforms.alpha[1]=r[1]},o.alpha.get=function(){return this.uniforms.alpha},Object.defineProperties(n.prototype,o),n}(n.Filter);return r.ReflectionFilter=o,r}({},PIXI);Object.assign(PIXI.filters,__filters);
|
||||
|
@@ -1,8 +1,8 @@
|
||||
/*!
|
||||
* @pixi/filter-rgb-split - v2.5.0
|
||||
* Compiled Fri, 20 Dec 2019 18:59:17 UTC
|
||||
* @pixi/filter-rgb-split - v3.1.1
|
||||
* Compiled Wed, 08 Apr 2020 11:09:37 UTC
|
||||
*
|
||||
* @pixi/filter-rgb-split is licensed under the MIT License.
|
||||
* http://www.opensource.org/licenses/mit-license
|
||||
*/
|
||||
!function(e,r){"object"==typeof exports&&"undefined"!=typeof module?r(exports,require("pixi.js")):"function"==typeof define&&define.amd?define(["exports","pixi.js"],r):r(e.__filters={},e.PIXI)}(this,function(e,r){"use strict";var t="attribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\n\nuniform mat3 projectionMatrix;\n\nvarying vec2 vTextureCoord;\n\nvoid main(void)\n{\n gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n vTextureCoord = aTextureCoord;\n}",n="precision mediump float;\n\nvarying vec2 vTextureCoord;\n\nuniform sampler2D uSampler;\nuniform vec4 filterArea;\nuniform vec2 red;\nuniform vec2 green;\nuniform vec2 blue;\n\nvoid main(void)\n{\n gl_FragColor.r = texture2D(uSampler, vTextureCoord + red/filterArea.xy).r;\n gl_FragColor.g = texture2D(uSampler, vTextureCoord + green/filterArea.xy).g;\n gl_FragColor.b = texture2D(uSampler, vTextureCoord + blue/filterArea.xy).b;\n gl_FragColor.a = texture2D(uSampler, vTextureCoord).a;\n}\n",o=function(e){function r(r,o,i){void 0===r&&(r=[-10,0]),void 0===o&&(o=[0,10]),void 0===i&&(i=[0,0]),e.call(this,t,n),this.red=r,this.green=o,this.blue=i}e&&(r.__proto__=e),r.prototype=Object.create(e&&e.prototype),r.prototype.constructor=r;var o={red:{configurable:!0},green:{configurable:!0},blue:{configurable:!0}};return o.red.get=function(){return this.uniforms.red},o.red.set=function(e){this.uniforms.red=e},o.green.get=function(){return this.uniforms.green},o.green.set=function(e){this.uniforms.green=e},o.blue.get=function(){return this.uniforms.blue},o.blue.set=function(e){this.uniforms.blue=e},Object.defineProperties(r.prototype,o),r}(r.Filter);e.RGBSplitFilter=o,Object.defineProperty(e,"__esModule",{value:!0})}),Object.assign(PIXI.filters,this?this.__filters:__filters);
|
||||
var __filters=function(e,r){"use strict";var t="attribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\n\nuniform mat3 projectionMatrix;\n\nvarying vec2 vTextureCoord;\n\nvoid main(void)\n{\n gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n vTextureCoord = aTextureCoord;\n}",n="precision mediump float;\n\nvarying vec2 vTextureCoord;\n\nuniform sampler2D uSampler;\nuniform vec4 filterArea;\nuniform vec2 red;\nuniform vec2 green;\nuniform vec2 blue;\n\nvoid main(void)\n{\n gl_FragColor.r = texture2D(uSampler, vTextureCoord + red/filterArea.xy).r;\n gl_FragColor.g = texture2D(uSampler, vTextureCoord + green/filterArea.xy).g;\n gl_FragColor.b = texture2D(uSampler, vTextureCoord + blue/filterArea.xy).b;\n gl_FragColor.a = texture2D(uSampler, vTextureCoord).a;\n}\n",o=function(e){function r(r,o,i){void 0===r&&(r=[-10,0]),void 0===o&&(o=[0,10]),void 0===i&&(i=[0,0]),e.call(this,t,n),this.red=r,this.green=o,this.blue=i}e&&(r.__proto__=e),r.prototype=Object.create(e&&e.prototype),r.prototype.constructor=r;var o={red:{configurable:!0},green:{configurable:!0},blue:{configurable:!0}};return o.red.get=function(){return this.uniforms.red},o.red.set=function(e){this.uniforms.red=e},o.green.get=function(){return this.uniforms.green},o.green.set=function(e){this.uniforms.green=e},o.blue.get=function(){return this.uniforms.blue},o.blue.set=function(e){this.uniforms.blue=e},Object.defineProperties(r.prototype,o),r}(r.Filter);return e.RGBSplitFilter=o,e}({},PIXI);Object.assign(PIXI.filters,__filters);
|
||||
|
@@ -1,8 +1,171 @@
|
||||
/*!
|
||||
* @pixi/filter-tilt-shift - v2.6.0
|
||||
* Compiled Fri, 20 Dec 2019 19:00:04 UTC
|
||||
* @pixi/filter-tilt-shift - v3.1.1
|
||||
* Compiled Wed, 08 Apr 2020 11:09:37 UTC
|
||||
*
|
||||
* @pixi/filter-tilt-shift is licensed under the MIT License.
|
||||
* http://www.opensource.org/licenses/mit-license
|
||||
*/
|
||||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("pixi.js")):"function"==typeof define&&define.amd?define(["exports","pixi.js"],e):e(t.__filters={},t.PIXI)}(this,function(t,e){"use strict";var i="attribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\n\nuniform mat3 projectionMatrix;\n\nvarying vec2 vTextureCoord;\n\nvoid main(void)\n{\n gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n vTextureCoord = aTextureCoord;\n}",r="varying vec2 vTextureCoord;\n\nuniform sampler2D uSampler;\nuniform float blur;\nuniform float gradientBlur;\nuniform vec2 start;\nuniform vec2 end;\nuniform vec2 delta;\nuniform vec2 texSize;\n\nfloat random(vec3 scale, float seed)\n{\n return fract(sin(dot(gl_FragCoord.xyz + seed, scale)) * 43758.5453 + seed);\n}\n\nvoid main(void)\n{\n vec4 color = vec4(0.0);\n float total = 0.0;\n\n float offset = random(vec3(12.9898, 78.233, 151.7182), 0.0);\n vec2 normal = normalize(vec2(start.y - end.y, end.x - start.x));\n float radius = smoothstep(0.0, 1.0, abs(dot(vTextureCoord * texSize - start, normal)) / gradientBlur) * blur;\n\n for (float t = -30.0; t <= 30.0; t++)\n {\n float percent = (t + offset - 0.5) / 30.0;\n float weight = 1.0 - abs(percent);\n vec4 sample = texture2D(uSampler, vTextureCoord + delta / texSize * percent * radius);\n sample.rgb *= sample.a;\n color += sample * weight;\n total += weight;\n }\n\n color /= total;\n color.rgb /= color.a + 0.00001;\n\n gl_FragColor = color;\n}\n",n=function(t){function n(n,o,s,l){void 0===n&&(n=100),void 0===o&&(o=600),void 0===s&&(s=null),void 0===l&&(l=null),t.call(this,i,r),this.uniforms.blur=n,this.uniforms.gradientBlur=o,this.uniforms.start=s||new e.Point(0,window.innerHeight/2),this.uniforms.end=l||new e.Point(600,window.innerHeight/2),this.uniforms.delta=new e.Point(30,30),this.uniforms.texSize=new e.Point(window.innerWidth,window.innerHeight),this.updateDelta()}t&&(n.__proto__=t),n.prototype=Object.create(t&&t.prototype),n.prototype.constructor=n;var o={blur:{configurable:!0},gradientBlur:{configurable:!0},start:{configurable:!0},end:{configurable:!0}};return n.prototype.updateDelta=function(){this.uniforms.delta.x=0,this.uniforms.delta.y=0},o.blur.get=function(){return this.uniforms.blur},o.blur.set=function(t){this.uniforms.blur=t},o.gradientBlur.get=function(){return this.uniforms.gradientBlur},o.gradientBlur.set=function(t){this.uniforms.gradientBlur=t},o.start.get=function(){return this.uniforms.start},o.start.set=function(t){this.uniforms.start=t,this.updateDelta()},o.end.get=function(){return this.uniforms.end},o.end.set=function(t){this.uniforms.end=t,this.updateDelta()},Object.defineProperties(n.prototype,o),n}(e.Filter),o=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.updateDelta=function(){var t=this.uniforms.end.x-this.uniforms.start.x,e=this.uniforms.end.y-this.uniforms.start.y,i=Math.sqrt(t*t+e*e);this.uniforms.delta.x=t/i,this.uniforms.delta.y=e/i},e}(n),s=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.updateDelta=function(){var t=this.uniforms.end.x-this.uniforms.start.x,e=this.uniforms.end.y-this.uniforms.start.y,i=Math.sqrt(t*t+e*e);this.uniforms.delta.x=-e/i,this.uniforms.delta.y=t/i},e}(n),l=function(t){function e(e,i,r,n){void 0===e&&(e=100),void 0===i&&(i=600),void 0===r&&(r=null),void 0===n&&(n=null),t.call(this),this.tiltShiftXFilter=new o(e,i,r,n),this.tiltShiftYFilter=new s(e,i,r,n)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var i={blur:{configurable:!0},gradientBlur:{configurable:!0},start:{configurable:!0},end:{configurable:!0}};return e.prototype.apply=function(t,e,i){var r=t.getRenderTarget(!0);this.tiltShiftXFilter.apply(t,e,r),this.tiltShiftYFilter.apply(t,r,i),t.returnRenderTarget(r)},i.blur.get=function(){return this.tiltShiftXFilter.blur},i.blur.set=function(t){this.tiltShiftXFilter.blur=this.tiltShiftYFilter.blur=t},i.gradientBlur.get=function(){return this.tiltShiftXFilter.gradientBlur},i.gradientBlur.set=function(t){this.tiltShiftXFilter.gradientBlur=this.tiltShiftYFilter.gradientBlur=t},i.start.get=function(){return this.tiltShiftXFilter.start},i.start.set=function(t){this.tiltShiftXFilter.start=this.tiltShiftYFilter.start=t},i.end.get=function(){return this.tiltShiftXFilter.end},i.end.set=function(t){this.tiltShiftXFilter.end=this.tiltShiftYFilter.end=t},Object.defineProperties(e.prototype,i),e}(e.Filter);t.TiltShiftFilter=l,t.TiltShiftXFilter=o,t.TiltShiftYFilter=s,t.TiltShiftAxisFilter=n,Object.defineProperty(t,"__esModule",{value:!0})}),Object.assign(PIXI.filters,this?this.__filters:__filters);
|
||||
// This was patched to add the missing "clearMode" argument in some functions.
|
||||
var __filters = (function (t, r, i) {
|
||||
'use strict';
|
||||
var e =
|
||||
'attribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\n\nuniform mat3 projectionMatrix;\n\nvarying vec2 vTextureCoord;\n\nvoid main(void)\n{\n gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n vTextureCoord = aTextureCoord;\n}',
|
||||
n =
|
||||
'varying vec2 vTextureCoord;\n\nuniform sampler2D uSampler;\nuniform float blur;\nuniform float gradientBlur;\nuniform vec2 start;\nuniform vec2 end;\nuniform vec2 delta;\nuniform vec2 texSize;\n\nfloat random(vec3 scale, float seed)\n{\n return fract(sin(dot(gl_FragCoord.xyz + seed, scale)) * 43758.5453 + seed);\n}\n\nvoid main(void)\n{\n vec4 color = vec4(0.0);\n float total = 0.0;\n\n float offset = random(vec3(12.9898, 78.233, 151.7182), 0.0);\n vec2 normal = normalize(vec2(start.y - end.y, end.x - start.x));\n float radius = smoothstep(0.0, 1.0, abs(dot(vTextureCoord * texSize - start, normal)) / gradientBlur) * blur;\n\n for (float t = -30.0; t <= 30.0; t++)\n {\n float percent = (t + offset - 0.5) / 30.0;\n float weight = 1.0 - abs(percent);\n vec4 sample = texture2D(uSampler, vTextureCoord + delta / texSize * percent * radius);\n sample.rgb *= sample.a;\n color += sample * weight;\n total += weight;\n }\n\n color /= total;\n color.rgb /= color.a + 0.00001;\n\n gl_FragColor = color;\n}\n',
|
||||
o = (function (t) {
|
||||
function r(r, o, l, u) {
|
||||
void 0 === r && (r = 100),
|
||||
void 0 === o && (o = 600),
|
||||
void 0 === l && (l = null),
|
||||
void 0 === u && (u = null),
|
||||
t.call(this, e, n),
|
||||
(this.uniforms.blur = r),
|
||||
(this.uniforms.gradientBlur = o),
|
||||
(this.uniforms.start = l || new i.Point(0, window.innerHeight / 2)),
|
||||
(this.uniforms.end = u || new i.Point(600, window.innerHeight / 2)),
|
||||
(this.uniforms.delta = new i.Point(30, 30)),
|
||||
(this.uniforms.texSize = new i.Point(
|
||||
window.innerWidth,
|
||||
window.innerHeight
|
||||
)),
|
||||
this.updateDelta();
|
||||
}
|
||||
t && (r.__proto__ = t),
|
||||
(r.prototype = Object.create(t && t.prototype)),
|
||||
(r.prototype.constructor = r);
|
||||
var o = {
|
||||
blur: { configurable: !0 },
|
||||
gradientBlur: { configurable: !0 },
|
||||
start: { configurable: !0 },
|
||||
end: { configurable: !0 },
|
||||
};
|
||||
return (
|
||||
(r.prototype.updateDelta = function () {
|
||||
(this.uniforms.delta.x = 0), (this.uniforms.delta.y = 0);
|
||||
}),
|
||||
(o.blur.get = function () {
|
||||
return this.uniforms.blur;
|
||||
}),
|
||||
(o.blur.set = function (t) {
|
||||
this.uniforms.blur = t;
|
||||
}),
|
||||
(o.gradientBlur.get = function () {
|
||||
return this.uniforms.gradientBlur;
|
||||
}),
|
||||
(o.gradientBlur.set = function (t) {
|
||||
this.uniforms.gradientBlur = t;
|
||||
}),
|
||||
(o.start.get = function () {
|
||||
return this.uniforms.start;
|
||||
}),
|
||||
(o.start.set = function (t) {
|
||||
(this.uniforms.start = t), this.updateDelta();
|
||||
}),
|
||||
(o.end.get = function () {
|
||||
return this.uniforms.end;
|
||||
}),
|
||||
(o.end.set = function (t) {
|
||||
(this.uniforms.end = t), this.updateDelta();
|
||||
}),
|
||||
Object.defineProperties(r.prototype, o),
|
||||
r
|
||||
);
|
||||
})(r.Filter),
|
||||
l = (function (t) {
|
||||
function r() {
|
||||
t.apply(this, arguments);
|
||||
}
|
||||
return (
|
||||
t && (r.__proto__ = t),
|
||||
(r.prototype = Object.create(t && t.prototype)),
|
||||
(r.prototype.constructor = r),
|
||||
(r.prototype.updateDelta = function () {
|
||||
var t = this.uniforms.end.x - this.uniforms.start.x,
|
||||
r = this.uniforms.end.y - this.uniforms.start.y,
|
||||
i = Math.sqrt(t * t + r * r);
|
||||
(this.uniforms.delta.x = t / i), (this.uniforms.delta.y = r / i);
|
||||
}),
|
||||
r
|
||||
);
|
||||
})(o),
|
||||
u = (function (t) {
|
||||
function r() {
|
||||
t.apply(this, arguments);
|
||||
}
|
||||
return (
|
||||
t && (r.__proto__ = t),
|
||||
(r.prototype = Object.create(t && t.prototype)),
|
||||
(r.prototype.constructor = r),
|
||||
(r.prototype.updateDelta = function () {
|
||||
var t = this.uniforms.end.x - this.uniforms.start.x,
|
||||
r = this.uniforms.end.y - this.uniforms.start.y,
|
||||
i = Math.sqrt(t * t + r * r);
|
||||
(this.uniforms.delta.x = -r / i), (this.uniforms.delta.y = t / i);
|
||||
}),
|
||||
r
|
||||
);
|
||||
})(o),
|
||||
s = (function (t) {
|
||||
function r(r, i, e, n) {
|
||||
void 0 === r && (r = 100),
|
||||
void 0 === i && (i = 600),
|
||||
void 0 === e && (e = null),
|
||||
void 0 === n && (n = null),
|
||||
t.call(this),
|
||||
(this.tiltShiftXFilter = new l(r, i, e, n)),
|
||||
(this.tiltShiftYFilter = new u(r, i, e, n));
|
||||
}
|
||||
t && (r.__proto__ = t),
|
||||
(r.prototype = Object.create(t && t.prototype)),
|
||||
(r.prototype.constructor = r);
|
||||
var i = {
|
||||
blur: { configurable: !0 },
|
||||
gradientBlur: { configurable: !0 },
|
||||
start: { configurable: !0 },
|
||||
end: { configurable: !0 },
|
||||
};
|
||||
return (
|
||||
(r.prototype.apply = function (t, r, i, clearMode) {
|
||||
var e = t.getFilterTexture();
|
||||
// Patch missing clearMode.
|
||||
this.tiltShiftXFilter.apply(t, r, e, clearMode),
|
||||
this.tiltShiftYFilter.apply(t, e, i, clearMode),
|
||||
t.returnFilterTexture(e);
|
||||
}),
|
||||
(i.blur.get = function () {
|
||||
return this.tiltShiftXFilter.blur;
|
||||
}),
|
||||
(i.blur.set = function (t) {
|
||||
this.tiltShiftXFilter.blur = this.tiltShiftYFilter.blur = t;
|
||||
}),
|
||||
(i.gradientBlur.get = function () {
|
||||
return this.tiltShiftXFilter.gradientBlur;
|
||||
}),
|
||||
(i.gradientBlur.set = function (t) {
|
||||
this.tiltShiftXFilter.gradientBlur = this.tiltShiftYFilter.gradientBlur = t;
|
||||
}),
|
||||
(i.start.get = function () {
|
||||
return this.tiltShiftXFilter.start;
|
||||
}),
|
||||
(i.start.set = function (t) {
|
||||
this.tiltShiftXFilter.start = this.tiltShiftYFilter.start = t;
|
||||
}),
|
||||
(i.end.get = function () {
|
||||
return this.tiltShiftXFilter.end;
|
||||
}),
|
||||
(i.end.set = function (t) {
|
||||
this.tiltShiftXFilter.end = this.tiltShiftYFilter.end = t;
|
||||
}),
|
||||
Object.defineProperties(r.prototype, i),
|
||||
r
|
||||
);
|
||||
})(r.Filter);
|
||||
return (
|
||||
(t.TiltShiftAxisFilter = o),
|
||||
(t.TiltShiftFilter = s),
|
||||
(t.TiltShiftXFilter = l),
|
||||
(t.TiltShiftYFilter = u),
|
||||
t
|
||||
);
|
||||
})({}, PIXI, PIXI);
|
||||
Object.assign(PIXI.filters, __filters);
|
||||
|
@@ -1,8 +1,8 @@
|
||||
/*!
|
||||
* @pixi/filter-twist - v2.7.0
|
||||
* Compiled Sun, 13 Jan 2019 22:51:52 UTC
|
||||
* @pixi/filter-twist - v3.1.1
|
||||
* Compiled Wed, 08 Apr 2020 11:09:37 UTC
|
||||
*
|
||||
* @pixi/filter-twist is licensed under the MIT License.
|
||||
* http://www.opensource.org/licenses/mit-license
|
||||
*/
|
||||
!function(o,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports,require("pixi.js")):"function"==typeof define&&define.amd?define(["exports","pixi.js"],n):n((o=o||self).__filters={},o.PIXI)}(this,function(o,n){"use strict";var r="attribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\n\nuniform mat3 projectionMatrix;\n\nvarying vec2 vTextureCoord;\n\nvoid main(void)\n{\n gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n vTextureCoord = aTextureCoord;\n}",e="varying vec2 vTextureCoord;\n\nuniform sampler2D uSampler;\nuniform float radius;\nuniform float angle;\nuniform vec2 offset;\nuniform vec4 filterArea;\n\nvec2 mapCoord( vec2 coord )\n{\n coord *= filterArea.xy;\n coord += filterArea.zw;\n\n return coord;\n}\n\nvec2 unmapCoord( vec2 coord )\n{\n coord -= filterArea.zw;\n coord /= filterArea.xy;\n\n return coord;\n}\n\nvec2 twist(vec2 coord)\n{\n coord -= offset;\n\n float dist = length(coord);\n\n if (dist < radius)\n {\n float ratioDist = (radius - dist) / radius;\n float angleMod = ratioDist * ratioDist * angle;\n float s = sin(angleMod);\n float c = cos(angleMod);\n coord = vec2(coord.x * c - coord.y * s, coord.x * s + coord.y * c);\n }\n\n coord += offset;\n\n return coord;\n}\n\nvoid main(void)\n{\n\n vec2 coord = mapCoord(vTextureCoord);\n\n coord = twist(coord);\n\n coord = unmapCoord(coord);\n\n gl_FragColor = texture2D(uSampler, coord );\n\n}\n",t=function(o){function n(n,t,i){void 0===n&&(n=200),void 0===t&&(t=4),void 0===i&&(i=20),o.call(this,r,e),this.radius=n,this.angle=t,this.padding=i}o&&(n.__proto__=o),n.prototype=Object.create(o&&o.prototype),n.prototype.constructor=n;var t={offset:{configurable:!0},radius:{configurable:!0},angle:{configurable:!0}};return t.offset.get=function(){return this.uniforms.offset},t.offset.set=function(o){this.uniforms.offset=o},t.radius.get=function(){return this.uniforms.radius},t.radius.set=function(o){this.uniforms.radius=o},t.angle.get=function(){return this.uniforms.angle},t.angle.set=function(o){this.uniforms.angle=o},Object.defineProperties(n.prototype,t),n}(n.Filter);o.TwistFilter=t,Object.defineProperty(o,"__esModule",{value:!0})}),Object.assign(PIXI.filters,this?this.__filters:__filters);
|
||||
var __filters=function(o,n){"use strict";var r="attribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\n\nuniform mat3 projectionMatrix;\n\nvarying vec2 vTextureCoord;\n\nvoid main(void)\n{\n gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n vTextureCoord = aTextureCoord;\n}",t="varying vec2 vTextureCoord;\n\nuniform sampler2D uSampler;\nuniform float radius;\nuniform float angle;\nuniform vec2 offset;\nuniform vec4 filterArea;\n\nvec2 mapCoord( vec2 coord )\n{\n coord *= filterArea.xy;\n coord += filterArea.zw;\n\n return coord;\n}\n\nvec2 unmapCoord( vec2 coord )\n{\n coord -= filterArea.zw;\n coord /= filterArea.xy;\n\n return coord;\n}\n\nvec2 twist(vec2 coord)\n{\n coord -= offset;\n\n float dist = length(coord);\n\n if (dist < radius)\n {\n float ratioDist = (radius - dist) / radius;\n float angleMod = ratioDist * ratioDist * angle;\n float s = sin(angleMod);\n float c = cos(angleMod);\n coord = vec2(coord.x * c - coord.y * s, coord.x * s + coord.y * c);\n }\n\n coord += offset;\n\n return coord;\n}\n\nvoid main(void)\n{\n\n vec2 coord = mapCoord(vTextureCoord);\n\n coord = twist(coord);\n\n coord = unmapCoord(coord);\n\n gl_FragColor = texture2D(uSampler, coord );\n\n}\n",e=function(o){function n(n,e,i){void 0===n&&(n=200),void 0===e&&(e=4),void 0===i&&(i=20),o.call(this,r,t),this.radius=n,this.angle=e,this.padding=i}o&&(n.__proto__=o),n.prototype=Object.create(o&&o.prototype),n.prototype.constructor=n;var e={offset:{configurable:!0},radius:{configurable:!0},angle:{configurable:!0}};return e.offset.get=function(){return this.uniforms.offset},e.offset.set=function(o){this.uniforms.offset=o},e.radius.get=function(){return this.uniforms.radius},e.radius.set=function(o){this.uniforms.radius=o},e.angle.get=function(){return this.uniforms.angle},e.angle.set=function(o){this.uniforms.angle=o},Object.defineProperties(n.prototype,e),n}(n.Filter);return o.TwistFilter=e,o}({},PIXI);Object.assign(PIXI.filters,__filters);
|
||||
|
@@ -1,8 +1,8 @@
|
||||
/*!
|
||||
* @pixi/filter-zoom-blur - v2.6.0
|
||||
* Compiled Fri, 20 Dec 2019 18:59:17 UTC
|
||||
* @pixi/filter-zoom-blur - v3.1.1
|
||||
* Compiled Wed, 08 Apr 2020 11:09:37 UTC
|
||||
*
|
||||
* @pixi/filter-zoom-blur is licensed under the MIT License.
|
||||
* http://www.opensource.org/licenses/mit-license
|
||||
*/
|
||||
!function(n,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("pixi.js")):"function"==typeof define&&define.amd?define(["exports","pixi.js"],e):e(n.__filters={},n.PIXI)}(this,function(n,e){"use strict";var t="attribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\n\nuniform mat3 projectionMatrix;\n\nvarying vec2 vTextureCoord;\n\nvoid main(void)\n{\n gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n vTextureCoord = aTextureCoord;\n}",r="varying vec2 vTextureCoord;\nuniform sampler2D uSampler;\nuniform vec4 filterArea;\n\nuniform vec2 uCenter;\nuniform float uStrength;\nuniform float uInnerRadius;\nuniform float uRadius;\n\nconst float MAX_KERNEL_SIZE = 32.0;\n\nfloat random(vec3 scale, float seed) {\n // use the fragment position for a different seed per-pixel\n return fract(sin(dot(gl_FragCoord.xyz + seed, scale)) * 43758.5453 + seed);\n}\n\nvoid main() {\n\n float minGradient = uInnerRadius * 0.3;\n float innerRadius = (uInnerRadius + minGradient * 0.5) / filterArea.x;\n\n float gradient = uRadius * 0.3;\n float radius = (uRadius - gradient * 0.5) / filterArea.x;\n\n float countLimit = MAX_KERNEL_SIZE;\n\n vec2 dir = vec2(uCenter.xy / filterArea.xy - vTextureCoord);\n float dist = length(vec2(dir.x, dir.y * filterArea.y / filterArea.x));\n\n float strength = uStrength;\n\n float delta = 0.0;\n float gap;\n if (dist < innerRadius) {\n delta = innerRadius - dist;\n gap = minGradient;\n } else if (radius >= 0.0 && dist > radius) { // radius < 0 means it's infinity\n delta = dist - radius;\n gap = gradient;\n }\n\n if (delta > 0.0) {\n float normalCount = gap / filterArea.x;\n delta = (normalCount - delta) / normalCount;\n countLimit *= delta;\n strength *= delta;\n if (countLimit < 1.0)\n {\n gl_FragColor = texture2D(uSampler, vTextureCoord);\n return;\n }\n }\n\n // randomize the lookup values to hide the fixed number of samples\n float offset = random(vec3(12.9898, 78.233, 151.7182), 0.0);\n\n float total = 0.0;\n vec4 color = vec4(0.0);\n\n dir *= strength;\n\n for (float t = 0.0; t < MAX_KERNEL_SIZE; t++) {\n float percent = (t + offset) / MAX_KERNEL_SIZE;\n float weight = 4.0 * (percent - percent * percent);\n vec2 p = vTextureCoord + dir * percent;\n vec4 sample = texture2D(uSampler, p);\n\n // switch to pre-multiplied alpha to correctly blur transparent images\n // sample.rgb *= sample.a;\n\n color += sample * weight;\n total += weight;\n\n if (t > countLimit){\n break;\n }\n }\n\n color /= total;\n // switch back from pre-multiplied alpha\n color.rgb /= color.a + 0.00001;\n\n gl_FragColor = color;\n}\n",i=function(n){function e(e,i,o,a){void 0===e&&(e=.1),void 0===i&&(i=[0,0]),void 0===o&&(o=0),void 0===a&&(a=-1),n.call(this,t,r),this.center=i,this.strength=e,this.innerRadius=o,this.radius=a}n&&(e.__proto__=n),e.prototype=Object.create(n&&n.prototype),e.prototype.constructor=e;var i={center:{configurable:!0},strength:{configurable:!0},innerRadius:{configurable:!0},radius:{configurable:!0}};return i.center.get=function(){return this.uniforms.uCenter},i.center.set=function(n){this.uniforms.uCenter=n},i.strength.get=function(){return this.uniforms.uStrength},i.strength.set=function(n){this.uniforms.uStrength=n},i.innerRadius.get=function(){return this.uniforms.uInnerRadius},i.innerRadius.set=function(n){this.uniforms.uInnerRadius=n},i.radius.get=function(){return this.uniforms.uRadius},i.radius.set=function(n){(n<0||n===1/0)&&(n=-1),this.uniforms.uRadius=n},Object.defineProperties(e.prototype,i),e}(e.Filter);n.ZoomBlurFilter=i,Object.defineProperty(n,"__esModule",{value:!0})}),Object.assign(PIXI.filters,this?this.__filters:__filters);
|
||||
var __filters=function(n,t){"use strict";var e="attribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\n\nuniform mat3 projectionMatrix;\n\nvarying vec2 vTextureCoord;\n\nvoid main(void)\n{\n gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n vTextureCoord = aTextureCoord;\n}",r="varying vec2 vTextureCoord;\nuniform sampler2D uSampler;\nuniform vec4 filterArea;\n\nuniform vec2 uCenter;\nuniform float uStrength;\nuniform float uInnerRadius;\nuniform float uRadius;\n\nconst float MAX_KERNEL_SIZE = 32.0;\n\n// author: http://byteblacksmith.com/improvements-to-the-canonical-one-liner-glsl-rand-for-opengl-es-2-0/\nhighp float rand(vec2 co, float seed) {\n const highp float a = 12.9898, b = 78.233, c = 43758.5453;\n highp float dt = dot(co + seed, vec2(a, b)), sn = mod(dt, 3.14159);\n return fract(sin(sn) * c + seed);\n}\n\nvoid main() {\n\n float minGradient = uInnerRadius * 0.3;\n float innerRadius = (uInnerRadius + minGradient * 0.5) / filterArea.x;\n\n float gradient = uRadius * 0.3;\n float radius = (uRadius - gradient * 0.5) / filterArea.x;\n\n float countLimit = MAX_KERNEL_SIZE;\n\n vec2 dir = vec2(uCenter.xy / filterArea.xy - vTextureCoord);\n float dist = length(vec2(dir.x, dir.y * filterArea.y / filterArea.x));\n\n float strength = uStrength;\n\n float delta = 0.0;\n float gap;\n if (dist < innerRadius) {\n delta = innerRadius - dist;\n gap = minGradient;\n } else if (radius >= 0.0 && dist > radius) { // radius < 0 means it's infinity\n delta = dist - radius;\n gap = gradient;\n }\n\n if (delta > 0.0) {\n float normalCount = gap / filterArea.x;\n delta = (normalCount - delta) / normalCount;\n countLimit *= delta;\n strength *= delta;\n if (countLimit < 1.0)\n {\n gl_FragColor = texture2D(uSampler, vTextureCoord);\n return;\n }\n }\n\n // randomize the lookup values to hide the fixed number of samples\n float offset = rand(vTextureCoord, 0.0);\n\n float total = 0.0;\n vec4 color = vec4(0.0);\n\n dir *= strength;\n\n for (float t = 0.0; t < MAX_KERNEL_SIZE; t++) {\n float percent = (t + offset) / MAX_KERNEL_SIZE;\n float weight = 4.0 * (percent - percent * percent);\n vec2 p = vTextureCoord + dir * percent;\n vec4 sample = texture2D(uSampler, p);\n\n // switch to pre-multiplied alpha to correctly blur transparent images\n // sample.rgb *= sample.a;\n\n color += sample * weight;\n total += weight;\n\n if (t > countLimit){\n break;\n }\n }\n\n color /= total;\n // switch back from pre-multiplied alpha\n // color.rgb /= color.a + 0.00001;\n\n gl_FragColor = color;\n}\n",i=function(n){function t(t){if(n.call(this,e,r),"object"!=typeof t){var i=arguments[0],o=arguments[1],a=arguments[2],u=arguments[3];t={},void 0!==i&&(t.strength=i),void 0!==o&&(t.center=o),void 0!==a&&(t.innerRadius=a),void 0!==u&&(t.radius=u)}Object.assign(this,{strength:.1,center:[0,0],innerRadius:0,radius:-1},t)}n&&(t.__proto__=n),t.prototype=Object.create(n&&n.prototype),t.prototype.constructor=t;var i={center:{configurable:!0},strength:{configurable:!0},innerRadius:{configurable:!0},radius:{configurable:!0}};return i.center.get=function(){return this.uniforms.uCenter},i.center.set=function(n){this.uniforms.uCenter=n},i.strength.get=function(){return this.uniforms.uStrength},i.strength.set=function(n){this.uniforms.uStrength=n},i.innerRadius.get=function(){return this.uniforms.uInnerRadius},i.innerRadius.set=function(n){this.uniforms.uInnerRadius=n},i.radius.get=function(){return this.uniforms.uRadius},i.radius.set=function(n){(n<0||n===1/0)&&(n=-1),this.uniforms.uRadius=n},Object.defineProperties(t.prototype,i),t}(t.Filter);return n.ZoomBlurFilter=i,n}({},PIXI);Object.assign(PIXI.filters,__filters);
|
||||
|
@@ -1,12 +1,13 @@
|
||||
gdjs.PixiFiltersTools.registerFilterCreator('Twist', {
|
||||
makePIXIFilter: function(layer, effectData) {
|
||||
var twistFilter = new PIXI.filters.TwistFilter();
|
||||
twistFilter.offset = new PIXI.Point(0, 0);
|
||||
|
||||
return twistFilter;
|
||||
},
|
||||
update: function(filter, layer) {
|
||||
filter.offset[0] = Math.round(filter._offsetX * layer.getWidth());
|
||||
filter.offset[1] = Math.round(filter._offsetY * layer.getHeight());
|
||||
filter.offset.x = Math.round(filter._offsetX * layer.getWidth());
|
||||
filter.offset.y = Math.round(filter._offsetY * layer.getHeight());
|
||||
},
|
||||
updateDoubleParameter: function(filter, parameterName, value) {
|
||||
if (parameterName === 'radius') {
|
||||
|
@@ -1,8 +1,9 @@
|
||||
// @flow
|
||||
/**
|
||||
* This is a declaration of an extension for GDevelop 5.
|
||||
*
|
||||
* ℹ️ Run `node import-GDJS-Runtime.js` (in newIDE/app/scripts) if you make any change
|
||||
* to this extension file or to any other *.js file that you reference inside.
|
||||
* ℹ️ Changes in this file are watched and automatically imported if the editor
|
||||
* is running. You can also manually run `node import-GDJS-Runtime.js` (in newIDE/app/scripts).
|
||||
*
|
||||
* The file must be named "JsExtension.js", otherwise GDevelop won't load it.
|
||||
* ⚠️ If you make a change and the extension is not loaded, open the developer console
|
||||
@@ -10,8 +11,19 @@
|
||||
*
|
||||
* More information on https://github.com/4ian/GDevelop/blob/master/newIDE/README-extensions.md
|
||||
*/
|
||||
|
||||
/*::
|
||||
// Import types to allow Flow to do static type checking on this file.
|
||||
// Extensions declaration are typed using Flow (like the editor), but the files
|
||||
// for the game engine are checked with TypeScript annotations.
|
||||
import { type ObjectsRenderingService, type ObjectsEditorService } from '../JsExtensionTypes.flow.js'
|
||||
*/
|
||||
|
||||
module.exports = {
|
||||
createExtension: function(_, gd) {
|
||||
createExtension: function (
|
||||
_ /*: (string) => string */,
|
||||
gd /*: libGDevelop */
|
||||
) {
|
||||
const extension = new gd.PlatformExtension();
|
||||
extension.setExtensionInformation(
|
||||
'MyDummyExtension',
|
||||
@@ -22,7 +34,7 @@ module.exports = {
|
||||
);
|
||||
|
||||
// Declare effects:
|
||||
const dumyEffect = extension
|
||||
const dummyEffect = extension
|
||||
.addEffect('DummyEffect')
|
||||
.setFullName(_('Dummy effect example'))
|
||||
.setDescription(
|
||||
@@ -31,37 +43,33 @@ module.exports = {
|
||||
)
|
||||
)
|
||||
.addIncludeFile('Extensions/ExampleJsExtension/dummyeffect.js');
|
||||
const dumyEffectProperties = dumyEffect.getProperties();
|
||||
dumyEffectProperties.set(
|
||||
'opacity',
|
||||
new gd.PropertyDescriptor(/* defaultValue= */ '1')
|
||||
.setLabel(_('Opacity of the effect (between 0 and 1)'))
|
||||
.setType('number')
|
||||
.setDescription(_('This is an optional description.'))
|
||||
);
|
||||
dumyEffectProperties.set(
|
||||
'someImage',
|
||||
new gd.PropertyDescriptor(/* defaultValue= */ '')
|
||||
.setLabel(
|
||||
_("Image resource (won't be used, just for demonstration purpose)")
|
||||
)
|
||||
.setType('resource')
|
||||
.addExtraInfo('image')
|
||||
);
|
||||
dumyEffectProperties.set(
|
||||
'someColor',
|
||||
new gd.PropertyDescriptor(/* defaultValue= */ '#0022FF')
|
||||
.setLabel(_("Color (won't be used, just for demonstration purpose)"))
|
||||
.setType('color')
|
||||
.setDescription(_('Another optional description.'))
|
||||
);
|
||||
dumyEffectProperties.set(
|
||||
'someBoolean',
|
||||
new gd.PropertyDescriptor(/* defaultValue= */ 'true')
|
||||
.setLabel(_('Some setting to enable or not for the effect'))
|
||||
.setType('boolean')
|
||||
.setDescription(_('And some *optional* description.'))
|
||||
);
|
||||
const dummyEffectProperties = dummyEffect.getProperties();
|
||||
dummyEffectProperties
|
||||
.getOrCreate('opacity')
|
||||
.setValue('1')
|
||||
.setLabel(_('Opacity of the effect (between 0 and 1)'))
|
||||
.setType('number')
|
||||
.setDescription(_('This is an optional description.'));
|
||||
dummyEffectProperties
|
||||
.getOrCreate('someImage')
|
||||
.setValue('')
|
||||
.setLabel(
|
||||
_("Image resource (won't be used, just for demonstration purpose)")
|
||||
)
|
||||
.setType('resource')
|
||||
.addExtraInfo('image');
|
||||
dummyEffectProperties
|
||||
.getOrCreate('someColor')
|
||||
.setValue('#0022FF')
|
||||
.setLabel(_("Color (won't be used, just for demonstration purpose)"))
|
||||
.setType('color')
|
||||
.setDescription(_('Another optional description.'));
|
||||
dummyEffectProperties
|
||||
.getOrCreate('someBoolean')
|
||||
.setValue('true')
|
||||
.setLabel(_('Some setting to enable or not for the effect'))
|
||||
.setType('boolean')
|
||||
.setDescription(_('And some *optional* description.'));
|
||||
|
||||
// Declare conditions, actions or expressions:
|
||||
extension
|
||||
@@ -116,7 +124,8 @@ module.exports = {
|
||||
// Everything that is stored inside the behavior is in "behaviorContent" and is automatically
|
||||
// saved/loaded to JSON.
|
||||
var dummyBehavior = new gd.BehaviorJsImplementation();
|
||||
dummyBehavior.updateProperty = function(
|
||||
// $FlowExpectedError - ignore Flow warning as we're creating a behavior
|
||||
dummyBehavior.updateProperty = function (
|
||||
behaviorContent,
|
||||
propertyName,
|
||||
newValue
|
||||
@@ -132,25 +141,24 @@ module.exports = {
|
||||
|
||||
return false;
|
||||
};
|
||||
dummyBehavior.getProperties = function(behaviorContent) {
|
||||
// $FlowExpectedError - ignore Flow warning as we're creating a behavior
|
||||
dummyBehavior.getProperties = function (behaviorContent) {
|
||||
var behaviorProperties = new gd.MapStringPropertyDescriptor();
|
||||
|
||||
behaviorProperties.set(
|
||||
'My first property',
|
||||
new gd.PropertyDescriptor(
|
||||
behaviorContent.getStringAttribute('property1')
|
||||
)
|
||||
);
|
||||
behaviorProperties.set(
|
||||
'My other property',
|
||||
new gd.PropertyDescriptor(
|
||||
behaviorProperties
|
||||
.getOrCreate('My first property')
|
||||
.setValue(behaviorContent.getStringAttribute('property1'));
|
||||
behaviorProperties
|
||||
.getOrCreate('My other property')
|
||||
.setValue(
|
||||
behaviorContent.getBoolAttribute('property2') ? 'true' : 'false'
|
||||
).setType('Boolean')
|
||||
);
|
||||
)
|
||||
.setType('Boolean');
|
||||
|
||||
return behaviorProperties;
|
||||
};
|
||||
dummyBehavior.initializeContent = function(behaviorContent) {
|
||||
// $FlowExpectedError - ignore Flow warning as we're creating a behavior
|
||||
dummyBehavior.initializeContent = function (behaviorContent) {
|
||||
behaviorContent.setStringAttribute('property1', 'Initial value 1');
|
||||
behaviorContent.setBoolAttribute('property2', true);
|
||||
};
|
||||
@@ -177,7 +185,8 @@ module.exports = {
|
||||
// Create a new gd.BehaviorSharedDataJsImplementation object and implement the methods
|
||||
// that are called to get and set the properties of the shared data.
|
||||
var dummyBehaviorWithSharedData = new gd.BehaviorJsImplementation();
|
||||
dummyBehaviorWithSharedData.updateProperty = function(
|
||||
// $FlowExpectedError - ignore Flow warning as we're creating a behavior
|
||||
dummyBehaviorWithSharedData.updateProperty = function (
|
||||
behaviorContent,
|
||||
propertyName,
|
||||
newValue
|
||||
@@ -189,24 +198,24 @@ module.exports = {
|
||||
|
||||
return false;
|
||||
};
|
||||
dummyBehaviorWithSharedData.getProperties = function(behaviorContent) {
|
||||
// $FlowExpectedError - ignore Flow warning as we're creating a behavior
|
||||
dummyBehaviorWithSharedData.getProperties = function (behaviorContent) {
|
||||
var behaviorProperties = new gd.MapStringPropertyDescriptor();
|
||||
|
||||
behaviorProperties.set(
|
||||
'My behavior property',
|
||||
new gd.PropertyDescriptor(
|
||||
behaviorContent.getStringAttribute('property1')
|
||||
)
|
||||
);
|
||||
behaviorProperties
|
||||
.getOrCreate('My behavior property')
|
||||
.setValue(behaviorContent.getStringAttribute('property1'));
|
||||
|
||||
return behaviorProperties;
|
||||
};
|
||||
dummyBehaviorWithSharedData.initializeContent = function(behaviorContent) {
|
||||
// $FlowExpectedError - ignore Flow warning as we're creating a behavior
|
||||
dummyBehaviorWithSharedData.initializeContent = function (behaviorContent) {
|
||||
behaviorContent.setStringAttribute('property1', 'Initial value 1');
|
||||
};
|
||||
|
||||
var sharedData = new gd.BehaviorSharedDataJsImplementation();
|
||||
sharedData.updateProperty = function(
|
||||
// $FlowExpectedError - ignore Flow warning as we're creating a behavior
|
||||
sharedData.updateProperty = function (
|
||||
sharedContent,
|
||||
propertyName,
|
||||
newValue
|
||||
@@ -218,19 +227,18 @@ module.exports = {
|
||||
|
||||
return false;
|
||||
};
|
||||
sharedData.getProperties = function(sharedContent) {
|
||||
// $FlowExpectedError - ignore Flow warning as we're creating a behavior
|
||||
sharedData.getProperties = function (sharedContent) {
|
||||
var sharedProperties = new gd.MapStringPropertyDescriptor();
|
||||
|
||||
sharedProperties.set(
|
||||
'My shared property',
|
||||
new gd.PropertyDescriptor(
|
||||
sharedContent.getStringAttribute('sharedProperty1')
|
||||
)
|
||||
);
|
||||
sharedProperties
|
||||
.getOrCreate('My shared property')
|
||||
.setValue(sharedContent.getStringAttribute('sharedProperty1'));
|
||||
|
||||
return sharedProperties;
|
||||
};
|
||||
sharedData.initializeContent = function(behaviorContent) {
|
||||
// $FlowExpectedError - ignore Flow warning as we're creating a behavior
|
||||
sharedData.initializeContent = function (behaviorContent) {
|
||||
behaviorContent.setStringAttribute(
|
||||
'sharedProperty1',
|
||||
'Initial shared value 1'
|
||||
@@ -264,7 +272,8 @@ module.exports = {
|
||||
// Everything that is stored inside the object is in "content" and is automatically
|
||||
// saved/loaded to JSON.
|
||||
var dummyObject = new gd.ObjectJsImplementation();
|
||||
dummyObject.updateProperty = function(
|
||||
// $FlowExpectedError - ignore Flow warning as we're creating an object
|
||||
dummyObject.updateProperty = function (
|
||||
objectContent,
|
||||
propertyName,
|
||||
newValue
|
||||
@@ -288,34 +297,29 @@ module.exports = {
|
||||
|
||||
return false;
|
||||
};
|
||||
dummyObject.getProperties = function(objectContent) {
|
||||
// $FlowExpectedError - ignore Flow warning as we're creating an object
|
||||
dummyObject.getProperties = function (objectContent) {
|
||||
var objectProperties = new gd.MapStringPropertyDescriptor();
|
||||
|
||||
objectProperties.set(
|
||||
'My first property',
|
||||
new gd.PropertyDescriptor(objectContent.property1)
|
||||
);
|
||||
objectProperties.set(
|
||||
'My other property',
|
||||
new gd.PropertyDescriptor(
|
||||
objectContent.property2 ? 'true' : 'false'
|
||||
).setType('boolean')
|
||||
);
|
||||
objectProperties.set(
|
||||
'My third property',
|
||||
new gd.PropertyDescriptor(objectContent.property3.toString()).setType(
|
||||
'number'
|
||||
)
|
||||
);
|
||||
objectProperties.set(
|
||||
'myImage',
|
||||
new gd.PropertyDescriptor(objectContent.myImage)
|
||||
.setType('resource')
|
||||
.addExtraInfo('image')
|
||||
.setLabel(
|
||||
_("Image resource (won't be shown, just for demonstration purpose)")
|
||||
)
|
||||
);
|
||||
objectProperties
|
||||
.getOrCreate('My first property')
|
||||
.setValue(objectContent.property1);
|
||||
objectProperties
|
||||
.getOrCreate('My other property')
|
||||
.setValue(objectContent.property2 ? 'true' : 'false')
|
||||
.setType('boolean');
|
||||
objectProperties
|
||||
.getOrCreate('My third property')
|
||||
.setValue(objectContent.property3.toString())
|
||||
.setType('number');
|
||||
objectProperties
|
||||
.getOrCreate('myImage')
|
||||
.setValue(objectContent.myImage)
|
||||
.setType('resource')
|
||||
.addExtraInfo('image')
|
||||
.setLabel(
|
||||
_("Image resource (won't be shown, just for demonstration purpose)")
|
||||
);
|
||||
|
||||
return objectProperties;
|
||||
};
|
||||
@@ -328,7 +332,8 @@ module.exports = {
|
||||
})
|
||||
);
|
||||
|
||||
dummyObject.updateInitialInstanceProperty = function(
|
||||
// $FlowExpectedError - ignore Flow warning as we're creating an object
|
||||
dummyObject.updateInitialInstanceProperty = function (
|
||||
objectContent,
|
||||
instance,
|
||||
propertyName,
|
||||
@@ -347,7 +352,8 @@ module.exports = {
|
||||
|
||||
return false;
|
||||
};
|
||||
dummyObject.getInitialInstanceProperties = function(
|
||||
// $FlowExpectedError - ignore Flow warning as we're creating an object
|
||||
dummyObject.getInitialInstanceProperties = function (
|
||||
content,
|
||||
instance,
|
||||
project,
|
||||
@@ -355,18 +361,13 @@ module.exports = {
|
||||
) {
|
||||
var instanceProperties = new gd.MapStringPropertyDescriptor();
|
||||
|
||||
instanceProperties.set(
|
||||
'My instance property',
|
||||
new gd.PropertyDescriptor(
|
||||
instance.getRawStringProperty('instanceprop1')
|
||||
)
|
||||
);
|
||||
instanceProperties.set(
|
||||
'My other instance property',
|
||||
new gd.PropertyDescriptor(
|
||||
instance.getRawFloatProperty('instanceprop2').toString()
|
||||
).setType('number')
|
||||
);
|
||||
instanceProperties
|
||||
.getOrCreate('My instance property')
|
||||
.setValue(instance.getRawStringProperty('instanceprop1'));
|
||||
instanceProperties
|
||||
.getOrCreate('My other instance property')
|
||||
.setValue(instance.getRawFloatProperty('instanceprop2').toString())
|
||||
.setType('number');
|
||||
|
||||
return instanceProperties;
|
||||
};
|
||||
@@ -409,13 +410,15 @@ module.exports = {
|
||||
* of your extension behaviors/objects by instanciating behaviors/objects
|
||||
* and setting the property to a given value.
|
||||
*
|
||||
* If you don't have any tests, you can simply return an empty array like this:
|
||||
* `runExtensionSanityTests: function(gd, extension) { return []; }`
|
||||
* If you don't have any tests, you can simply return an empty array.
|
||||
*
|
||||
* But it is recommended to create tests for the behaviors/objects properties you created
|
||||
* to avoid mistakes.
|
||||
*/
|
||||
runExtensionSanityTests: function(gd, extension) {
|
||||
runExtensionSanityTests: function (
|
||||
gd /*: libGDevelop */,
|
||||
extension /*: gdPlatformExtension*/
|
||||
) {
|
||||
const dummyBehavior = extension
|
||||
.getBehaviorMetadata('MyDummyExtension::DummyBehavior')
|
||||
.get();
|
||||
@@ -440,7 +443,9 @@ module.exports = {
|
||||
*
|
||||
* ℹ️ Run `node import-GDJS-Runtime.js` (in newIDE/app/scripts) if you make any change.
|
||||
*/
|
||||
registerEditorConfigurations: function(objectsEditorService) {
|
||||
registerEditorConfigurations: function (
|
||||
objectsEditorService /*: ObjectsEditorService */
|
||||
) {
|
||||
objectsEditorService.registerEditorConfiguration(
|
||||
'MyDummyExtension::DummyObject',
|
||||
objectsEditorService.getDefaultObjectJsImplementationPropertiesEditor({
|
||||
@@ -453,7 +458,9 @@ module.exports = {
|
||||
*
|
||||
* ℹ️ Run `node import-GDJS-Runtime.js` (in newIDE/app/scripts) if you make any change.
|
||||
*/
|
||||
registerInstanceRenderers: function(objectsRenderingService) {
|
||||
registerInstanceRenderers: function (
|
||||
objectsRenderingService /*: ObjectsRenderingService */
|
||||
) {
|
||||
const RenderedInstance = objectsRenderingService.RenderedInstance;
|
||||
const PIXI = objectsRenderingService.PIXI;
|
||||
|
||||
@@ -498,7 +505,7 @@ module.exports = {
|
||||
/**
|
||||
* Return the path to the thumbnail of the specified object.
|
||||
*/
|
||||
RenderedDummyObjectInstance.getThumbnail = function(
|
||||
RenderedDummyObjectInstance.getThumbnail = function (
|
||||
project,
|
||||
resourcesLoader,
|
||||
object
|
||||
@@ -509,10 +516,10 @@ module.exports = {
|
||||
/**
|
||||
* This is called to update the PIXI object on the scene editor
|
||||
*/
|
||||
RenderedDummyObjectInstance.prototype.update = function() {
|
||||
RenderedDummyObjectInstance.prototype.update = function () {
|
||||
// Read a property from the object
|
||||
const property1Value = this._associatedObject
|
||||
.getProperties(this.project)
|
||||
.getProperties()
|
||||
.get('My first property')
|
||||
.getValue();
|
||||
this._pixiObject.text = property1Value;
|
||||
@@ -532,14 +539,14 @@ module.exports = {
|
||||
/**
|
||||
* Return the width of the instance, when it's not resized.
|
||||
*/
|
||||
RenderedDummyObjectInstance.prototype.getDefaultWidth = function() {
|
||||
RenderedDummyObjectInstance.prototype.getDefaultWidth = function () {
|
||||
return this._pixiObject.width;
|
||||
};
|
||||
|
||||
/**
|
||||
* Return the height of the instance, when it's not resized.
|
||||
*/
|
||||
RenderedDummyObjectInstance.prototype.getDefaultHeight = function() {
|
||||
RenderedDummyObjectInstance.prototype.getDefaultHeight = function () {
|
||||
return this._pixiObject.height;
|
||||
};
|
||||
|
||||
|
@@ -22,6 +22,12 @@ gdjs.DummyRuntimeBehavior = function(runtimeScene, behaviorData, owner)
|
||||
gdjs.DummyRuntimeBehavior.prototype = Object.create( gdjs.RuntimeBehavior.prototype );
|
||||
gdjs.registerBehavior("MyDummyExtension::DummyBehavior", gdjs.DummyRuntimeBehavior);
|
||||
|
||||
gdjs.DummyRuntimeBehavior.prototype.updateFromBehaviorData = function(oldBehaviorData, newBehaviorData) {
|
||||
if (oldBehaviorData.property1 !== newBehaviorData.property1) {
|
||||
this._textToSet = newBehaviorData.property1;
|
||||
}
|
||||
}
|
||||
|
||||
gdjs.DummyRuntimeBehavior.prototype.onDeActivate = function() {
|
||||
};
|
||||
|
||||
|
@@ -1,6 +1,6 @@
|
||||
/**
|
||||
* The PIXI.js renderer for the DummyRuntimeObject.
|
||||
*
|
||||
*
|
||||
* @class DummyRuntimeObjectPixiRenderer
|
||||
* @constructor
|
||||
* @param {gdjs.DummyRuntimeObject} runtimeObject The object to render
|
||||
@@ -9,7 +9,7 @@
|
||||
gdjs.DummyRuntimeObjectPixiRenderer = function(runtimeObject, runtimeScene)
|
||||
{
|
||||
this._object = runtimeObject; // Keep a reference to the object to read from it later.
|
||||
|
||||
|
||||
// Here we're going to create a dummy text as an example.
|
||||
if ( this._text === undefined ) {
|
||||
this._text = new PIXI.Text(runtimeObject.getText(), {align:"left"});
|
||||
@@ -38,6 +38,10 @@ gdjs.DummyRuntimeObjectPixiRenderer.prototype.ensureUpToDate = function() {
|
||||
this.updatePosition();
|
||||
};
|
||||
|
||||
gdjs.DummyRuntimeObjectPixiRenderer.prototype.updateText = function() {
|
||||
this._text.text = this._object.getText();
|
||||
};
|
||||
|
||||
gdjs.DummyRuntimeObjectPixiRenderer.prototype.updatePosition = function() {
|
||||
this._text.position.x = this._object.x+this._text.width/2;
|
||||
this._text.position.y = this._object.y+this._text.height/2;
|
||||
|
@@ -28,6 +28,17 @@ gdjs.DummyRuntimeObject.prototype.getRendererObject = function() {
|
||||
return this._renderer.getRendererObject();
|
||||
};
|
||||
|
||||
gdjs.DummyRuntimeObject.prototype.updateFromObjectData = function(oldObjectData, newObjectData) {
|
||||
// Compare previous and new data for the object and update it accordingly.
|
||||
// This is useful for "hot-reloading".
|
||||
if (oldObjectData.content.property1 !== newObjectData.content.property1) {
|
||||
this._property1 = newObjectData.content.property1;
|
||||
this._renderer.updateText();
|
||||
}
|
||||
|
||||
return true;
|
||||
};
|
||||
|
||||
/**
|
||||
* Called once during the game loop, before events and rendering.
|
||||
* @param {gdjs.RuntimeScene} runtimeScene The gdjs.RuntimeScene the object belongs to.
|
||||
@@ -109,7 +120,6 @@ gdjs.DummyRuntimeObject.prototype.getText = function() {
|
||||
return this._property1;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* A dummy method that can be called from events
|
||||
*/
|
||||
|
@@ -23,6 +23,14 @@ gdjs.DummyWithSharedDataRuntimeBehavior = function(runtimeScene, behaviorData, o
|
||||
gdjs.DummyWithSharedDataRuntimeBehavior.prototype = Object.create( gdjs.RuntimeBehavior.prototype );
|
||||
gdjs.registerBehavior("MyDummyExtension::DummyBehaviorWithSharedData", gdjs.DummyRuntimeBehavior);
|
||||
|
||||
gdjs.DummyWithSharedDataRuntimeBehavior.prototype.updateFromBehaviorData = function(oldBehaviorData, newBehaviorData) {
|
||||
if (oldBehaviorData.property1 !== newBehaviorData.property1) {
|
||||
this._textToSet = newBehaviorData.property1;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
gdjs.DummyWithSharedDataRuntimeBehavior.prototype.onDeActivate = function() {
|
||||
};
|
||||
|
||||
|
@@ -1,8 +1,9 @@
|
||||
// @flow
|
||||
/**
|
||||
* This is a declaration of an extension for GDevelop 5.
|
||||
*
|
||||
* ℹ️ Run `node import-GDJS-Runtime.js` (in newIDE/app/scripts) if you make any change
|
||||
* to this extension file or to any other *.js file that you reference inside.
|
||||
* ℹ️ Changes in this file are watched and automatically imported if the editor
|
||||
* is running. You can also manually run `node import-GDJS-Runtime.js` (in newIDE/app/scripts).
|
||||
*
|
||||
* The file must be named "JsExtension.js", otherwise GDevelop won't load it.
|
||||
* ⚠️ If you make a change and the extension is not loaded, open the developer console
|
||||
@@ -10,8 +11,16 @@
|
||||
*
|
||||
* More information on https://github.com/4ian/GDevelop/blob/master/newIDE/README-extensions.md
|
||||
*/
|
||||
|
||||
/*::
|
||||
// Import types to allow Flow to do static type checking on this file.
|
||||
// Extensions declaration are typed using Flow (like the editor), but the files
|
||||
// for the game engine are checked with TypeScript annotations.
|
||||
import { type ObjectsRenderingService, type ObjectsEditorService } from '../JsExtensionTypes.flow.js'
|
||||
*/
|
||||
|
||||
module.exports = {
|
||||
createExtension: function(_, gd) {
|
||||
createExtension: function(_/*: (string) => string */, gd/*: libGDevelop */) {
|
||||
const extension = new gd.PlatformExtension();
|
||||
extension
|
||||
.setExtensionInformation(
|
||||
@@ -361,7 +370,7 @@ module.exports = {
|
||||
|
||||
return extension;
|
||||
},
|
||||
runExtensionSanityTests: function(gd, extension) {
|
||||
runExtensionSanityTests: function(gd /*: libGDevelop */, extension /*: gdPlatformExtension*/) {
|
||||
return [];
|
||||
}
|
||||
};
|
||||
|
@@ -1,8 +1,9 @@
|
||||
// @flow
|
||||
/**
|
||||
* This is a declaration of an extension for GDevelop 5.
|
||||
*
|
||||
* ℹ️ Run `node import-GDJS-Runtime.js` (in newIDE/app/scripts) if you make any change
|
||||
* to this extension file or to any other *.js file that you reference inside.
|
||||
* ℹ️ Changes in this file are watched and automatically imported if the editor
|
||||
* is running. You can also manually run `node import-GDJS-Runtime.js` (in newIDE/app/scripts).
|
||||
*
|
||||
* The file must be named "JsExtension.js", otherwise GDevelop won't load it.
|
||||
* ⚠️ If you make a change and the extension is not loaded, open the developer console
|
||||
@@ -10,8 +11,16 @@
|
||||
*
|
||||
* More information on https://github.com/4ian/GDevelop/blob/master/newIDE/README-extensions.md
|
||||
*/
|
||||
|
||||
/*::
|
||||
// Import types to allow Flow to do static type checking on this file.
|
||||
// Extensions declaration are typed using Flow (like the editor), but the files
|
||||
// for the game engine are checked with TypeScript annotations.
|
||||
import { type ObjectsRenderingService, type ObjectsEditorService } from '../JsExtensionTypes.flow.js'
|
||||
*/
|
||||
|
||||
module.exports = {
|
||||
createExtension: function(_, gd) {
|
||||
createExtension: function(_/*: (string) => string */, gd/*: libGDevelop */) {
|
||||
const extension = new gd.PlatformExtension();
|
||||
extension
|
||||
.setExtensionInformation(
|
||||
@@ -321,7 +330,6 @@ module.exports = {
|
||||
_('Desktop folder'),
|
||||
_('Get the path to the desktop folder.'),
|
||||
_('Filesystem/Windows, Linux, MacOS'),
|
||||
'JsPlatform/Extensions/filesystem_folder24.png',
|
||||
'JsPlatform/Extensions/filesystem_folder32.png'
|
||||
)
|
||||
.addCodeOnlyParameter('currentScene', '')
|
||||
@@ -335,7 +343,6 @@ module.exports = {
|
||||
_('Documents folder'),
|
||||
_('Get the path to the documents folder.'),
|
||||
_('Filesystem/Windows, Linux, MacOS'),
|
||||
'JsPlatform/Extensions/filesystem_folder24.png',
|
||||
'JsPlatform/Extensions/filesystem_folder32.png'
|
||||
)
|
||||
.addCodeOnlyParameter('currentScene', '')
|
||||
@@ -349,7 +356,6 @@ module.exports = {
|
||||
_('Pictures folder'),
|
||||
_('Get the path to the pictures folder.'),
|
||||
_('Filesystem/Windows, Linux, MacOS'),
|
||||
'JsPlatform/Extensions/filesystem_folder24.png',
|
||||
'JsPlatform/Extensions/filesystem_folder32.png'
|
||||
)
|
||||
.addCodeOnlyParameter('currentScene', '')
|
||||
@@ -363,7 +369,6 @@ module.exports = {
|
||||
_('This games executable folder'),
|
||||
_('Get the path to this games executable folder.'),
|
||||
_('Filesystem/Windows, Linux, MacOS'),
|
||||
'JsPlatform/Extensions/filesystem_folder24.png',
|
||||
'JsPlatform/Extensions/filesystem_folder32.png'
|
||||
)
|
||||
.addCodeOnlyParameter('currentScene', '')
|
||||
@@ -377,7 +382,6 @@ module.exports = {
|
||||
_('Userdata folder (For application settings)'),
|
||||
_('Get the path to userdata folder. (For application settings)'),
|
||||
_('Filesystem/Windows, Linux, MacOS'),
|
||||
'JsPlatform/Extensions/filesystem_folder24.png',
|
||||
'JsPlatform/Extensions/filesystem_folder32.png'
|
||||
)
|
||||
.addCodeOnlyParameter('currentScene', '')
|
||||
@@ -391,7 +395,6 @@ module.exports = {
|
||||
_('User\'s Home folder'),
|
||||
_('Get the path to the user home folder.'),
|
||||
_('Filesystem/Windows, Linux, MacOS'),
|
||||
'JsPlatform/Extensions/filesystem_folder24.png',
|
||||
'JsPlatform/Extensions/filesystem_folder32.png'
|
||||
)
|
||||
.getCodeExtraInformation()
|
||||
@@ -404,7 +407,6 @@ module.exports = {
|
||||
_('Temp folder'),
|
||||
_('Get the path to temp folder.'),
|
||||
_('Filesystem/Windows, Linux, MacOS'),
|
||||
'JsPlatform/Extensions/filesystem_folder24.png',
|
||||
'JsPlatform/Extensions/filesystem_folder32.png'
|
||||
)
|
||||
.addCodeOnlyParameter('currentScene', '')
|
||||
@@ -418,7 +420,6 @@ module.exports = {
|
||||
_('Path delimiter'),
|
||||
_('Get the operating system agnostic path delimiter.'),
|
||||
_('Filesystem/Windows, Linux, MacOS'),
|
||||
'JsPlatform/Extensions/filesystem_folder24.png',
|
||||
'JsPlatform/Extensions/filesystem_folder32.png'
|
||||
)
|
||||
.getCodeExtraInformation()
|
||||
@@ -427,7 +428,7 @@ module.exports = {
|
||||
|
||||
return extension;
|
||||
},
|
||||
runExtensionSanityTests: function(gd, extension) {
|
||||
runExtensionSanityTests: function(gd /*: libGDevelop */, extension /*: gdPlatformExtension*/) {
|
||||
return [];
|
||||
},
|
||||
};
|
||||
|
@@ -18,7 +18,7 @@ void DeclareInventoryExtension(gd::PlatformExtension& extension) {
|
||||
"with items in memory."),
|
||||
"Florian Rival",
|
||||
"Open source (MIT License)")
|
||||
.SetExtensionHelpPath("all-features/inventory");
|
||||
.SetExtensionHelpPath("/all-features/inventory");
|
||||
|
||||
#if defined(GD_IDE_ONLY)
|
||||
extension
|
||||
|
29
Extensions/JsExtensionTypes.flow.js
Normal file
29
Extensions/JsExtensionTypes.flow.js
Normal file
@@ -0,0 +1,29 @@
|
||||
// @flow
|
||||
|
||||
/**
|
||||
* @file This file contains the (Flow) types that are used in the JavaScript
|
||||
* extensions declaration (i.e: JsExtension.js files).
|
||||
*
|
||||
* If you do changes here, run `node import-GDJS-Runtime.js` (in newIDE/app/scripts),
|
||||
* and be sure that the types declared here are reflecting the types exposed by the editor.
|
||||
*
|
||||
* Note that Flow comments are used to avoid having to preprocess this file and the
|
||||
* JsExtension.js files through Babel. This allows to keep plain JS files, while allowing
|
||||
* Flow static type checking to be run on them when integrated in the editor.
|
||||
*/
|
||||
|
||||
/*::
|
||||
export type ObjectsRenderingService = {
|
||||
gd: libGDevelop,
|
||||
PIXI: any,
|
||||
RenderedInstance: any,
|
||||
registerInstanceRenderer: (objectType: string, renderer: any) => void,
|
||||
requireModule: (dirname: string, moduleName: string) => any,
|
||||
getThumbnail: (project: gdProject, object: gdObject) => string,
|
||||
};
|
||||
|
||||
export type ObjectsEditorService = {
|
||||
registerEditorConfiguration: (objectType: string, editorConfiguration: any) => void,
|
||||
getDefaultObjectJsImplementationPropertiesEditor: ({| helpPagePath: string |}) => any,
|
||||
};
|
||||
*/
|
@@ -3,7 +3,7 @@ describe('gdjs.LinksManager', function() {
|
||||
var runtimeGame = new gdjs.RuntimeGame({variables: [], properties: {windowWidth: 800, windowHeight: 600}, resources: {resources: []}});
|
||||
var runtimeScene = new gdjs.RuntimeScene(runtimeGame);
|
||||
runtimeScene.loadFromScene({
|
||||
layers:[{name:"", visibility: true}],
|
||||
layers:[{name:"", visibility: true, effects: []}],
|
||||
variables: [],
|
||||
behaviorsSharedData: [],
|
||||
objects: [],
|
||||
|
@@ -12,7 +12,7 @@ gdjs.PanelSpriteRuntimeObjectPixiRenderer = function(
|
||||
.getImageManager()
|
||||
.getPIXITexture(textureName);
|
||||
|
||||
var StretchedSprite = !tiled ? PIXI.Sprite : PIXI.extras.TilingSprite;
|
||||
var StretchedSprite = !tiled ? PIXI.Sprite : PIXI.TilingSprite;
|
||||
|
||||
this._spritesContainer = new PIXI.Container();
|
||||
this._centerSprite = new StretchedSprite(new PIXI.Texture(texture));
|
||||
|
@@ -13,7 +13,7 @@
|
||||
* @property {number} width The object width
|
||||
* @property {number} height The object height
|
||||
* @property {string} texture The name of the resource containing the texture to use
|
||||
*
|
||||
*
|
||||
* @typedef {ObjectData & PanelSpriteObjectDataType} PanelSpriteObjectData
|
||||
*/
|
||||
|
||||
@@ -80,6 +80,49 @@ gdjs.PanelSpriteRuntimeObject.prototype = Object.create(
|
||||
);
|
||||
gdjs.registerObject("PanelSpriteObject::PanelSprite", gdjs.PanelSpriteRuntimeObject);
|
||||
|
||||
/**
|
||||
* @param {PanelSpriteObjectData} oldObjectData
|
||||
* @param {PanelSpriteObjectData} newObjectData
|
||||
*/
|
||||
gdjs.PanelSpriteRuntimeObject.prototype.updateFromObjectData = function(oldObjectData, newObjectData) {
|
||||
if (oldObjectData.width !== newObjectData.width) {
|
||||
this.setWidth(newObjectData.width);
|
||||
}
|
||||
if (oldObjectData.height !== newObjectData.height) {
|
||||
this.setHeight(newObjectData.height);
|
||||
}
|
||||
|
||||
var updateTexture = false;
|
||||
if (oldObjectData.rightMargin !== newObjectData.rightMargin) {
|
||||
this._rBorder = newObjectData.rightMargin;
|
||||
updateTexture = true;
|
||||
}
|
||||
if (oldObjectData.leftMargin !== newObjectData.leftMargin) {
|
||||
this._lBorder = newObjectData.leftMargin;
|
||||
updateTexture = true;
|
||||
}
|
||||
if (oldObjectData.topMargin !== newObjectData.topMargin) {
|
||||
this._tBorder = newObjectData.topMargin;
|
||||
updateTexture = true;
|
||||
}
|
||||
if (oldObjectData.bottomMargin !== newObjectData.bottomMargin) {
|
||||
this._bBorder = newObjectData.bottomMargin;
|
||||
updateTexture = true;
|
||||
}
|
||||
if (oldObjectData.texture !== newObjectData.texture) {
|
||||
updateTexture = true;
|
||||
}
|
||||
if (updateTexture) {
|
||||
this.setTexture(newObjectData.texture, this._runtimeScene);
|
||||
}
|
||||
|
||||
if (oldObjectData.tiled !== newObjectData.tiled) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
};
|
||||
|
||||
gdjs.PanelSpriteRuntimeObject.prototype.getRendererObject = function() {
|
||||
return this._renderer.getRendererObject();
|
||||
};
|
||||
|
@@ -224,4 +224,4 @@ extern "C" gd::PlatformExtension* GD_EXTENSION_API CreateGDJSExtension() {
|
||||
return new ParticleSystemJsExtension;
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
@@ -194,7 +194,7 @@ gdjs.ParticleEmitterObjectCocosRenderer = function(runtimeScene, runtimeObject,
|
||||
|
||||
this.started = false;
|
||||
|
||||
var renderer = runtimeScene.getLayer("").getRenderer();
|
||||
var renderer = runtimeScene.getLayer(runtimeObject.getLayer()).getRenderer();
|
||||
renderer.addRendererObject(this.renderer, runtimeObject.getZOrder());
|
||||
this._convertYPosition = renderer.convertYPosition;
|
||||
};
|
||||
|
@@ -152,7 +152,7 @@ gdjs.ParticleEmitterObjectPixiRenderer = function(runtimeScene, runtimeObject, o
|
||||
this.emitter.emit = true;
|
||||
this.started = false;
|
||||
|
||||
var layer = runtimeScene.getLayer("");
|
||||
var layer = runtimeScene.getLayer(runtimeObject.getLayer());
|
||||
if (layer) layer.getRenderer().addRendererObject(this.renderer, runtimeObject.getZOrder());
|
||||
};
|
||||
gdjs.ParticleEmitterObjectRenderer = gdjs.ParticleEmitterObjectPixiRenderer;
|
||||
|
@@ -24,17 +24,19 @@
|
||||
* @property {number} particleBlue2
|
||||
* @property {number} particleSize1
|
||||
* @property {number} particleSize2
|
||||
* @property {number} sizeParam
|
||||
* @property {number} particleAngle1
|
||||
* @property {number} particleAngle2
|
||||
* @property {string} sizeParam
|
||||
* @property {number} particleAlpha1
|
||||
* @property {number} particleAlpha2
|
||||
* @property {string} rendererType
|
||||
* @property {number} rendererParam1
|
||||
* @property {number} rendererParam1
|
||||
* @property {number} rendererParam2
|
||||
* @property {string} textureParticleName Resource name for image in particle
|
||||
* @property {number} flow
|
||||
* @property {number} tank
|
||||
* @property {boolean} destroyWhenNoParticles Destroy the object when there is no particles?
|
||||
*
|
||||
*
|
||||
* @typedef {ObjectData & ParticleEmitterObjectDataType} ParticleEmitterObjectData
|
||||
*/
|
||||
|
||||
@@ -107,7 +109,7 @@ gdjs.ParticleEmitterObject = function(runtimeScene, particleObjectData){
|
||||
/** @type {number} */
|
||||
this.size2 = particleObjectData.particleSize2;
|
||||
|
||||
/** @type {number} */
|
||||
/** @type {string} */
|
||||
this.sizeParam = particleObjectData.sizeParam;
|
||||
|
||||
/** @type {number} */
|
||||
@@ -121,7 +123,7 @@ gdjs.ParticleEmitterObject = function(runtimeScene, particleObjectData){
|
||||
|
||||
/** @type {number} */
|
||||
this.rendererParam1 = particleObjectData.rendererParam1;
|
||||
|
||||
|
||||
/** @type {number} */
|
||||
this.rendererParam2 = particleObjectData.rendererParam2;
|
||||
|
||||
@@ -185,6 +187,116 @@ gdjs.ParticleEmitterObject.prototype.getRendererObject = function(){
|
||||
return this._renderer.getRendererObject();
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {ParticleEmitterObjectData} oldObjectData
|
||||
* @param {ParticleEmitterObjectData} newObjectData
|
||||
*/
|
||||
gdjs.ParticleEmitterObject.prototype.updateFromObjectData = function(oldObjectData, newObjectData) {
|
||||
if (oldObjectData.emissionEditionSimpleMode !== newObjectData.emissionEditionSimpleMode) {
|
||||
this.singleAngle = newObjectData.emissionEditionSimpleMode;
|
||||
this._angleDirty = true;
|
||||
}
|
||||
if (oldObjectData.emitterAngleA !== newObjectData.emitterAngleA) {
|
||||
this.setEmitterAngleA(newObjectData.emitterAngleA);
|
||||
}
|
||||
if (oldObjectData.emitterAngleB !== newObjectData.emitterAngleB) {
|
||||
this.setEmitterAngleB(newObjectData.emitterAngleB);
|
||||
}
|
||||
if (oldObjectData.emitterForceMin !== newObjectData.emitterForceMin) {
|
||||
this.setEmitterForceMin(newObjectData.emitterForceMin);
|
||||
}
|
||||
if (oldObjectData.emitterForceMax !== newObjectData.emitterForceMax) {
|
||||
this.setEmitterForceMax(newObjectData.emitterForceMax);
|
||||
}
|
||||
if (oldObjectData.zoneRadius !== newObjectData.zoneRadius) {
|
||||
this.setZoneRadius(newObjectData.zoneRadius);
|
||||
}
|
||||
if (oldObjectData.particleLifeTimeMin !== newObjectData.particleLifeTimeMin) {
|
||||
this.setParticleLifeTimeMin(newObjectData.particleLifeTimeMin);
|
||||
}
|
||||
if (oldObjectData.particleLifeTimeMax !== newObjectData.particleLifeTimeMax) {
|
||||
this.setParticleLifeTimeMax(newObjectData.particleLifeTimeMax);
|
||||
}
|
||||
if (oldObjectData.particleGravityX !== newObjectData.particleGravityX) {
|
||||
this.setParticleGravityX(newObjectData.particleGravityX);
|
||||
}
|
||||
if (oldObjectData.particleGravityY !== newObjectData.particleGravityY) {
|
||||
this.setParticleGravityY(newObjectData.particleGravityY);
|
||||
}
|
||||
if (oldObjectData.particleRed1 !== newObjectData.particleRed1) {
|
||||
this.setParticleRed1(newObjectData.particleRed1);
|
||||
}
|
||||
if (oldObjectData.particleRed2 !== newObjectData.particleRed2) {
|
||||
this.setParticleRed2(newObjectData.particleRed2);
|
||||
}
|
||||
if (oldObjectData.particleGreen1 !== newObjectData.particleGreen1) {
|
||||
this.setParticleGreen1(newObjectData.particleGreen1);
|
||||
}
|
||||
if (oldObjectData.particleGreen2 !== newObjectData.particleGreen2) {
|
||||
this.setParticleGreen2(newObjectData.particleGreen2);
|
||||
}
|
||||
if (oldObjectData.particleBlue1 !== newObjectData.particleBlue1) {
|
||||
this.setParticleBlue1(newObjectData.particleBlue1);
|
||||
}
|
||||
if (oldObjectData.particleBlue2 !== newObjectData.particleBlue2) {
|
||||
this.setParticleBlue2(newObjectData.particleBlue2);
|
||||
}
|
||||
if (oldObjectData.particleSize1 !== newObjectData.particleSize1) {
|
||||
this.setParticleSize1(newObjectData.particleSize1);
|
||||
}
|
||||
if (oldObjectData.particleSize2 !== newObjectData.particleSize2) {
|
||||
this.setParticleSize2(newObjectData.particleSize2);
|
||||
}
|
||||
if (oldObjectData.sizeParam !== newObjectData.sizeParam) {
|
||||
this.sizeParam = newObjectData.sizeParam;
|
||||
this._sizeDirty = true;
|
||||
}
|
||||
if (oldObjectData.particleAlpha1 !== newObjectData.particleAlpha1) {
|
||||
this.setParticleAlpha1(newObjectData.particleAlpha1);
|
||||
}
|
||||
if (oldObjectData.particleAlpha2 !== newObjectData.particleAlpha2) {
|
||||
this.setParticleAlpha2(newObjectData.particleAlpha2);
|
||||
}
|
||||
if (oldObjectData.textureParticleName !== newObjectData.textureParticleName) {
|
||||
this.setTexture(newObjectData.textureParticleName, this._runtimeScene);
|
||||
}
|
||||
if (oldObjectData.flow !== newObjectData.flow) {
|
||||
this.setFlow(newObjectData.flow);
|
||||
}
|
||||
if (oldObjectData.tank !== newObjectData.tank) {
|
||||
this.setTank(newObjectData.tank);
|
||||
}
|
||||
if (oldObjectData.destroyWhenNoParticles !== newObjectData.destroyWhenNoParticles) {
|
||||
this.destroyWhenNoParticles = newObjectData.destroyWhenNoParticles;
|
||||
}
|
||||
|
||||
if (oldObjectData.particleSizeRandomness1 !== newObjectData.particleSizeRandomness1 ||
|
||||
oldObjectData.particleSizeRandomness2 !== newObjectData.particleSizeRandomness2 ||
|
||||
oldObjectData.particleAngle1 !== newObjectData.particleAngle1 ||
|
||||
oldObjectData.particleAngle2 !== newObjectData.particleAngle2 ||
|
||||
oldObjectData.maxParticleNb !== newObjectData.maxParticleNb ||
|
||||
oldObjectData.additive !== newObjectData.additive ||
|
||||
oldObjectData.rendererType !== newObjectData.rendererType ||
|
||||
oldObjectData.rendererParam1 !== newObjectData.rendererParam1 ||
|
||||
oldObjectData.rendererParam2 !== newObjectData.rendererParam2) {
|
||||
// Destroy the renderer, ensure it's removed from the layer.
|
||||
var layer = this._runtimeScene.getLayer(this.layer);
|
||||
layer.getRenderer().removeRendererObject(this._renderer.getRendererObject());
|
||||
this._renderer.destroy();
|
||||
|
||||
// and recreate the renderer, which will add itself to the layer.
|
||||
this._renderer = new gdjs.ParticleEmitterObjectRenderer(this._runtimeScene, this, newObjectData);
|
||||
|
||||
// Consider every state dirty as the renderer was just re-created, so it needs
|
||||
// to be repositioned, angle updated, etc...
|
||||
this._posDirty = this._angleDirty = this._forceDirty = this._zoneRadiusDirty = true;
|
||||
this._lifeTimeDirty = this._gravityDirty = this._colorDirty = this._sizeDirty = true;
|
||||
this._alphaDirty = this._flowDirty = this._textureDirty = true;
|
||||
}
|
||||
|
||||
return true;
|
||||
};
|
||||
|
||||
gdjs.ParticleEmitterObject.prototype.update = function(runtimeScene){
|
||||
if(this._posDirty){
|
||||
this._renderer.setPosition(this.getX(), this.getY());
|
||||
|
File diff suppressed because one or more lines are too long
@@ -26,7 +26,7 @@ void PathfindingBehavior::InitializeContent(
|
||||
|
||||
#if defined(GD_IDE_ONLY)
|
||||
std::map<gd::String, gd::PropertyDescriptor> PathfindingBehavior::GetProperties(
|
||||
const gd::SerializerElement& behaviorContent, gd::Project& project) const {
|
||||
const gd::SerializerElement& behaviorContent) const {
|
||||
std::map<gd::String, gd::PropertyDescriptor> properties;
|
||||
|
||||
properties[_("Allows diagonals")]
|
||||
@@ -57,8 +57,7 @@ std::map<gd::String, gd::PropertyDescriptor> PathfindingBehavior::GetProperties(
|
||||
|
||||
bool PathfindingBehavior::UpdateProperty(gd::SerializerElement& behaviorContent,
|
||||
const gd::String& name,
|
||||
const gd::String& value,
|
||||
gd::Project& project) {
|
||||
const gd::String& value) {
|
||||
if (name == _("Allows diagonals")) {
|
||||
behaviorContent.SetAttribute("allowDiagonals", (value != "0"));
|
||||
return true;
|
||||
|
@@ -35,12 +35,10 @@ class GD_EXTENSION_API PathfindingBehavior : public Behavior {
|
||||
|
||||
#if defined(GD_IDE_ONLY)
|
||||
virtual std::map<gd::String, gd::PropertyDescriptor> GetProperties(
|
||||
const gd::SerializerElement& behaviorContent,
|
||||
gd::Project& project) const override;
|
||||
const gd::SerializerElement& behaviorContent) const override;
|
||||
virtual bool UpdateProperty(gd::SerializerElement& behaviorContent,
|
||||
const gd::String& name,
|
||||
const gd::String& value,
|
||||
gd::Project& project) override;
|
||||
const gd::String& value) override;
|
||||
#endif
|
||||
|
||||
/**
|
||||
|
@@ -18,7 +18,7 @@ void PathfindingObstacleBehavior::InitializeContent(
|
||||
#if defined(GD_IDE_ONLY)
|
||||
std::map<gd::String, gd::PropertyDescriptor>
|
||||
PathfindingObstacleBehavior::GetProperties(
|
||||
const gd::SerializerElement& behaviorContent, gd::Project& project) const {
|
||||
const gd::SerializerElement& behaviorContent) const {
|
||||
std::map<gd::String, gd::PropertyDescriptor> properties;
|
||||
properties[_("Impassable obstacle")]
|
||||
.SetValue(behaviorContent.GetBoolAttribute("impassable") ? "true"
|
||||
@@ -33,8 +33,7 @@ PathfindingObstacleBehavior::GetProperties(
|
||||
bool PathfindingObstacleBehavior::UpdateProperty(
|
||||
gd::SerializerElement& behaviorContent,
|
||||
const gd::String& name,
|
||||
const gd::String& value,
|
||||
gd::Project& project) {
|
||||
const gd::String& value) {
|
||||
if (name == _("Impassable obstacle")) {
|
||||
behaviorContent.SetAttribute("impassable", (value != "0"));
|
||||
return true;
|
||||
|
@@ -30,12 +30,10 @@ class GD_EXTENSION_API PathfindingObstacleBehavior : public Behavior {
|
||||
|
||||
#if defined(GD_IDE_ONLY)
|
||||
virtual std::map<gd::String, gd::PropertyDescriptor> GetProperties(
|
||||
const gd::SerializerElement& behaviorContent,
|
||||
gd::Project& project) const override;
|
||||
const gd::SerializerElement& behaviorContent) const override;
|
||||
virtual bool UpdateProperty(gd::SerializerElement& behaviorContent,
|
||||
const gd::String& name,
|
||||
const gd::String& value,
|
||||
gd::Project& project) override;
|
||||
const gd::String& value) override;
|
||||
#endif
|
||||
|
||||
virtual void InitializeContent(
|
||||
|
@@ -104,6 +104,17 @@ gdjs.PathfindingObstacleRuntimeBehavior = function(runtimeScene, behaviorData, o
|
||||
gdjs.PathfindingObstacleRuntimeBehavior.prototype = Object.create( gdjs.RuntimeBehavior.prototype );
|
||||
gdjs.registerBehavior("PathfindingBehavior::PathfindingObstacleBehavior", gdjs.PathfindingObstacleRuntimeBehavior);
|
||||
|
||||
gdjs.PathfindingObstacleRuntimeBehavior.prototype.updateFromBehaviorData = function(oldBehaviorData, newBehaviorData) {
|
||||
if (oldBehaviorData.impassable !== newBehaviorData.impassable) {
|
||||
this.setImpassable(newBehaviorData.impassable);
|
||||
}
|
||||
if (oldBehaviorData.cost !== newBehaviorData.cost) {
|
||||
this.setCost(newBehaviorData.cost);
|
||||
}
|
||||
|
||||
return true;
|
||||
};
|
||||
|
||||
gdjs.PathfindingObstacleRuntimeBehavior.prototype.onDestroy = function() {
|
||||
if ( this._manager && this._registeredInManager ) this._manager.removeObstacle(this);
|
||||
};
|
||||
|
@@ -48,6 +48,38 @@ gdjs.PathfindingRuntimeBehavior = function(runtimeScene, behaviorData, owner)
|
||||
gdjs.PathfindingRuntimeBehavior.prototype = Object.create( gdjs.RuntimeBehavior.prototype );
|
||||
gdjs.registerBehavior("PathfindingBehavior::PathfindingBehavior", gdjs.PathfindingRuntimeBehavior);
|
||||
|
||||
gdjs.PathfindingRuntimeBehavior.prototype.updateFromBehaviorData = function(oldBehaviorData, newBehaviorData) {
|
||||
if (oldBehaviorData.allowDiagonals !== newBehaviorData.allowDiagonals) {
|
||||
this.allowDiagonals(newBehaviorData.allowDiagonals);
|
||||
}
|
||||
if (oldBehaviorData.acceleration !== newBehaviorData.acceleration) {
|
||||
this.setAcceleration(newBehaviorData.acceleration);
|
||||
}
|
||||
if (oldBehaviorData.maxSpeed !== newBehaviorData.maxSpeed) {
|
||||
this.setMaxSpeed(newBehaviorData.maxSpeed);
|
||||
}
|
||||
if (oldBehaviorData.angularMaxSpeed !== newBehaviorData.angularMaxSpeed) {
|
||||
this.setAngularMaxSpeed(newBehaviorData.angularMaxSpeed);
|
||||
}
|
||||
if (oldBehaviorData.rotateObject !== newBehaviorData.rotateObject) {
|
||||
this.setRotateObject(newBehaviorData.rotateObject);
|
||||
}
|
||||
if (oldBehaviorData.angleOffset !== newBehaviorData.angleOffset) {
|
||||
this.setAngleOffset(newBehaviorData.angleOffset);
|
||||
}
|
||||
if (oldBehaviorData.cellWidth !== newBehaviorData.cellWidth) {
|
||||
this.setCellWidth(newBehaviorData.cellWidth);
|
||||
}
|
||||
if (oldBehaviorData.cellHeight !== newBehaviorData.cellHeight) {
|
||||
this.setCellHeight(newBehaviorData.cellHeight);
|
||||
}
|
||||
if (oldBehaviorData.extraBorder !== newBehaviorData.extraBorder) {
|
||||
this.setExtraBorder(newBehaviorData.extraBorder);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
gdjs.PathfindingRuntimeBehavior.prototype.setCellWidth = function(width) {
|
||||
this._cellWidth = width;
|
||||
};
|
||||
|
@@ -1,8 +1,9 @@
|
||||
// @flow
|
||||
/**
|
||||
* This is a declaration of an extension for GDevelop 5.
|
||||
*
|
||||
* ℹ️ Run `node import-GDJS-Runtime.js` (in newIDE/app/scripts) if you make any change
|
||||
* to this extension file or to any other *.js file that you reference inside.
|
||||
* ℹ️ Changes in this file are watched and automatically imported if the editor
|
||||
* is running. You can also manually run `node import-GDJS-Runtime.js` (in newIDE/app/scripts).
|
||||
*
|
||||
* The file must be named "JsExtension.js", otherwise GDevelop won't load it.
|
||||
* ⚠️ If you make a change and the extension is not loaded, open the developer console
|
||||
@@ -10,8 +11,19 @@
|
||||
*
|
||||
* More information on https://github.com/4ian/GDevelop/blob/master/newIDE/README-extensions.md
|
||||
*/
|
||||
|
||||
/*::
|
||||
// Import types to allow Flow to do static type checking on this file.
|
||||
// Extensions declaration are typed using Flow (like the editor), but the files
|
||||
// for the game engine are checked with TypeScript annotations.
|
||||
import { type ObjectsRenderingService, type ObjectsEditorService } from '../JsExtensionTypes.flow.js'
|
||||
*/
|
||||
|
||||
module.exports = {
|
||||
createExtension: function(_, gd) {
|
||||
createExtension: function (
|
||||
_ /*: (string) => string */,
|
||||
gd /*: libGDevelop */
|
||||
) {
|
||||
const extension = new gd.PlatformExtension();
|
||||
extension.setExtensionInformation(
|
||||
'Physics2',
|
||||
@@ -22,7 +34,8 @@ module.exports = {
|
||||
);
|
||||
|
||||
var physics2Behavior = new gd.BehaviorJsImplementation();
|
||||
physics2Behavior.updateProperty = function(
|
||||
// $FlowExpectedError - ignore Flow warning as we're creating a behavior
|
||||
physics2Behavior.updateProperty = function (
|
||||
behaviorContent,
|
||||
propertyName,
|
||||
newValue
|
||||
@@ -36,7 +49,9 @@ module.exports = {
|
||||
return true;
|
||||
}
|
||||
if (propertyName === 'fixedRotation') {
|
||||
behaviorContent.getChild('fixedRotation').setBoolValue(newValue === '1');
|
||||
behaviorContent
|
||||
.getChild('fixedRotation')
|
||||
.setBoolValue(newValue === '1');
|
||||
return true;
|
||||
}
|
||||
if (propertyName === 'canSleep') {
|
||||
@@ -77,11 +92,14 @@ module.exports = {
|
||||
}
|
||||
if (propertyName === 'vertices') {
|
||||
behaviorContent.addChild('vertices');
|
||||
// $FlowFixMe
|
||||
behaviorContent.setChild('vertices', gd.Serializer.fromJSON(newValue));
|
||||
return true;
|
||||
}
|
||||
if (propertyName === 'density') {
|
||||
behaviorContent.getChild('density').setDoubleValue(parseFloat(newValue));
|
||||
behaviorContent
|
||||
.getChild('density')
|
||||
.setDoubleValue(parseFloat(newValue));
|
||||
return true;
|
||||
}
|
||||
if (propertyName === 'friction') {
|
||||
@@ -123,174 +141,168 @@ module.exports = {
|
||||
return true;
|
||||
}
|
||||
};
|
||||
physics2Behavior.getProperties = function(behaviorContent) {
|
||||
// $FlowExpectedError - ignore Flow warning as we're creating a behavior
|
||||
physics2Behavior.getProperties = function (behaviorContent) {
|
||||
var behaviorProperties = new gd.MapStringPropertyDescriptor();
|
||||
|
||||
behaviorProperties.set(
|
||||
'bodyType',
|
||||
new gd.PropertyDescriptor(behaviorContent.getChild('bodyType').getStringValue())
|
||||
.setType('Choice')
|
||||
.setLabel('Type')
|
||||
.addExtraInfo('Static')
|
||||
.addExtraInfo('Dynamic')
|
||||
.addExtraInfo('Kinematic')
|
||||
);
|
||||
behaviorProperties.set(
|
||||
'bullet',
|
||||
new gd.PropertyDescriptor(
|
||||
behaviorProperties
|
||||
.getOrCreate('bodyType')
|
||||
.setValue(behaviorContent.getChild('bodyType').getStringValue())
|
||||
.setType('Choice')
|
||||
.setLabel('Type')
|
||||
.addExtraInfo('Static')
|
||||
.addExtraInfo('Dynamic')
|
||||
.addExtraInfo('Kinematic');
|
||||
behaviorProperties
|
||||
.getOrCreate('bullet')
|
||||
.setValue(
|
||||
behaviorContent.getChild('bullet').getBoolValue() ? 'true' : 'false'
|
||||
)
|
||||
.setType('Boolean')
|
||||
.setLabel('Bullet')
|
||||
);
|
||||
behaviorProperties.set(
|
||||
'fixedRotation',
|
||||
new gd.PropertyDescriptor(
|
||||
behaviorContent.getChild('fixedRotation').getBoolValue() ? 'true' : 'false'
|
||||
.setType('Boolean')
|
||||
.setLabel('Bullet');
|
||||
behaviorProperties
|
||||
.getOrCreate('fixedRotation')
|
||||
.setValue(
|
||||
behaviorContent.getChild('fixedRotation').getBoolValue()
|
||||
? 'true'
|
||||
: 'false'
|
||||
)
|
||||
.setType('Boolean')
|
||||
.setLabel('Fixed Rotation')
|
||||
);
|
||||
behaviorProperties.set(
|
||||
'canSleep',
|
||||
new gd.PropertyDescriptor(
|
||||
.setType('Boolean')
|
||||
.setLabel('Fixed Rotation');
|
||||
behaviorProperties
|
||||
.getOrCreate('canSleep')
|
||||
.setValue(
|
||||
behaviorContent.getChild('canSleep').getBoolValue() ? 'true' : 'false'
|
||||
)
|
||||
.setType('Boolean')
|
||||
.setLabel('Can Sleep')
|
||||
);
|
||||
behaviorProperties.set(
|
||||
'shape',
|
||||
new gd.PropertyDescriptor(behaviorContent.getChild('shape').getStringValue())
|
||||
.setType('Choice')
|
||||
.setLabel('Shape')
|
||||
.addExtraInfo('Box')
|
||||
.addExtraInfo('Circle')
|
||||
.addExtraInfo('Edge')
|
||||
.addExtraInfo('Polygon')
|
||||
);
|
||||
behaviorProperties.set(
|
||||
'shapeDimensionA',
|
||||
new gd.PropertyDescriptor(
|
||||
behaviorContent.getChild('shapeDimensionA').getDoubleValue().toString(10)
|
||||
.setType('Boolean')
|
||||
.setLabel('Can Sleep');
|
||||
behaviorProperties
|
||||
.getOrCreate('shape')
|
||||
.setValue(behaviorContent.getChild('shape').getStringValue())
|
||||
.setType('Choice')
|
||||
.setLabel('Shape')
|
||||
.addExtraInfo('Box')
|
||||
.addExtraInfo('Circle')
|
||||
.addExtraInfo('Edge')
|
||||
.addExtraInfo('Polygon');
|
||||
behaviorProperties
|
||||
.getOrCreate('shapeDimensionA')
|
||||
.setValue(
|
||||
behaviorContent
|
||||
.getChild('shapeDimensionA')
|
||||
.getDoubleValue()
|
||||
.toString(10)
|
||||
)
|
||||
.setType('Number')
|
||||
.setLabel('Shape Dimension A')
|
||||
);
|
||||
behaviorProperties.set(
|
||||
'shapeDimensionB',
|
||||
new gd.PropertyDescriptor(
|
||||
behaviorContent.getChild('shapeDimensionB').getDoubleValue().toString(10)
|
||||
.setType('Number')
|
||||
.setLabel('Shape Dimension A');
|
||||
behaviorProperties
|
||||
.getOrCreate('shapeDimensionB')
|
||||
.setValue(
|
||||
behaviorContent
|
||||
.getChild('shapeDimensionB')
|
||||
.getDoubleValue()
|
||||
.toString(10)
|
||||
)
|
||||
.setType('Number')
|
||||
.setLabel('Shape Dimension B')
|
||||
);
|
||||
behaviorProperties.set(
|
||||
'shapeOffsetX',
|
||||
new gd.PropertyDescriptor(
|
||||
.setType('Number')
|
||||
.setLabel('Shape Dimension B');
|
||||
behaviorProperties
|
||||
.getOrCreate('shapeOffsetX')
|
||||
.setValue(
|
||||
behaviorContent.getChild('shapeOffsetX').getDoubleValue().toString(10)
|
||||
)
|
||||
.setType('Number')
|
||||
.setLabel('Shape Offset X')
|
||||
);
|
||||
behaviorProperties.set(
|
||||
'shapeOffsetY',
|
||||
new gd.PropertyDescriptor(
|
||||
.setType('Number')
|
||||
.setLabel('Shape Offset X');
|
||||
behaviorProperties
|
||||
.getOrCreate('shapeOffsetY')
|
||||
.setValue(
|
||||
behaviorContent.getChild('shapeOffsetY').getDoubleValue().toString(10)
|
||||
)
|
||||
.setType('Number')
|
||||
.setLabel('Shape Offset Y')
|
||||
);
|
||||
behaviorProperties.set(
|
||||
'polygonOrigin',
|
||||
new gd.PropertyDescriptor(
|
||||
behaviorContent.hasChild('polygonOrigin') ?
|
||||
behaviorContent.getChild('polygonOrigin').getStringValue() :
|
||||
'Center'
|
||||
.setType('Number')
|
||||
.setLabel('Shape Offset Y');
|
||||
behaviorProperties
|
||||
.getOrCreate('polygonOrigin')
|
||||
.setValue(
|
||||
behaviorContent.hasChild('polygonOrigin')
|
||||
? behaviorContent.getChild('polygonOrigin').getStringValue()
|
||||
: 'Center'
|
||||
)
|
||||
.setType('Choice')
|
||||
.setLabel('Polygon Origin')
|
||||
.addExtraInfo('Center')
|
||||
.addExtraInfo('Origin')
|
||||
.addExtraInfo('TopLeft')
|
||||
);
|
||||
behaviorProperties.set(
|
||||
'vertices',
|
||||
new gd.PropertyDescriptor(
|
||||
behaviorContent.hasChild('vertices') ?
|
||||
gd.Serializer.toJSON(behaviorContent.getChild('vertices')) :
|
||||
'[]'
|
||||
).setLabel('Vertices')
|
||||
);
|
||||
behaviorProperties.set(
|
||||
'density',
|
||||
new gd.PropertyDescriptor(
|
||||
.setType('Choice')
|
||||
.setLabel('Polygon Origin')
|
||||
.addExtraInfo('Center')
|
||||
.addExtraInfo('Origin')
|
||||
.addExtraInfo('TopLeft');
|
||||
behaviorProperties
|
||||
.getOrCreate('vertices')
|
||||
.setValue(
|
||||
behaviorContent.hasChild('vertices')
|
||||
? gd.Serializer.toJSON(behaviorContent.getChild('vertices'))
|
||||
: '[]'
|
||||
)
|
||||
.setLabel('Vertices');
|
||||
behaviorProperties
|
||||
.getOrCreate('density')
|
||||
.setValue(
|
||||
behaviorContent.getChild('density').getDoubleValue().toString(10)
|
||||
)
|
||||
.setType('Number')
|
||||
.setLabel('Density')
|
||||
);
|
||||
behaviorProperties.set(
|
||||
'friction',
|
||||
new gd.PropertyDescriptor(
|
||||
.setType('Number')
|
||||
.setLabel('Density');
|
||||
behaviorProperties
|
||||
.getOrCreate('friction')
|
||||
.setValue(
|
||||
behaviorContent.getChild('friction').getDoubleValue().toString(10)
|
||||
)
|
||||
.setType('Number')
|
||||
.setLabel('Friction')
|
||||
);
|
||||
behaviorProperties.set(
|
||||
'restitution',
|
||||
new gd.PropertyDescriptor(
|
||||
.setType('Number')
|
||||
.setLabel('Friction');
|
||||
behaviorProperties
|
||||
.getOrCreate('restitution')
|
||||
.setValue(
|
||||
behaviorContent.getChild('restitution').getDoubleValue().toString(10)
|
||||
)
|
||||
.setType('Number')
|
||||
.setLabel('Restitution')
|
||||
);
|
||||
behaviorProperties.set(
|
||||
'linearDamping',
|
||||
new gd.PropertyDescriptor(
|
||||
behaviorContent.getChild('linearDamping').getDoubleValue().toString(10)
|
||||
.setType('Number')
|
||||
.setLabel('Restitution');
|
||||
behaviorProperties
|
||||
.getOrCreate('linearDamping')
|
||||
.setValue(
|
||||
behaviorContent
|
||||
.getChild('linearDamping')
|
||||
.getDoubleValue()
|
||||
.toString(10)
|
||||
)
|
||||
.setType('Number')
|
||||
.setLabel('Linear Damping')
|
||||
);
|
||||
behaviorProperties.set(
|
||||
'angularDamping',
|
||||
new gd.PropertyDescriptor(
|
||||
behaviorContent.getChild('angularDamping').getDoubleValue().toString(10)
|
||||
.setType('Number')
|
||||
.setLabel('Linear Damping');
|
||||
behaviorProperties
|
||||
.getOrCreate('angularDamping')
|
||||
.setValue(
|
||||
behaviorContent
|
||||
.getChild('angularDamping')
|
||||
.getDoubleValue()
|
||||
.toString(10)
|
||||
)
|
||||
.setType('Number')
|
||||
.setLabel('Angular Damping')
|
||||
);
|
||||
behaviorProperties.set(
|
||||
'gravityScale',
|
||||
new gd.PropertyDescriptor(
|
||||
.setType('Number')
|
||||
.setLabel('Angular Damping');
|
||||
behaviorProperties
|
||||
.getOrCreate('gravityScale')
|
||||
.setValue(
|
||||
behaviorContent.getChild('gravityScale').getDoubleValue().toString(10)
|
||||
)
|
||||
.setType('Number')
|
||||
.setLabel('Gravity Scale')
|
||||
);
|
||||
behaviorProperties.set(
|
||||
'layers',
|
||||
new gd.PropertyDescriptor(
|
||||
behaviorContent.getChild('layers').getIntValue().toString(10)
|
||||
)
|
||||
.setType('Number')
|
||||
.setLabel('Layers')
|
||||
);
|
||||
behaviorProperties.set(
|
||||
'masks',
|
||||
new gd.PropertyDescriptor(
|
||||
behaviorContent.getChild('masks').getIntValue().toString(10)
|
||||
)
|
||||
.setType('Number')
|
||||
.setLabel('Masks')
|
||||
);
|
||||
.setType('Number')
|
||||
.setLabel('Gravity Scale');
|
||||
behaviorProperties
|
||||
.getOrCreate('layers')
|
||||
.setValue(behaviorContent.getChild('layers').getIntValue().toString(10))
|
||||
.setType('Number')
|
||||
.setLabel('Layers');
|
||||
behaviorProperties
|
||||
.getOrCreate('masks')
|
||||
.setValue(behaviorContent.getChild('masks').getIntValue().toString(10))
|
||||
.setType('Number')
|
||||
.setLabel('Masks');
|
||||
|
||||
return behaviorProperties;
|
||||
};
|
||||
|
||||
physics2Behavior.initializeContent = function(behaviorContent) {
|
||||
// $FlowExpectedError - ignore Flow warning as we're creating a behavior
|
||||
physics2Behavior.initializeContent = function (behaviorContent) {
|
||||
behaviorContent.addChild('bodyType').setStringValue('Dynamic');
|
||||
behaviorContent.addChild('bullet').setBoolValue(false);
|
||||
behaviorContent.addChild('fixedRotation').setBoolValue(false);
|
||||
@@ -313,7 +325,8 @@ module.exports = {
|
||||
};
|
||||
|
||||
var sharedData = new gd.BehaviorSharedDataJsImplementation();
|
||||
sharedData.updateProperty = function(
|
||||
// $FlowExpectedError - ignore Flow warning as we're creating a behavior
|
||||
sharedData.updateProperty = function (
|
||||
sharedContent,
|
||||
propertyName,
|
||||
newValue
|
||||
@@ -345,42 +358,44 @@ module.exports = {
|
||||
|
||||
return false;
|
||||
};
|
||||
sharedData.getProperties = function(sharedContent) {
|
||||
// $FlowExpectedError - ignore Flow warning as we're creating a behavior
|
||||
sharedData.getProperties = function (sharedContent) {
|
||||
var sharedProperties = new gd.MapStringPropertyDescriptor();
|
||||
|
||||
sharedProperties.set(
|
||||
'gravityX',
|
||||
new gd.PropertyDescriptor(
|
||||
sharedProperties
|
||||
.getOrCreate('gravityX')
|
||||
.setValue(
|
||||
sharedContent.getChild('gravityX').getDoubleValue().toString(10)
|
||||
).setType('Number')
|
||||
);
|
||||
sharedProperties.set(
|
||||
'gravityY',
|
||||
new gd.PropertyDescriptor(
|
||||
)
|
||||
.setType('Number');
|
||||
sharedProperties
|
||||
.getOrCreate('gravityY')
|
||||
.setValue(
|
||||
sharedContent.getChild('gravityY').getDoubleValue().toString(10)
|
||||
).setType('Number')
|
||||
);
|
||||
sharedProperties.set(
|
||||
'scaleX',
|
||||
new gd.PropertyDescriptor(
|
||||
)
|
||||
.setType('Number');
|
||||
sharedProperties
|
||||
.getOrCreate('scaleX')
|
||||
.setValue(
|
||||
sharedContent.getChild('scaleX').getDoubleValue().toString(10)
|
||||
).setType('Number')
|
||||
);
|
||||
sharedProperties.set(
|
||||
'scaleY',
|
||||
new gd.PropertyDescriptor(
|
||||
)
|
||||
.setType('Number');
|
||||
sharedProperties
|
||||
.getOrCreate('scaleY')
|
||||
.setValue(
|
||||
sharedContent.getChild('scaleY').getDoubleValue().toString(10)
|
||||
).setType('Number')
|
||||
);
|
||||
)
|
||||
.setType('Number');
|
||||
|
||||
return sharedProperties;
|
||||
};
|
||||
sharedData.initializeContent = function(behaviorContent) {
|
||||
behaviorContent.addChild("gravityX").setDoubleValue(0);
|
||||
behaviorContent.addChild("gravityY").setDoubleValue(9.8);
|
||||
behaviorContent.addChild("scaleX").setDoubleValue(100);
|
||||
behaviorContent.addChild("scaleY").setDoubleValue(100);
|
||||
}
|
||||
// $FlowExpectedError - ignore Flow warning as we're creating a behavior
|
||||
sharedData.initializeContent = function (behaviorContent) {
|
||||
behaviorContent.addChild('gravityX').setDoubleValue(0);
|
||||
behaviorContent.addChild('gravityY').setDoubleValue(9.8);
|
||||
behaviorContent.addChild('scaleX').setDoubleValue(100);
|
||||
behaviorContent.addChild('scaleY').setDoubleValue(100);
|
||||
};
|
||||
|
||||
var aut = extension
|
||||
// extension
|
||||
@@ -413,7 +428,7 @@ module.exports = {
|
||||
)
|
||||
.addParameter('object', _('Object'), '', false)
|
||||
.addParameter('behavior', _('Behavior'), 'Physics2Behavior')
|
||||
.useStandardRelationalOperatorParameters("number")
|
||||
.useStandardRelationalOperatorParameters('number')
|
||||
.getCodeExtraInformation()
|
||||
.setFunctionName('getGravityX');
|
||||
|
||||
@@ -442,7 +457,7 @@ module.exports = {
|
||||
)
|
||||
.addParameter('object', _('Object'), '', false)
|
||||
.addParameter('behavior', _('Behavior'), 'Physics2Behavior')
|
||||
.useStandardRelationalOperatorParameters("number")
|
||||
.useStandardRelationalOperatorParameters('number')
|
||||
.getCodeExtraInformation()
|
||||
.setFunctionName('getGravityY');
|
||||
|
||||
@@ -488,7 +503,7 @@ module.exports = {
|
||||
)
|
||||
.addParameter('object', _('Object'), '', false)
|
||||
.addParameter('behavior', _('Behavior'), 'Physics2Behavior')
|
||||
.useStandardRelationalOperatorParameters("number")
|
||||
.useStandardRelationalOperatorParameters('number')
|
||||
.getCodeExtraInformation()
|
||||
.setFunctionName('getTimeScale');
|
||||
|
||||
@@ -752,9 +767,9 @@ module.exports = {
|
||||
)
|
||||
.addParameter('object', _('Object'), '', false)
|
||||
.addParameter('behavior', _('Behavior'), 'Physics2Behavior')
|
||||
.useStandardOperatorParameters("number")
|
||||
.useStandardOperatorParameters('number')
|
||||
.getCodeExtraInformation()
|
||||
.setFunctionName('setShapeScale')
|
||||
.setFunctionName('setShapeScale')
|
||||
.setGetter('getShapeScale');
|
||||
|
||||
aut
|
||||
@@ -769,7 +784,7 @@ module.exports = {
|
||||
)
|
||||
.addParameter('object', _('Object'), '', false)
|
||||
.addParameter('behavior', _('Behavior'), 'Physics2Behavior')
|
||||
.useStandardRelationalOperatorParameters("number")
|
||||
.useStandardRelationalOperatorParameters('number')
|
||||
.getCodeExtraInformation()
|
||||
.setFunctionName('getDensity');
|
||||
|
||||
@@ -787,9 +802,9 @@ module.exports = {
|
||||
)
|
||||
.addParameter('object', _('Object'), '', false)
|
||||
.addParameter('behavior', _('Behavior'), 'Physics2Behavior')
|
||||
.useStandardOperatorParameters("number")
|
||||
.useStandardOperatorParameters('number')
|
||||
.getCodeExtraInformation()
|
||||
.setFunctionName('setDensity')
|
||||
.setFunctionName('setDensity')
|
||||
.setGetter('getDensity');
|
||||
|
||||
aut
|
||||
@@ -817,7 +832,7 @@ module.exports = {
|
||||
)
|
||||
.addParameter('object', _('Object'), '', false)
|
||||
.addParameter('behavior', _('Behavior'), 'Physics2Behavior')
|
||||
.useStandardRelationalOperatorParameters("number")
|
||||
.useStandardRelationalOperatorParameters('number')
|
||||
.getCodeExtraInformation()
|
||||
.setFunctionName('getFriction');
|
||||
|
||||
@@ -835,7 +850,7 @@ module.exports = {
|
||||
)
|
||||
.addParameter('object', _('Object'), '', false)
|
||||
.addParameter('behavior', _('Behavior'), 'Physics2Behavior')
|
||||
.useStandardOperatorParameters("number")
|
||||
.useStandardOperatorParameters('number')
|
||||
.getCodeExtraInformation()
|
||||
.setFunctionName('setFriction')
|
||||
.setGetter('getFriction');
|
||||
@@ -865,7 +880,7 @@ module.exports = {
|
||||
)
|
||||
.addParameter('object', _('Object'), '', false)
|
||||
.addParameter('behavior', _('Behavior'), 'Physics2Behavior')
|
||||
.useStandardRelationalOperatorParameters("number")
|
||||
.useStandardRelationalOperatorParameters('number')
|
||||
.getCodeExtraInformation()
|
||||
.setFunctionName('getRestitution');
|
||||
|
||||
@@ -883,7 +898,7 @@ module.exports = {
|
||||
)
|
||||
.addParameter('object', _('Object'), '', false)
|
||||
.addParameter('behavior', _('Behavior'), 'Physics2Behavior')
|
||||
.useStandardOperatorParameters("number")
|
||||
.useStandardOperatorParameters('number')
|
||||
.getCodeExtraInformation()
|
||||
.setFunctionName('setRestitution')
|
||||
.setGetter('getRestitution');
|
||||
@@ -913,7 +928,7 @@ module.exports = {
|
||||
)
|
||||
.addParameter('object', _('Object'), '', false)
|
||||
.addParameter('behavior', _('Behavior'), 'Physics2Behavior')
|
||||
.useStandardRelationalOperatorParameters("number")
|
||||
.useStandardRelationalOperatorParameters('number')
|
||||
.getCodeExtraInformation()
|
||||
.setFunctionName('getLinearDamping');
|
||||
|
||||
@@ -931,7 +946,7 @@ module.exports = {
|
||||
)
|
||||
.addParameter('object', _('Object'), '', false)
|
||||
.addParameter('behavior', _('Behavior'), 'Physics2Behavior')
|
||||
.useStandardOperatorParameters("number")
|
||||
.useStandardOperatorParameters('number')
|
||||
.getCodeExtraInformation()
|
||||
.setFunctionName('setLinearDamping')
|
||||
.setGetter('getLinearDamping');
|
||||
@@ -961,7 +976,7 @@ module.exports = {
|
||||
)
|
||||
.addParameter('object', _('Object'), '', false)
|
||||
.addParameter('behavior', _('Behavior'), 'Physics2Behavior')
|
||||
.useStandardRelationalOperatorParameters("number")
|
||||
.useStandardRelationalOperatorParameters('number')
|
||||
.getCodeExtraInformation()
|
||||
.setFunctionName('getAngularDamping');
|
||||
|
||||
@@ -979,7 +994,7 @@ module.exports = {
|
||||
)
|
||||
.addParameter('object', _('Object'), '', false)
|
||||
.addParameter('behavior', _('Behavior'), 'Physics2Behavior')
|
||||
.useStandardOperatorParameters("number")
|
||||
.useStandardOperatorParameters('number')
|
||||
.getCodeExtraInformation()
|
||||
.setFunctionName('setAngularDamping')
|
||||
.setGetter('getAngularDamping');
|
||||
@@ -1009,7 +1024,7 @@ module.exports = {
|
||||
)
|
||||
.addParameter('object', _('Object'), '', false)
|
||||
.addParameter('behavior', _('Behavior'), 'Physics2Behavior')
|
||||
.useStandardRelationalOperatorParameters("number")
|
||||
.useStandardRelationalOperatorParameters('number')
|
||||
.getCodeExtraInformation()
|
||||
.setFunctionName('getGravityScale');
|
||||
|
||||
@@ -1027,7 +1042,7 @@ module.exports = {
|
||||
)
|
||||
.addParameter('object', _('Object'), '', false)
|
||||
.addParameter('behavior', _('Behavior'), 'Physics2Behavior')
|
||||
.useStandardOperatorParameters("number")
|
||||
.useStandardOperatorParameters('number')
|
||||
.getCodeExtraInformation()
|
||||
.setFunctionName('setGravityScale')
|
||||
.setGetter('getGravityScale');
|
||||
@@ -1131,7 +1146,7 @@ module.exports = {
|
||||
)
|
||||
.addParameter('object', _('Object'), '', false)
|
||||
.addParameter('behavior', _('Behavior'), 'Physics2Behavior')
|
||||
.useStandardRelationalOperatorParameters("number")
|
||||
.useStandardRelationalOperatorParameters('number')
|
||||
.getCodeExtraInformation()
|
||||
.setFunctionName('getLinearVelocityX');
|
||||
|
||||
@@ -1147,7 +1162,7 @@ module.exports = {
|
||||
)
|
||||
.addParameter('object', _('Object'), '', false)
|
||||
.addParameter('behavior', _('Behavior'), 'Physics2Behavior')
|
||||
.useStandardOperatorParameters("number")
|
||||
.useStandardOperatorParameters('number')
|
||||
.getCodeExtraInformation()
|
||||
.setFunctionName('setLinearVelocityX')
|
||||
.setGetter('getLinearVelocityX');
|
||||
@@ -1177,7 +1192,7 @@ module.exports = {
|
||||
)
|
||||
.addParameter('object', _('Object'), '', false)
|
||||
.addParameter('behavior', _('Behavior'), 'Physics2Behavior')
|
||||
.useStandardRelationalOperatorParameters("number")
|
||||
.useStandardRelationalOperatorParameters('number')
|
||||
.getCodeExtraInformation()
|
||||
.setFunctionName('getLinearVelocityY');
|
||||
|
||||
@@ -1193,7 +1208,7 @@ module.exports = {
|
||||
)
|
||||
.addParameter('object', _('Object'), '', false)
|
||||
.addParameter('behavior', _('Behavior'), 'Physics2Behavior')
|
||||
.useStandardOperatorParameters("number")
|
||||
.useStandardOperatorParameters('number')
|
||||
.getCodeExtraInformation()
|
||||
.setFunctionName('setLinearVelocityY')
|
||||
.setGetter('getLinearVelocityY');
|
||||
@@ -1223,7 +1238,7 @@ module.exports = {
|
||||
)
|
||||
.addParameter('object', _('Object'), '', false)
|
||||
.addParameter('behavior', _('Behavior'), 'Physics2Behavior')
|
||||
.useStandardRelationalOperatorParameters("number")
|
||||
.useStandardRelationalOperatorParameters('number')
|
||||
.getCodeExtraInformation()
|
||||
.setFunctionName('getLinearVelocityLength');
|
||||
|
||||
@@ -1252,7 +1267,7 @@ module.exports = {
|
||||
)
|
||||
.addParameter('object', _('Object'), '', false)
|
||||
.addParameter('behavior', _('Behavior'), 'Physics2Behavior')
|
||||
.useStandardRelationalOperatorParameters("number")
|
||||
.useStandardRelationalOperatorParameters('number')
|
||||
.getCodeExtraInformation()
|
||||
.setFunctionName('getAngularVelocity');
|
||||
|
||||
@@ -1268,7 +1283,7 @@ module.exports = {
|
||||
)
|
||||
.addParameter('object', _('Object'), '', false)
|
||||
.addParameter('behavior', _('Behavior'), 'Physics2Behavior')
|
||||
.useStandardOperatorParameters("number")
|
||||
.useStandardOperatorParameters('number')
|
||||
.getCodeExtraInformation()
|
||||
.setFunctionName('setAngularVelocity')
|
||||
.setGetter('getAngularVelocity');
|
||||
@@ -1581,7 +1596,7 @@ module.exports = {
|
||||
.addParameter('object', _('Object'), '', false)
|
||||
.addParameter('behavior', _('Behavior'), 'Physics2Behavior')
|
||||
.addParameter('expression', _('Joint ID'))
|
||||
.useStandardRelationalOperatorParameters("number")
|
||||
.useStandardRelationalOperatorParameters('number')
|
||||
.getCodeExtraInformation()
|
||||
.setFunctionName('getJointReactionForce');
|
||||
|
||||
@@ -1612,7 +1627,7 @@ module.exports = {
|
||||
.addParameter('object', _('Object'), '', false)
|
||||
.addParameter('behavior', _('Behavior'), 'Physics2Behavior')
|
||||
.addParameter('expression', _('Joint ID'))
|
||||
.useStandardRelationalOperatorParameters("number")
|
||||
.useStandardRelationalOperatorParameters('number')
|
||||
.getCodeExtraInformation()
|
||||
.setFunctionName('getJointReactionTorque');
|
||||
|
||||
@@ -1716,7 +1731,7 @@ module.exports = {
|
||||
.addParameter('object', _('Object'), '', false)
|
||||
.addParameter('behavior', _('Behavior'), 'Physics2Behavior')
|
||||
.addParameter('expression', _('Joint ID'))
|
||||
.useStandardOperatorParameters("number")
|
||||
.useStandardOperatorParameters('number')
|
||||
.getCodeExtraInformation()
|
||||
.setFunctionName('setDistanceJointLength')
|
||||
.setGetter('getDistanceJointLength');
|
||||
@@ -1748,7 +1763,7 @@ module.exports = {
|
||||
.addParameter('object', _('Object'), '', false)
|
||||
.addParameter('behavior', _('Behavior'), 'Physics2Behavior')
|
||||
.addParameter('expression', _('Joint ID'))
|
||||
.useStandardOperatorParameters("number")
|
||||
.useStandardOperatorParameters('number')
|
||||
.getCodeExtraInformation()
|
||||
.setFunctionName('setDistanceJointFrequency')
|
||||
.setGetter('getDistanceJointFrequency');
|
||||
@@ -1780,7 +1795,7 @@ module.exports = {
|
||||
.addParameter('object', _('Object'), '', false)
|
||||
.addParameter('behavior', _('Behavior'), 'Physics2Behavior')
|
||||
.addParameter('expression', _('Joint ID'))
|
||||
.useStandardOperatorParameters("number")
|
||||
.useStandardOperatorParameters('number')
|
||||
.getCodeExtraInformation()
|
||||
.setFunctionName('setDistanceJointDampingRatio')
|
||||
.setGetter('getDistanceJointDampingRatio');
|
||||
@@ -2075,7 +2090,7 @@ module.exports = {
|
||||
.addParameter('object', _('Object'), '', false)
|
||||
.addParameter('behavior', _('Behavior'), 'Physics2Behavior')
|
||||
.addParameter('expression', _('Joint ID'))
|
||||
.useStandardOperatorParameters("number")
|
||||
.useStandardOperatorParameters('number')
|
||||
.getCodeExtraInformation()
|
||||
.setFunctionName('setRevoluteJointMotorSpeed')
|
||||
.setGetter('getRevoluteJointMotorSpeed');
|
||||
@@ -2107,7 +2122,7 @@ module.exports = {
|
||||
.addParameter('object', _('Object'), '', false)
|
||||
.addParameter('behavior', _('Behavior'), 'Physics2Behavior')
|
||||
.addParameter('expression', _('Joint ID'))
|
||||
.useStandardOperatorParameters("number")
|
||||
.useStandardOperatorParameters('number')
|
||||
.getCodeExtraInformation()
|
||||
.setFunctionName('setRevoluteJointMaxMotorTorque')
|
||||
.setGetter('getRevoluteJointMaxMotorTorque');
|
||||
@@ -2387,7 +2402,7 @@ module.exports = {
|
||||
.addParameter('object', _('Object'), '', false)
|
||||
.addParameter('behavior', _('Behavior'), 'Physics2Behavior')
|
||||
.addParameter('expression', _('Joint ID'))
|
||||
.useStandardOperatorParameters("number")
|
||||
.useStandardOperatorParameters('number')
|
||||
.getCodeExtraInformation()
|
||||
.setFunctionName('setPrismaticJointMotorSpeed')
|
||||
.setGetter('getPrismaticJointMotorSpeed');
|
||||
@@ -2419,7 +2434,7 @@ module.exports = {
|
||||
.addParameter('object', _('Object'), '', false)
|
||||
.addParameter('behavior', _('Behavior'), 'Physics2Behavior')
|
||||
.addParameter('expression', _('Joint ID'))
|
||||
.useStandardOperatorParameters("number")
|
||||
.useStandardOperatorParameters('number')
|
||||
.getCodeExtraInformation()
|
||||
.setFunctionName('setPrismaticJointMaxMotorForce')
|
||||
.setGetter('getPrismaticJointMaxMotorForce');
|
||||
@@ -2689,7 +2704,7 @@ module.exports = {
|
||||
.addParameter('object', _('Object'), '', false)
|
||||
.addParameter('behavior', _('Behavior'), 'Physics2Behavior')
|
||||
.addParameter('expression', _('Joint ID'))
|
||||
.useStandardOperatorParameters("number")
|
||||
.useStandardOperatorParameters('number')
|
||||
.getCodeExtraInformation()
|
||||
.setFunctionName('setGearJointRatio')
|
||||
.setGetter('getGearJointRatio');
|
||||
@@ -2814,7 +2829,7 @@ module.exports = {
|
||||
.addParameter('object', _('Object'), '', false)
|
||||
.addParameter('behavior', _('Behavior'), 'Physics2Behavior')
|
||||
.addParameter('expression', _('Joint ID'))
|
||||
.useStandardOperatorParameters("number")
|
||||
.useStandardOperatorParameters('number')
|
||||
.getCodeExtraInformation()
|
||||
.setFunctionName('setMouseJointMaxForce')
|
||||
.setGetter('getMouseJointMaxForce');
|
||||
@@ -2846,7 +2861,7 @@ module.exports = {
|
||||
.addParameter('object', _('Object'), '', false)
|
||||
.addParameter('behavior', _('Behavior'), 'Physics2Behavior')
|
||||
.addParameter('expression', _('Joint ID'))
|
||||
.useStandardOperatorParameters("number")
|
||||
.useStandardOperatorParameters('number')
|
||||
.getCodeExtraInformation()
|
||||
.setFunctionName('setMouseJointFrequency')
|
||||
.setGetter('getMouseJointFrequency');
|
||||
@@ -2878,7 +2893,7 @@ module.exports = {
|
||||
.addParameter('object', _('Object'), '', false)
|
||||
.addParameter('behavior', _('Behavior'), 'Physics2Behavior')
|
||||
.addParameter('expression', _('Joint ID'))
|
||||
.useStandardOperatorParameters("number")
|
||||
.useStandardOperatorParameters('number')
|
||||
.getCodeExtraInformation()
|
||||
.setFunctionName('setMouseJointDampingRatio')
|
||||
.setGetter('getMouseJointDampingRatio');
|
||||
@@ -3047,7 +3062,7 @@ module.exports = {
|
||||
.addParameter('object', _('Object'), '', false)
|
||||
.addParameter('behavior', _('Behavior'), 'Physics2Behavior')
|
||||
.addParameter('expression', _('Joint ID'))
|
||||
.useStandardOperatorParameters("number")
|
||||
.useStandardOperatorParameters('number')
|
||||
.getCodeExtraInformation()
|
||||
.setFunctionName('setWheelJointMotorSpeed')
|
||||
.setGetter('getWheelJointMotorSpeed');
|
||||
@@ -3079,7 +3094,7 @@ module.exports = {
|
||||
.addParameter('object', _('Object'), '', false)
|
||||
.addParameter('behavior', _('Behavior'), 'Physics2Behavior')
|
||||
.addParameter('expression', _('Joint ID'))
|
||||
.useStandardOperatorParameters("number")
|
||||
.useStandardOperatorParameters('number')
|
||||
.getCodeExtraInformation()
|
||||
.setFunctionName('setWheelJointMaxMotorTorque')
|
||||
.setGetter('getWheelJointMaxMotorTorque');
|
||||
@@ -3125,7 +3140,7 @@ module.exports = {
|
||||
.addParameter('object', _('Object'), '', false)
|
||||
.addParameter('behavior', _('Behavior'), 'Physics2Behavior')
|
||||
.addParameter('expression', _('Joint ID'))
|
||||
.useStandardOperatorParameters("number")
|
||||
.useStandardOperatorParameters('number')
|
||||
.getCodeExtraInformation()
|
||||
.setFunctionName('setWheelJointFrequency')
|
||||
.setGetter('getWheelJointFrequency');
|
||||
@@ -3157,7 +3172,7 @@ module.exports = {
|
||||
.addParameter('object', _('Object'), '', false)
|
||||
.addParameter('behavior', _('Behavior'), 'Physics2Behavior')
|
||||
.addParameter('expression', _('Joint ID'))
|
||||
.useStandardOperatorParameters("number")
|
||||
.useStandardOperatorParameters('number')
|
||||
.getCodeExtraInformation()
|
||||
.setFunctionName('setWheelJointDampingRatio')
|
||||
.setGetter('getWheelJointDampingRatio');
|
||||
@@ -3253,7 +3268,7 @@ module.exports = {
|
||||
.addParameter('object', _('Object'), '', false)
|
||||
.addParameter('behavior', _('Behavior'), 'Physics2Behavior')
|
||||
.addParameter('expression', _('Joint ID'))
|
||||
.useStandardOperatorParameters("number")
|
||||
.useStandardOperatorParameters('number')
|
||||
.getCodeExtraInformation()
|
||||
.setFunctionName('setWeldJointFrequency')
|
||||
.setGetter('getWeldJointFrequency');
|
||||
@@ -3285,7 +3300,7 @@ module.exports = {
|
||||
.addParameter('object', _('Object'), '', false)
|
||||
.addParameter('behavior', _('Behavior'), 'Physics2Behavior')
|
||||
.addParameter('expression', _('Joint ID'))
|
||||
.useStandardOperatorParameters("number")
|
||||
.useStandardOperatorParameters('number')
|
||||
.getCodeExtraInformation()
|
||||
.setFunctionName('setWeldJointDampingRatio')
|
||||
.setGetter('getWeldJointDampingRatio');
|
||||
@@ -3360,7 +3375,7 @@ module.exports = {
|
||||
.addParameter('object', _('Object'), '', false)
|
||||
.addParameter('behavior', _('Behavior'), 'Physics2Behavior')
|
||||
.addParameter('expression', _('Joint ID'))
|
||||
.useStandardOperatorParameters("number")
|
||||
.useStandardOperatorParameters('number')
|
||||
.getCodeExtraInformation()
|
||||
.setFunctionName('setRopeJointMaxLength')
|
||||
.setGetter('getRopeJointMaxLength');
|
||||
@@ -3428,7 +3443,7 @@ module.exports = {
|
||||
.addParameter('object', _('Object'), '', false)
|
||||
.addParameter('behavior', _('Behavior'), 'Physics2Behavior')
|
||||
.addParameter('expression', _('Joint ID'))
|
||||
.useStandardOperatorParameters("number")
|
||||
.useStandardOperatorParameters('number')
|
||||
.getCodeExtraInformation()
|
||||
.setFunctionName('setFrictionJointMaxForce')
|
||||
.setGetter('getFrictionJointMaxForce');
|
||||
@@ -3460,7 +3475,7 @@ module.exports = {
|
||||
.addParameter('object', _('Object'), '', false)
|
||||
.addParameter('behavior', _('Behavior'), 'Physics2Behavior')
|
||||
.addParameter('expression', _('Joint ID'))
|
||||
.useStandardOperatorParameters("number")
|
||||
.useStandardOperatorParameters('number')
|
||||
.getCodeExtraInformation()
|
||||
.setFunctionName('setFrictionJointMaxTorque')
|
||||
.setGetter('getFrictionJointMaxTorque');
|
||||
@@ -3577,7 +3592,7 @@ module.exports = {
|
||||
.addParameter('object', _('Object'), '', false)
|
||||
.addParameter('behavior', _('Behavior'), 'Physics2Behavior')
|
||||
.addParameter('expression', _('Joint ID'))
|
||||
.useStandardOperatorParameters("number")
|
||||
.useStandardOperatorParameters('number')
|
||||
.getCodeExtraInformation()
|
||||
.setFunctionName('setMotorJointAngularOffset')
|
||||
.setGetter('getMotorJointAngularOffset');
|
||||
@@ -3609,7 +3624,7 @@ module.exports = {
|
||||
.addParameter('object', _('Object'), '', false)
|
||||
.addParameter('behavior', _('Behavior'), 'Physics2Behavior')
|
||||
.addParameter('expression', _('Joint ID'))
|
||||
.useStandardOperatorParameters("number")
|
||||
.useStandardOperatorParameters('number')
|
||||
.getCodeExtraInformation()
|
||||
.setFunctionName('setMotorJointMaxForce')
|
||||
.setGetter('getMotorJointMaxForce');
|
||||
@@ -3641,7 +3656,7 @@ module.exports = {
|
||||
.addParameter('object', _('Object'), '', false)
|
||||
.addParameter('behavior', _('Behavior'), 'Physics2Behavior')
|
||||
.addParameter('expression', _('Joint ID'))
|
||||
.useStandardOperatorParameters("number")
|
||||
.useStandardOperatorParameters('number')
|
||||
.getCodeExtraInformation()
|
||||
.setFunctionName('setMotorJointMaxTorque')
|
||||
.setGetter('getMotorJointMaxTorque');
|
||||
@@ -3673,7 +3688,7 @@ module.exports = {
|
||||
.addParameter('object', _('Object'), '', false)
|
||||
.addParameter('behavior', _('Behavior'), 'Physics2Behavior')
|
||||
.addParameter('expression', _('Joint ID'))
|
||||
.useStandardOperatorParameters("number")
|
||||
.useStandardOperatorParameters('number')
|
||||
.getCodeExtraInformation()
|
||||
.setFunctionName('setMotorJointCorrectionFactor')
|
||||
.setGetter('getMotorJointCorrectionFactor');
|
||||
@@ -3714,7 +3729,10 @@ module.exports = {
|
||||
return extension;
|
||||
},
|
||||
|
||||
runExtensionSanityTests: function(gd, extension) {
|
||||
runExtensionSanityTests: function (
|
||||
gd /*: libGDevelop */,
|
||||
extension /*: gdPlatformExtension*/
|
||||
) {
|
||||
return [];
|
||||
},
|
||||
};
|
||||
|
@@ -252,6 +252,75 @@ gdjs.Physics2RuntimeBehavior.prototype.b2Vec2Sec = function(x, y) {
|
||||
return this._tempb2Vec2Sec;
|
||||
};
|
||||
|
||||
gdjs.Physics2RuntimeBehavior.prototype.updateFromBehaviorData = function(oldBehaviorData, newBehaviorData) {
|
||||
if (oldBehaviorData.bullet !== newBehaviorData.bullet) {
|
||||
this.setBullet(newBehaviorData.bullet);
|
||||
}
|
||||
if (oldBehaviorData.fixedRotation !== newBehaviorData.fixedRotation) {
|
||||
this.setFixedRotation(newBehaviorData.fixedRotation);
|
||||
}
|
||||
if (oldBehaviorData.canSleep !== newBehaviorData.canSleep) {
|
||||
this.setSleepingAllowed(newBehaviorData.canSleep);
|
||||
}
|
||||
if (oldBehaviorData.shapeDimensionA !== newBehaviorData.shapeDimensionA) {
|
||||
this.shapeDimensionA = newBehaviorData.shapeDimensionA;
|
||||
this.recreateShape();
|
||||
}
|
||||
if (oldBehaviorData.shapeDimensionB !== newBehaviorData.shapeDimensionB) {
|
||||
this.shapeDimensionB = newBehaviorData.shapeDimensionB;
|
||||
this.recreateShape();
|
||||
}
|
||||
if (oldBehaviorData.shapeOffsetX !== newBehaviorData.shapeOffsetX) {
|
||||
this.shapeOffsetX = newBehaviorData.shapeOffsetX;
|
||||
this.recreateShape();
|
||||
}
|
||||
if (oldBehaviorData.shapeOffsetY !== newBehaviorData.shapeOffsetY) {
|
||||
this.shapeOffsetY = newBehaviorData.shapeOffsetY;
|
||||
this.recreateShape();
|
||||
}
|
||||
if (oldBehaviorData.polygonOrigin !== newBehaviorData.polygonOrigin) {
|
||||
this.polygonOrigin = newBehaviorData.polygonOrigin;
|
||||
this.recreateShape();
|
||||
}
|
||||
if (oldBehaviorData.density !== newBehaviorData.density) {
|
||||
this.setDensity(newBehaviorData.density);
|
||||
}
|
||||
if (oldBehaviorData.friction !== newBehaviorData.friction) {
|
||||
this.setFriction(newBehaviorData.friction);
|
||||
}
|
||||
if (oldBehaviorData.restitution !== newBehaviorData.restitution) {
|
||||
this.setRestitution(newBehaviorData.restitution);
|
||||
}
|
||||
if (oldBehaviorData.linearDamping !== newBehaviorData.linearDamping) {
|
||||
this.setLinearDamping(newBehaviorData.linearDamping);
|
||||
}
|
||||
if (oldBehaviorData.angularDamping !== newBehaviorData.angularDamping) {
|
||||
this.setAngularDamping(newBehaviorData.angularDamping);
|
||||
}
|
||||
if (oldBehaviorData.gravityScale !== newBehaviorData.gravityScale) {
|
||||
this.setGravityScale(newBehaviorData.gravityScale);
|
||||
}
|
||||
|
||||
// TODO: make these properties updatable.
|
||||
if (oldBehaviorData.layers !== newBehaviorData.layers) {
|
||||
return false;
|
||||
}
|
||||
if (oldBehaviorData.masks !== newBehaviorData.masks) {
|
||||
return false;
|
||||
}
|
||||
if (oldBehaviorData.vertices !== newBehaviorData.vertices) {
|
||||
return false;
|
||||
}
|
||||
if (oldBehaviorData.bodyType !== newBehaviorData.bodyType) {
|
||||
return false;
|
||||
}
|
||||
if (oldBehaviorData.shape !== newBehaviorData.shape) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
};
|
||||
|
||||
gdjs.Physics2RuntimeBehavior.prototype.onDeActivate = function() {
|
||||
if (this._body !== null) {
|
||||
// When a body is deleted, Box2D removes automatically its joints, leaving an invalid pointer in our joints list
|
||||
@@ -573,10 +642,21 @@ gdjs.Physics2RuntimeBehavior.prototype.doStepPreEvents = function(
|
||||
gdjs.Physics2RuntimeBehavior.prototype.doStepPostEvents = function(
|
||||
runtimeScene
|
||||
) {
|
||||
this._updateBodyFromObject();
|
||||
|
||||
// Reset world step to update next frame
|
||||
this._sharedData.stepped = false;
|
||||
};
|
||||
|
||||
gdjs.Physics2RuntimeBehavior.prototype.onObjectHotReloaded = function() {
|
||||
this._updateBodyFromObject();
|
||||
}
|
||||
|
||||
gdjs.Physics2RuntimeBehavior.prototype._updateBodyFromObject = function() {
|
||||
// If there is no body, set a new one
|
||||
if (this._body === null) this.createBody();
|
||||
|
||||
// GD object size has changed, recreate shape
|
||||
// The object size has changed, recreate the shape.
|
||||
// The width has changed and there is no custom dimension A (box: width, circle: radius, edge: length) or
|
||||
// The height has changed, the shape is not an edge (edges doesn't have height),
|
||||
// it isn't a box with custom height or a circle with custom radius
|
||||
@@ -586,12 +666,12 @@ gdjs.Physics2RuntimeBehavior.prototype.doStepPostEvents = function(
|
||||
(this._objectOldHeight !== this.owner.getHeight() &&
|
||||
this.shape !== 'Edge' &&
|
||||
!(this.shape === 'Box' && this.shapeDimensionB > 0) &&
|
||||
!(this.shape === 'Ciecle' && this.shapeDimensionA > 0))
|
||||
!(this.shape === 'Circle' && this.shapeDimensionA > 0))
|
||||
) {
|
||||
this.recreateShape();
|
||||
}
|
||||
|
||||
// GD object transform has changed, update body transform
|
||||
// The object object transform has changed, update body transform:
|
||||
if (
|
||||
this._objectOldX !== this.owner.getX() ||
|
||||
this._objectOldY !== this.owner.getY() ||
|
||||
@@ -606,10 +686,7 @@ gdjs.Physics2RuntimeBehavior.prototype.doStepPostEvents = function(
|
||||
this._body.SetTransform(pos, gdjs.toRad(this.owner.getAngle()));
|
||||
this._body.SetAwake(true);
|
||||
}
|
||||
|
||||
// Reset world step to update next frame
|
||||
this._sharedData.stepped = false;
|
||||
};
|
||||
}
|
||||
|
||||
gdjs.Physics2RuntimeBehavior.prototype.getGravityX = function() {
|
||||
return this._sharedData.gravityX;
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user