Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Tween extension #922

Closed
wants to merge 94 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
94 commits
Select commit Hold shift + click to select a range
f214565
Merge pull request #1 from 4ian/master
Wend1go Jan 23, 2019
6d17ebf
Merge pull request #2 from 4ian/master
Wend1go Jan 27, 2019
891ca20
Initial commit
Feb 3, 2019
6d5164f
Declare actions/conditions/expressions on the behavior instead of the…
Feb 4, 2019
45a193d
Add X,Y / Size,Width,Height / Angle tween functions
Feb 5, 2019
e25fc9a
Merge pull request #3 from 4ian/master
Wend1go Feb 7, 2019
89c906a
Merge branch 'master' of https://github.com/Wend1go/GDevelop into twe…
Feb 7, 2019
596c7bd
Fix typos
Feb 7, 2019
cfec5b7
Merge pull request #4 from 4ian/master
Wend1go Feb 9, 2019
cf79b8f
Merge branch 'master' into tween_extension
Feb 9, 2019
09ecc5a
Add opacity tween animation
Feb 9, 2019
8625d66
Store tween reference in a variable to recuce function calls
Feb 9, 2019
f85b0ca
Replace let by var in tween reference variables
Feb 9, 2019
cd621a1
Apply fixes from review
Feb 14, 2019
b7eed83
Add Tween - test project
Feb 14, 2019
a57cd8a
Add getColor to spriteruntimeobject-pixi-renderer.js and spriteruntim…
Feb 14, 2019
c9c2a8d
Add colour tween to test project
Feb 14, 2019
01177d1
Update addColorTween function
Feb 14, 2019
d52a42a
Fix regex check for correct color string in addObjectColorTween
Feb 16, 2019
edbe462
Add check for correct easing strings
Feb 16, 2019
09fe008
Merge pull request #5 from 4ian/master
Wend1go Feb 17, 2019
c07b3f2
Merge branch 'master' into tween_extension
Feb 17, 2019
e240538
Replace t("") with _("") for translateable strings in JsExtension.js
Feb 17, 2019
d37ef30
Update Howler to 2.1.1 (#939)
zatsme Feb 17, 2019
93326c5
Change "t" to "_" in createExtension
Feb 17, 2019
c3d6c97
Add subfolders for addXXXTween actions
Feb 17, 2019
40de623
Fix uncaught rejected promise
4ian Feb 18, 2019
be950a7
Add pseudolocalization (fake language) to detect hardcoded strings
4ian Feb 18, 2019
72282d4
Show instance variables in panel + inherited object variables + fix c…
blurymind Feb 19, 2019
9a7c5ea
Fix edition button for children variables
4ian Feb 19, 2019
63b581b
Remove unused properties from JsExtension.js
Feb 21, 2019
f032b1b
Remove double group name in conditions/actions editor
Feb 21, 2019
7d1bd0b
Remove shifty.js license from addIncludeFile
Feb 21, 2019
aac8782
Replace redundant easing lists by a constant
Feb 21, 2019
7fa1e50
Fix typos
4ian Feb 22, 2019
ec0b934
Add VideoResource
4ian Feb 22, 2019
0fdf123
Improve Flow typing and fix tests
4ian Feb 23, 2019
5ff045d
Fix Prettier
4ian Feb 23, 2019
0cc4543
Add support for "resource" property and field in PropertiesEditor
4ian Feb 23, 2019
20ce83c
Add image resource to the dummy example object
4ian Feb 23, 2019
bc468d6
Protect against running "step" on deleted tweens
4ian Feb 23, 2019
5a44fd8
Fix wording in Particle actions/conditions
4ian Feb 24, 2019
76d2972
Update Shifty.js (with the new processTweens export)
4ian Feb 26, 2019
756157b
Manually control Shifty.js tween processing
4ian Feb 26, 2019
505ec78
Update test game - remove explicit "remove the tween" actions
Feb 26, 2019
c9906fd
Add catch to resume tween promise
Feb 27, 2019
460b96f
add catch to then promises
Feb 27, 2019
0c8560e
Separate languages in LanguageDialog according to progress
4ian Feb 28, 2019
af9ab09
Make some tooltips translatable
4ian Feb 28, 2019
0c2d58e
Make "Downhill Bike Racing" a starter
4ian Feb 28, 2019
3166daf
Fix a bunch of mistakes/typos
4ian Feb 28, 2019
ac2867f
Fix Prettier
4ian Feb 28, 2019
e100b6f
Add support for translations in Main menu
4ian Mar 2, 2019
fc7c092
Exclude some files from the i18n coverage script
4ian Mar 2, 2019
2ce1c56
Improve translation coverage and fix BrowserPreviewLinkDialog
4ian Mar 2, 2019
8d57aa5
Update translations and add translation support to LinkEvent
4ian Mar 2, 2019
b57316b
Fix Storybook build (babel stuck by locales large file) and add langu…
4ian Mar 2, 2019
14b00c3
Rework calculation of current process
Mar 2, 2019
808721a
Update newIDE Pixi.js to version 4.8.6
4ian Mar 2, 2019
edecc01
Clean folder when importing GDJS Runtime files in newIDE
4ian Mar 2, 2019
acc34e8
Add hint and differentiate buttons between string/number expression f…
4ian Mar 2, 2019
34c25a7
Rework getProgress again to use getTimeFromStart
Mar 3, 2019
c4bb03d
Revert to Pixi.js 3.0.11 for the IDE - will upgrade properly later
4ian Mar 3, 2019
175e12b
Allow both "Center" and "Centre" for Center point in expressions (#955)
zatsme Mar 5, 2019
afe9d18
Button to open the events function editor from instruction editor
4ian Mar 6, 2019
f5827d4
Add missing translation in InstructionParametersEditor
4ian Mar 7, 2019
aaeaa83
Fix Prettier
4ian Mar 7, 2019
c31de12
Add max displayed rows number in TextEditor to avoid dialog mis posit…
4ian Mar 7, 2019
96674f3
Fix click while renaming project item and warning when name is not ch…
4ian Mar 7, 2019
4fb27b6
Don't mark Algolia as translatable
4ian Mar 7, 2019
b36cb17
Fix Prettier
4ian Mar 7, 2019
816513a
Fix wrong merging of some duplicated translations and update translat…
4ian Mar 7, 2019
d0a2491
Fix wrong forbidden characters in translations
4ian Mar 7, 2019
94ea44b
Update shifty.js to 2.7.2
Mar 9, 2019
80bd2ef
Add text object character size tween
Mar 9, 2019
f769a1c
Update test project to add text character size tween
Mar 9, 2019
e2c7898
Add 'getColor' method to textruntimeobject.js to enable colour tweens…
Mar 9, 2019
1c0fd2e
[WIP] (de)activation of tween behaviour
Mar 9, 2019
fa02274
Make warnings about instruction/behaviors translatable
4ian Mar 9, 2019
6c629f6
Add performance warning for text object character size action
4ian Mar 9, 2019
2544c71
Fix Flow
4ian Mar 10, 2019
29f7501
Add button to "Open Project Folder" in Resources Editor (#968)
Bouh Mar 10, 2019
3e822e4
Remove useless minus sign
4ian Mar 11, 2019
72a61be
Add button to report wrong translation
4ian Mar 11, 2019
7281881
Update forum links
4ian Mar 11, 2019
0d965fc
Merge branch 'master' of github.com:4ian/GDevelop
4ian Mar 11, 2019
e288414
Update translations
4ian Mar 11, 2019
3dae2c5
Add geodash example and betabox-basics-learning-experience
4ian Mar 11, 2019
137a23b
Bump newIDE version
4ian Mar 11, 2019
3cf8a8e
Add callbacks for when a gdjs.RuntimeScene is paused/resumed
4ian Mar 14, 2019
664744f
Merge branch 'tween_extension' of https://github.com/Wend1go/GDevelop…
4ian Mar 14, 2019
8d6b05f
Update Shifty to 2.7.4-alpha.2
4ian Mar 14, 2019
b12b2c0
Use shifty.Scene to group tweens by scenes and pause/resume them
4ian Mar 15, 2019
bb847cb
Update example to add keys to start/stop scenes
4ian Mar 15, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 1 addition & 1 deletion Core/GDCore/Extensions/Builtin/MouseExtension.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsMouseExtension(
.AddCodeOnlyParameter("currentScene", "")
.AddParameter("expression", _("Touch identifier"))
.AddParameter("relationalOperator", _("Sign of the test"))
.AddParameter("expression", _("X position"))
.AddParameter("expression", _("Y position"))
.AddParameter("layer", _("Layer (base layer if empty)"), "", true)
.SetDefaultValue("\"\"")
.AddParameter("expression", _("Camera number (default : 0)"), "", true)
Expand Down
24 changes: 24 additions & 0 deletions Core/GDCore/Project/ResourcesManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,8 @@ std::shared_ptr<Resource> ResourcesManager::CreateResource(
return std::make_shared<AudioResource>();
else if (kind == "font")
return std::make_shared<FontResource>();
else if (kind == "video")
return std::make_shared<VideoResource>();

std::cout << "Bad resource created (type: " << kind << ")" << std::endl;
return std::make_shared<Resource>();
Expand Down Expand Up @@ -590,6 +592,28 @@ void FontResource::SerializeTo(SerializerElement& element) const {
}
#endif

void VideoResource::SetFile(const gd::String& newFile) {
file = newFile;

// Convert all backslash to slashs.
while (file.find('\\') != gd::String::npos)
file.replace(file.find('\\'), 1, "/");
}

void VideoResource::UnserializeFrom(const SerializerElement& element) {
SetUserAdded(element.GetBoolAttribute("userAdded"));
SetFile(element.GetStringAttribute("file"));
}

#if defined(GD_IDE_ONLY)
void VideoResource::SerializeTo(SerializerElement& element) const {
element.SetAttribute("userAdded", IsUserAdded());
element.SetAttribute(
"file", GetFile()); // Keep the resource path in the current locale (but
// save it in UTF8 for compatibility on other OSes)
}
#endif

#if defined(GD_IDE_ONLY)
ResourceFolder::ResourceFolder(const ResourceFolder& other) { Init(other); }

Expand Down
28 changes: 28 additions & 0 deletions Core/GDCore/Project/ResourcesManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,34 @@ class GD_CORE_API FontResource : public Resource {
gd::String file;
};

/**
* \brief Describe a video file used by a project.
*
* \see Resource
* \ingroup ResourcesManagement
*/
class GD_CORE_API VideoResource : public Resource {
public:
VideoResource() : Resource() { SetKind("video"); };
virtual ~VideoResource(){};
virtual VideoResource* Clone() const override {
return new VideoResource(*this);
}

virtual const gd::String& GetFile() const override { return file; };
virtual void SetFile(const gd::String& newFile) override;

#if defined(GD_IDE_ONLY)
virtual bool UseFile() override { return true; }
void SerializeTo(SerializerElement& element) const override;
#endif

void UnserializeFrom(const SerializerElement& element) override;

private:
gd::String file;
};

/**
* \brief Inventory all resources used by a project
*
Expand Down
22 changes: 18 additions & 4 deletions Extensions/ExampleJsExtension/JsExtension.js
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,10 @@ module.exports = {
objectContent.property3 = newValue;
return true;
}
if (propertyName === "myImage") {
objectContent.myImage = newValue;
return true;
}

return false;
};
Expand All @@ -257,14 +261,24 @@ module.exports = {
"number"
)
);
objectProperties.set(
"myImage",
new gd.PropertyDescriptor(objectContent.myImage)
.setType("resource")
.addExtraInfo("image")
.setLabel(
_("Image resource (won't be shown, just for demonstration purpose)")
)
);

return objectProperties;
};
dummyObject.setRawJSONContent(
JSON.stringify({
property1: "Hello world",
property2: true,
property3: 123
property3: 123,
myImage: ""
})
);

Expand Down Expand Up @@ -377,7 +391,7 @@ module.exports = {
},
/**
* Register editors for objects.
*
*
* ℹ️ Run `node import-GDJS-Runtime.js` (in newIDE/app/scripts) if you make any change.
*/
registerEditorConfigurations: function(objectsEditorService) {
Expand All @@ -388,7 +402,7 @@ module.exports = {
},
/**
* Register renderers for instance of objects on the scene editor.
*
*
* ℹ️ Run `node import-GDJS-Runtime.js` (in newIDE/app/scripts) if you make any change.
*/
registerInstanceRenderers: function(objectsRenderingService) {
Expand Down Expand Up @@ -463,7 +477,7 @@ module.exports = {
this._pixiObject.rotation = RenderedInstance.toRad(
this._instance.getAngle()
);
// Custom size can be read in instance.getCustomWidth() and
// Custom size can be read in instance.getCustomWidth() and
// instance.getCustomHeight()
};

Expand Down
2 changes: 1 addition & 1 deletion Extensions/FacebookInstantGames/JsExtension.js
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ module.exports = {
.addCondition(
"AreAdsSupported",
_("Check if ads are supported"),
_("Check if showind ads is supported on this device (only mobile phones can show ads)"),
_("Check if showing ads is supported on this device (only mobile phones can show ads)"),
_("Ads can be shown on this device"),
_("Facebook Instant Games/Ads"),
"JsPlatform/Extensions/facebookicon24.png",
Expand Down
24 changes: 12 additions & 12 deletions Extensions/ParticleSystem/ExtensionSubDeclaration1.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -322,9 +322,9 @@ void ExtensionSubDeclaration1(gd::ObjectMetadata& obj) {
.SetManipulatedType("number");

obj.AddAction("ParticleGravityX",
_("X Gravity"),
_("Gravity value on X axis"),
_("Change value of the gravity on X axis."),
_("Do _PARAM1__PARAM2_ to the direction of gravity on X axis "
_("Do _PARAM1__PARAM2_ to the value of gravity on X axis "
"of _PARAM0_"),
_("Advanced"),
"CppPlatform/Extensions/particleSystemicon24.png",
Expand All @@ -336,9 +336,9 @@ void ExtensionSubDeclaration1(gd::ObjectMetadata& obj) {

obj.AddCondition(
"ParticleGravityX",
_("Direction of gravity on X axis"),
_("Direction of the gravity on X axis."),
_("Direction of gravity on X axis of _PARAM0_ is _PARAM1__PARAM2_"),
_("Gravity value on X axis"),
_("Compare value of the gravity on X axis."),
_("Value of gravity on X axis of _PARAM0_ is _PARAM1__PARAM2_"),
_("Advanced"),
"CppPlatform/Extensions/particleSystemicon24.png",
"CppPlatform/Extensions/particleSystemicon16.png")
Expand All @@ -348,10 +348,10 @@ void ExtensionSubDeclaration1(gd::ObjectMetadata& obj) {
.SetManipulatedType("number");

obj.AddAction("ParticleGravityY",
_("Y Gravity"),
_("Gravity value on Y axis"),
_("Change value of the gravity on Y axis."),
_("Do _PARAM1__PARAM2_ to the direction of gravity on Y axis "
"of_PARAM0_"),
_("Do _PARAM1__PARAM2_ to the value of gravity on Y axis "
"of _PARAM0_"),
_("Advanced"),
"CppPlatform/Extensions/particleSystemicon24.png",
"CppPlatform/Extensions/particleSystemicon16.png")
Expand All @@ -362,9 +362,9 @@ void ExtensionSubDeclaration1(gd::ObjectMetadata& obj) {

obj.AddCondition(
"ParticleGravityY",
_("Direction of the gravity on Y axis"),
_("Test direction of gravity on Y axis"),
_("Direction of gravity on Y axis of _PARAM0_ is _PARAM1__PARAM2_"),
_("Gravity value on Y axis"),
_("Compare value of the gravity on Y axis."),
_("Value of gravity on Y axis of _PARAM0_ is _PARAM1__PARAM2_"),
_("Advanced"),
"CppPlatform/Extensions/particleSystemicon24.png",
"CppPlatform/Extensions/particleSystemicon16.png")
Expand Down Expand Up @@ -413,7 +413,7 @@ void ExtensionSubDeclaration1(gd::ObjectMetadata& obj) {

obj.AddCondition("ParticleGravityAngle",
_("Gravity angle"),
_("Test the gravity angle the emitter"),
_("Test the gravity angle of the emitter"),
_("Gravity angle of _PARAM0_ is _PARAM1__PARAM2_"),
_("Common"),
"CppPlatform/Extensions/particleSystemicon24.png",
Expand Down
4 changes: 2 additions & 2 deletions Extensions/PathfindingBehavior/Extension.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,7 @@ void DeclarePathfindingBehaviorExtension(gd::PlatformExtension& extension) {

aut.AddAction(
"AllowDiagonals",
_("Diagonals moves"),
_("Diagonal movement"),
_("Allow or restrict diagonal movement on the path"),
_("Allow diagonal movement for _PARAM0_ on the path: _PARAM2_"),
_("Path"),
Expand All @@ -372,7 +372,7 @@ void DeclarePathfindingBehaviorExtension(gd::PlatformExtension& extension) {
.SetIncludeFile("PathfindingBehavior/PathfindingBehavior.h");

aut.AddCondition("DiagonalsAllowed",
_("Diagonals moves"),
_("Diagonal movement"),
_("Return true if the object is allowed to move "
"diagonally on the path"),
_("Diagonal moves allowed for _PARAM0_"),
Expand Down
7 changes: 7 additions & 0 deletions Extensions/TextObject/textruntimeobject.js
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,13 @@ gdjs.TextRuntimeObject.prototype.setColor = function(str) {
this._renderer.updateStyle();
};

/**
* Get the text color.
* @return {String} The color as a "R;G;B" string, for example: "255;0;0"
*/
gdjs.TextRuntimeObject.prototype.getColor = function(str) {
return this._color[0] + ";" + this._color[1] + ";" + this._color[2];
};

/**
* Return true if word wrapping is enabled for the text.
Expand Down
4 changes: 2 additions & 2 deletions Extensions/TopDownMovementBehavior/Extension.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -361,7 +361,7 @@ void DeclareTopDownMovementBehaviorExtension(gd::PlatformExtension& extension) {
.SetIncludeFile("TopDownMovementBehavior/TopDownMovementBehavior.h");

aut.AddAction("AllowDiagonals",
_("Diagonals moves"),
_("Diagonal movement"),
_("Allow or restrict diagonal movemment"),
_("Allow diagonal moves for _PARAM0_: _PARAM2_"),
_("Movement"),
Expand All @@ -374,7 +374,7 @@ void DeclareTopDownMovementBehaviorExtension(gd::PlatformExtension& extension) {
.SetIncludeFile("TopDownMovementBehavior/TopDownMovementBehavior.h");

aut.AddCondition("DiagonalsAllowed",
_("Diagonals moves"),
_("Diagonal movement"),
_("Return true if the object is allowed to move diagonally"),
_("Allow diagonal moves for _PARAM0_"),
_("Movement"),
Expand Down
Loading