Compare commits

..

401 Commits

Author SHA1 Message Date
Florian Rival
11ac1be195 Update translations 2016-10-31 23:36:32 +01:00
Florian Rival
f1509cf7b8 Bump version 2016-10-16 00:03:40 +02:00
Florian Rival
612ea7f067 Fix crash when changing scene in external layout editor on OS X 2016-10-15 19:09:26 +02:00
Florian Rival
fa3399f7d2 Fix InitialInstancesContainer::RemoveInstance and harden test (#303) 2016-10-07 13:57:08 +02:00
Florian Rival
296a2ae345 Merge pull request #300 from victorlevasseur/no_shared_ptr
Manage gd::Object, gd::Layout, gd::ExternalEvents, gd::ExternalLayout and gd::SourceFile with std::unique_ptr
2016-10-02 17:20:07 +02:00
Victor Levasseur
0c7c841aab Use unique_ptr to store gd::SourceFile 2016-09-19 00:15:37 +02:00
Victor Levasseur
ce7b0bfe85 Merge remote-tracking branch 'upstream/master' into no_shared_ptr 2016-09-18 19:15:21 +02:00
Victor Levasseur
affdbbead8 Store external events and layouts using unique_ptr instead of shared_ptr 2016-09-18 19:13:05 +02:00
Florian Rival
6ac34ee7e3 Update translations 2016-09-18 16:22:50 +02:00
Florian Rival
e07b9ae942 Merge pull request #299 from victorlevasseur/improve-code
Improve various part of the codebase
2016-09-18 15:38:34 +02:00
Victor Levasseur
ac57c1e25a Fix gd::Project::Insert(New)Layout 2016-09-18 15:25:28 +02:00
Victor Levasseur
3f3b619cd2 Merge branch 'improve-code' into no_shared_ptr 2016-09-18 14:02:40 +02:00
Victor Levasseur
6a92872fd0 Use conditions to avoid crash with invalid camera number 2016-09-18 13:58:45 +02:00
Victor Levasseur
be38240eee Revert "Fix crash when using a wrong camera number"
This reverts commit 2ff461f3b1.
2016-09-18 13:49:24 +02:00
Victor Levasseur
1bf86461f0 Use std::vector<std::unique_ptr> to store objects in gd::Project 2016-09-18 13:45:45 +02:00
Victor Levasseur
2ff461f3b1 Fix crash when using a wrong camera number 2016-09-16 19:14:31 +02:00
Victor Levasseur
e88701df92 Use std::iter_swap to spaw objects in vectors 2016-09-16 18:39:20 +02:00
Victor Levasseur
5aa30efa52 Improve InitialInstancesContainer code
Add tests for InitialInstancesContainer
2016-09-14 11:52:40 +02:00
Victor Levasseur
0ac9f8720b Rename EventsCodeGeneratorContext test to EventsCodeGenerationContext 2016-09-13 17:00:02 +02:00
Victor Levasseur
82684041ff Use std::copy instead of loops in EventsCodeGenerationContext
Add test cases for EventsCodeGenerationContext
2016-09-13 01:12:26 +02:00
Florian Rival
85867a53a9 Avoid allocation when creating a gdjs.SpriteRuntimeObject 2016-09-11 22:46:35 +02:00
Florian Rival
0e21c757d2 Merge pull request #297 from victorlevasseur/master
Expand/Collapse instructions categories when user clicks on them
2016-09-11 19:27:26 +03:00
Florian Rival
cc4e48d82f Fix name of pasted scenes/external events/layouts having an extra space 2016-09-11 18:10:41 +02:00
Victor Levasseur
fa1861da27 Expand/Collapse instructions categories when user clicks on them 2016-09-11 14:06:10 +02:00
Victor Levasseur
3533608cb0 Updated LinkEvent editor with support for including groups (#287)
* LinkEvent can now includes an events group
* New editor for LinkEvent
* Fix events groups not always included by the link event
2016-09-06 08:47:12 +02:00
Victor Levasseur
d22a183078 Optimize Hitboxes collision testing for "big" objects (#289)
* Add a new GetHitBox method to get polygons inside an hint AABB

* Add GetAABB method to RuntimeObject and use it as an hint for collision

* Use GetHitbox with hint inside SeparateFromObjects

* Remove debug outputs in TileMapObject
2016-09-05 22:53:56 +02:00
Florian Rival
771a2196ea Merge pull request #292 from victorlevasseur/bugfix/heap-corruptions
Fix array deleted with delete instead of delete[]
2016-08-21 14:36:41 +02:00
Victor Levasseur
60ada8d94f Fix array deleted with delete instead of delete[]
Potentially causing an undefined behavior
2016-08-21 02:01:45 +02:00
Florian Rival
ee868546d3 Merge pull request #291 from 4ian/fix/code-generation
Fix code generation when multiple scenes link to the same events
2016-08-20 17:19:01 +02:00
Florian Rival
526fdd852f Improve a bit const-correctness of EventsCodeGenerator 2016-08-20 17:10:47 +02:00
Florian Rival
cc84aa5478 Fix code generation when multiple scenes used the same events.
Code generation was modifying the events in place. If two or more scenes
used the same events, the events could be modified for a scene during code
generation, leading to a bad code generation for the others.

(In particular, if a scene was not containing an object, any action related to it
would be set an action with an empty type. Any other scene using the action will then
have the action not working).
2016-08-20 16:19:24 +02:00
Florian Rival
8c613ed6a3 Merge pull request #290 from 4ian/feature/inventory
This includes a new small extension to store an inventory with items in memory, to avoid re-implementing this classic game element by hand using events. Items number can be limited, unlimited, marked as equipped.

The PR also includes a few improvements to the JS game engine to avoid garbage creation and fix compilation on OS X 10.11 ("El Capitan").
2016-08-20 16:12:08 +02:00
Florian Rival
1e2cf210b5 Merge pull request #286 from victorlevasseur/bugfix/heap-corruptions
Bugfix/heap corruptions
2016-08-20 12:52:37 +02:00
Florian Rival
422132d8c7 Avoid allocations in gdjs.RuntimeObject.getRendererObject and gdjs.evtTools.object.pickObjectsIf 2016-08-15 19:54:01 +02:00
Florian Rival
4830e6b5bc Reworked gdjs.Polygon.collisionTest to avoid allocations 2016-08-15 18:03:07 +02:00
Florian Rival
fc2fe9e1eb Reworked gdjs.evtTools.object.twoListsTest and Array.prototype.createFrom to avoid allocations 2016-08-14 19:33:43 +02:00
Florian Rival
682efcbfdc Avoid allocation in gdjs.PlatformerObjectRuntimeBehavior and add TODO where allocations should be removed 2016-08-14 18:59:42 +02:00
Florian Rival
e4c6f2dd0c Avoid allocations in gdjs.RuntimeScene and gdjs.SpriteRuntimeObject 2016-08-12 21:04:40 +02:00
Florian Rival
cbc0a6bf2b Add Inventory extension icons 2016-08-10 21:54:44 +02:00
Florian Rival
982fd4cc67 Add serialization of inventories for Javascript platform 2016-08-10 00:11:47 +02:00
Florian Rival
f33f361e45 Add serialization of inventories to variables for native games 2016-08-09 00:17:12 +02:00
Victor Levasseur
be72d44a4d Fix CppEvent editor adding empty line to the includes (#284) 2016-08-08 22:15:57 +02:00
Victor Levasseur
7e9a2e40aa Merge pull request #283 from victorlevasseur/master
Remove useless files (SPARK doc, Box2D doc, dlib doc)
2016-08-08 18:57:29 +02:00
Victor Levasseur
bc5349fd26 Remove useless files (SPARK doc, Box2D doc, dlib doc) 2016-08-08 18:45:51 +02:00
Victor Levasseur
9131b6a143 Fix out of bound access in FlatAuiTabArt.cpp 2016-08-08 18:17:34 +02:00
Victor Levasseur
6fc8d1cf97 Fix heap corruption with link events 2016-08-08 12:09:06 +02:00
Florian Rival
51c172f4d5 Fix compilation on Windows 2016-08-07 22:26:41 +02:00
Florian Rival
116e7cfe25 Implement Inventory for native games 2016-08-07 22:26:41 +02:00
Florian Rival
d70204b24c Fix compilation on OS X 10.11 by removing deprecated GLU calls 2016-08-07 22:26:41 +02:00
Florian Rival
edae3892ca Rework gdjs.TimeManager to avoid using Date.now() 2016-08-07 22:26:41 +02:00
Florian Rival
b3b39ab468 Remove gdjs.iterateOverArray and replace its usage by raw loops 2016-08-07 22:26:41 +02:00
Florian Rival
4699e161e4 Add Inventory extension (JS platform only for now) 2016-08-07 22:26:41 +02:00
Florian Rival
be3ae5802d Add support for adding multiple include files for instructions 2016-08-07 22:26:41 +02:00
Florian Rival
097508829a Merge pull request #278 from 4ian/feature/anchor-behavior-js
Implement AnchorBehavior for the Javascript Platform
2016-08-02 17:31:30 +02:00
Victor Levasseur
1eac74c12c Merge branch 'release/gd-4.0.93' 2016-08-01 14:45:20 +02:00
Victor Levasseur
af8d2fc5d8 Fix linking failing when GDevelop is installed in a path containing spaces 2016-08-01 14:33:59 +02:00
Florian Rival
2ae5f01836 Add an option to AnchorBehavior to position objects according to the original game window size
The option is activated by default, so that the distance to the edges are the same as the one
in the editor, even when the game size has been changed.
2016-07-27 01:14:16 +02:00
Florian Rival
a1fa6dad15 Implement AnchorBehavior for the Javascript Platform 2016-07-25 23:23:30 +02:00
Florian Rival
7d8178c2e5 Fix an anchor behavior issue with right edge 2016-07-24 20:58:27 +02:00
Florian Rival
70a35c11c2 Fix anchor behavior not always properly applying bottom/right edges and warnings 2016-07-24 18:13:50 +02:00
Victor Levasseur
d7c897b488 Anchor behavior for native games (#275)
* Add AnchorBehavior

* Improve the AnchorBehavior

* Add an icon to the AnchorBehavior

* Code cleaning in AnchorBehavior

* Add more icons for the AnchorBehavior
2016-07-24 15:45:09 +02:00
Florian Rival
d12924daaf Merge pull request #277 from Wend1go/variable_child_count
Add expression to retrieve the number of subitems from a structure variable (native & js)
2016-07-22 14:09:58 +02:00
Wend1go
2d3cdcdde8 Retrieve number of subitems from variable/structure (native/js)
- global variables (expression)
- scene variables  (expression)
- object variables (expression)
2016-07-22 09:07:49 +02:00
Florian Rival
5ab601e8e6 Add SystemInfo extension with isMobile condition 2016-07-17 18:33:24 +02:00
Florian Rival
5c66a37406 Merge pull request #274 from victorlevasseur/loading-optimization
Texture loading optimization
2016-07-17 15:13:26 +02:00
Florian Rival
cfa161f763 Fix music looping in HTML5 game and update Howler.js to latest version 2016-07-17 14:32:13 +02:00
Florian Rival
84c8efffa3 Fix compilation on OS X 2016-07-16 15:13:01 +02:00
Florian Rival
a4e2a3e8f1 Merge branch 'master' of github.com:4ian/GD 2016-07-16 13:24:44 +02:00
Florian Rival
73984d7cfc Fix loading stored values set to 0/empty string in HTML5 games 2016-07-16 13:24:28 +02:00
Victor Levasseur
327a3b05b8 Load the sf::Image and then load the sf::Texture from it (avoids an image copy) 2016-07-15 18:36:26 +02:00
Victor Levasseur
a9e5790d78 Avoid sf::Texture copy when loading them 2016-07-15 18:10:50 +02:00
Florian Rival
a544666ea4 Merge pull request #271 from RandomShaper/fix-manifest-side-effects
Fix side effects of too broad Windows targeting in the manifest for high contrast theme support
2016-07-13 14:01:13 +02:00
Florian Rival
d0ca9cac54 Merge pull request #273 from victorlevasseur/bugfix/gcc_6
Some fixes for GCC6 and Fedora 24
2016-07-13 13:56:34 +02:00
Victor Levasseur
d0910e3e6f Set the RPATH of compiled files when previewing the game 2016-07-12 12:24:18 +02:00
Victor Levasseur
4018353d50 Some fix for GCC6 and Fedora 24 2016-07-12 11:34:14 +02:00
Florian Rival
6388e6a914 Add Lil BUB's HELLO EARTH game links 2016-07-05 01:02:55 +02:00
Pedro J. Estébanez
4f144f7532 Fix side effects of too broad Windows targeting 2016-07-04 19:25:30 +02:00
Victor Levasseur
82a7c3048f Revert "Provide compatibility with Windows high contrast themes"
This reverts commit 91cfff6e84.
The updated manifest caused some bugs with the text object editor
2016-07-03 23:08:04 +02:00
Florian Rival
8daa0354e1 Merge branch 'master' of github.com:4ian/GD 2016-07-02 19:11:53 +02:00
Florian Rival
f26357c9b8 Fix platformer objects stuck in floor when resized when the origin is not at the top left of the object 2016-07-02 18:30:51 +02:00
Florian Rival
4110c38c10 Update gdupdate-info*.xml files 2016-07-02 18:30:18 +02:00
Florian Rival
084f8fbe72 Fix compilation of IDE on Windows 2016-06-28 23:54:07 +02:00
Florian Rival
db074c7f57 Bump version 2016-06-27 23:54:39 +02:00
Florian Rival
5b1fed4d9e Merge pull request #269 from 4ian/feature/layers-effects
Layers effects for the JS engine (Pixi.js & Cocos2d-JS)
2016-06-24 00:09:29 +02:00
Florian Rival
447106b7fb Merge pull request #270 from RandomShaper/windows-high-contrast-compat
Provide compatibility with Windows high contrast themes
2016-06-23 23:35:37 +02:00
Pedro J. Estébanez
91cfff6e84 Provide compatibility with Windows high contrast themes
By providing a manifest specifying the targeted Windows versions (as per https://msdn.microsoft.com/en-us/library/windows/desktop/hh404233(v=vs.85).aspx#_______supporting_high_contrast_themes_in_windows_8_and_later) now scene renders normally under a high contrast theme on Windows, instead of staying unrefreshed.
2016-06-23 23:30:51 +02:00
Florian Rival
db3a107e0f Fix GDJS unit tests 2016-06-23 23:16:21 +02:00
Florian Rival
23dab62ad5 Add partial support for Cocos2d-JS fileUtils, deactivated for now 2016-06-23 23:01:26 +02:00
Florian Rival
3dd5c0f997 Fix localStorage with Cocos2d-JS 2016-06-13 23:12:03 +02:00
Florian Rival
517ef5fc57 Make open URL action compatible with Cocos2d-JS 2016-06-12 01:30:47 +02:00
Florian Rival
1d539968bb Unfold events when highlighting an event in SearchEvents dialog 2016-06-07 22:22:56 +02:00
Florian Rival
4879bfe1b1 Added LightNight effect and action to change effect parameters 2016-06-04 18:20:36 +02:00
Florian Rival
e83d2a2b48 Add support for effects for HTML5 games (Pixi.js and Cocos2d-JS renderers)
Two effects are hardcoded for now
2016-06-02 01:05:14 +02:00
Florian Rival
cd84f6c43c Add gd::Effect and allow one effect to be added to layers 2016-06-01 00:38:56 +02:00
Florian Rival
7bcc3dc6bb Use the properties grid for editing layers properties and cameras, deleted EditLayerDialog 2016-05-28 22:08:20 +02:00
Florian Rival
1a995ba55c Add support for Cocos2d-JS localStorage 2016-05-28 14:44:26 +02:00
Florian Rival
622fcdcc62 Fix compilation on OS X 2016-05-26 21:06:00 +02:00
Florian Rival
b933ab24dd Merge pull request #267 from 4ian/feature/platformer-grab-platforms
Feature/platformer grab platforms
2016-05-26 20:57:44 +02:00
Florian Rival
7fe4a5c5ff Add unit test for platform ledge grabbing for the JS engine 2016-05-23 23:50:31 +02:00
Victor Levasseur
3b36e16256 Fix "°" encoding in the initial instances dialog 2016-05-18 00:19:20 +02:00
Florian Rival
b620737b18 Rework platform ledge grabbing mechanism 2016-05-16 22:31:33 +02:00
Florian Rival
bcb9b03eab Fix missing Release key handling in platformer "Simulate key press" action 2016-05-15 17:36:24 +02:00
Florian Rival
e20f66909e Implement platform ledges grabbing for native games 2016-05-15 17:36:24 +02:00
Florian Rival
667d0a1f4a Add options to allow ledged grab on platform/platformer behaviors + test game 2016-05-15 17:36:24 +02:00
Florian Rival
de9d6bd103 [WIP] Allow to release the grabbed platform with down key 2016-05-15 17:36:24 +02:00
Florian Rival
ba625133f1 [WIP] Rework platform grabbing to avoid issues with floor and rescaled sprites (and avoid relying on object.getX/getY) 2016-05-15 17:36:24 +02:00
Florian Rival
44ce216894 [WIP] Add ability for platformer objects to grab platforms
TODO: Add a testbed in GDJS/tests
2016-05-15 17:36:23 +02:00
Florian Rival
0bcf3475b0 Always copy GDJS Runtime/GDCpp headers when building
This helps during the development, as copying the headers/GDJS runtime
can be easily forgotten. Also, the commands were not triggered when working only on the
extensions.
2016-05-15 17:34:46 +02:00
Florian Rival
09b35c9dd8 Add test game displaying the width of scaled sprite objects 2016-05-09 23:05:19 +02:00
Florian Rival
0123128206 Add option to activate debug mode when exporting with Cocos2d-JS 2016-05-06 20:29:01 +02:00
Florian Rival
7a728d370d Add support for non-smoothed texture with Cocos2d-JS 2016-05-05 17:14:52 +02:00
Florian Rival
6bb426ecf6 Fix scene unloading with Cocos2d-JS 2016-05-05 16:18:57 +02:00
Florian Rival
459b395ee9 Enable multline editing of variables default value in ChooseVariableDialog 2016-05-05 16:18:16 +02:00
Florian Rival
943401d8bf Merge pull request #265 from 4ian/feature/optimize-js
Optimizations for the JS game engine
2016-05-02 23:44:25 +02:00
Florian Rival
020348e3b0 Fix text objects font not properly applied with Cocos2d on Android/iOS
For iOS, the user still need to add the font to the app provided fonts in XCode
(see http://stackoverflow.com/questions/14508675/how-can-i-add-a-font-to-my-cocos2d-ios-project-and-use-it-with-a-cclabelttf)
2016-05-02 23:34:48 +02:00
Florian Rival
347ee2a74e Update documentation link to the recommended compiler 2016-05-02 23:34:24 +02:00
Florian Rival
c7cd582152 Avoid creating objects when calling Hashtable.values() and by using gdjs.staticArray 2016-04-28 23:16:38 +02:00
Florian Rival
6625e3fd00 Avoid creating temporary objects when calling Hashtable.keys() 2016-04-28 22:18:25 +02:00
Florian Rival
1710aacb17 Rework internal profiler to avoid creating temporary objects 2016-04-27 23:05:39 +02:00
Florian Rival
c88f7e53c0 Rework PlatformBehavior to avoid creating temporary objects. Remove dead code in HSHG and avoid temp objects/arrays 2016-04-27 23:03:46 +02:00
Florian Rival
4c62c8c046 Comment out a console.log 2016-04-27 00:31:57 +02:00
Florian Rival
ab2a347f97 Avoid creating a new Hashtable each tick in PlatformerObjectRuntimeBehavior and avoid creating temporary objects/arrays 2016-04-27 00:31:36 +02:00
Florian Rival
2a90e9bd5e Avoid usage of Hashtable.entries() and remove it 2016-04-26 23:50:20 +02:00
Florian Rival
08a9a856a7 Avoid using Hashtable.entries() in gdjs.InputManager 2016-04-26 23:33:29 +02:00
Florian Rival
ad2e85be49 Use prototype to define Hashtable functions instead of modifying the object 2016-04-26 23:29:09 +02:00
Florian Rival
71f6cd529f Avoid creating objects/arrays in gdjs.RuntimeScene.prototype._updateObjectsVisibility 2016-04-26 23:20:07 +02:00
Florian Rival
70c804e34a Rewrite gdjs.RuntimeScene.prototype._constructListOfAllInstances to avoid calling Hashtable.values() 2016-04-26 23:05:45 +02:00
Florian Rival
8d92dd818e Remove calls to Hashtable.keys(), useless function/object creations 2016-04-26 22:55:15 +02:00
Florian Rival
7af76081d0 Avoid declaring functions in gdjs.RuntimeScene.prototype._updateObjectsVisibility 2016-04-26 21:59:09 +02:00
Florian Rival
3e31081e88 Merge pull request #260 from victorlevasseur/master
Remove useless SPARK vc2008 libs and demos
2016-04-26 10:59:06 +02:00
Florian Rival
c5b5819edf Merge pull request #261 from 4ian/feature/named-animations
Named animations
2016-04-25 22:48:28 +02:00
Florian Rival
6820a3eb10 Add test for named animations of RuntimeSpriteObject 2016-04-24 17:06:08 +02:00
Florian Rival
727b34df75 Implement named animations for SpriteObject for native games 2016-04-24 16:18:12 +02:00
Florian Rival
bdb5461847 Implement named animations for SpriteObject for HTML5 games 2016-04-24 15:40:51 +02:00
Florian Rival
c41537bcac Add name to SpriteObject animations 2016-04-24 01:19:20 +02:00
Victor Levasseur
cd05c57e20 Remove useless SPARK vc2008 libs
Prevents a crash when packaging for Fedora
2016-04-17 23:54:29 +02:00
Victor Levasseur
c432378c78 Rename lumière.png to lumiere.png
Prevents a crash when packaging on Arch Linux
2016-04-17 23:53:35 +02:00
Victor Levasseur
b650ba33b1 Add a new rpmlint rule for building RPM packages 2016-04-17 22:44:50 +02:00
Florian Rival
f67206940e Version bump 2016-04-17 15:16:42 +02:00
Florian Rival
bb69871c93 Update French translation 2016-04-17 14:59:35 +02:00
Victor Levasseur
6abfa19dd8 Fix "ignore default controls" of TopDownMovementBehavior for HTML5 games 2016-04-17 11:11:54 +02:00
Victor Levasseur
f8cbd788a1 Fix "Layer up" and "Layer down" context menu buttons in the layout editor 2016-04-17 10:49:24 +02:00
Florian Rival
5516c85f1d Merge pull request #259 from victorlevasseur/feature/tilemap-android
Feature/tilemap android
2016-04-16 15:19:30 +02:00
Florian Rival
dfc4f524fc Update translations 2016-04-16 15:12:30 +02:00
Victor Levasseur
0b9728030a Fix GL states popped on Android 2016-04-16 14:54:48 +02:00
Victor Levasseur
8aeb7bfacb TileMapObject is now compatible with Android 2016-04-16 14:30:10 +02:00
Florian Rival
966105fcc4 Minor UI fix 2016-04-14 22:02:50 +02:00
Florian Rival
51a6c935d9 Add an explanation text in AndroidExportDialog and update translation sources 2016-04-14 21:12:13 +02:00
Florian Rival
0d34568afc Merge pull request #258 from victorlevasseur/feature/improve-android-export
Feature/improve android export
2016-04-13 21:27:00 +02:00
Victor Levasseur
b68d24e8e4 Add an export dialog for the experimental Android export 2016-04-13 12:03:16 +02:00
Victor Levasseur
13d5069bd3 Update Application.mk for the lastest NDK 2016-04-11 19:36:21 +02:00
Victor Levasseur
01372c9589 Add an help button to the android export dialog 2016-04-11 14:36:16 +02:00
Victor Levasseur
e7498fd8f3 Add a dialog to choose where to export the android game 2016-04-11 13:02:12 +02:00
Victor Levasseur
846eceabdf Allow platforms to provide multiple exporters 2016-04-11 12:06:45 +02:00
Florian Rival
64692e405e Merge pull request #257 from victorlevasseur/bugfix/box2djs
Fix box2d.js crash when changing scenes
2016-04-10 12:10:32 +02:00
Victor Levasseur
1adb4febb1 Fix world only destroyed if instanciated 2016-04-10 11:13:38 +02:00
Victor Levasseur
ff24bf7af6 Merge remote-tracking branch 'upstream/master' into bugfix/box2djs 2016-04-09 22:59:41 +02:00
Victor Levasseur
d705f7503a Fix physic behavior memory leak in HTML5 games 2016-04-09 22:06:46 +02:00
Florian Rival
61b01aa1a1 Version bump 2016-04-09 17:32:30 +02:00
Florian Rival
0296162cda Merge branch 'feature/native-android' 2016-04-09 16:35:36 +02:00
Florian Rival
c11ffca94a Save the latest export directory when exporting HTML5 game with Cocos2d-JS 2016-04-09 16:34:40 +02:00
Florian Rival
2fce1fc16f Fix "Put object(s) on the lower layer" menu item in LayoutEditorCanvas" 2016-04-09 16:33:56 +02:00
Florian Rival
2a3657abef Merge pull request #256 from 4ian/feature/modular-html5-rendering
Experimental Cocos2d-JS export and native android export
2016-04-09 16:27:08 +02:00
Victor Levasseur
da4dc223f7 Fix box2d.js crash when changing scenes
(use an updated version of box2d.js)
2016-04-09 13:32:48 +02:00
Florian Rival
eeb0dc8a63 Implement TextEntryObject for Cocos2d 2016-03-28 19:40:09 +02:00
Florian Rival
f6f56d77a0 Add tiling and fix rendering of PanelSprite objects with Cocos2d 2016-03-28 00:47:12 +02:00
Florian Rival
749c383fd7 Fix tiling not properly done in TilingSprite objects with Cocos2d-x. Need to workaround a Cocos2d shader uniform issue 2016-03-27 19:45:27 +02:00
Florian Rival
98c822bfb4 Don't erase files when exporting with Cocos2d 2016-03-27 19:07:15 +02:00
Florian Rival
2ed48d302d Add support for custom font for TextObject rendered with Cocos2d 2016-03-21 23:49:22 +01:00
Florian Rival
7e7e93b94c Add support for MouseWheel with Cocos2d 2016-03-21 22:38:40 +01:00
Florian Rival
848df5aa5b Add Cocos renderer for ShapePainter objects 2016-03-20 12:20:56 +01:00
Florian Rival
7a6f3ffe7c Move ShapePainter object renderering to ShapePainterRuntimeObjectRenderer 2016-03-19 23:59:17 +01:00
Florian Rival
21012c3445 Add experimental export with Cocos2d 2016-03-19 23:05:45 +01:00
Florian Rival
5485b28b19 Fix blending with Cocos2d Sprite object renderer 2016-03-19 23:02:24 +01:00
Florian Rival
d313f13475 Add support for blend mode for Sprite objects rendered with Cocos2d 2016-03-14 22:46:34 +01:00
Florian Rival
a4e88bd504 Move events related functions of HTML5 game engine to events-tools 2016-03-14 21:42:41 +01:00
Florian Rival
f446a75fd8 Fix HTML5 tests 2016-03-14 19:55:09 +01:00
Florian Rival
e64bb8a6f7 Improve PanelSprite test game 2016-03-14 19:50:23 +01:00
Florian Rival
1cd4226427 Use shader to render TiledSprite with Cocos2d, enabling tiling for any texture size 2016-03-13 18:26:29 +01:00
Florian Rival
817fba1114 Fix TiledSpriteRuntimeObjectPixiRenderer not properly setting angle/offset when created from an existing object 2016-03-13 17:50:02 +01:00
Florian Rival
37a0c3c919 Add basic profiling in runtimescene 2016-03-10 19:16:01 +01:00
Florian Rival
fc4b12803d Fix Pixi Cordova export 2016-03-09 19:22:02 +01:00
Florian Rival
51f09d1bb6 Fix (multi)touch with Cocos2d 2016-03-07 21:05:23 +01:00
Florian Rival
8ce9afff6b Fix RuntimeGameCocosRenderer.setSize 2016-03-06 23:26:34 +01:00
Florian Rival
84711a25c3 Add Cocos2d renderer for PanelSprite (without support for tiled option) 2016-03-06 23:14:27 +01:00
Victor Levasseur
d33042cece Merge pull request #254 from victorlevasseur/feature/native-android
Fix crash when ending a scene with Platform objects in it
2016-03-06 19:58:31 +01:00
Victor Levasseur
719032f91d Fix crash when ending a scene with Platform objects in it 2016-03-06 19:42:53 +01:00
Florian Rival
73c0bf56c8 Move PanelSprite rendering to gdjs.PanelSpriteRuntimeObjectPixiRenderer 2016-03-06 18:56:03 +01:00
Florian Rival
acd8d54c5e Add Cocos renderer for TiledSprite (only support power-of-2 textures) 2016-03-05 18:09:30 +01:00
Florian Rival
99b0c8345c Move TiledSprite objects rendering to gdjs.TiledSpriteRuntimeObjectPixiRenderer 2016-03-05 15:37:17 +01:00
Florian Rival
c97fea1a9e Fix Draggable Automatism test game 2016-03-05 14:48:11 +01:00
Florian Rival
cd7457eba8 Fix rendering of Sprite objects with Cocos2d when in 8 direction mode 2016-03-05 14:44:34 +01:00
Florian Rival
c9a0cc9afd Tiny fixes on TextRuntimeObject and its renderers 2016-03-05 14:38:11 +01:00
Florian Rival
0f990cc913 Add gdjs.CocosSoundManager 2016-03-05 14:02:28 +01:00
Florian Rival
656921b9c8 Move soundmanager.js to howler-sound-manager 2016-03-02 12:19:03 +01:00
Florian Rival
246bde6dec Various fixes for Cocos2d 2016-03-02 11:38:50 +01:00
Florian Rival
d54eadf39d Implement getScreenWidth/Height for Cocos2d renderering 2016-03-01 21:27:22 +01:00
Florian Rival
3a2f6a2ac7 Add gdjs.CocosDirectorManager to manage scene changes when rendering with Cocos2d 2016-03-01 21:06:45 +01:00
Florian Rival
feb243d2f7 Fix SceneStack not calling gdjs.RuntimeScene.unloadScene
Also fix GDJS tests
2016-02-29 23:50:00 +01:00
Florian Rival
aea43b96d5 [WIP] Fix rotated layer rendering with Cocos2d renderer 2016-02-29 22:28:56 +01:00
Florian Rival
64f077bcb2 Abstract GDJS window title manipulation in RuntimeGameRenderer 2016-02-28 21:18:56 +01:00
Florian Rival
9e5893883f Updated GDJS breakout test game 2016-02-28 21:16:36 +01:00
Florian Rival
99681bb89b [WIP] Cocos2D renderer for text object + fixes for Sprite/Layer 2016-02-28 18:39:37 +01:00
Florian Rival
13dcc9a1bd Move HTML5 Text object rendering to gdjs.TextRuntimeObjectPixiRenderer 2016-02-28 18:23:09 +01:00
Florian Rival
7eb96d97af [WIP] Cocos2d-JS renderers for HTML5 games 2016-02-28 16:18:01 +01:00
Florian Rival
8e8b49f27d Fix gdjs.RuntimeObject.setLayer 2016-02-27 16:52:49 +01:00
Florian Rival
226f67f114 Abstract texture in gdjs.SpriteAnimationFrame to gdjs.SpriteRuntimeObjectPixiRenderer 2016-02-27 14:31:07 +01:00
Florian Rival
0c2600ccf4 Directly use *Renderer in game engine 2016-02-22 23:12:45 +01:00
Florian Rival
d3d37afea6 Move loading screen rendering to gdjs.LoadingScreenPixiRenderer 2016-02-22 22:22:13 +01:00
Florian Rival
507c23f401 Move Sprite objects rendering to gdjs.SpriteRuntimeObjectPixiRenderer 2016-02-22 22:07:07 +01:00
Florian Rival
961513f81b Move game loop implementation in RuntimeGamePixiRenderer 2016-02-21 23:05:31 +01:00
Florian Rival
de45e12245 Rename gdjs.ImageManager to gdjs.PixiImageManager 2016-02-21 22:43:28 +01:00
Florian Rival
746bdd0114 Move rendering of gdjs.RuntimeGame to gdjs.RuntimeGamePixiRenderer 2016-02-21 19:13:35 +01:00
Florian Rival
8a0d0d332d Rename gdjs.LayerPixiRenderer PIXI related methods 2016-02-21 17:16:13 +01:00
Florian Rival
40be4153c2 Rename exposePIXIDisplayObject to exposeRendererObject 2016-02-21 17:00:30 +01:00
Florian Rival
9bae415530 Move rendering of layers in gdjs.LayerPixiRenderer 2016-02-21 16:51:48 +01:00
Florian Rival
fad17d7901 Fix GDJS Exporter not properly exporting subdirectories of the game engine 2016-02-21 15:52:42 +01:00
Florian Rival
35f857060c Move rendering of runtime scene into gdjs.RuntimeScenePixiRenderer 2016-02-21 15:51:52 +01:00
Florian Rival
90b8854ecf Merge pull request #252 from victorlevasseur/bugfix/opengl-depth-buffer
Enable depth buffer on SFML windows to fix 3DBox objects
2016-02-18 16:27:00 +01:00
Victor Levasseur
cbb79a2d52 Enable depth buffer on SFML windows to fix 3DBox objects 2016-02-17 13:43:40 +01:00
Florian Rival
116411a300 Merge branch 'master' into feature/native-android 2016-02-16 23:19:49 +01:00
Florian Rival
7f3ef4002d Remove dead code in HTML5 game engine 2016-02-16 23:16:59 +01:00
Florian Rival
7ad5358451 Avoid creating functions in gdjs.Polygon.collisionTest 2016-02-16 23:12:33 +01:00
Florian Rival
acd08be06a Merge pull request #250 from victorlevasseur/feature/native-android
TiledSpriteObject is displayed correctly on Android devices
2016-02-10 18:35:45 +01:00
Victor Levasseur
12071e8645 TiledSpriteObject is displayed correctly on Android devices
(manual repetition using vertices instead of texture repetition)
2016-02-10 15:48:39 +01:00
Victor Levasseur
9aad6a89df Merge pull request #249 from victorlevasseur/feature/native-android
Fix Android main.cpp
2016-02-10 14:31:37 +01:00
Victor Levasseur
927632cd0f Fix Android main.cpp 2016-02-10 14:30:11 +01:00
Victor Levasseur
f44d2ec219 Merge pull request #248 from victorlevasseur/feature/native-android
Fix Extensions headers not included
2016-02-10 13:41:11 +01:00
Victor Levasseur
1006cf3fcb Fix Extensions headers not included 2016-02-10 13:40:16 +01:00
Victor Levasseur
fd8b6ce4ba Merge pull request #247 from victorlevasseur/feature/native-android
Fix EventsPrecompiledHeaders.h.pch location on Windows
2016-02-10 13:22:50 +01:00
Victor Levasseur
2dac7b12bb Fix EventsPrecompiledHeaders.h.pch location on Windows 2016-02-10 13:21:24 +01:00
Florian Rival
cab91ebb8b Fix compilation, add comments about experimental Android exporter 2016-02-09 20:27:03 +01:00
Florian Rival
95709fbd4d Support no smooth option for textures for HTML5 games 2016-02-09 19:42:53 +01:00
Florian Rival
72a5d32979 Small Android fixes 2016-02-09 19:42:52 +01:00
Florian Rival
dca642ebb1 Fix window size expression/actions for Android 2016-02-09 19:42:52 +01:00
Florian Rival
d1b486f3cf Add support for touches in RuntimeSpriteObject::CursorOnObject 2016-02-09 19:42:52 +01:00
Florian Rival
35c7328a48 Add AndroidExporter and include full GDCpp/Core in CppPlatform folder 2016-02-09 19:42:52 +01:00
Florian Rival
e68e814853 Fix wrong header filename used by CodeCompiler 2016-02-09 19:42:52 +01:00
Florian Rival
117722621a Change file organization in GDCpp to have a Runtime directory inside GDCpp 2016-02-09 19:42:52 +01:00
Florian Rival
ce1c1c3cea Use sf::TrianglesStrip instead of sf::Quads for Android support 2016-02-09 19:40:47 +01:00
Florian Rival
18626964eb Add support for touches in RuntimeObject::CursorOnObject 2016-02-09 19:40:47 +01:00
Florian Rival
f2f40a4275 Refactor SceneStack to improve scene execution decoupling 2016-02-09 19:40:47 +01:00
Florian Rival
77e4a1a614 Allow CodeExecutionEngine to directly use a C-style function 2016-02-09 19:40:47 +01:00
Florian Rival
bec51c705b Update some extensions to be created on Android 2016-02-09 19:40:47 +01:00
Florian Rival
3df427fb7c Exclude OpenGL calls and adapt ResourcesLoader for Android 2016-02-09 19:40:46 +01:00
Florian Rival
7a6d549f53 Update XML update files with latest GD version 2016-02-09 19:40:27 +01:00
Florian Rival
34981bd794 Merge pull request #245 from victorlevasseur/templated-objects-decls
Refactor/simplify objects declarations with templates
2016-01-29 18:11:06 +01:00
Victor Levasseur
c499817bed Update licence on some files 2016-01-29 16:29:37 +01:00
Victor Levasseur
f1be2948cf Update doc 2016-01-29 11:20:16 +01:00
Florian Rival
976ea58f6b Merge pull request #244 from victorlevasseur/bugfix/behavior-pointers
Fix crash when trying to (de)activate a behavior on an object that doesn't have the behavior + bonus
2016-01-29 10:32:05 +01:00
Victor Levasseur
12323965e0 RuntimeObjects ctor now takes their Object derivative as argument 2016-01-28 17:37:27 +01:00
Victor Levasseur
804e8c8718 Remove old CreateXXXObject(...) functions 2016-01-28 17:15:48 +01:00
Victor Levasseur
a549f220cb Extensions now use the new templated AddObject and AddRuntimeObject methods 2016-01-28 16:45:35 +01:00
Victor Levasseur
452a4ec616 Add a templated version of AddRuntimeObject
Automatically create the Creation function which is able to dynamic_cast the gd::Object (avoid repetitive casts in RuntimeObject derivates ctor)
2016-01-28 16:22:42 +01:00
Victor Levasseur
1af2bb6023 Add a templated version of AddObject to avoid the unnecessary Create function 2016-01-28 16:21:55 +01:00
Victor Levasseur
21dcb391b4 Behavior are created in an unique_ptr 2016-01-27 19:43:44 +01:00
Victor Levasseur
8602bbfa51 Include <memory> in GDCpp/RuntimeObject.h 2016-01-27 16:52:51 +01:00
Victor Levasseur
99e4c394fe Fix RuntimeObject::ActivateBehavior crashing if the behavior doesn't exist 2016-01-27 16:44:50 +01:00
Victor Levasseur
dc85bbacea Replace raw pointers by unique_ptrs to store Behaviors in RuntimeObject 2016-01-27 16:40:38 +01:00
Victor Levasseur
b24060f8d0 Replace raw pointers with unique_ptrs to store Behaviors in gd::Object 2016-01-27 16:24:40 +01:00
Florian Rival
40ba9526c4 Merge branch 'master' of github.com:4ian/GD 2016-01-24 23:25:34 +01:00
Florian Rival
12106192b9 Basic handling of touch events for native games (simulate mouse) 2016-01-24 23:25:24 +01:00
Florian Rival
d306c8f3fd Change windows packaging to generate a 7z file instead of a zip one 2016-01-21 21:42:49 +01:00
Florian Rival
57c1b66a25 Merge pull request #242 from victorlevasseur/master
Fix gd::String::From/ToLocale crashing on some Linux distro
2016-01-20 23:25:20 +01:00
Victor Levasseur
54b6a7f295 Fix gd::String::From/ToLocale crashing on some Linux distro
(on which the UTF8 locale is named utf8 and not utf-8 !)
2016-01-20 18:31:48 +01:00
Florian Rival
6a74d8c75f Version bump 2016-01-17 13:29:21 +01:00
Florian Rival
e444e80493 Update copyrights year 2016-01-14 19:46:56 +01:00
Florian Rival
b78e8a46ec Merge pull request #235 from pstieber/b2TOISolverInitializationFix
b2TOISolver initialization fix
2016-01-14 18:50:23 +01:00
Florian Rival
42aed41cfc Merge pull request #240 from victorlevasseur/master
Fix HTTP server serving a invalid directory on some libstdc++ implementations
2016-01-13 23:28:45 +01:00
Victor Levasseur
9d970fb0ce Fix server serving a invalid directory on some libstdc++ implementations 2016-01-13 23:14:30 +01:00
Florian Rival
8da557443f Merge branch 'master' of github.com:4ian/GD 2016-01-10 13:38:12 +01:00
Florian Rival
010759bdc2 Don't show bug report/update/reminder dialog if rebranding is applied 2016-01-10 13:35:09 +01:00
Florian Rival
eb9c265ec1 Upgrade 7za.exe to latest version (fix zipping issue and improve Windows packaging speed) 2016-01-10 00:08:30 +01:00
Florian Rival
626a54b78f Merge branch 'master' of github.com:4ian/GD 2016-01-09 18:52:54 +01:00
Florian Rival
5f0f3327c3 Fix potential crash with AdMob object on Android and made the extension compatible with Emscripten 2016-01-09 18:52:37 +01:00
Florian Rival
6c83d655ea Merge pull request #237 from pstieber/UpdateWxSetSize
Changed SetBestSize to SetInitialSize.
2016-01-09 14:50:01 +01:00
Peter J. Stieber
f648d61f54 Changed SetBestSize to SetInitialSize.
This prevents a wxWidgets deprecated warning.
2016-01-08 20:16:51 -08:00
Florian Rival
7fc0742dfd Merge pull request #236 from pstieber/StringWarningFixes
String warning fixes
2016-01-09 00:13:48 +01:00
Florian Rival
f9e7455e12 Merge pull request #234 from pstieber/UpdateWxFontStyles
Update wx font styles
2016-01-08 23:46:22 +01:00
Peter J. Stieber
9acfea02db Made string pointers constant.
This removed over 1000 warnings from a Fedora 21 build with gcc 4.9.2.
2016-01-08 14:10:28 -08:00
Peter J. Stieber
1630b82d63 Made PDF fon name strings constant to remove gcc warnings. 2016-01-08 13:01:37 -08:00
Peter J. Stieber
0121ce489b Made xpm strings constant to remove gcc warnings. 2016-01-08 13:01:01 -08:00
Peter J. Stieber
35b14bb58a Fixed incorrect initialization.
Replaced initialization of an in32 (m_count) with NULL to an
initialization with 0 because the value is not a pointer.  This
removed gcc 4.9.2 warnings when building on Fedora 21.
2016-01-08 11:33:07 -08:00
Peter J. Stieber
4605ac8688 Merge branch 'master' into UpdateWxFontStyles 2016-01-08 10:31:49 -08:00
Peter J. Stieber
b707e5acb8 Merge branch 'master' of https://github.com/4ian/GD 2016-01-08 10:28:08 -08:00
Peter J. Stieber
a75b87d69d Merge branch 'UpdateWxBrushConstruction' 2016-01-08 10:27:06 -08:00
Peter J. Stieber
b8322398f3 Updated wxFont flags to remove warnings.
Changed font family and font weight flags to use the new convention
to prevent deprecation warnings from wxWidgets.
2016-01-08 09:49:33 -08:00
Florian Rival
6f8ce3a133 Merge pull request #233 from pstieber/UpdateWxBrushConstruction
Updated wxBrush styles.
2016-01-08 17:09:33 +01:00
Peter J. Stieber
4573a9db1e Updated wxBrush styles.
Changed the following in wxBrush constructors:
wxTRANSPARENT -> wxBRUSHSTYLE_TRANSPARENT
wxSOLID -> wxBRUSHSTYLE_SOLID
wxFDIAGONAL_HATCH -> wxBRUSHSTYLE_FDIAGONAL_HATCH
This fixed 6 warnings in the build.
2016-01-08 07:23:52 -08:00
Florian Rival
42f6dc9a76 Merge pull request #232 from pstieber/master
wxTextCtrl and and wxMenuItem updates
2016-01-07 21:13:06 +01:00
Peter J. Stieber
a48c3aef38 Removed wxTE_AUTO_SCROLL from wxSmith files. 2016-01-06 06:27:10 -08:00
Peter J. Stieber
760b06dc47 Replaced deprecated wxMenuItem function.
Replaced SetText with SetItemLabel.
2016-01-05 21:53:38 -08:00
Peter J. Stieber
718f204ebb Removed use of deprecated wxTE_AUTO_SCROLL.
Use of this macro prevents compilation with wxWidgets that has been
compiled with 2.8 compatibility turned off.  This macro is set to 0
and the comment in the wxWidgets source reads:

this style is (or at least should be) on by default now, don't use it

This commit removed the use of this obsolete macro.
2016-01-05 21:46:39 -08:00
Florian Rival
5688e21d0a Merge pull request #231 from brylie/master
Change sign test text to conventional terms
2015-12-28 12:11:29 +01:00
Brylie Christopher Oxley
21238c8cb3 Change to 'not equal to' 2015-12-28 12:55:06 +02:00
Brylie Christopher Oxley
a4ee365eb8 Change to 'not equal to' 2015-12-28 12:54:20 +02:00
Brylie Christopher Oxley
3c24bb047f Change to 'less than' 2015-12-28 12:53:36 +02:00
Brylie Christopher Oxley
f5acc4c9b3 Change to 'less than' 2015-12-28 12:52:34 +02:00
Florian Rival
97ef2d5c94 Merge pull request #224 from 4ian/feature/rebranding
Add support for rebranding
2015-12-26 20:08:56 +01:00
Florian Rival
877679c726 Update Mac OS X icon.icns 2015-12-25 16:04:51 +01:00
Florian Rival
fff64c0ec9 Add rebranding capabilities 2015-12-17 20:38:55 +01:00
Florian Rival
7d81821040 Fix ribbon page not connected when switching to an external layout editor tab 2015-12-15 22:55:52 +01:00
Florian Rival
b8e3164aa6 Fix compilation when GD_NO_WX_GUI is defined 2015-12-15 22:48:35 +01:00
Florian Rival
871f6ade67 Merge pull request #219 from victorlevasseur/master
Support TMX files (Tiled Editor) for TileMap Objects
2015-12-15 22:32:48 +01:00
Florian Rival
dcae745626 Merge pull request #222 from 4ian/feature/launch-external-layout-preview
External layouts enhancements
2015-12-15 22:29:41 +01:00
Florian Rival
156fcaec8a Properly save the layout being used to edit an external layout in the IDE 2015-12-15 22:27:41 +01:00
Florian Rival
d65bc5c61f Previewing an external layout from the IDE now launches the game with the objects from the external layout 2015-12-15 22:03:57 +01:00
Florian Rival
989f4b2e4e Fix typo 2015-12-15 21:10:23 +01:00
Florian Rival
40059d4270 Merge pull request #221 from victorlevasseur/cleaner-about-page
Clean the credit dialog
2015-12-14 23:37:16 +01:00
Victor Levasseur
56967479de Clean the credit dialog 2015-12-14 23:11:57 +01:00
Florian Rival
af0a3ca3eb Merge pull request #220 from 4ian/fix/external-layout-editors-allocation
Fixes for external layout editors
2015-12-13 21:15:27 +01:00
Florian Rival
5a5b1d6eff Fix ribbon page not connected when switching to an external layout editor tab 2015-12-13 21:06:15 +01:00
Florian Rival
98b5a66ad0 Fix incorrect re-creation of editors when changing scene in an external layout editor 2015-12-13 19:18:51 +01:00
Victor Levasseur
01196c6542 Fix compilation error with AddResource in the TileMapImporter 2015-12-13 15:52:50 +01:00
Florian Rival
002bfb06d0 Refactored StartHerePage management to use EditorsNotebookManager 2015-12-12 23:04:01 +01:00
Victor Levasseur
ad868362fe Merge branch 'feature/tilemap-tmx-import' 2015-12-12 22:23:24 +01:00
Florian Rival
b059c3f3b4 Refactored editor tabs management into EditorsNotebookManager 2015-12-12 22:16:52 +01:00
Florian Rival
508dd80c60 Refactor MainFrameWrapper to change ribbon page using page names 2015-12-11 00:09:34 +01:00
Florian Rival
1f022e860d Make start page handling more robust 2015-12-08 23:16:45 +01:00
Florian Rival
fe9252d3f9 Move SkinHelper to IDE/wxTools directory & avoid crash at startup if StartHerePage is deleted 2015-12-08 22:51:16 +01:00
Florian Rival
4706990730 Update CMakeLists.txt to avoid a warning with latest Clang on OS X 2015-12-08 21:01:02 +01:00
Victor Levasseur
e22cbbeabd Improve the tilemap tmx importer dialog 2015-12-01 22:59:23 +01:00
Victor Levasseur
71f0d25b77 Use a relative filepath for the imported tileset image 2015-12-01 17:26:26 +01:00
Victor Levasseur
91aa2ec604 Update the tileset editor when a tmx file is imported 2015-12-01 00:45:18 +01:00
Victor Levasseur
5dc0413f48 Reload the tileset image when imported from a tmx file 2015-12-01 00:40:33 +01:00
Victor Levasseur
7ff0bc3fa0 Use wxwidgets logger to show warnings and errors in the tmx importer 2015-11-30 13:51:07 +01:00
Florian Rival
951f3f54af Merge pull request #216 from 4ian/feature/audio-resources
Support for audio resources
2015-11-28 16:58:59 +01:00
Florian Rival
7d991c6823 Fix GDJS tests 2015-11-28 16:37:55 +01:00
Florian Rival
549614adbb Fix native games not launching properly when in a directory with non ASCII characters 2015-11-28 16:10:51 +01:00
Florian Rival
f4053c18a6 Force HTML5 audio for musics so we don't wait for the full file to be loaded on Android. 2015-11-28 13:41:02 +01:00
Florian Rival
b492cc72c4 Support for using audio files directly or as resources 2015-11-23 00:14:56 +01:00
Florian Rival
2d6de6e16a Rework gdjs.ImageManager to make it responsible of textures loading 2015-11-22 15:37:18 +01:00
Florian Rival
95afd2c5b6 Support stop pingsounds/musics of previous scene for HTML5 games 2015-11-19 23:16:10 +01:00
Florian Rival
693eac1916 Refactor SoundManager to be owned by RuntimeGame 2015-11-19 22:00:19 +01:00
Florian Rival
780a022029 Add AudioResource 2015-11-18 22:57:45 +01:00
Florian Rival
1e4f622b5c Update pixi.js to v3.0.8 and add a TODO about HTML5 resources loading 2015-11-18 21:57:48 +01:00
Florian Rival
1fc1863e5b Improve performance of HTML5 PanelSpriteObject by avoiding the use of masks 2015-11-18 00:06:39 +01:00
Victor Levasseur
476f6da7ec Use gd::NewNameGenerator to generate a name for the tileset imported image 2015-11-16 23:41:56 +01:00
Florian Rival
828e16ac5b Fix storage actions not properly persisting values in some cases
Fix #210
2015-11-16 22:10:57 +01:00
Victor Levasseur
33ff92681e Add tileset image importation 2015-11-15 11:05:18 +01:00
Victor Levasseur
20afa9201d Improve the tmx importer's source code 2015-11-13 15:21:12 +01:00
Victor Levasseur
764443d31f Improve the tile hitbox importation 2015-11-12 18:29:40 +01:00
Victor Levasseur
539f68c013 Add hitbox import from .tmx file in TileMapObject 2015-11-11 12:19:24 +01:00
Victor Levasseur
078669bf55 Add "experimental" label to the .tmx file import 2015-11-09 23:10:51 +01:00
Victor Levasseur
3eb2a86b23 Add support for importing the tileset conf from a .tmx file 2015-11-09 23:08:35 +01:00
Victor Levasseur
10873c559d Use a fixed width font for the importer message text ctrl 2015-11-09 13:46:44 +01:00
Victor Levasseur
34a902dc11 Some adjustments 2015-11-08 22:06:28 +01:00
Victor Levasseur
e1c56f1c71 Add Tilemap importation (not tileset and hitboxes for now) 2015-11-08 21:59:20 +01:00
Victor Levasseur
02891a777b Fix image paths in wxcrafter dialogs 2015-11-08 20:06:14 +01:00
Victor Levasseur
18c5a230a3 Change TileMapObject source code organization and added tmx-parser 2015-11-08 19:05:48 +01:00
Florian Rival
e95ae97c35 Merge pull request #211 from 4ian/refactor/directories
Refactor directory structure
2015-11-07 13:01:56 +01:00
Florian Rival
db69c83a58 Change file organization 5 (GDCpp/Project) 2015-11-01 17:06:23 +01:00
Florian Rival
cd9ae7ca40 Change file organization 4 (tinyxml -> TinyXml) 2015-11-01 12:01:06 +01:00
Florian Rival
04a699d3e9 Change file organization 3 (IDE/Dialogs) 2015-11-01 11:26:40 +01:00
Florian Rival
e4fab74a32 Change file organization 2 (Events, Extensions + more folders) 2015-11-01 11:26:40 +01:00
Florian Rival
63cb853d72 Change file organization (Events, Extensions + more folders) 2015-11-01 11:26:40 +01:00
Florian Rival
2a95765fd9 Merge pull request #206 from victorlevasseur/bugfix/parameters-list-layout-bug
Fix parameter list layout glitch when the user switch many times the instruction in the window
2015-10-28 15:54:54 +01:00
Florian Rival
f4a603217c Merge pull request #209 from victorlevasseur/bugfix/tilemap-empty-image-fix
Fix tilemap object crash when using an empty image (or invalid file)
2015-10-27 18:15:07 +01:00
Victor Levasseur
ee0ad9d346 Fix tilemap object crash when using an empty image (or invalid file) 2015-10-27 17:56:09 +01:00
Florian Rival
e1e6ab0d6d Merge pull request #207 from victorlevasseur/feature/improve-help
Improve help and add help button for instructions
2015-10-27 09:30:17 +01:00
Victor Levasseur
05e8dc998b Fix parameter list layout glitch when changing of instructions a lot 2015-10-26 15:27:45 +01:00
Victor Levasseur
66f67e7694 Add an help button for instructions 2015-10-26 10:50:47 +01:00
Victor Levasseur
ade4c5b4f5 Use gd::HelpFileAccess::OpenPage in gd::ObjectsPropgridHelper 2015-10-26 09:57:49 +01:00
Florian Rival
5b22ed1d45 Add Finnish translation 2015-10-25 19:04:02 +01:00
Victor Levasseur
8462eefb7d Use gd::HelpFileAccess::OpenPage instead of OpenURL in GDevelop 2015-10-25 18:45:02 +01:00
Victor Levasseur
46e6ecd72a Add gd::HelpFileAccess::OpenPage to open a page without passing its whole URL.
The webpage is assumed to be stored on the wiki and the language is automatically added to the URL if needed
2015-10-25 17:43:18 +01:00
Florian Rival
08def0ebbf Add a FIXME on a potential bug for condition with custom code generator 2015-10-21 22:07:05 +02:00
Florian Rival
9a0e138407 Fix 'Always' condition for HTML5 games 2015-10-21 00:17:22 +02:00
Florian Rival
3a982afea7 Fix mistakes and add Dutch to Windows installer languages 2015-10-19 22:57:18 +02:00
Florian Rival
ba5ccf72ef Add complete Dutch translation 2015-10-19 22:43:46 +02:00
Florian Rival
5375647001 Merge pull request #205 from 4ian/refactor/runtimescene-time-manager
Refactor time management in game engines and use gd::String in JSON serializer
2015-10-16 17:50:55 +02:00
Florian Rival
02a5fb07a3 Add missing u8 prefix for UTF8 strings in tests 2015-10-16 15:33:18 +02:00
Florian Rival
327eba95a6 Merge branch 'refactor/runtimescene-time-manager' of github.com:4ian/GD into refactor/runtimescene-time-manager 2015-10-12 23:12:12 +02:00
Florian Rival
6b88bae850 Add tests for JSON Serializer and UTF8 characters 2015-10-12 23:11:52 +02:00
Florian Rival
5e534aa414 Fix backward compatibility for the behavior of TimerElapsedTime with not existing timers 2015-10-12 22:21:14 +02:00
Florian Rival
faf4baffc5 Refactor time management into TimeManager for native game engine 2015-10-12 00:17:57 +02:00
Florian Rival
cf2100a626 Refactor time management into gdjs.TimeManager for HTML5 game engine 2015-10-11 20:39:10 +02:00
Florian Rival
0b8f72c572 Remove dead code 2015-10-11 19:23:03 +02:00
Florian Rival
4fd7ae71f8 Merge branch 'master' into feature/json-gd-string 2015-10-11 17:12:56 +02:00
Florian Rival
656b3bf3eb Use gd::String in Serializer 2015-10-11 17:12:17 +02:00
Florian Rival
18eb1b1cf4 Merge branch 'master' of github.com:4ian/GD 2015-10-10 13:41:09 +02:00
Florian Rival
9a246686d5 Fix AdMob object banner default position being top of the screen 2015-10-10 13:37:37 +02:00
Florian Rival
2c435388a7 Avoid creating temporaries when dealing with objects list maps in HTML5 games 2015-10-09 22:14:24 +02:00
Florian Rival
1efd19ee82 Fix typo 2015-10-07 22:20:53 +02:00
Florian Rival
f4dc2d6983 Merge pull request #202 from victorlevasseur/master
Fix WriteToFile/ReadFile not converting the filename into the OS locale
2015-09-20 23:32:24 +02:00
Victor Levasseur
64bfdf165f Fix WriteToFile/ReadFile not converting the filename into the OS locale 2015-09-20 20:36:12 +02:00
Florian Rival
ef3e145f42 Version bump 2015-09-20 17:51:07 +02:00
Florian Rival
3b221ae54e Merge pull request #200 from victorlevasseur/bugfix/resolution-change-and-fullscreen
Fix Vsync and Max FPS not reactived after a sf::RenderWindow change
2015-09-16 20:24:10 +02:00
Victor Levasseur
00928414a4 Fix project not saving Vsync properly 2015-09-16 14:45:27 +02:00
Victor Levasseur
0202e7bab2 FPS limit and Vsync is now set in RuntimeScene::ChangeWindow method 2015-09-16 14:39:53 +02:00
Victor Levasseur
7c2264a9b9 Fix Vsync and Max FPS not reactived after a sf::RenderWindow change 2015-09-15 23:21:29 +02:00
Florian Rival
a0246dd33e Update translations 2015-09-15 00:05:16 +02:00
Florian Rival
5612333c55 Version bump 2015-09-13 22:17:46 +02:00
Florian Rival
05551c4d43 Merge pull request #199 from 4ian/feature/display-object-refactoring
Refactor methods of gdjs.RuntimeObject and improve PanelSpriteObject
2015-09-13 22:11:38 +02:00
Florian Rival
f6a55188c6 Remove incorrect optimisation in hitboxes collision test 2015-09-13 21:58:50 +02:00
Florian Rival
b5ec6e8deb Fix rendering of HTML5 tiled PanelSprite objects 2015-09-11 19:57:44 +02:00
Florian Rival
970bc3b0f0 Add caching and tiled borders/center option for HTML5 PanelSprite object 2015-09-11 17:29:45 +02:00
Florian Rival
876a7fecb5 Fix gdjs.Runtimeobject.hide method 2015-09-11 16:30:12 +02:00
Florian Rival
3ac292ec18 Factor common methods to gdjs.RuntimeObject.
Thanks to exposePIXIDisplayObject, objects can expose the PIXI.DisplayObject that they are using
and let RuntimeObject handles common operations (layer change, z order change, deletion, visibility).
2015-09-10 22:37:32 +02:00
Florian Rival
1ff06d4c9c Add an object to PanelSprite test/benchmark game 2015-09-10 21:19:20 +02:00
Florian Rival
4a84e5048a Fix wrong object size calculation in Destroy Outside behavior of HTML5 games 2015-09-10 19:53:58 +02:00
3950 changed files with 223124 additions and 831330 deletions

1
.gitignore vendored
View File

@@ -50,6 +50,7 @@ Binaries/Packaging/logs
!/Binaries/Output/Release_Linux/CppPlatform/
/Binaries/**/MinGW32
/Binaries/**/CppPlatform/Runtime
/Binaries/**/CppPlatform/Sources
/Binaries/**/CppPlatform/include
/Binaries/**/CppPlatform/Extensions/include
/Binaries/**/JsPlatform/Runtime

Binary file not shown.

After

Width:  |  Height:  |  Size: 308 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 226 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 303 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

View File

@@ -55,7 +55,7 @@
<resource alwaysLoaded="false" file="mur 6.png" kind="image" name="mur 6.png" smoothed="true" userAdded="true" />
<resource alwaysLoaded="false" file="mur 7.png" kind="image" name="mur 7.png" smoothed="true" userAdded="true" />
<resource alwaysLoaded="false" file="mur 8.png" kind="image" name="mur 8.png" smoothed="true" userAdded="true" />
<resource alwaysLoaded="false" file="lumière.png" kind="image" name="lumière.png" smoothed="true" userAdded="true" />
<resource alwaysLoaded="false" file="lumiere.png" kind="image" name="lumiere.png" smoothed="true" userAdded="true" />
<resource alwaysLoaded="false" file="towerground.png" kind="image" name="towerground.png" smoothed="true" userAdded="true" />
</resources>
<resourceFolders />
@@ -282,7 +282,7 @@
<directions>
<direction looping="false" timeBetweenFrames="1.000000">
<sprites>
<sprite hasCustomCollisionMask="false" image="lumière.png">
<sprite hasCustomCollisionMask="false" image="lumiere.png">
<points />
<originPoint name="origine" x="0.000000" y="0.000000" />
<centerPoint automatic="true" name="centre" x="4.000000" y="4.000000" />

View File

@@ -1,4 +1,4 @@
#include "GDCpp/RuntimeScene.h"
#include "GDCpp/Runtime/RuntimeScene.h"
#include "TextObject/TextObject.h" //but do not forget extensions includes
#include <iostream>

View File

Before

Width:  |  Height:  |  Size: 130 B

After

Width:  |  Height:  |  Size: 130 B

View File

@@ -1,5 +1,5 @@
GDevelop logos
2008-2015 Florian Rival
2008-2016 Florian Rival
-------------------
GDevelop's logos can be used in a game to indicate that it was created using GDevelop, as long as these logos stay unmodified and you do not state being the author of the logos.

View File

@@ -26,4 +26,16 @@
/>
</dependentAssembly>
</dependency>
<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
<application>
<!-- Windows 8.1 -->
<supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}"/>
<!-- Windows 8 -->
<supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}"/>
<!-- Windows 7 -->
<supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}"/>
<!-- Windows Vista -->
<supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}"/>
</application>
</compatibility>
</assembly>

View File

@@ -0,0 +1 @@
fi_FI

View File

@@ -0,0 +1 @@
nl_NL

18112
Binaries/Output/Release_Windows/locale/de_DE/GD.po Executable file → Normal file

File diff suppressed because it is too large Load Diff

20622
Binaries/Output/Release_Windows/locale/es_ES/GD.po Executable file → Normal file

File diff suppressed because it is too large Load Diff

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.

20626
Binaries/Output/Release_Windows/locale/fr_FR/GD.po Executable file → Normal file

File diff suppressed because it is too large Load Diff

23935
Binaries/Output/Release_Windows/locale/it_IT/GD.po Executable file → Normal file

File diff suppressed because it is too large Load Diff

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.

24213
Binaries/Output/Release_Windows/locale/pl_PL/GD.po Executable file → Normal file

File diff suppressed because it is too large Load Diff

20589
Binaries/Output/Release_Windows/locale/pt_PT/GD.po Executable file → Normal file

File diff suppressed because it is too large Load Diff

20469
Binaries/Output/Release_Windows/locale/ru_RU/GD.po Executable file → Normal file

File diff suppressed because it is too large Load Diff

23613
Binaries/Output/Release_Windows/locale/zh_CN/GD.po Executable file → Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -40,9 +40,9 @@ IF "%SKIPINSTALLER%"=="1" echo (Skipped)
echo.
echo --Creating archive...
if exist Releases\gd3xxxx.zip (del Releases\gd3xxxx.zip)
if exist Releases\gd4xxxx.7z (del Releases\gd4xxxx.7z)
cd Output\Release_Windows\
IF NOT "%SKIPINSTALLERANDARCHIVE%"=="1" "..\..\..\ExtLibs\7za.exe" a ..\..\Releases\gd3xxxx.zip * > ..\..\Packaging\logs\zipArchiveLog.txt
IF NOT "%SKIPINSTALLERANDARCHIVE%"=="1" "..\..\..\ExtLibs\7za.exe" a ..\..\Releases\gd4xxxx.7z * > ..\..\Packaging\logs\7zArchiveLog.txt
IF "%SKIPINSTALLERANDARCHIVE%"=="1" echo (Skipped)
cd ..\..\..
@@ -50,4 +50,4 @@ echo. >CON
echo Finished. Do not forget to : >CON
echo -Update news.txt >CON
echo -Update pad file >CON
pause >CON
pause >CON

View File

@@ -1,3 +1,4 @@
#Files needed by the IDE to build games (they are not part of a devel package)
addFilter("devel-file-in-non-devel-package.*/opt/gdevelop/CppPlatform/include/.*")
addFilter("devel-file-in-non-devel-package.*/opt/gdevelop/CppPlatform/Extensions/include/.*")
addFilter("devel-file-in-non-devel-package.*/opt/gdevelop/CppPlatform/Extensions/include/.*")
addFilter("devel-file-in-non-devel-package.*/opt/gdevelop/CppPlatform/Sources/.*")

View File

@@ -13,17 +13,17 @@ AllowNoIcons=yes
LicenseFile=..\Output\Release_Windows\License-en.rtf
InfoBeforeFile=..\Output\Release_Windows\Informations-en.rtf
OutputDir=.\
OutputBaseFilename=gd4083
OutputBaseFilename=gd4090
Compression=lzma
SolidCompression=yes
SetupIconFile=..\Output\Release_Windows\res\icon.ico
VersionInfoVersion=4.0
WizardImageFile=Setup bitmap\wizbmp.bmp
WizardSmallImageFile=Setup bitmap/smallicon.bmp
AppCopyright=2008-2015 Florian Rival
AppCopyright=2008-2016 Florian Rival
VersionInfoCompany=Florian Rival
VersionInfoDescription=GDevelop setup
VersionInfoCopyright=2008-2015 Florian Rival
VersionInfoCopyright=2008-2016 Florian Rival
VersionInfoProductName=GDevelop
VersionInfoProductVersion=4.0
@@ -36,7 +36,9 @@ Name: "portuguese"; MessagesFile: "compiler:Languages\Portuguese.isl";
Name: "german"; MessagesFile: "compiler:Languages\German.isl";
Name: "chinese"; MessagesFile: "..\Packaging\innosetup-languages\ChineseSimplified.isl";
Name: "italian"; MessagesFile: "compiler:Languages\Italian.isl";
Name: "finnish"; MessagesFile: "compiler:Languages\Finnish.isl";
Name: "polish"; MessagesFile: "compiler:Languages\Polish.isl";
Name: "dutch"; MessagesFile: "compiler:Languages\Dutch.isl";
[Tasks]
Name: desktopicon; Description: {cm:CreateDesktopIcon}; GroupDescription: {cm:AdditionalIcons}; Flags:
@@ -45,11 +47,11 @@ Name: quicklaunchicon; Description: {cm:CreateQuickLaunchIcon}; GroupDescription
[Components]
Name: "main"; Description: "GDevelop"; Types: full compact custom; Flags: fixed
Name: "example"; Description: "Exemples"; Types: full custom; Languages: french
Name: "example"; Description: "Examples"; Types: full custom; Languages: english russian
Name: "example"; Description: "Examples"; Types: full custom; Languages: english russian italian polish chinese dutch finnish
Name: "example"; Description: "Ejemplos"; Types: full custom; Languages: spanish
Name: "res"; Description: "Ressources (Images, sons...)"; Types: full custom; Languages: french
Name: "res"; Description: "Resources (images, sounds...)"; Types: full custom; Languages: english russian italian polish chinese
Name: "res"; Description: "Recursos (im<69>genes, sonidos ...)"; Types: full custom; Languages: spanish
Name: "res"; Description: "Resources (images, sounds...)"; Types: full custom; Languages: english russian italian polish chinese dutch finnish
Name: "res"; Description: "Recursos (im<69>genes, sonidos ...)"; Types: full custom; Languages: spanish
[Files]
Source: ..\Output\Release_Windows\GDIDE.exe; DestDir: {app}; Flags: ignoreversion
@@ -72,6 +74,8 @@ Source: ..\Output\Release_Windows\SelectLanguage-pt.cfg; DestDir: {userdocs}\..\
Source: ..\Output\Release_Windows\SelectLanguage-pl.cfg; DestDir: {userdocs}\..\.GDevelop; Flags: ignoreversion createallsubdirs recursesubdirs; DestName: SelectLanguage.cfg; Languages: polish ; Components: main
Source: ..\Output\Release_Windows\SelectLanguage-zh.cfg; DestDir: {userdocs}\..\.GDevelop; Flags: ignoreversion createallsubdirs recursesubdirs; DestName: SelectLanguage.cfg; Languages: chinese ; Components: main
Source: ..\Output\Release_Windows\SelectLanguage-it.cfg; DestDir: {userdocs}\..\.GDevelop; Flags: ignoreversion createallsubdirs recursesubdirs; DestName: SelectLanguage.cfg; Languages: italian ; Components: main
Source: ..\Output\Release_Windows\SelectLanguage-nl.cfg; DestDir: {userdocs}\..\.GDevelop; Flags: ignoreversion createallsubdirs recursesubdirs; DestName: SelectLanguage.cfg; Languages: dutch ; Components: main
Source: ..\Output\Release_Windows\SelectLanguage-fi.cfg; DestDir: {userdocs}\..\.GDevelop; Flags: ignoreversion createallsubdirs recursesubdirs; DestName: SelectLanguage.cfg; Languages: finnish ; Components: main
[Icons]
Name: {group}\GDevelop; Filename: {app}\GDIDE.exe; WorkingDir: {app}

View File

@@ -1,8 +1,6 @@
<?xml version="1.0" encoding="ISO-8859-1" ?>
<News>
<Version Major="3" Minor="6" Build="84" Revision="0"/>
<Info Info="La version 3.6.84 est disponible.&#x0A;&#x0A;Correction d'un crash lors de l'<27>dition d'un nouvel objet Carte de tuiles&#x0A;&#x0A;Nouveaut<75>s de la version 3.6.83 :&#x0A;&#x0A;Nouvelles traductions (partielles) italiennes, chinoises et polonaises.&#x0A;Nouvelle condition 'S<>lectionner l'objet le plus proche'&#x0A;Nouvelle conditions pour tester si un bouton de la souris ou du clavier est relach<EFBFBD>&#x0A;Am<41>lioration du syst<73>me audio des jeux HTML5, meilleure performances sur les mobiles.&#x0A;Mise <20> jour du moteur de rendu des jeux HTML5 (Pixi.js)&#x0A;Nouvelle d<>mo technique Advanced 3D Tower&#x0A;Ajout de la touche retour arri<72>re en alternative <20> Suppr. dans la majorit<69> des <20>diteurs.&#x0A;Correction du crash avec les objets lumi<6D>res sur Windows.&#x0A;Correction de l'usage trop intensif du processeur dans l'<27>diteur d'<27>venements sur Linux.&#x0A;Correction de l'ordre d'insertion d'images multiples dans une animation.&#x0A;Correction de la couleur global d'un objet Sprite dans les jeux HTML5&#x0A;Correction de l'<27>chelle de la taille d'un Sprite quand l'objet est invers<72>.&#x0A;Correction de la recherche de chemin qui ne marchait plus pour les jeux natifs.&#x0A;Correction de crash avec l'objet Carte de tuiles en utilisant des grandes images pour les tuiles.&#x0A;Correction de glitchs avec GTK3
Correction de la mauvaise prise en compte de la taille/animation initiale d'un Sprite dans les jeux HTML5.
" Lien="http://compilgames.net"/>
<CommunityNews text="GDevApp est une web app de cr<63>ation de jeux bas<61>e sur GDevelop : venez essayer la plus avanc<6E>e des applications online de cr<63>ation de jeux. Compatible avec les tablettes et fournie avec des superbes packs de graphismes pr<70>-pr<70>par<61>s." link1="https://github.com/4ian/GD" linkLabel1="GDevelop sur GitHub" link2="https://gdevapp.com?utm_source=software&amp;utm_medium=link_fr&amp;utm_campaign=launch" linkLabel2="Tester GDevApp, la nouvelle app de cr<63>ation de jeux"/>
<Version Major="4" Minor="0" Build="92" Revision="0"/>
<Info Info="La version 4.0.92 est disponible.&#x0A;&#x0A;(Expérimental) Exportation des jeux HTML5 vers Android/iOS/Mac/Windows avec le moteur Cocos2d-JS.&#x0A;(Expérimental) Exportation des jeux natifs vers Android.&#x0A;&#x0A;Les objets avec le comportement 'Objet se déplaçant sur des plateformes' peuvent maintenant agripper les rebords des plateformes - il faut activer l'option dans le comportement de l'objet.&#x0A;Les animations des objets Sprite peuvent maintenant être nommés. Une condition et action ont été ajoutées pour utiliser ces noms.&#x0A;Ajout du support basique d'effets pour les jeux HTML5. ✨ Pour le moment, 3 effets sont disponibles et peuvent être attribués au calques d'une scène. &#x0A;Amélioration des performances des jeux HTML5&#x0A;Correction et améliorations pour les jeux HTML5 exportés avec Cocos2d-JS.&#x0A;Lors de la recherche dans les évènements, l'évènement surlignés est correctement affiché en dépliant au besoin les groupes/évènements repliés.&#x0A;Correction du rendu sur Windows avec les thèmes à fort contraste." Lien="http://compilgames.net"/>
<CommunityNews text="GDevApp est une web app de création de jeux basée sur GDevelop : venez essayer la plus avancée des applications online de création de jeux. Compatible avec les tablettes et fournie avec des superbes packs de graphismes pré-préparés." link1="https://github.com/4ian/GD" linkLabel1="GDevelop sur GitHub" link2="https://gdevapp.com?utm_source=software&amp;utm_medium=link_fr&amp;utm_campaign=launch" linkLabel2="Tester GDevApp, la nouvelle app de création de jeux"/>
</News>

View File

@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="ISO-8859-1" ?>
<News>
<Version Major="3" Minor="6" Build="84" Revision="0"/>
<Info Info="Version 3.6.84 is available.&#x0A;&#x0A;Fix crash when editing newly created TileMap objects&#x0A;&#x0A;Changes of version 3.6.83:&#x0A;&#x0A;New (partial) Italian, Polish and Chinese translations! Your help is welcome, you can contribute on https://crowdin.com/project/gdevelop&#x0A;New 'Pick nearest object' condition&#x0A;New condition to check if a mouse button is released&#x0A;New condition to check if a key is released&#x0A;New sound system for HTML5 with huge performance improvements&#x0A;Update rendering engine of HTML5 (Pixi.js) for improved performances&#x0A;New Advanced 3D tower technical demo&#x0A;Add Backspace as an alternative to Delete key shortcut in most editors&#x0A;Fixed crash with Lights objects on Windows.&#x0A;Fixed the high cpu usage when switching to the event editor on Linux&#x0A;Fixed images insertion order when adding multiple picture to an animation&#x0A;Fixed sprite global color action for HTML5 games&#x0A;Fixed scale factor of Sprite objects being negative when object is flipped&#x0A;Fixed pathfinding not working for native games&#x0A;Updated titles of some editors to make them more consistent&#x0A;Fixed crash with tilemap and large tilesets&#x0A;Fixed some GTK3 glitches&#x0A;Fixed wrong initial sprite size and animation when custom properties were set in HTML5 games" Lien="http://compilgames.net"/>
<Version Major="4" Minor="0" Build="92" Revision="0"/>
<Info Info="Version 4.0.92 is available.&#x0A;&#x0A;New experimental option to export HTML5 games to Android/iOS/Mac/Windows using the Cocos2d as the underlying game engine.&#x0A;&#x0A; New experimental option to export native games to Android.&#x0A;&#x0A;Platformer object now have an option allowing them to grab platform ledges. Activate this option in the behavior and be sure to also enable this on platforms.&#x0A;Animations of Sprite objects can now be named. Specific actions/conditions are also available.&#x0A;Add basic support for effects for HTML5 games. For now, there are 3 simple effects (Night, LightNight, Sepia) and you can apply one of them on each layer of a scene.&#x0A;Performance improvement for HTML5 games.&#x0A;Fix text rendering when using a custom font, when exporting HTML5 games with Cocos2d-JS.&#x0A;Add support for non-smoothed texture for HTML5 games using Cocos2d-JS.&#x0A;Add support for storage actions when for HTML5 games using Cocos2d-JS on Android/iOS.&#x0A;When searching in events, events that are matched are unfolded.&#x0A;Provide compatibility with Windows high contrast themes (thanks @RandomShaper!)&#x0A;Many fixes" Lien="http://compilgames.net"/>
<CommunityNews text="GDevelop has a new website! Help us to translate it to your language by going on the Crowdin project.&#x0A;&#x0A;GDevApp is an online game creator based on GDevelop: Go try the most advanced game creation web app. Compatible with tablets and bundled with awesome graphics assets." link1="https://crowdin.com/project/gdevelop-website/" linkLabel1="Help translate GD website" link2="https://gdevapp.com?utm_source=software&amp;utm_medium=link_en&amp;utm_campaign=launch" linkLabel2="Try GDevApp, the online game creator based on GD"/>
</News>

View File

@@ -42,6 +42,7 @@ IF(APPLE)
set(CMAKE_INSTALL_RPATH ".")
set(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D_WCHAR_H_CPLUSPLUS_98_CONFORMANCE_")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-potentially-evaluated-expression")
ENDIF()
#Sanity checks
@@ -59,10 +60,6 @@ IF("${CMAKE_BUILD_TYPE}" STREQUAL "Release" AND NOT WIN32 AND CMAKE_COMPILER_IS_
SET(CMAKE_SHARED_LINKER_FLAGS "-s") #Force stripping to avoid errors when packaging for linux.
ENDIF()
if(EMSCRIPTEN) #When compiling for the web, ensure we get no warning when using our own external libraries.
SET( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-warn-absolute-paths" )
ENDIF()
#Activate C++11
include(CheckCXXCompilerFlag)
CHECK_CXX_COMPILER_FLAG("-std=gnu++11" COMPILER_SUPPORTS_CXX11)

View File

@@ -246,8 +246,8 @@
<Unit filename="GDCore/CommonTools.cpp" />
<Unit filename="GDCore/CommonTools.h" />
<Unit filename="GDCore/DocMainPage.h" />
<Unit filename="GDCore/Events/BehaviorMetadata.cpp" />
<Unit filename="GDCore/Events/BehaviorMetadata.h" />
<Unit filename="GDCore/Extensions/Metadata/BehaviorMetadata.cpp" />
<Unit filename="GDCore/Extensions/Metadata/BehaviorMetadata.h" />
<Unit filename="GDCore/Events/Builtin/CommentEvent.cpp" />
<Unit filename="GDCore/Events/Builtin/CommentEvent.h" />
<Unit filename="GDCore/Events/Builtin/ForEachEvent.cpp" />
@@ -262,37 +262,37 @@
<Unit filename="GDCore/Events/Builtin/WhileEvent.h" />
<Unit filename="GDCore/Events/Event.cpp" />
<Unit filename="GDCore/Events/Event.h" />
<Unit filename="GDCore/Events/EventMetadata.cpp" />
<Unit filename="GDCore/Events/EventMetadata.h" />
<Unit filename="GDCore/Events/EventsCodeGenerationContext.cpp" />
<Unit filename="GDCore/Events/EventsCodeGenerationContext.h" />
<Unit filename="GDCore/Events/EventsCodeGenerator.cpp" />
<Unit filename="GDCore/Events/EventsCodeGenerator.h" />
<Unit filename="GDCore/Events/EventsCodeNameMangler.cpp" />
<Unit filename="GDCore/Events/EventsCodeNameMangler.h" />
<Unit filename="GDCore/Extensions/Metadata/EventMetadata.cpp" />
<Unit filename="GDCore/Extensions/Metadata/EventMetadata.h" />
<Unit filename="GDCore/Events/CodeGeneration/EventsCodeGenerationContext.cpp" />
<Unit filename="GDCore/Events/CodeGeneration/EventsCodeGenerationContext.h" />
<Unit filename="GDCore/Events/CodeGeneration/EventsCodeGenerator.cpp" />
<Unit filename="GDCore/Events/CodeGeneration/EventsCodeGenerator.h" />
<Unit filename="GDCore/Events/Tools/EventsCodeNameMangler.cpp" />
<Unit filename="GDCore/Events/Tools/EventsCodeNameMangler.h" />
<Unit filename="GDCore/Events/Expression.h" />
<Unit filename="GDCore/Events/ExpressionMetadata.cpp" />
<Unit filename="GDCore/Events/ExpressionMetadata.h" />
<Unit filename="GDCore/Events/ExpressionParser.cpp" />
<Unit filename="GDCore/Events/ExpressionParser.h" />
<Unit filename="GDCore/Events/ExpressionsCodeGeneration.cpp" />
<Unit filename="GDCore/Events/ExpressionsCodeGeneration.h" />
<Unit filename="GDCore/Extensions/Metadata/ExpressionMetadata.cpp" />
<Unit filename="GDCore/Extensions/Metadata/ExpressionMetadata.h" />
<Unit filename="GDCore/Events/Parsers/ExpressionParser.cpp" />
<Unit filename="GDCore/Events/Parsers/ExpressionParser.h" />
<Unit filename="GDCore/Events/CodeGeneration/ExpressionsCodeGeneration.cpp" />
<Unit filename="GDCore/Events/CodeGeneration/ExpressionsCodeGeneration.h" />
<Unit filename="GDCore/Events/Instruction.cpp" />
<Unit filename="GDCore/Events/Instruction.h" />
<Unit filename="GDCore/Events/InstructionMetadata.cpp" />
<Unit filename="GDCore/Events/InstructionMetadata.h" />
<Unit filename="GDCore/Events/ObjectMetadata.cpp" />
<Unit filename="GDCore/Events/ObjectMetadata.h" />
<Unit filename="GDCore/Extensions/Metadata/InstructionMetadata.cpp" />
<Unit filename="GDCore/Extensions/Metadata/InstructionMetadata.h" />
<Unit filename="GDCore/Extensions/Metadata/ObjectMetadata.cpp" />
<Unit filename="GDCore/Extensions/Metadata/ObjectMetadata.h" />
<Unit filename="GDCore/Events/Serialization.cpp" />
<Unit filename="GDCore/Events/Serialization.h" />
<Unit filename="GDCore/IDE/ActionSentenceFormatter.cpp" />
<Unit filename="GDCore/IDE/ActionSentenceFormatter.h" />
<Unit filename="GDCore/IDE/ArbitraryResourceWorker.cpp" />
<Unit filename="GDCore/IDE/ArbitraryResourceWorker.h" />
<Unit filename="GDCore/IDE/Project/ArbitraryResourceWorker.cpp" />
<Unit filename="GDCore/IDE/Project/ArbitraryResourceWorker.h" />
<Unit filename="GDCore/IDE/Clipboard.cpp" />
<Unit filename="GDCore/IDE/Clipboard.h" />
<Unit filename="GDCore/IDE/CommonBitmapManager.cpp" />
<Unit filename="GDCore/IDE/CommonBitmapManager.h" />
<Unit filename="GDCore/IDE/CommonBitmapProvider.cpp" />
<Unit filename="GDCore/IDE/wxTools/CommonBitmapProvider.h" />
<Unit filename="GDCore/IDE/ConditionSentenceFormatter.cpp" />
<Unit filename="GDCore/IDE/ConditionSentenceFormatter.h" />
<Unit filename="GDCore/IDE/Dialogs/AdvancedEntryDialog.cpp" />
@@ -356,41 +356,41 @@
<Unit filename="GDCore/IDE/Dialogs/ResourceLibraryDialog.h" />
<Unit filename="GDCore/IDE/EventsChangesNotifier.cpp" />
<Unit filename="GDCore/IDE/EventsChangesNotifier.h" />
<Unit filename="GDCore/IDE/EventsEditorItemsAreas.cpp" />
<Unit filename="GDCore/IDE/EventsEditorItemsAreas.h" />
<Unit filename="GDCore/IDE/EventsEditorSelection.cpp" />
<Unit filename="GDCore/IDE/EventsEditorSelection.h" />
<Unit filename="GDCore/IDE/EventsRefactorer.cpp" />
<Unit filename="GDCore/IDE/EventsRefactorer.h" />
<Unit filename="GDCore/IDE/EventsRenderingHelper.cpp" />
<Unit filename="GDCore/IDE/EventsRenderingHelper.h" />
<Unit filename="GDCore/IDE/EventsVariablesFinder.cpp" />
<Unit filename="GDCore/IDE/EventsVariablesFinder.h" />
<Unit filename="GDCore/IDE/ExpressionsCorrectnessTesting.cpp" />
<Unit filename="GDCore/IDE/ExpressionsCorrectnessTesting.h" />
<Unit filename="GDCore/IDE/Dialogs/EventsEditor/EventsEditorItemsAreas.cpp" />
<Unit filename="GDCore/IDE/Dialogs/EventsEditor/EventsEditorItemsAreas.h" />
<Unit filename="GDCore/IDE/Dialogs/EventsEditor/EventsEditorSelection.cpp" />
<Unit filename="GDCore/IDE/Dialogs/EventsEditor/EventsEditorSelection.h" />
<Unit filename="GDCore/IDE/Events/EventsRefactorer.cpp" />
<Unit filename="GDCore/IDE/Events/EventsRefactorer.h" />
<Unit filename="GDCore/IDE/Dialogs/EventsEditor/EventsRenderingHelper.cpp" />
<Unit filename="GDCore/IDE/Dialogs/EventsEditor/EventsRenderingHelper.h" />
<Unit filename="GDCore/IDE/Events/EventsVariablesFinder.cpp" />
<Unit filename="GDCore/IDE/Events/EventsVariablesFinder.h" />
<Unit filename="GDCore/IDE/Events/ExpressionsCorrectnessTesting.cpp" />
<Unit filename="GDCore/IDE/Events/ExpressionsCorrectnessTesting.h" />
<Unit filename="GDCore/IDE/ExtensionsLoader.cpp" />
<Unit filename="GDCore/IDE/ExtensionsLoader.h" />
<Unit filename="GDCore/IDE/ImagesUsedInventorizer.cpp" />
<Unit filename="GDCore/IDE/ImagesUsedInventorizer.h" />
<Unit filename="GDCore/IDE/MetadataProvider.cpp" />
<Unit filename="GDCore/IDE/MetadataProvider.h" />
<Unit filename="GDCore/IDE/Project/ImagesUsedInventorizer.cpp" />
<Unit filename="GDCore/IDE/Project/ImagesUsedInventorizer.h" />
<Unit filename="GDCore/Extensions/Metadata/MetadataProvider.cpp" />
<Unit filename="GDCore/Extensions/Metadata/MetadataProvider.h" />
<Unit filename="GDCore/IDE/PlatformLoader.cpp" />
<Unit filename="GDCore/IDE/PlatformLoader.h" />
<Unit filename="GDCore/IDE/PlatformManager.cpp" />
<Unit filename="GDCore/IDE/PlatformManager.h" />
<Unit filename="GDCore/IDE/ProjectExporter.cpp" />
<Unit filename="GDCore/IDE/ProjectExporter.h" />
<Unit filename="GDCore/IDE/ProjectResourcesCopier.cpp" />
<Unit filename="GDCore/IDE/ProjectResourcesCopier.h" />
<Unit filename="GDCore/IDE/ResourcesAbsolutePathChecker.cpp" />
<Unit filename="GDCore/IDE/ResourcesAbsolutePathChecker.h" />
<Unit filename="GDCore/IDE/ResourcesMergingHelper.cpp" />
<Unit filename="GDCore/IDE/ResourcesMergingHelper.h" />
<Unit filename="GDCore/IDE/Project/ProjectResourcesCopier.cpp" />
<Unit filename="GDCore/IDE/Project/ProjectResourcesCopier.h" />
<Unit filename="GDCore/IDE/Project/ResourcesAbsolutePathChecker.cpp" />
<Unit filename="GDCore/IDE/Project/ResourcesAbsolutePathChecker.h" />
<Unit filename="GDCore/IDE/Project/ResourcesMergingHelper.cpp" />
<Unit filename="GDCore/IDE/Project/ResourcesMergingHelper.h" />
<Unit filename="GDCore/IDE/ResourcesUnmergingHelper.cpp" />
<Unit filename="GDCore/IDE/ResourcesUnmergingHelper.h" />
<Unit filename="GDCore/IDE/SceneNameMangler.cpp" />
<Unit filename="GDCore/IDE/SceneNameMangler.h" />
<Unit filename="GDCore/IDE/TextFormatting.h" />
<Unit filename="GDCore/IDE/Events/TextFormatting.h" />
<Unit filename="GDCore/IDE/wxTools/AuiTabArt.cpp" />
<Unit filename="GDCore/IDE/wxTools/AuiTabArt.h" />
<Unit filename="GDCore/IDE/wxTools/FileProperty.cpp" />
@@ -400,50 +400,50 @@
<Unit filename="GDCore/IDE/wxTools/SkinHelper.cpp" />
<Unit filename="GDCore/IDE/wxTools/SkinHelper.h" />
<Unit filename="GDCore/IDE/wxTools/TreeItemStringData.h" />
<Unit filename="GDCore/PlatformDefinition/Behavior.cpp" />
<Unit filename="GDCore/PlatformDefinition/Behavior.h" />
<Unit filename="GDCore/PlatformDefinition/BehaviorsSharedData.cpp" />
<Unit filename="GDCore/PlatformDefinition/BehaviorsSharedData.h" />
<Unit filename="GDCore/PlatformDefinition/ChangesNotifier.cpp" />
<Unit filename="GDCore/PlatformDefinition/ChangesNotifier.h" />
<Unit filename="GDCore/PlatformDefinition/ClassWithObjects.cpp" />
<Unit filename="GDCore/PlatformDefinition/ClassWithObjects.h" />
<Unit filename="GDCore/PlatformDefinition/ExternalEvents.cpp" />
<Unit filename="GDCore/PlatformDefinition/ExternalEvents.h" />
<Unit filename="GDCore/PlatformDefinition/ExternalLayout.cpp" />
<Unit filename="GDCore/PlatformDefinition/ExternalLayout.h" />
<Unit filename="GDCore/PlatformDefinition/ImageManager.cpp" />
<Unit filename="GDCore/PlatformDefinition/ImageManager.h" />
<Unit filename="GDCore/PlatformDefinition/InitialInstance.cpp" />
<Unit filename="GDCore/PlatformDefinition/InitialInstance.h" />
<Unit filename="GDCore/PlatformDefinition/InitialInstancesContainer.cpp" />
<Unit filename="GDCore/PlatformDefinition/InitialInstancesContainer.h" />
<Unit filename="GDCore/PlatformDefinition/Layer.cpp" />
<Unit filename="GDCore/PlatformDefinition/Layer.h" />
<Unit filename="GDCore/PlatformDefinition/Layout.cpp" />
<Unit filename="GDCore/PlatformDefinition/Layout.h" />
<Unit filename="GDCore/PlatformDefinition/LayoutEditorPreviewer.cpp" />
<Unit filename="GDCore/PlatformDefinition/LayoutEditorPreviewer.h" />
<Unit filename="GDCore/PlatformDefinition/Object.cpp" />
<Unit filename="GDCore/PlatformDefinition/Object.h" />
<Unit filename="GDCore/PlatformDefinition/ObjectGroup.cpp" />
<Unit filename="GDCore/PlatformDefinition/ObjectGroup.h" />
<Unit filename="GDCore/PlatformDefinition/Platform.cpp" />
<Unit filename="GDCore/PlatformDefinition/Platform.h" />
<Unit filename="GDCore/PlatformDefinition/PlatformExtension.cpp" />
<Unit filename="GDCore/PlatformDefinition/PlatformExtension.h" />
<Unit filename="GDCore/PlatformDefinition/Project.cpp" />
<Unit filename="GDCore/PlatformDefinition/Project.h" />
<Unit filename="GDCore/PlatformDefinition/ResourcesManager.cpp" />
<Unit filename="GDCore/PlatformDefinition/ResourcesManager.h" />
<Unit filename="GDCore/PlatformDefinition/RessourcesLoader.cpp" />
<Unit filename="GDCore/PlatformDefinition/RessourcesLoader.h" />
<Unit filename="GDCore/PlatformDefinition/SourceFile.cpp" />
<Unit filename="GDCore/PlatformDefinition/SourceFile.h" />
<Unit filename="GDCore/PlatformDefinition/Variable.cpp" />
<Unit filename="GDCore/PlatformDefinition/Variable.h" />
<Unit filename="GDCore/PlatformDefinition/VariablesContainer.cpp" />
<Unit filename="GDCore/PlatformDefinition/VariablesContainer.h" />
<Unit filename="GDCore/Project/Behavior.cpp" />
<Unit filename="GDCore/Project/Behavior.h" />
<Unit filename="GDCore/Project/BehaviorsSharedData.cpp" />
<Unit filename="GDCore/Project/BehaviorsSharedData.h" />
<Unit filename="GDCore/Project/ChangesNotifier.cpp" />
<Unit filename="GDCore/Project/ChangesNotifier.h" />
<Unit filename="GDCore/Project/ClassWithObjects.cpp" />
<Unit filename="GDCore/Project/ClassWithObjects.h" />
<Unit filename="GDCore/Project/ExternalEvents.cpp" />
<Unit filename="GDCore/Project/ExternalEvents.h" />
<Unit filename="GDCore/Project/ExternalLayout.cpp" />
<Unit filename="GDCore/Project/ExternalLayout.h" />
<Unit filename="GDCore/Project/ImageManager.cpp" />
<Unit filename="GDCore/Project/ImageManager.h" />
<Unit filename="GDCore/Project/InitialInstance.cpp" />
<Unit filename="GDCore/Project/InitialInstance.h" />
<Unit filename="GDCore/Project/InitialInstancesContainer.cpp" />
<Unit filename="GDCore/Project/InitialInstancesContainer.h" />
<Unit filename="GDCore/Project/Layer.cpp" />
<Unit filename="GDCore/Project/Layer.h" />
<Unit filename="GDCore/Project/Layout.cpp" />
<Unit filename="GDCore/Project/Layout.h" />
<Unit filename="GDCore/Project/LayoutEditorPreviewer.cpp" />
<Unit filename="GDCore/Project/LayoutEditorPreviewer.h" />
<Unit filename="GDCore/Project/Object.cpp" />
<Unit filename="GDCore/Project/Object.h" />
<Unit filename="GDCore/Project/ObjectGroup.cpp" />
<Unit filename="GDCore/Project/ObjectGroup.h" />
<Unit filename="GDCore/Extensions/Platform.cpp" />
<Unit filename="GDCore/Extensions/Platform.h" />
<Unit filename="GDCore/Extensions/PlatformExtension.cpp" />
<Unit filename="GDCore/Extensions/PlatformExtension.h" />
<Unit filename="GDCore/Project/Project.cpp" />
<Unit filename="GDCore/Project/Project.h" />
<Unit filename="GDCore/Project/ResourcesManager.cpp" />
<Unit filename="GDCore/Project/ResourcesManager.h" />
<Unit filename="GDCore/Project/RessourcesLoader.cpp" />
<Unit filename="GDCore/Project/RessourcesLoader.h" />
<Unit filename="GDCore/Project/SourceFile.cpp" />
<Unit filename="GDCore/Project/SourceFile.h" />
<Unit filename="GDCore/Project/Variable.cpp" />
<Unit filename="GDCore/Project/Variable.h" />
<Unit filename="GDCore/Project/VariablesContainer.cpp" />
<Unit filename="GDCore/Project/VariablesContainer.h" />
<Unit filename="GDCore/TinyXml/tinystr.cpp" />
<Unit filename="GDCore/TinyXml/tinystr.h" />
<Unit filename="GDCore/TinyXml/tinyxml.cpp" />
@@ -489,29 +489,29 @@
<debugger />
<wxsmith version="1">
<resources>
<wxDialog wxs="wxsmith/ChooseVariableDialog.wxs" src="GDCore\IDE\Dialogs\ChooseVariableDialog.cpp" hdr="GDCore\IDE\Dialogs\ChooseVariableDialog.h" fwddecl="0" i18n="1" name="ChooseVariableDialog" language="CPP" />
<wxDialog wxs="wxsmith/ResourceLibraryDialog.wxs" src="GDCore\IDE\Dialogs\ResourceLibraryDialog.cpp" hdr="GDCore\IDE\Dialogs\ResourceLibraryDialog.h" fwddecl="0" i18n="1" name="ResourceLibraryDialog" language="CPP" />
<wxDialog wxs="wxsmith/ProjectExtensionsDialog.wxs" src="GDCore\IDE\Dialogs\ProjectExtensionsDialog.cpp" hdr="GDCore\IDE\Dialogs\ProjectExtensionsDialog.h" fwddecl="0" i18n="1" name="ProjectExtensionsDialog" language="CPP" />
<wxDialog wxs="wxsmith/ChooseObjectDialog.wxs" src="GDCore\IDE\Dialogs\ChooseObjectDialog.cpp" hdr="GDCore\IDE\Dialogs\ChooseObjectDialog.h" fwddecl="0" i18n="1" name="ChooseObjectDialog" language="CPP" />
<wxDialog wxs="wxsmith/ChooseBehaviorDialog.wxs" src="GDCore\IDE\Dialogs\ChooseBehaviorDialog.cpp" hdr="GDCore\IDE\Dialogs\ChooseBehaviorDialog.h" fwddecl="0" i18n="1" name="ChooseBehaviorDialog" language="CPP" />
<wxDialog wxs="wxsmith/ChooseLayerDialog.wxs" src="GDCore\IDE\Dialogs\ChooseLayerDialog.cpp" hdr="GDCore\IDE\Dialogs\ChooseLayerDialog.h" fwddecl="0" i18n="1" name="ChooseLayerDialog" language="CPP" />
<wxDialog wxs="wxsmith/EditExpressionDialog.wxs" src="GDCore\IDE\Dialogs\EditExpressionDialog.cpp" hdr="GDCore\IDE\Dialogs\EditExpressionDialog.h" fwddecl="0" i18n="1" name="EditExpressionDialog" language="CPP" />
<wxDialog wxs="wxsmith/EditStrExpressionDialog.wxs" src="GDCore\IDE\Dialogs\EditStrExpressionDialog.cpp" hdr="GDCore\IDE\Dialogs\EditStrExpressionDialog.h" fwddecl="0" i18n="1" name="EditStrExpressionDialog" language="CPP" />
<wxDialog wxs="wxsmith/AdvancedEntryDialog.wxs" src="GDCore\IDE\Dialogs\AdvancedEntryDialog.cpp" hdr="GDCore\IDE\Dialogs\AdvancedEntryDialog.h" fwddecl="0" i18n="1" name="AdvancedEntryDialog" language="CPP" />
<wxDialog wxs="wxsmith/ChooseObjectTypeDialog.wxs" src="GDCore\IDE\Dialogs\ChooseObjectTypeDialog.cpp" hdr="GDCore\IDE\Dialogs\ChooseObjectTypeDialog.h" fwddecl="0" i18n="1" name="ChooseObjectTypeDialog" language="CPP" />
<wxPanel wxs="wxsmith/LayoutEditorCanvas.wxs" src="GDCore\IDE\Dialogs\LayoutEditorCanvas.cpp" hdr="GDCore\IDE\Dialogs\LayoutEditorCanvas.h" fwddecl="0" i18n="1" name="LayoutEditorCanvas" language="CPP" />
<wxDialog wxs="wxsmith/GridSetupDialog.wxs" src="GDCore\IDE\Dialogs\GridSetupDialog.cpp" hdr="GDCore\IDE\Dialogs\GridSetupDialog.h" fwddecl="0" i18n="1" name="GridSetupDialog" language="CPP" />
<wxPanel wxs="wxsmith/LayersEditorPanel.wxs" src="GDCore\IDE\Dialogs\LayersEditorPanel.cpp" hdr="GDCore\IDE\Dialogs\LayersEditorPanel.h" fwddecl="0" i18n="1" name="LayersEditorPanel" language="CPP" />
<wxDialog wxs="wxsmith/InstancesAdvancedPasteDialog.wxs" src="GDCore\IDE\Dialogs\InstancesAdvancedPasteDialog.cpp" hdr="GDCore\IDE\Dialogs\InstancesAdvancedPasteDialog.h" fwddecl="0" i18n="1" name="InstancesAdvancedPasteDialog" language="CPP" />
<wxDialog wxs="wxsmith/ChooseBehaviorTypeDialog.wxs" src="GDCore\IDE\Dialogs\ChooseBehaviorTypeDialog.cpp" hdr="GDCore\IDE\Dialogs\ChooseBehaviorTypeDialog.h" fwddecl="0" i18n="1" name="ChooseBehaviorTypeDialog" language="CPP" />
<wxDialog wxs="wxsmith/EditLayerDialog.wxs" src="GDCore\IDE\Dialogs\EditLayerDialog.cpp" hdr="GDCore\IDE\Dialogs\EditLayerDialog.h" fwddecl="0" i18n="1" name="EditLayerDialog" language="CPP" />
<wxDialog wxs="wxsmith/EditLink.wxs" src="GDCore\IDE\Dialogs\EditLink.cpp" hdr="GDCore\IDE\Dialogs\EditLink.h" fwddecl="0" i18n="1" name="EditLink" language="CPP" />
<wxDialog wxs="wxsmith/EditComment.wxs" src="GDCore\IDE\Dialogs\EditComment.cpp" hdr="GDCore\IDE\Dialogs\EditComment.h" fwddecl="0" i18n="1" name="EditComment" language="CPP" />
<wxDialog wxs="wxsmith/EditForEachEvent.wxs" src="GDCore\IDE\Dialogs\EditForEachEvent.cpp" hdr="GDCore\IDE\Dialogs\EditForEachEvent.h" fwddecl="0" i18n="1" name="EditForEachEvent" language="CPP" />
<wxDialog wxs="wxsmith/EditRepeatEvent.wxs" src="GDCore\IDE\Dialogs\EditRepeatEvent.cpp" hdr="GDCore\IDE\Dialogs\EditRepeatEvent.h" fwddecl="0" i18n="1" name="EditRepeatEvent" language="CPP" />
<wxDialog wxs="wxsmith/ProjectUpdateDialog.wxs" src="GDCore\IDE\Dialogs\ProjectUpdateDialog.cpp" hdr="GDCore\IDE\Dialogs\ProjectUpdateDialog.h" fwddecl="0" i18n="1" name="ProjectUpdateDialog" language="CPP" />
<wxDialog wxs="wxsmith/SpriteObjectEditor.wxs" src="GDCore\BuiltinExtensions\SpriteExtension\Dialogs\SpriteObjectEditor.cpp" hdr="GDCore\BuiltinExtensions\SpriteExtension\Dialogs\SpriteObjectEditor.h" fwddecl="0" i18n="1" name="SpriteObjectEditor" language="CPP" />
<wxPanel wxs="wxsmith/ResourcesEditor.wxs" src="GDCore\IDE\Dialogs\ResourcesEditor.cpp" hdr="GDCore\IDE\Dialogs\ResourcesEditor.h" fwddecl="0" i18n="1" name="ResourcesEditor" language="CPP" />
<wxDialog wxs="wxsmith/ChooseVariableDialog.wxs" src="GDCore/IDE/Dialogs/ChooseVariableDialog.cpp" hdr="GDCore/IDE/Dialogs/ChooseVariableDialog.h" fwddecl="0" i18n="1" name="ChooseVariableDialog" language="CPP" />
<wxDialog wxs="wxsmith/ResourceLibraryDialog.wxs" src="GDCore/IDE/Dialogs/ResourceLibraryDialog.cpp" hdr="GDCore/IDE/Dialogs/ResourceLibraryDialog.h" fwddecl="0" i18n="1" name="ResourceLibraryDialog" language="CPP" />
<wxDialog wxs="wxsmith/ProjectExtensionsDialog.wxs" src="GDCore/IDE/Dialogs/ProjectExtensionsDialog.cpp" hdr="GDCore/IDE/Dialogs/ProjectExtensionsDialog.h" fwddecl="0" i18n="1" name="ProjectExtensionsDialog" language="CPP" />
<wxDialog wxs="wxsmith/ChooseObjectDialog.wxs" src="GDCore/IDE/Dialogs/ChooseObjectDialog.cpp" hdr="GDCore/IDE/Dialogs/ChooseObjectDialog.h" fwddecl="0" i18n="1" name="ChooseObjectDialog" language="CPP" />
<wxDialog wxs="wxsmith/ChooseBehaviorDialog.wxs" src="GDCore/IDE/Dialogs/ChooseBehaviorDialog.cpp" hdr="GDCore/IDE/Dialogs/ChooseBehaviorDialog.h" fwddecl="0" i18n="1" name="ChooseBehaviorDialog" language="CPP" />
<wxDialog wxs="wxsmith/ChooseLayerDialog.wxs" src="GDCore/IDE/Dialogs/ChooseLayerDialog.cpp" hdr="GDCore/IDE/Dialogs/ChooseLayerDialog.h" fwddecl="0" i18n="1" name="ChooseLayerDialog" language="CPP" />
<wxDialog wxs="wxsmith/EditExpressionDialog.wxs" src="GDCore/IDE/Dialogs/EditExpressionDialog.cpp" hdr="GDCore/IDE/Dialogs/EditExpressionDialog.h" fwddecl="0" i18n="1" name="EditExpressionDialog" language="CPP" />
<wxDialog wxs="wxsmith/EditStrExpressionDialog.wxs" src="GDCore/IDE/Dialogs/EditStrExpressionDialog.cpp" hdr="GDCore/IDE/Dialogs/EditStrExpressionDialog.h" fwddecl="0" i18n="1" name="EditStrExpressionDialog" language="CPP" />
<wxDialog wxs="wxsmith/AdvancedEntryDialog.wxs" src="GDCore/IDE/Dialogs/AdvancedEntryDialog.cpp" hdr="GDCore/IDE/Dialogs/AdvancedEntryDialog.h" fwddecl="0" i18n="1" name="AdvancedEntryDialog" language="CPP" />
<wxDialog wxs="wxsmith/ChooseObjectTypeDialog.wxs" src="GDCore/IDE/Dialogs/ChooseObjectTypeDialog.cpp" hdr="GDCore/IDE/Dialogs/ChooseObjectTypeDialog.h" fwddecl="0" i18n="1" name="ChooseObjectTypeDialog" language="CPP" />
<wxPanel wxs="wxsmith/LayoutEditorCanvas.wxs" src="GDCore/IDE/Dialogs/LayoutEditorCanvas.cpp" hdr="GDCore/IDE/Dialogs/LayoutEditorCanvas.h" fwddecl="0" i18n="1" name="LayoutEditorCanvas" language="CPP" />
<wxDialog wxs="wxsmith/GridSetupDialog.wxs" src="GDCore/IDE/Dialogs/GridSetupDialog.cpp" hdr="GDCore/IDE/Dialogs/GridSetupDialog.h" fwddecl="0" i18n="1" name="GridSetupDialog" language="CPP" />
<wxPanel wxs="wxsmith/LayersEditorPanel.wxs" src="GDCore/IDE/Dialogs/LayersEditorPanel.cpp" hdr="GDCore/IDE/Dialogs/LayersEditorPanel.h" fwddecl="0" i18n="1" name="LayersEditorPanel" language="CPP" />
<wxDialog wxs="wxsmith/InstancesAdvancedPasteDialog.wxs" src="GDCore/IDE/Dialogs/InstancesAdvancedPasteDialog.cpp" hdr="GDCore/IDE/Dialogs/InstancesAdvancedPasteDialog.h" fwddecl="0" i18n="1" name="InstancesAdvancedPasteDialog" language="CPP" />
<wxDialog wxs="wxsmith/ChooseBehaviorTypeDialog.wxs" src="GDCore/IDE/Dialogs/ChooseBehaviorTypeDialog.cpp" hdr="GDCore/IDE/Dialogs/ChooseBehaviorTypeDialog.h" fwddecl="0" i18n="1" name="ChooseBehaviorTypeDialog" language="CPP" />
<wxDialog wxs="wxsmith/EditLayerDialog.wxs" src="GDCore/IDE/Dialogs/EditLayerDialog.cpp" hdr="GDCore/IDE/Dialogs/EditLayerDialog.h" fwddecl="0" i18n="1" name="EditLayerDialog" language="CPP" />
<wxDialog wxs="wxsmith/EditLink.wxs" src="GDCore/IDE/Dialogs/EditLink.cpp" hdr="GDCore/IDE/Dialogs/EditLink.h" fwddecl="0" i18n="1" name="EditLink" language="CPP" />
<wxDialog wxs="wxsmith/EditComment.wxs" src="GDCore/IDE/Dialogs/EditComment.cpp" hdr="GDCore/IDE/Dialogs/EditComment.h" fwddecl="0" i18n="1" name="EditComment" language="CPP" />
<wxDialog wxs="wxsmith/EditForEachEvent.wxs" src="GDCore/IDE/Dialogs/EditForEachEvent.cpp" hdr="GDCore/IDE/Dialogs/EditForEachEvent.h" fwddecl="0" i18n="1" name="EditForEachEvent" language="CPP" />
<wxDialog wxs="wxsmith/EditRepeatEvent.wxs" src="GDCore/IDE/Dialogs/EditRepeatEvent.cpp" hdr="GDCore/IDE/Dialogs/EditRepeatEvent.h" fwddecl="0" i18n="1" name="EditRepeatEvent" language="CPP" />
<wxDialog wxs="wxsmith/ProjectUpdateDialog.wxs" src="GDCore/IDE/Dialogs/ProjectUpdateDialog.cpp" hdr="GDCore/IDE/Dialogs/ProjectUpdateDialog.h" fwddecl="0" i18n="1" name="ProjectUpdateDialog" language="CPP" />
<wxDialog wxs="wxsmith/SpriteObjectEditor.wxs" src="GDCore/Extensions/Builtin/SpriteExtension/Dialogs/SpriteObjectEditor.cpp" hdr="GDCore/Extensions/Builtin/SpriteExtension/Dialogs/SpriteObjectEditor.h" fwddecl="0" i18n="1" name="SpriteObjectEditor" language="CPP" />
<wxPanel wxs="wxsmith/ResourcesEditor.wxs" src="GDCore/IDE/Dialogs/ResourcesEditor.cpp" hdr="GDCore/IDE/Dialogs/ResourcesEditor.h" fwddecl="0" i18n="1" name="ResourcesEditor" language="CPP" />
</resources>
</wxsmith>
</Extensions>

View File

@@ -1,34 +0,0 @@
/*
* GDevelop Core
* Copyright 2008-2015 Florian Rival (Florian.Rival@gmail.com). All rights reserved.
* This project is released under the MIT License.
*/
#include "AllBuiltinExtensions.h"
#include "GDCore/Tools/Localization.h"
using namespace std;
namespace gd
{
void GD_CORE_API BuiltinExtensionsImplementer::ImplementsAdvancedExtension(gd::PlatformExtension & extension)
{
extension.SetExtensionInformation("BuiltinAdvanced",
_("Advanced control features"),
_("Built-in extension providing advanced control features."),
"Florian Rival",
"Open source (MIT License)");
#if defined(GD_IDE_ONLY)
extension.AddCondition("Toujours",
_("Always"),
_("This condition returns always true (or always false if condition is inverted)."),
_("Always"),
_("Other"),
"res/conditions/toujours24.png",
"res/conditions/toujours.png")
.AddCodeOnlyParameter("conditionInverted", "")
.MarkAsAdvanced();
#endif
}
}

View File

@@ -1,435 +0,0 @@
/*
* GDevelop Core
* Copyright 2008-2015 Florian Rival (Florian.Rival@gmail.com). All rights reserved.
* This project is released under the MIT License.
*/
#include "AllBuiltinExtensions.h"
#include "GDCore/Tools/Localization.h"
using namespace std;
namespace gd
{
void GD_CORE_API BuiltinExtensionsImplementer::ImplementsAudioExtension(gd::PlatformExtension & extension)
{
extension.SetExtensionInformation("BuiltinAudio",
_("Audio"),
_("Builtin audio extension"),
"Florian Rival",
"Open source (MIT License)");
#if defined(GD_IDE_ONLY)
extension.AddAction("PlaySoundCanal",
_("Play a sound on a channel"),
_("Play a sound (small audio file) on a specific channel,\nso as to be able to manipulate it."),
_("Play the sound _PARAM1_ on the channel _PARAM2_"),
_("Audio/Sounds on channels"),
"res/actions/son24.png",
"res/actions/son.png")
.AddCodeOnlyParameter("currentScene", "")
.AddParameter("soundfile", _("Audio file"))
.AddParameter("expression", _("Channel identifier"))
.AddParameter("yesorno", _("Repeat the sound"), "",true).SetDefaultValue("no")
.AddParameter("expression", _("Volume (from 0 to 100, 100 by default)"), "",true).SetDefaultValue("100")
.AddParameter("expression", _("Pitch (speed) (1 by default)"), "",true).SetDefaultValue("1")
.MarkAsAdvanced();
extension.AddAction("StopSoundCanal",
_("Stop the sound of a channel"),
_("Stop the sound on the specified channel."),
_("Stop the sound of channel _PARAM1_"),
_("Audio/Sounds on channels"),
"res/actions/son24.png",
"res/actions/son.png")
.AddCodeOnlyParameter("currentScene", "")
.AddParameter("expression", _("Channel identifier"))
.MarkAsAdvanced();
extension.AddAction("PauseSoundCanal",
_("Pause the sound of a channel"),
_("Pause the sound played on the specified channel."),
_("Pause the sound of channel _PARAM1_"),
_("Audio/Sounds on channels"),
"res/actions/son24.png",
"res/actions/son.png")
.AddCodeOnlyParameter("currentScene", "")
.AddParameter("expression", _("Channel identifier"))
.MarkAsAdvanced();
extension.AddAction("RePlaySoundCanal",
_("Play the sound of a channel"),
_("Play the sound of the channel."),
_("Play the sound of channel _PARAM1_"),
_("Audio/Sounds on channels"),
"res/actions/son24.png",
"res/actions/son.png")
.AddCodeOnlyParameter("currentScene", "")
.AddParameter("expression", _("Channel identifier"))
.MarkAsAdvanced();
extension.AddAction("PlayMusicCanal",
_("Play a music on a channel"),
_("Play a music an on specific channel,\nso as to be able to interact with later."),
_("Play the music _PARAM1_ on channel _PARAM2_"),
_("Audio/Musics on channels"),
"res/actions/music24.png",
"res/actions/music.png")
.AddCodeOnlyParameter("currentScene", "")
.AddParameter("musicfile", _("Audio file"))
.AddParameter("expression", _("Channel identifier"))
.AddParameter("yesorno", _("Repeat the sound"), "",true).SetDefaultValue("no")
.AddParameter("expression", _("Volume (from 0 to 100, 100 by default)"), "",true).SetDefaultValue("100")
.AddParameter("expression", _("Pitch (speed) (1 by default)"), "",true).SetDefaultValue("1")
.MarkAsAdvanced();
extension.AddAction("StopMusicCanal",
_("Stop the music on a channel"),
_("Stop the music on the specified channel"),
_("Stop the music of channel _PARAM1_"),
_("Audio/Musics on channels"),
"res/actions/music24.png",
"res/actions/music.png")
.AddCodeOnlyParameter("currentScene", "")
.AddParameter("expression", _("Channel identifier"))
.MarkAsAdvanced();
extension.AddAction("PauseMusicCanal",
_("Pause the music of a channel"),
_("Pause the music on the specified channel."),
_("Pause the music of channel _PARAM1_"),
_("Audio/Musics on channels"),
"res/actions/music24.png",
"res/actions/music.png")
.AddCodeOnlyParameter("currentScene", "")
.AddParameter("expression", _("Channel identifier"))
.MarkAsAdvanced();
extension.AddAction("RePlayMusicCanal",
_("Play the music of a channel"),
_("Play the music of the channel."),
_("Play the music of channel _PARAM1_"),
_("Audio/Musics on channels"),
"res/actions/music24.png",
"res/actions/music.png")
.AddCodeOnlyParameter("currentScene", "")
.AddParameter("expression", _("Channel identifier"))
.MarkAsAdvanced();
extension.AddAction("ModVolumeSoundCanal",
_("Volume of the sound on a channel"),
_("This action modify the volume of the sound on the specified channel. The volume is between 0 and 100."),
_("Do _PARAM2__PARAM3_ to the volume of the sound on channel _PARAM1_"),
_("Audio/Sounds on channels"),
"res/actions/sonVolume24.png",
"res/actions/sonVolume.png")
.AddCodeOnlyParameter("currentScene", "")
.AddParameter("expression", _("Channel identifier"))
.AddParameter("operator", _("Modification's sign"))
.AddParameter("expression", _("Value"))
.MarkAsAdvanced()
.SetManipulatedType("number");
extension.AddAction("ModVolumeMusicCanal",
_("Volume of the music on a channel"),
_("This action modify the volume of the music on the specified channel. The volume is between 0 and 100."),
_("Do _PARAM2__PARAM3_ to the volume of the music on channel _PARAM1_"),
_("Audio/Musics on channels"),
"res/actions/musicVolume24.png",
"res/actions/musicVolume.png")
.AddCodeOnlyParameter("currentScene", "")
.AddParameter("expression", _("Channel identifier"))
.AddParameter("operator", _("Modification's sign"))
.AddParameter("expression", _("Value"))
.MarkAsAdvanced()
.SetManipulatedType("number");
extension.AddAction("ModGlobalVolume",
_("Game global volume"),
_("This action modify the global volume of the game. The volume is between 0 and 100."),
_("Do _PARAM1__PARAM2_ to global sound level"),
_("Audio"),
"res/actions/volume24.png",
"res/actions/volume.png")
.AddCodeOnlyParameter("currentScene", "")
.AddParameter("operator", _("Modification's sign"))
.AddParameter("expression", _("Value"))
.MarkAsSimple()
.SetManipulatedType("number");
extension.AddAction("ModPitchSoundChannel",
_("Pitch of the sound of a channel"),
_("This action modify pitch (speed) of the sound on a channel.\n1 is the default pitch."),
_("Do _PARAM2__PARAM3_ to the pitch of the sound on channel _PARAM1_"),
_("Audio/Sounds on channels"),
"res/actions/son24.png",
"res/actions/son.png")
.AddCodeOnlyParameter("currentScene", "")
.AddParameter("expression", _("Channel identifier"))
.AddParameter("operator", _("Modification's sign"))
.AddParameter("expression", _("Value"))
.MarkAsAdvanced()
.SetManipulatedType("number");
extension.AddAction("ModPitchMusicChannel",
_("Pitch of the music on a channel"),
_("This action modify the pitch of the music on the specified channel. 1 is the default pitch"),
_("Do _PARAM2__PARAM3_ to the pitch of the music on channel _PARAM1_"),
_("Audio/Musics on channels"),
"res/actions/music24.png",
"res/actions/music.png")
.AddCodeOnlyParameter("currentScene", "")
.AddParameter("expression", _("Channel identifier"))
.AddParameter("operator", _("Modification's sign"))
.AddParameter("expression", _("Value"))
.MarkAsAdvanced()
.SetManipulatedType("number");
extension.AddAction("ModPlayingOffsetSoundChannel",
_("Playing offset of the sound on a channel"),
_("This action modify the playing offset of the sound on a channel"),
_("Do _PARAM2__PARAM3_ to the playing offset of the sound on channel _PARAM1_"),
_("Audio/Sounds on channels"),
"res/actions/son24.png",
"res/actions/son.png")
.AddCodeOnlyParameter("currentScene", "")
.AddParameter("expression", _("Channel identifier"))
.AddParameter("operator", _("Modification's sign"))
.AddParameter("expression", _("Value"))
.MarkAsAdvanced()
.SetManipulatedType("number");
extension.AddAction("ModPlayingOffsetMusicChannel",
_("Playing offset of the music on a channel"),
_("This action modify the playing offset of the music on the specified channel"),
_("Do _PARAM2__PARAM3_ to the playing offset of the music on channel _PARAM1_"),
_("Audio/Musics on channels"),
"res/actions/music24.png",
"res/actions/music.png")
.AddCodeOnlyParameter("currentScene", "")
.AddParameter("expression", _("Channel identifier"))
.AddParameter("operator", _("Modification's sign"))
.AddParameter("expression", _("Value"))
.MarkAsAdvanced()
.SetManipulatedType("number");
extension.AddAction("PlaySound",
_("Play a sound"),
_("Play a sound."),
_("Play the sound _PARAM1_"),
_("Audio"),
"res/actions/son24.png",
"res/actions/son.png")
.AddCodeOnlyParameter("currentScene", "")
.AddParameter("soundfile", _("Audio file"))
.AddParameter("yesorno", _("Repeat the sound"), "",true).SetDefaultValue("no")
.AddParameter("expression", _("Volume (from 0 to 100, 100 by default)"), "",true).SetDefaultValue("100")
.AddParameter("expression", _("Pitch (speed) (1 by default)"), "",true).SetDefaultValue("1")
.MarkAsSimple();
extension.AddAction("PlayMusic",
_("Play a music"),
_("Play a music."),
_("Play the music _PARAM1_"),
_("Audio"),
"res/actions/music24.png",
"res/actions/music.png")
.AddCodeOnlyParameter("currentScene", "")
.AddParameter("musicfile", _("Audio file"))
.AddParameter("yesorno", _("Repeat the sound"), "",true).SetDefaultValue("no")
.AddParameter("expression", _("Volume (from 0 to 100, 100 by default)"), "",true).SetDefaultValue("100")
.AddParameter("expression", _("Pitch (speed) (1 by default)"), "",true).SetDefaultValue("1")
.MarkAsSimple();
extension.AddCondition("MusicPlaying",
_("A music is being played"),
_("Test if the music on a channel is being played"),
_("Music on channel _PARAM1_ is being played"),
_("Audio/Musics on channels"),
"res/conditions/musicplaying24.png",
"res/conditions/musicplaying.png")
.AddCodeOnlyParameter("currentScene", "")
.AddParameter("expression", _("Channel"))
.MarkAsAdvanced();
extension.AddCondition("MusicPaused",
_("A music is paused"),
_("Test if the music on the specified channel is paused."),
_("Music on channel _PARAM1_ is paused"),
_("Audio/Musics on channels"),
"res/conditions/musicpaused24.png",
"res/conditions/musicpaused.png")
.AddCodeOnlyParameter("currentScene", "")
.AddParameter("expression", _("Channel"))
.MarkAsAdvanced();
extension.AddCondition("MusicStopped",
_("A music is stopped"),
_("Test if the music on the specified channel is stopped."),
_("Music on channel _PARAM1_ is stopped"),
_("Audio/Musics on channels"),
"res/conditions/musicstopped24.png",
"res/conditions/musicstopped.png")
.AddCodeOnlyParameter("currentScene", "")
.AddParameter("expression", _("Channel"))
.MarkAsAdvanced();
extension.AddCondition("SoundPlaying",
_("A sound is being played"),
_("Test if the sound on a channel is being played."),
_("Sound on channel _PARAM1_ is being played"),
_("Audio/Sounds on channels"),
"res/conditions/sonplaying24.png",
"res/conditions/sonplaying.png")
.AddCodeOnlyParameter("currentScene", "")
.AddParameter("expression", _("Channel"))
.MarkAsAdvanced();
extension.AddCondition("SoundPaused",
_("A sound is paused"),
_("Test if the sound on the specified channel is paused."),
_("Sound on channel _PARAM1_ is paused"),
_("Audio/Sounds on channels"),
"res/conditions/sonpaused24.png",
"res/conditions/sonpaused.png")
.AddCodeOnlyParameter("currentScene", "")
.AddParameter("expression", _("Channel"))
.MarkAsAdvanced();
extension.AddCondition("SoundStopped",
_("A sound is stopped"),
_("Test if the sound on the specified channel is stopped."),
_("Sound on channel _PARAM1_ is stopped"),
_("Audio/Sounds on channels"),
"res/conditions/sonstopped24.png",
"res/conditions/sonstopped.png")
.AddCodeOnlyParameter("currentScene", "")
.AddParameter("expression", _("Channel"))
.MarkAsAdvanced();
extension.AddCondition("SoundCanalVolume",
_("Volume of the sound on a channel"),
_("Test the volume of the sound on the specified channel. The volume is between 0 and 100."),
_("The volume of the sound on channel _PARAM1_ is _PARAM2__PARAM3_"),
_("Audio/Sounds on channels"),
"res/conditions/sonVolume24.png",
"res/conditions/sonVolume.png")
.AddCodeOnlyParameter("currentScene", "")
.AddParameter("expression", _("Channel identifier"))
.AddParameter("relationalOperator", _("Sign of the test"))
.AddParameter("expression", _("Volume to test"))
.MarkAsAdvanced()
.SetManipulatedType("number");
extension.AddCondition("MusicCanalVolume",
_("Volume of the music on a channel"),
_("Test the volume of the music on specified channel. The volume is between 0 and 100."),
_("The volume of the music on channel _PARAM1_ is _PARAM2__PARAM3_"),
_("Audio/Musics on channels"),
"res/conditions/musicVolume24.png",
"res/conditions/musicVolume.png")
.AddCodeOnlyParameter("currentScene", "")
.AddParameter("expression", _("Channel identifier"))
.AddParameter("relationalOperator", _("Sign of the test"))
.AddParameter("expression", _("Volume to test"))
.MarkAsAdvanced()
.SetManipulatedType("number");
extension.AddCondition("GlobalVolume",
_("Global volume"),
_("Test the global sound level. The volume is between 0 and 100."),
_("The global game volume is _PARAM2_ to _PARAM1_"),
_("Audio"),
"res/conditions/volume24.png",
"res/conditions/volume.png")
.AddCodeOnlyParameter("currentScene", "")
.AddParameter("relationalOperator", _("Sign of the test"))
.AddParameter("expression", _("Volume to test"))
.SetManipulatedType("number");
extension.AddCondition("SoundChannelPitch",
_("Pitch of the sound of a channel"),
_("Test the pitch of the sound on the specified channel. 1 is the default pitch."),
_("The pitch of the sound on channel _PARAM1_ is _PARAM2__PARAM3_"),
_("Audio/Sounds on channels"),
"res/conditions/sonVolume24.png",
"res/conditions/sonVolume.png")
.AddCodeOnlyParameter("currentScene", "")
.AddParameter("expression", _("Channel identifier"))
.AddParameter("relationalOperator", _("Sign of the test"))
.AddParameter("expression", _("Pitch to test"))
.MarkAsAdvanced()
.SetManipulatedType("number");
extension.AddCondition("MusicChannelPitch",
_("Pitch of the music on a channel"),
_("Test the pitch (speed) of the music on specified channel. 1 is the default pitch."),
_("The volume of the music on channel _PARAM1_ is _PARAM2__PARAM3_"),
_("Audio/Musics on channels"),
"res/conditions/musicVolume24.png",
"res/conditions/musicVolume.png")
.AddCodeOnlyParameter("currentScene", "")
.AddParameter("expression", _("Channel identifier"))
.AddParameter("relationalOperator", _("Sign of the test"))
.AddParameter("expression", _("Pitch to test"))
.MarkAsAdvanced()
.SetManipulatedType("number");
extension.AddCondition("SoundChannelPlayingOffset",
_("Playing offset of the sound on a channel"),
_("Test the playing offset of the sound on the specified channel."),
_("The playing offset of the sound on channel _PARAM1_ is _PARAM2__PARAM3_"),
_("Audio/Sounds on channels"),
"res/conditions/sonVolume24.png",
"res/conditions/sonVolume.png")
.AddCodeOnlyParameter("currentScene", "")
.AddParameter("expression", _("Channel identifier"))
.AddParameter("relationalOperator", _("Sign of the test"))
.AddParameter("expression", _("Playing position (in seconds)"))
.MarkAsAdvanced()
.SetManipulatedType("number");
extension.AddCondition("MusicChannelPlayingOffset",
_("Playing offset of the music on a channel"),
_("Test the playing offset of the music on the specified channel."),
_("The playing offset of the music on channel _PARAM1_ is _PARAM2__PARAM3_"),
_("Audio/Musics on channels"),
"res/conditions/musicVolume24.png",
"res/conditions/musicVolume.png")
.AddCodeOnlyParameter("currentScene", "")
.AddParameter("expression", _("Channel identifier"))
.AddParameter("relationalOperator", _("Sign of the test"))
.AddParameter("expression", _("Playing position (in seconds)"))
.MarkAsAdvanced()
.SetManipulatedType("number");
extension.AddExpression("SoundChannelPlayingOffset", _("Sound playing offset"), _("Sound playing offset"), _("Sounds"), "res/actions/son.png")
.AddCodeOnlyParameter("currentScene", "")
.AddParameter("expression", _("Channel"));
extension.AddExpression("MusicChannelPlayingOffset", _("Music playing offset"), _("Music playing offset"), _("Musics"), "res/actions/music.png")
.AddCodeOnlyParameter("currentScene", "")
.AddParameter("expression", _("Channel"));
extension.AddExpression("SoundChannelVolume", _("Sound volume"), _("Sound volume"), _("Sounds"), "res/actions/son.png")
.AddCodeOnlyParameter("currentScene", "")
.AddParameter("expression", _("Channel"));
extension.AddExpression("MusicChannelVolume", _("Music volume"), _("Music volume"), _("Musics"), "res/actions/music.png")
.AddCodeOnlyParameter("currentScene", "")
.AddParameter("expression", _("Channel"));
extension.AddExpression("SoundChannelPitch", _("Sound's pitch"), _("Sound's pitch"), _("Sounds"), "res/actions/son.png")
.AddCodeOnlyParameter("currentScene", "")
.AddParameter("expression", _("Channel"));
extension.AddExpression("MusicChannelPitch", _("Music's pitch"), _("Music's pitch"), _("Musics"), "res/actions/music.png")
.AddCodeOnlyParameter("currentScene", "")
.AddParameter("expression", _("Channel"));
extension.AddExpression("GlobalVolume", _("Global volume"), _("Global volume value"), _("Sound level"), "res/conditions/volume.png")
.AddCodeOnlyParameter("currentScene", "");
#endif
}
}

View File

@@ -1,828 +0,0 @@
/*
* GDevelop Core
* Copyright 2008-2015 Florian Rival (Florian.Rival@gmail.com). All rights reserved.
* This project is released under the MIT License.
*/
#include "AllBuiltinExtensions.h"
#include "GDCore/Tools/Localization.h"
#include "GDCore/PlatformDefinition/Object.h"
using namespace std;
namespace gd
{
void GD_CORE_API BuiltinExtensionsImplementer::ImplementsBaseObjectExtension(gd::PlatformExtension & extension)
{
extension.SetExtensionInformation("BuiltinObject",
_("Base object"),
_("Base object"),
"Florian Rival",
"Open source (MIT License)");
gd::ObjectMetadata & obj = extension.AddObject("",
_("Base object"),
_("Base object"),
"res/objeticon24.png",
&CreateBaseObject);
#if defined(GD_IDE_ONLY)
obj.AddCondition("PosX",
_("Compare X position of an object"),
_("Compare the X position of the object."),
_("The X position of _PARAM0_ is _PARAM1__PARAM2_"),
_("Position"),
"res/conditions/position24.png",
"res/conditions/position.png")
.AddParameter("object", _("Object"))
.AddParameter("relationalOperator", _("Sign of the test"))
.AddParameter("expression", _("X position"))
.MarkAsSimple()
.SetManipulatedType("number");
obj.AddAction("MettreX",
_("X position of an object"),
_("Change the X position of an object."),
_("Do _PARAM1__PARAM2_ to the X position of _PARAM0_"),
_("Position"),
"res/actions/position24.png",
"res/actions/position.png")
.AddParameter("object", _("Object"))
.AddParameter("operator", _("Modification's sign"))
.AddParameter("expression", _("Value"))
.MarkAsSimple()
.SetManipulatedType("number");
obj.AddCondition("PosY",
_("Compare Y position of an object"),
_("Compare the Y position of an object."),
_("The Y position of _PARAM0_ is _PARAM1__PARAM2_"),
_("Position"),
"res/conditions/position24.png",
"res/conditions/position.png")
.AddParameter("object", _("Object"))
.AddParameter("relationalOperator", _("Sign of the test"))
.AddParameter("expression", _("Y position"))
.MarkAsSimple()
.SetManipulatedType("number");
obj.AddAction("MettreY",
_("Y position of an object"),
_("Change the Y position of an object."),
_("Do _PARAM1__PARAM2_ to the Y position of _PARAM0_"),
_("Position"),
"res/actions/position24.png",
"res/actions/position.png")
.AddParameter("object", _("Object"))
.AddParameter("operator", _("Modification's sign"))
.AddParameter("expression", _("Value"))
.MarkAsSimple()
.SetManipulatedType("number");
obj.AddAction("MettreXY",
_("Position of an object"),
_("Change the position of an object."),
_("Do _PARAM1__PARAM2_;_PARAM3__PARAM4_ to the position of _PARAM0_"),
_("Position"),
"res/actions/position24.png",
"res/actions/position.png")
.AddParameter("object", _("Object"))
.AddParameter("operator", _("Modification's sign"))
.AddParameter("expression", _("X position"))
.AddParameter("operator", _("Modification's sign"))
.AddParameter("expression", _("Y position"))
.MarkAsSimple();
obj.AddAction("MettreAutourPos",
_("Put an object around a position"),
_("Position an object around a position, with specified angle and distance."),
_("Put _PARAM0_ around _PARAM1_;_PARAM2_, with an angle of _PARAM4_ degrees and _PARAM3_ pixels distance."),
_("Position"),
"res/actions/positionAutour24.png",
"res/actions/positionAutour.png")
.AddParameter("object", _("Object"))
.AddParameter("expression", _("X position"))
.AddParameter("expression", _("Y position"))
.AddParameter("expression", _("Distance"))
.AddParameter("expression", _("Angle, in degrees"))
.MarkAsAdvanced();
obj.AddAction("SetAngle",
_("Angle"),
_("Change the angle of rotation of an object."),
_("Do _PARAM1__PARAM2_ to angle of _PARAM0_"),
_("Angle"),
"res/actions/direction24.png",
"res/actions/direction.png")
.AddParameter("object", _("Object"))
.AddParameter("operator", _("Modification's sign"))
.AddParameter("expression", _("Value"))
.SetManipulatedType("number");
obj.AddAction("Rotate",
_("Rotate"),
_("Rotate an object, clockwise if the speed is positive, counterclockwise otherwise."),
_("Rotate _PARAM0_ at speed _PARAM1_deg/second"),
_("Angle"),
"res/actions/direction24.png",
"res/actions/direction.png")
.AddParameter("object", _("Object"))
.AddParameter("expression", _("Angular speed (in degrees per second)"))
.AddCodeOnlyParameter("currentScene", "")
.MarkAsSimple();
obj.AddAction("RotateTowardAngle",
_("Rotate toward angle"),
_("Rotate an object towards an angle with the specified speed."),
_("Rotate _PARAM0_ towards _PARAM1_ at speed _PARAM2_deg/second"),
_("Angle"),
"res/actions/direction24.png",
"res/actions/direction.png")
.AddParameter("object", _("Object"))
.AddParameter("expression", _("Angle to rotate towards (in degrees)"))
.AddParameter("expression", _("Angular speed (in degrees per second) (0 for immediate rotation)"))
.AddCodeOnlyParameter("currentScene", "");
obj.AddAction("RotateTowardPosition",
_("Rotate toward position"),
_("Rotate an object towards a position, with the specified speed."),
_("Rotate _PARAM0_ towards _PARAM1_;_PARAM2_ at speed _PARAM3_deg/second"),
_("Angle"),
"res/actions/direction24.png",
"res/actions/direction.png")
.AddParameter("object", _("Object"))
.AddParameter("expression", _("X position"))
.AddParameter("expression", _("Y position"))
.AddParameter("expression", _("Angular speed (in degrees per second) (0 for immediate rotation)"))
.AddCodeOnlyParameter("currentScene", "")
.MarkAsAdvanced();
obj.AddAction("AddForceXY",
_("Add a force"),
_("Add a force to an object. The object will move according to all forces it has."),
_("Add to _PARAM0_ a force of _PARAM1_ p/s on X axis and _PARAM2_ p/s on Y axis"),
_("Movement"),
"res/actions/force24.png",
"res/actions/force.png")
.AddParameter("object", _("Object"))
.AddParameter("expression", _("Speed on X axis (in pixels per second)"))
.AddParameter("expression", _("Speed on Y axis (in pixels per second)"))
.AddParameter("expression", _("Damping (Default: 0)"));
obj.AddAction("AddForceAL",
_("Add a force (angle)"),
_("Add a force to an object. The object will move according to all forces it has. This action creates the force using the specified angle and length."),
_("Add to _PARAM0_ a force, angle: _PARAM1_ degrees and length: _PARAM2_ pixels"),
_("Movement"),
"res/actions/force24.png",
"res/actions/force.png")
.AddParameter("object", _("Object"))
.AddParameter("expression", _("Angle"))
.AddParameter("expression", _("Speed (in pixels per second)"))
.AddParameter("expression", _("Damping (Default: 0)"))
.MarkAsAdvanced();
obj.AddAction("AddForceVersPos",
_("Add a force to move toward a position"),
_("Add a force to an object to make it move toward a position."),
_("Move _PARAM0_ to _PARAM1_;_PARAM2_ with a force of _PARAM3_ pixels"),
_("Movement"),
"res/actions/force24.png",
"res/actions/force.png")
.AddParameter("object", _("Object"))
.AddParameter("expression", _("X position"))
.AddParameter("expression", _("Y position"))
.AddParameter("expression", _("Speed (in pixels per second)"))
.AddParameter("expression", _("Damping (Default: 0)"))
.MarkAsAdvanced();
obj.AddAction("AddForceTournePos",
_("Add a force to move around an position"),
_("Add a force to an object to make it rotate around a position.\nNote that the movement is not precise, especially if the speed is high.\nTo position an object around a position more precisly, use the actions in the category \"Position\"."),
_("Rotate _PARAM0_ around _PARAM1_;_PARAM2_ at _PARAM3_ deg/sec and _PARAM4_ pixels away"),
_("Movement"),
"res/actions/forceTourne24.png",
"res/actions/forceTourne.png")
.AddParameter("object", _("Object"))
.AddParameter("expression", _("X position of the center"))
.AddParameter("expression", _("Y position of the center"))
.AddParameter("expression", _("Speed (in Degrees per seconds)"))
.AddParameter("expression", _("Distance (in pixels)"))
.AddParameter("expression", _("Damping (Default: 0)"))
.SetHidden();
obj.AddAction("Arreter",
_("Stop the object"),
_("Stop the object by deleting all its forces."),
_("Stop the object _PARAM0_"),
_("Movement"),
"res/actions/arreter24.png",
"res/actions/arreter.png")
.AddParameter("object", _("Object"))
.MarkAsAdvanced();
obj.AddAction("Delete",
_("Delete an object"),
_("Delete the specified object."),
_("Delete object _PARAM0_"),
_("Objects"),
"res/actions/delete24.png",
"res/actions/delete.png")
.AddParameter("object", _("Object"))
.AddCodeOnlyParameter("currentScene","")
.MarkAsSimple();
obj.AddAction("ChangePlan",
_("Z order"),
_("Modify the z order of an object"),
_("Do _PARAM1__PARAM2_ to z-Order of _PARAM0_"),
_("Z order"),
"res/actions/planicon24.png",
"res/actions/planicon.png")
.AddParameter("object", _("Object"))
.AddParameter("operator", _("Modification's sign"))
.AddParameter("expression", _("Value"))
.SetManipulatedType("number");
obj.AddAction("ChangeLayer",
_("Layer"),
_("Change the layer where is the object."),
_("Put _PARAM0_ on the layer _PARAM1_"),
_("Layers and cameras"),
"res/actions/layer24.png",
"res/actions/layer.png")
.AddParameter("object", _("Object"))
.AddParameter("layer", _("Put on the layer (base layer if empty)")).SetDefaultValue("\"\"")
.MarkAsAdvanced();
obj.AddAction("ModVarObjet",
_("Modify a variable of an object"),
_("Modify the value of a variable of an object"),
_("Do _PARAM2__PARAM3_ to variable _PARAM1_ of _PARAM0_"),
_("Variables"),
"res/actions/var24.png",
"res/actions/var.png")
.AddParameter("object", _("Object"))
.AddParameter("objectvar", _("Variable"))
.AddParameter("operator", _("Modification's sign"))
.AddParameter("expression", _("Value"))
.SetManipulatedType("number");
obj.AddAction("ModVarObjetTxt",
_("Modify the text of a variable of an object"),
_("Modify the text of a variable of an object"),
_("Do _PARAM2__PARAM3_ to the text of variable _PARAM1_ of _PARAM0_"),
_("Variables"),
"res/actions/var24.png",
"res/actions/var.png")
.AddParameter("object", _("Object"))
.AddParameter("objectvar", _("Variable"))
.AddParameter("operator", _("Modification's sign"))
.AddParameter("string", _("Text"))
.SetManipulatedType("string");
obj.AddCondition("ObjectVariableChildExists",
_("Child existence"),
_("Return true if the specified child of the variable exists."),
_("Child _PARAM2_ of variable _PARAM1_ of _PARAM0_ exists"),
_("Variables/Structures"),
"res/conditions/var24.png",
"res/conditions/var.png")
.AddParameter("object", _("Object"))
.AddParameter("objectvar", _("Variable"))
.AddParameter("string", _("Name of the child"))
.MarkAsAdvanced();
obj.AddAction("ObjectVariableRemoveChild",
_("Remove a child"),
_("Remove a child from a variable of an object."),
_("Remove child _PARAM2_ from variable _PARAM1_ of _PARAM0_"),
_("Variables/Structure"),
"res/actions/var24.png",
"res/actions/var.png")
.AddParameter("object", _("Object"))
.AddParameter("objectvar", _("Variable"))
.AddParameter("string", _("Child's name"))
.MarkAsAdvanced();
obj.AddAction("Cache",
_("Hide"),
_("Hide the specified object."),
_("Hide the object _PARAM0_"),
_("Visibility"),
"res/actions/visibilite24.png",
"res/actions/visibilite.png")
.AddParameter("object", _("Object"))
.MarkAsSimple();
obj.AddAction("Montre",
_("Show"),
_("Show the specified object"),
_("Show object _PARAM0_"),
_("Visibility"),
"res/actions/visibilite24.png",
"res/actions/visibilite.png")
.AddParameter("object", _("Object"))
.AddCodeOnlyParameter("inlineCode", "false")
.MarkAsSimple();
obj.AddCondition("Angle",
_("Angle"),
_("Compare angle of the specified object."),
_("Angle of _PARAM0_ is _PARAM1__PARAM2_ deg."),
_("Angle"),
"res/conditions/direction24.png",
"res/conditions/direction.png")
.AddParameter("object", _("Object"))
.AddParameter("relationalOperator", _("Sign of the test"))
.AddParameter("expression", _("Value to compare (in degrees)"))
.MarkAsAdvanced()
.SetManipulatedType("number");
obj.AddCondition("Plan",
_("Compare Z order"),
_("Compare the z-order of the specified object."),
_("Z Order of _PARAM0_ is _PARAM1__PARAM2_"),
_("Z order"),
"res/conditions/planicon24.png",
"res/conditions/planicon.png")
.AddParameter("object", _("Object"))
.AddParameter("relationalOperator", _("Sign of the test"))
.AddParameter("expression", _("Z order"))
.MarkAsAdvanced()
.SetManipulatedType("number");
obj.AddCondition("Layer",
_("Compare layer"),
_("Test if the object is on the specified layer."),
_("_PARAM0_ is on layer _PARAM1_"),
_("Layer"),
"res/conditions/layer24.png",
"res/conditions/layer.png")
.AddParameter("object", _("Object"))
.AddParameter("layer", _("Layer"))
.MarkAsAdvanced();
obj.AddCondition("Visible",
_("Visibility of an object"),
_("Test if an object is not hidden."),
_("The object _PARAM0_ is visible"),
_("Visibility"),
"res/conditions/visibilite24.png",
"res/conditions/visibilite.png")
.AddParameter("object", _("Object"))
.MarkAsSimple();
obj.AddCondition("Invisible",
_("Invisibility of an object"),
_("Test if an object is hidden."),
_("_PARAM0_ is hidden"),
_("Visibility"),
"res/conditions/visibilite24.png",
"res/conditions/visibilite.png")
.AddParameter("object", _("Object"))
.SetHidden(); //Inverted "Visible" condition does the same thing.
obj.AddCondition("Arret",
_("Object is stopped"),
_("Test if an object does not move"),
_("_PARAM0_ is stopped"),
_("Movement"),
"res/conditions/arret24.png",
"res/conditions/arret.png")
.AddParameter("object", _("Object"))
.MarkAsAdvanced();
obj.AddCondition("Vitesse",
_("Speed"),
_("Compare the overall speed of an object"),
_("Overall speed of _PARAM0_ is _PARAM1__PARAM2_"),
_("Movement"),
"res/conditions/vitesse24.png",
"res/conditions/vitesse.png")
.AddParameter("object", _("Object"))
.AddParameter("relationalOperator", _("Sign of the test"))
.AddParameter("expression", _("Speed"))
.MarkAsAdvanced()
.SetManipulatedType("number");
obj.AddCondition("AngleOfDisplacement",
_("Angle of moving"),
_("Compare the angle of displacement of an object"),
_("Angle of displacement of _PARAM0_ is _PARAM1_ (tolerance : _PARAM2_ degrees)"),
_("Movement"),
"res/conditions/vitesse24.png",
"res/conditions/vitesse.png")
.AddParameter("object", _("Object"))
.AddParameter("expression", _("Angle, in degrees"))
.AddParameter("expression", _("Tolerance"))
.MarkAsAdvanced();
obj.AddCondition("VarObjet",
_("Value of an object's variable"),
_("Compare the value of a variable of an object."),
_("Variable _PARAM1_ of _PARAM0_ is _PARAM2__PARAM3_"),
_("Variables"),
"res/conditions/var24.png",
"res/conditions/var.png")
.AddParameter("object", _("Object"))
.AddParameter("objectvar", _("Variable"))
.AddParameter("relationalOperator", _("Sign of the test"))
.AddParameter("expression", _("Value to test"))
.SetManipulatedType("number");
obj.AddCondition("VarObjetTxt",
_("Text of an object's variable"),
_("Compare the text of a variable of an object."),
_("The text of variable _PARAM1_ of _PARAM0_ is _PARAM2__PARAM3_"),
_("Variables"),
"res/conditions/var24.png",
"res/conditions/var.png")
.AddParameter("object", _("Object"))
.AddParameter("objectvar", _("Variable"))
.AddParameter("relationalOperator", _("Sign of the test"))
.AddParameter("string", _("Text to test"))
.SetManipulatedType("string");
obj.AddCondition("VarObjetDef",
_("Variable defined"),
_("Test "),
_("Variable _PARAM1 of _PARAM0_ is defined"),
_("Variables"),
"res/conditions/var24.png",
"res/conditions/var.png")
.AddParameter("object", _("Object"))
.AddParameter("string", _("Variable"))
.SetHidden();
obj.AddCondition("BehaviorActivated",
_("Behavior activated"),
_("Return true if the behavior is activated for the object."),
_("Behavior _PARAM1_ of _PARAM0_ is activated"),
_("Behaviors"),
"res/behavior24.png",
"res/behavior16.png")
.AddParameter("object", _("Object"))
.AddParameter("behavior", _("Behavior"))
.MarkAsAdvanced();
obj.AddAction("ActivateBehavior",
_("De/activate a behavior"),
_("De/activate the behavior for the object."),
_("Activate behavior _PARAM1_ of _PARAM0_: _PARAM2_"),
_("Behaviors"),
"res/behavior24.png",
"res/behavior16.png")
.AddParameter("object", _("Object"))
.AddParameter("behavior", _("Behavior"))
.AddParameter("yesorno", _("Activate?"))
.MarkAsAdvanced();
obj.AddAction("AddForceVers",
_("Add a force to move toward an object"),
_("Add a force to an object to make it move toward another."),
_("Move _PARAM0_ to _PARAM1_ with a force of _PARAM2_ pixels"),
_("Movement"),
"res/actions/forceVers24.png",
"res/actions/forceVers.png")
.AddParameter("object", _("Object"))
.AddParameter("objectPtr", _("Target Object"))
.AddParameter("expression", _("Speed (in pixels per second)"))
.AddParameter("expression", _("Damping (Default: 0)"))
.MarkAsAdvanced();
obj.AddAction("AddForceTourne",
_("Add a force to move around an object"),
_("Add a force to an object to make it rotate around another.\nNote that the movement is not precise, especially if the speed is high.\nTo position an object around a position more precisly, use the actions in category \"Position\"."),
_("Rotate _PARAM0_ around _PARAM1_ at _PARAM2_ deg/sec and _PARAM3_ pixels away"),
_("Movement"),
"res/actions/forceTourne24.png",
"res/actions/forceTourne.png")
.AddParameter("object", _("Object"))
.AddParameter("objectPtr", _("Rotate around this object"))
.AddParameter("expression", _("Speed (in degrees per second)"))
.AddParameter("expression", _("Distance (in pixels)"))
.AddParameter("expression", _("Damping (Default: 0)"))
.MarkAsAdvanced();
obj.AddAction("MettreAutour",
_("Put an object around another"),
_("Position an object around another, with the specified angle and distance."),
_("Put _PARAM0_ around _PARAM1_, with an angle of _PARAM3_ degrees and _PARAM2_ pixels distance."),
_("Position"),
"res/actions/positionAutour24.png",
"res/actions/positionAutour.png")
.AddParameter("object", _("Object"))
.AddParameter("objectPtr", _("\"Center\" Object"))
.AddParameter("expression", _("Distance"))
.AddParameter("expression", _("Angle, in degrees"))
.MarkAsAdvanced();
//Deprecated action
obj.AddAction("Rebondir",
_("Move an object away from another"),
_("Move an object away from another, using forces."),
_("Move _PARAM0_ away of _PARAM1_ (only _PARAM0_ will move)"),
_("Movement"),
"res/actions/ecarter24.png",
"res/actions/ecarter.png")
.SetHidden()
.AddParameter("object", _("Object"))
.AddParameter("objectList", _("Object 2 (won't move)"));
//Deprecated action
obj.AddAction("Ecarter",
_("Move an object away from another"),
_("Move an object away from another without using forces."),
_("Move _PARAM0_ away of _PARAM2_ (only _PARAM0_ will move)"),
_("Position"),
"res/actions/ecarter24.png",
"res/actions/ecarter.png")
.SetHidden()
.AddParameter("object", _("Object"))
.AddParameter("objectList", _("Object 2 (won't move)"));
obj.AddAction("SeparateFromObjects",
_("Separate two objects"),
_("Move an object away from another using their collision masks.\nBe sure to call this action on a reasonable number of objects so as\nnot to slow down the game."),
_("Move _PARAM0_ away of _PARAM1_ (only _PARAM0_ will move)"),
_("Position"),
"res/actions/ecarter24.png",
"res/actions/ecarter.png")
.AddParameter("object", _("Object"))
.AddParameter("objectList", _("Objects"))
.MarkAsSimple();
obj.AddExpression("X", _("X position"), _("X position of the object"), _("Position"), "res/actions/position.png")
.AddParameter("object", _("Object"));
obj.AddExpression("Y", _("Y position"), _("Y position of the object"), _("Position"), "res/actions/position.png")
.AddParameter("object", _("Object"));
obj.AddExpression("Angle", _("Angle"), _("Current angle, in degrees, of the object"), _("Angle"), "res/actions/direction.png")
.AddParameter("object", _("Object"));
obj.AddExpression("ForceX", _("Average X coordinates of forces"), _("Average X coordinates of forces"), _("Movement"), "res/actions/force.png")
.AddParameter("object", _("Object"));
obj.AddExpression("ForceY", _("Average Y coordinates of forces"), _("Average Y coordinates of forces"), _("Movement"), "res/actions/force.png")
.AddParameter("object", _("Object"));
obj.AddExpression("ForceAngle", _("Average angle of the forces"), _("Average angle of the forces"), _("Movement"), "res/actions/force.png")
.AddParameter("object", _("Object"));
obj.AddExpression("ForceLength", _("Average length of the forces"), _("Average length of the forces"), _("Movement"), "res/actions/force.png")
.AddParameter("object", _("Object"));
obj.AddExpression("Longueur", _("Average length of the forces"), _("Average length of the forces"), _("Movement"), "res/actions/force.png")
.AddParameter("object", _("Object"))
.SetHidden();
obj.AddExpression("Width", _("Width"), _("Width of the object"), _("Size"), "res/actions/scaleWidth.png")
.AddParameter("object", _("Object"));
obj.AddExpression("Largeur", _("Width"), _("Width of the object"), _("Size"), "res/actions/scaleWidth.png")
.AddParameter("object", _("Object"))
.SetHidden();
obj.AddExpression("Height", _("Height"), _("Height of the object"), _("Size"), "res/actions/scaleHeight.png")
.AddParameter("object", _("Object"));
obj.AddExpression("Hauteur", _("Height"), _("Height of the object"), _("Size"), "res/actions/scaleHeight.png")
.AddParameter("object", _("Object"))
.SetHidden();
obj.AddExpression("ZOrder", _("Z order"), _("Z order of an object"), _("Visibility"), "res/actions/planicon.png")
.AddParameter("object", _("Object"));
obj.AddExpression("Plan", _("Z order"), _("Z order of an object"), _("Visibility"), "res/actions/planicon.png")
.AddParameter("object", _("Object"))
.SetHidden();
obj.AddExpression("Distance", _("Distance between two objects"), _("Distance between two objects"), _("Position"), "res/conditions/distance.png")
.AddParameter("object", _("Object"))
.AddParameter("objectPtr", _("Object"));
obj.AddExpression("SqDistance", _("Square distance between two objects"), _("Square distance between two objects"), _("Position"), "res/conditions/distance.png")
.AddParameter("object", _("Object"))
.AddParameter("objectPtr", _("Object"));
obj.AddExpression("Variable", _("Object's variable"), _("Object's variable"), _("Variables"), "res/actions/var.png")
.AddParameter("object", _("Object"))
.AddParameter("objectvar", _("Variable"));
obj.AddStrExpression("VariableString", _("Object's variable"), _("Text of variable of an object"), _("Variables"), "res/actions/var.png")
.AddParameter("object", _("Object"))
.AddParameter("objectvar", _("Variable"));
extension.AddAction("Create",
_("Create an object"),
_("Create an object at specified position"),
_("Create object _PARAM1_ at position _PARAM2_;_PARAM3_"),
_("Objects"),
"res/actions/create24.png",
"res/actions/create.png")
.AddCodeOnlyParameter("currentScene", "")
.AddParameter("objectListWithoutPicking", _("Object to create"))
.AddParameter("expression", _("X position"))
.AddParameter("expression", _("Y position"))
.AddParameter("layer", _("Layer (base layer if empty)"), "", true).SetDefaultValue("\"\"")
.MarkAsSimple();
extension.AddAction("CreateByName",
_("Create an object from its name"),
_("Among the objects of the specified group, the action will create the object with the specified name."),
_("Among objects _PARAM1_, create object named _PARAM2_ at position _PARAM3_;_PARAM4_"),
_("Objects"),
"res/actions/create24.png",
"res/actions/create.png")
.AddCodeOnlyParameter("currentScene", "")
.AddParameter("objectListWithoutPicking", _("Groups containing objects which can be created by the action"))
.AddParameter("string", _("Text representing the name of the object to create"))
.AddParameter("expression", _("X position"))
.AddParameter("expression", _("Y position"))
.AddParameter("layer", _("Layer (base layer if empty)"), "", true).SetDefaultValue("\"\"")
.MarkAsAdvanced();
extension.AddAction("AjoutObjConcern",
_("Pick all objects"),
_("Pick all objects with this name."),
_("Pick all _PARAM1_"),
_("Objects"),
"res/actions/add24.png",
"res/actions/add.png")
.AddCodeOnlyParameter("currentScene", "")
.AddParameter("objectList", _("Object"))
.MarkAsAdvanced();
extension.AddAction("AjoutHasard",
_("Pick a random object"),
_("Pick only one object with this name among all"),
_("Pick a random _PARAM1_"),
_("Objects"),
"res/actions/ajouthasard24.png",
"res/actions/ajouthasard.png")
.AddCodeOnlyParameter("currentScene", "")
.AddParameter("objectList", _("Object"))
.MarkAsSimple();
extension.AddAction("MoveObjects",
_("Apply objects movement"),
_("Moves the objects according to the forces they have. GDevelop call this action at the end of the events by default."),
_("Apply objects movement"),
_("Movement"),
"res/actions/doMove24.png",
"res/actions/doMove.png")
.AddCodeOnlyParameter("currentScene", "")
.MarkAsAdvanced();
extension.AddCondition("SeDirige",
_("An object is moving toward another"),
_("Check if an object moves toward another.\nThe first object must move."),
_("_PARAM0_ is moving toward _PARAM1_"),
_("Movement"),
"res/conditions/sedirige24.png",
"res/conditions/sedirige.png")
.AddParameter("objectList", _("Object"))
.AddParameter("objectList", _("Object 2"))
.AddParameter("expression", _("Angle of tolerance"))
.AddCodeOnlyParameter("conditionInverted", "")
.MarkAsAdvanced();
extension.AddCondition("Distance",
_("Distance between two objects"),
_("Compare the distance between two objects.\nIf condition is inverted, only objects that have a distance greater than specified to any other object will be picked."),
_("_PARAM0_ distance to _PARAM1_ is below _PARAM2_ pixels"),
_("Position"),
"res/conditions/distance24.png",
"res/conditions/distance.png")
.AddParameter("objectList", _("Object"))
.AddParameter("objectList", _("Object 2"))
.AddParameter("expression", _("Distance"))
.AddCodeOnlyParameter("conditionInverted", "")
.MarkAsSimple();
extension.AddCondition("AjoutObjConcern",
_("Pick all objects"),
_("Pick all objects with this name."),
_("Pick all _PARAM1_"),
_("Objects"),
"res/conditions/add24.png",
"res/conditions/add.png")
.AddCodeOnlyParameter("currentScene", "")
.AddParameter("objectList", _("Object"))
.MarkAsAdvanced();
extension.AddCondition("AjoutHasard",
_("Pick a random object"),
_("Pick only one object with this name among all"),
_("Pick a random _PARAM1_"),
_("Objects"),
"res/conditions/ajouthasard24.png",
"res/conditions/ajouthasard.png")
.AddCodeOnlyParameter("currentScene", "")
.AddParameter("objectList", _("Object"))
.MarkAsSimple();
extension.AddCondition("PickNearest",
_("Pick nearest object"),
_("Among the objects, pick the one that is nearest (or furthest if condition is inverted) from the specified position."),
_("Pick nearest _PARAM0_ to _PARAM1_;_PARAM2_"),
_("Objects"),
"res/conditions/distance24.png",
"res/conditions/distance.png")
.AddParameter("objectList", _("Object"))
.AddParameter("expression", _("X position"))
.AddParameter("expression", _("Y position"))
.AddCodeOnlyParameter("conditionInverted", "")
.MarkAsSimple();
extension.AddCondition("NbObjet",
_("Objects count"),
_("Compare the number of picked objects"),
_("The number of _PARAM0_ is _PARAM1__PARAM2_"),
_("Objects"),
"res/conditions/nbObjet24.png",
"res/conditions/nbObjet.png")
.AddParameter("objectList", _("Object"))
.AddParameter("relationalOperator", _("Sign of the test"))
.AddParameter("expression", _("Value to test"))
.MarkAsSimple()
.SetManipulatedType("number");
extension.AddCondition("CollisionNP", //"CollisionNP" cames from an old condition to test collision between two sprites non precisely.
_("Collision"),
_("Test the collision between two objects using their collision mask.\nNote that some objects may not have a collision mask.\nSome others, like Sprite, provide also more precise collision conditions."),
_("_PARAM0_ is in collision with _PARAM1_"),
_("Collision"),
"res/conditions/collision24.png",
"res/conditions/collision.png")
.AddParameter("objectList", _("Object"))
.AddParameter("objectList", _("Object"))
.AddCodeOnlyParameter("conditionInverted", "")
.MarkAsSimple();
extension.AddCondition("EstTourne",
_("An object is turned toward another"),
_("Test if an object is turned toward another"),
_("_PARAM0_ is rotated towards _PARAM1_"),
_("Angle"),
"res/conditions/estTourne24.png",
"res/conditions/estTourne.png")
.AddParameter("objectList", _("Name of the object"))
.AddParameter("objectList", _("Name of the second object"))
.AddParameter("expression", _("Angle of tolerance, in degrees (0: minimum tolerance)"))
.AddCodeOnlyParameter("conditionInverted", "")
.MarkAsAdvanced();
extension.AddExpression("Count", _("Number of objects"), _("Count the number of the specified objects currently picked"), _("Objects"), "res/conditions/nbObjet.png")
.AddParameter("objectList", _("Object"));
#endif
}
}

View File

@@ -1,343 +0,0 @@
/*
* GDevelop Core
* Copyright 2008-2015 Florian Rival (Florian.Rival@gmail.com). All rights reserved.
* This project is released under the MIT License.
*/
#include "AllBuiltinExtensions.h"
#include "GDCore/Tools/Localization.h"
using namespace std;
namespace gd
{
void GD_CORE_API BuiltinExtensionsImplementer::ImplementsCameraExtension(gd::PlatformExtension & extension)
{
extension.SetExtensionInformation("BuiltinCamera",
_("Cameras and layers features"),
_("Builtin camera extension"),
"Florian Rival",
"Open source (MIT License)");
#if defined(GD_IDE_ONLY)
extension.AddCondition("CameraX",
_("Camera center X position"),
_("Compare the X position of a the center of a camera."),
_("X position of camera _PARAM4_ is _PARAM1__PARAM2_ (layer: _PARAM3_)"),
_("Layers and cameras"),
"res/conditions/camera24.png",
"res/conditions/camera.png")
.AddCodeOnlyParameter("currentScene", "")
.AddParameter("relationalOperator", _("Sign of the test"))
.AddParameter("expression", _("Value to test"))
.AddParameter("layer", _("Layer (base layer if empty)"), "",true).SetDefaultValue("\"\"")
.AddParameter("expression", _("Camera number (default : 0)"), "",true).SetDefaultValue("0")
.MarkAsAdvanced()
.SetManipulatedType("number");
extension.AddCondition("CameraY",
_("Camera center Y position"),
_("Compare the Y position of a the center of a camera."),
_("The Y position of camera _PARAM4_ is _PARAM1__PARAM2_ (layer: _PARAM3_)"),
_("Layers and cameras"),
"res/conditions/camera24.png",
"res/conditions/camera.png")
.AddCodeOnlyParameter("currentScene", "")
.AddParameter("relationalOperator", _("Sign of the test"))
.AddParameter("expression", _("Value to test"))
.AddParameter("layer", _("Layer (base layer if empty)")).SetDefaultValue("\"\"")
.AddParameter("expression", _("Camera number (default : 0)")).SetDefaultValue("0")
.MarkAsAdvanced()
.SetManipulatedType("number");
extension.AddAction("CameraX",
_("Camera center X position"),
_("Change X position of the center of the specified camera."),
_("Do _PARAM1__PARAM2_ to X position of camera _PARAM4_ (layer: _PARAM3_)"),
_("Layers and cameras"),
"res/conditions/camera24.png",
"res/conditions/camera.png")
.AddCodeOnlyParameter("currentScene", "")
.AddParameter("operator", _("Modification's sign"))
.AddParameter("expression", _("Value"))
.AddParameter("layer", _("Layer (base layer if empty)"), "",true).SetDefaultValue("\"\"")
.AddParameter("expression", _("Camera number (default : 0)"), "",true).SetDefaultValue("0")
.MarkAsAdvanced()
.SetManipulatedType("number");
extension.AddAction("CameraY",
_("Camera center Y position"),
_("Change Y position of the center of the specified camera."),
_("Do _PARAM1__PARAM2_ to Y position of camera _PARAM4_ (layer: _PARAM3_)"),
_("Layers and cameras"),
"res/conditions/camera24.png",
"res/conditions/camera.png")
.AddCodeOnlyParameter("currentScene", "")
.AddParameter("operator", _("Modification's sign"))
.AddParameter("expression", _("Value"))
.AddParameter("layer", _("Layer (base layer if empty)"), "",true).SetDefaultValue("\"\"")
.AddParameter("expression", _("Camera number (default : 0)"), "",true).SetDefaultValue("0")
.MarkAsAdvanced()
.SetManipulatedType("number");
extension.AddCondition("CameraWidth",
_("Width of a camera"),
_("Test the width of a camera of a layer"),
_("The width of camera _PARAM2_ of layer _PARAM1_ is _PARAM3__PARAM4_"),
_("Layers and cameras"),
"res/conditions/camera24.png",
"res/conditions/camera.png")
.AddCodeOnlyParameter("currentScene", "")
.AddParameter("layer", _("Layer")).SetDefaultValue("\"\"")
.AddParameter("expression", _("Camera number"))
.AddParameter("relationalOperator", _("Sign of the test"))
.AddParameter("expression", _("Value to test"))
.MarkAsAdvanced()
.SetManipulatedType("number");
extension.AddCondition("CameraHeight",
_("Height of a camera"),
_("Test the height of a camera of a layer"),
_("The height of camera _PARAM2_ of layer _PARAM1_ is _PARAM3__PARAM4_"),
_("Layers and cameras"),
"res/conditions/camera24.png",
"res/conditions/camera.png")
.AddCodeOnlyParameter("currentScene", "")
.AddParameter("layer", _("Layer (base layer if empty)")).SetDefaultValue("\"\"")
.AddParameter("expression", _("Camera number"))
.AddParameter("relationalOperator", _("Sign of the test"))
.AddParameter("expression", _("Value to test"))
.MarkAsAdvanced()
.SetManipulatedType("number");
extension.AddCondition("CameraAngle",
_("Angle of a camera of a layer"),
_("Test a camera angle."),
_("Angle of camera is _PARAM1__PARAM2_ (layer: _PARAM3_, camera: _PARAM4_)"),
_("Layers and cameras"),
"res/conditions/camera24.png",
"res/conditions/camera.png")
.AddCodeOnlyParameter("currentScene", "")
.AddParameter("relationalOperator", _("Sign of the test"))
.AddParameter("expression", _("Value to test"))
.AddParameter("layer", _("Layer (base layer if empty)"), "",true).SetDefaultValue("\"\"")
.AddParameter("expression", _("Camera number (default : 0)"), "",true).SetDefaultValue("0")
.MarkAsAdvanced()
.SetManipulatedType("number");
extension.AddAction("RotateCamera",
_("Change camera angle"),
_("This action modify the angle of a camera of the specified layer."),
_("Do _PARAM1__PARAM2_ to angle of camera (layer: _PARAM3_, camera: _PARAM4_)"),
_("Layers and cameras"),
"res/actions/camera24.png",
"res/actions/camera.png")
.AddCodeOnlyParameter("currentScene", "")
.AddParameter("operator", _("Modification's sign"))
.AddParameter("expression", _("Value"))
.AddParameter("layer", _("Layer (base layer if empty)"), "",true).SetDefaultValue("\"\"")
.AddParameter("expression", _("Camera number (default : 0)"), "",true).SetDefaultValue("0")
.SetManipulatedType("number");
extension.AddAction("AddCamera",
_("Add a camera to a layer"),
_("This action add a camera to a layer"),
_("Add a camera to layer _PARAM1_"),
_("Layers and cameras"),
"res/actions/camera24.png",
"res/actions/camera.png")
.AddCodeOnlyParameter("currentScene", "")
.AddParameter("layer", _("Layer (base layer if empty)")).SetDefaultValue("\"\"")
.AddParameter("expression", _("Width"), "",true)
.AddParameter("expression", _("Height"), "",true)
.AddParameter("expression", _("Render zone: Top left side: X Position (between 0 and 1)"), "",true)
.AddParameter("expression", _("Render zone: Top left side: Y Position (between 0 and 1)"), "",true)
.AddParameter("expression", _("Render zone: Bottom right side: X Position (between 0 and 1)"), "",true)
.AddParameter("expression", _("Render zone: Bottom right side: Y Position (between 0 and 1)"), "",true)
.MarkAsComplex();
extension.AddAction("DeleteCamera",
_("Delete a camera of a layer"),
_("Remove the specified camera from a layer"),
_("Delete camera _PARAM2_ from layer _PARAM1_"),
_("Layers and cameras"),
"res/actions/camera24.png",
"res/actions/camera.png")
.AddCodeOnlyParameter("currentScene", "")
.AddParameter("layer", _("Layer (base layer if empty)")).SetDefaultValue("\"\"")
.AddParameter("expression", _("Camera number"))
.MarkAsComplex();
extension.AddAction("CameraSize",
_("Modify the size of a camera"),
_("This action modify the size of a camera of the specified layer. The zoom will be reset."),
_("Change the size of camera _PARAM2_ of _PARAM1_ to _PARAM3_*_PARAM4_"),
_("Layers and cameras"),
"res/actions/camera24.png",
"res/actions/camera.png")
.AddCodeOnlyParameter("currentScene", "")
.AddParameter("layer", _("Layer (base layer if empty)")).SetDefaultValue("\"\"")
.AddParameter("expression", _("Camera number"))
.AddParameter("expression", _("Width"))
.AddParameter("expression", _("Height"))
.MarkAsComplex();
extension.AddAction("CameraViewport",
_("Modify the render zone of a camera"),
_("This action modify the render zone of a camera of the specified layer."),
_("Set the render zone of camera _PARAM2_ from layer _PARAM1_ to _PARAM3_;_PARAM4_ _PARAM5_;_PARAM6_"),
_("Layers and cameras"),
"res/actions/camera24.png",
"res/actions/camera.png")
.AddCodeOnlyParameter("currentScene", "")
.AddParameter("layer", _("Layer (base layer if empty)")).SetDefaultValue("\"\"")
.AddParameter("expression", _("Camera number"))
.AddParameter("expression", _("Render zone: Top left side: X Position (between 0 and 1)"))
.AddParameter("expression", _("Render zone: Top left side: Y Position (between 0 and 1)"))
.AddParameter("expression", _("Render zone: Bottom right side: X Position (between 0 and 1)"))
.AddParameter("expression", _("Render zone: Bottom right side: Y Position (between 0 and 1)"))
.MarkAsComplex();
extension.AddAction("ZoomCamera",
_("Change camera zoom."),
_("Change camera zoom."),
_("Change camera zoom to _PARAM1_ (layer : _PARAM2_, camera : _PARAM3_)"),
_("Layers and cameras"),
"res/actions/camera24.png",
"res/actions/camera.png")
.AddCodeOnlyParameter("currentScene", "")
.AddParameter("expression", _("Value (1:Initial zoom, 2:Zoom x2, 0.5:Unzoom x2...)"))
.AddParameter("layer", _("Layer (base layer if empty)"), "",true).SetDefaultValue("\"\"")
.AddParameter("expression", _("Camera number (default : 0)"), "",true).SetDefaultValue("0");
extension.AddAction("FixCamera",
_("Center the camera on an object within limits"),
_("Center the camera on the specified object, without leaving the specified limits."),
_("Center the camera on _PARAM1_ (limit : from _PARAM2_;_PARAM3_ to _PARAM4_;_PARAM5_) (layer: _PARAM7_, camera: _PARAM8_)"),
_("Layers and cameras"),
"res/actions/camera24.png",
"res/actions/camera.png")
.AddCodeOnlyParameter("currentScene", "")
.AddParameter("objectPtr", _("Object"))
.AddParameter("expression", _("Top left side of the boundary: X Position"))
.AddParameter("expression", _("Top left side of the boundary: Y Position"))
.AddParameter("expression", _("Bottom right side of the boundary: X Position"))
.AddParameter("expression", _("Bottom right side of the boundary: Y Position"))
.AddParameter("yesorno", _("Anticipate the movement of the object (yes by default)"), "",true).SetDefaultValue("true")
.AddParameter("layer", _("Layer (base layer if empty)"), "",true).SetDefaultValue("\"\"")
.AddParameter("expression", _("Camera number (default : 0)"), "",true).SetDefaultValue("0")
.MarkAsAdvanced();
extension.AddAction("CentreCamera",
_("Center the camera on an object"),
_("Center the camera on the specified object."),
_("Center camera on _PARAM1_ (layer: _PARAM3_, camera: _PARAM4_)"),
_("Layers and cameras"),
"res/actions/camera24.png",
"res/actions/camera.png")
.AddCodeOnlyParameter("currentScene", "")
.AddParameter("objectPtr", _("Object"))
.AddParameter("yesorno", _("Anticipate the movement of the object (yes by default)"), "",true).SetDefaultValue("true")
.AddParameter("layer", _("Layer (base layer if empty)"), "",true).SetDefaultValue("\"\"")
.AddParameter("expression", _("Camera number (default : 0)"), "",true).SetDefaultValue("0")
.MarkAsSimple();
extension.AddAction("ShowLayer",
_("Show a layer"),
_("Show a layer."),
_("Show layer _PARAM1_"),
_("Layers and cameras"),
"res/actions/layer24.png",
"res/actions/layer.png")
.AddCodeOnlyParameter("currentScene", "")
.AddParameter("layer", _("Layer (base layer if empty)")).SetDefaultValue("\"\"")
.MarkAsAdvanced();
extension.AddAction("HideLayer",
_("Hide a layer"),
_("Hide a layer."),
_("Hide layer _PARAM1_"),
_("Layers and cameras"),
"res/actions/layer24.png",
"res/actions/layer.png")
.AddCodeOnlyParameter("currentScene", "")
.AddParameter("layer", _("Layer (base layer if empty)")).SetDefaultValue("\"\"")
.MarkAsAdvanced();
extension.AddCondition("LayerVisible",
_("Visibility of a layer"),
_("Test if a layer is displayed"),
_("Layer _PARAM1_ is visible"),
_("Layers and cameras"),
"res/conditions/layer24.png",
"res/conditions/layer.png")
.AddCodeOnlyParameter("currentScene", "")
.AddParameter("layer", _("Layer (base layer if empty)")).SetDefaultValue("\"\"")
.MarkAsAdvanced();
extension.AddExpression("CameraWidth", _("Width of a camera of a layer"), _("Width of a camera of a layer"), _("Camera"), "res/actions/camera.png")
.AddCodeOnlyParameter("currentScene", "")
.AddParameter("layer", _("Layer"))
.AddParameter("expression", _("Camera number (default : 0)")).SetDefaultValue("0");
extension.AddExpression("CameraHeight", _("Height of a camera of a layer"), _("Height of a camera of a layer"), _("Camera"), "res/actions/camera.png")
.AddCodeOnlyParameter("currentScene", "")
.AddParameter("layer", _("Layer"))
.AddParameter("expression", _("Camera number (default : 0)")).SetDefaultValue("0");
extension.AddExpression("CameraViewportLeft", _("X position of the top left side point of a render zone"), _("X position of the top left side point of a render zone"), _("Camera"), "res/actions/camera.png")
.AddCodeOnlyParameter("currentScene", "")
.AddParameter("layer", _("Layer"))
.AddParameter("expression", _("Camera number (default : 0)")).SetDefaultValue("0");
extension.AddExpression("CameraViewportTop", _("Y position of the top left side point of a render zone"), _("Y position of the top left side point of a render zone"), _("Camera"), "res/actions/camera.png")
.AddCodeOnlyParameter("currentScene", "")
.AddParameter("layer", _("Layer"))
.AddParameter("expression", _("Camera number (default : 0)")).SetDefaultValue("0");
extension.AddExpression("CameraViewportRight", _("X position of the bottom right side point of a render zone"), _("X position of the bottom right side point of a render zone"), _("Camera"), "res/actions/camera.png")
.AddCodeOnlyParameter("currentScene", "")
.AddParameter("layer", _("Layer"))
.AddParameter("expression", _("Camera number (default : 0)")).SetDefaultValue("0");
extension.AddExpression("CameraViewportBottom", _("Y position of the bottom right side point of a render zone"), _("Y position of the bottom right side point of a render zone"), _("Camera"), "res/actions/camera.png")
.AddCodeOnlyParameter("currentScene", "")
.AddParameter("layer", _("Layer"))
.AddParameter("expression", _("Camera number (default : 0)")).SetDefaultValue("0");
extension.AddExpression("CameraX", _("Camera X position"), _("Camera X position"), _("Camera"), "res/actions/camera.png")
.AddCodeOnlyParameter("currentScene", "")
.AddParameter("layer", _("Layer"), "",true).SetDefaultValue("\"\"")
.AddParameter("expression", _("Camera number (default : 0)"), "",true).SetDefaultValue("0");
extension.AddExpression("VueX", _("Camera X position"), _("Camera X position"), _("Camera"), "res/actions/camera.png")
.SetHidden()
.AddCodeOnlyParameter("currentScene", "")
.AddParameter("layer", _("Layer"), "",true).SetDefaultValue("\"\"")
.AddParameter("expression", _("Camera number (default : 0)"), "",true).SetDefaultValue("0");
extension.AddExpression("CameraY", _("Camera Y position"), _("Camera Y position"), _("Camera"), "res/actions/camera.png")
.AddCodeOnlyParameter("currentScene", "")
.AddParameter("layer", _("Layer"), "",true).SetDefaultValue("\"\"")
.AddParameter("expression", _("Camera number (default : 0)"), "",true).SetDefaultValue("0");
extension.AddExpression("VueY", _("Camera Y position"), _("Camera Y position"), _("Camera"), "res/actions/camera.png")
.SetHidden()
.AddCodeOnlyParameter("currentScene", "")
.AddParameter("layer", _("Layer"), "",true).SetDefaultValue("\"\"")
.AddParameter("expression", _("Camera number (default : 0)"), "",true).SetDefaultValue("0");
extension.AddExpression("CameraRotation", _("Angle of a camera of a layer"), _("Angle of a camera of a layer"), _("Camera"), "res/actions/camera.png")
.AddCodeOnlyParameter("currentScene", "")
.AddParameter("layer", _("Layer"), "",true).SetDefaultValue("\"\"")
.AddParameter("expression", _("Camera number (default : 0)"), "",true).SetDefaultValue("0");
extension.AddExpression("VueRotation", _("Angle of a camera of a layer"), _("Angle of a camera of a layer"), _("Camera"), "res/actions/camera.png")
.SetHidden()
.AddCodeOnlyParameter("currentScene", "")
.AddParameter("layer", _("Layer"), "",true).SetDefaultValue("\"\"")
.AddParameter("expression", _("Camera number (default : 0)"), "",true).SetDefaultValue("0");
#endif
}
}

View File

@@ -1,61 +0,0 @@
/*
* GDevelop Core
* Copyright 2008-2015 Florian Rival (Florian.Rival@gmail.com). All rights reserved.
* This project is released under the MIT License.
*/
#include "AllBuiltinExtensions.h"
#include "GDCore/Tools/Localization.h"
using namespace std;
namespace gd
{
void GD_CORE_API BuiltinExtensionsImplementer::ImplementsCommonConversionsExtension(gd::PlatformExtension & extension)
{
extension.SetExtensionInformation("BuiltinCommonConversions",
_("Standard Conversions"),
_("Built-in extension providing standard conversions expressions."),
"Florian Rival",
"Open source (MIT License)");
#if defined(GD_IDE_ONLY)
extension.AddExpression("ToNumber",
_("Text > Number"),
_("Convert the text to a number"),
_("Conversion"),
"res/conditions/toujours24.png")
.AddParameter("string", _("Text to convert in a number"));
extension.AddStrExpression("ToString",
_("Number > Text"),
_("Convert the result of the expression in a text"),
_("Conversion"),
"res/conditions/toujours24.png")
.AddParameter("expression", _("Expression to be converted to a text"));
extension.AddStrExpression("LargeNumberToString",
_("Number > Text ( without scientific notation )"),
_("Convert the result of the expression in a text, without using the scientific notation"),
_("Conversion"),
"res/conditions/toujours24.png")
.AddParameter("expression", _("Expression to be converted to a text"));
extension.AddExpression("ToRad",
_("Degrees > Radians"),
_("Converts the angle, expressed in degrees, into radians"),
_("Conversion"),
"res/conditions/toujours24.png")
.AddParameter("expression", _("Angle, in degrees"));
extension.AddExpression("ToDeg",
_("Radians > Degrees"),
_("Converts the angle, expressed in radians, into degrees"),
_("Conversion"),
"res/conditions/toujours24.png")
.AddParameter("expression", _("Angle, in radians"));
#endif
}
}

View File

@@ -1,107 +0,0 @@
/*
* GDevelop Core
* Copyright 2008-2015 Florian Rival (Florian.Rival@gmail.com). All rights reserved.
* This project is released under the MIT License.
*/
#include "AllBuiltinExtensions.h"
#include "GDCore/Tools/Localization.h"
#if defined(GD_IDE_ONLY)
#include "GDCore/Events/Event.h"
#include "GDCore/Events/Builtin/StandardEvent.h"
#include "GDCore/Events/Builtin/CommentEvent.h"
#include "GDCore/Events/Builtin/ForEachEvent.h"
#include "GDCore/Events/Builtin/WhileEvent.h"
#include "GDCore/Events/Builtin/RepeatEvent.h"
#include "GDCore/Events/Builtin/LinkEvent.h"
#include "GDCore/Events/Builtin/GroupEvent.h"
#endif
using namespace std;
namespace gd
{
void GD_CORE_API BuiltinExtensionsImplementer::ImplementsCommonInstructionsExtension(gd::PlatformExtension & extension)
{
extension.SetExtensionInformation("BuiltinCommonInstructions",
_("Standard events"),
_("Built-in extension providing standard events."),
"Florian Rival",
"Open source (MIT License)");
#if defined(GD_IDE_ONLY)
extension.AddCondition("Or",
_("Or"),
_("Return true if one of the sub conditions is true"),
_("If one of these conditions is true:"),
_("Advanced"),
"res/conditions/or24.png",
"res/conditions/or.png")
.SetCanHaveSubInstructions()
.MarkAsAdvanced();
extension.AddCondition("And",
_("And"),
_("Return true if all sub conditions are true"),
_("If all of these conditions are true:"),
_("Advanced"),
"res/conditions/and24.png",
"res/conditions/and.png")
.SetCanHaveSubInstructions()
.MarkAsAdvanced();
extension.AddCondition("Not",
_("Not"),
_("Return the contrary of the result of the sub conditions"),
_("Invert the logical result of these conditions:"),
_("Advanced"),
"res/conditions/not24.png",
"res/conditions/not.png")
.SetCanHaveSubInstructions()
.MarkAsAdvanced();
extension.AddCondition("Once",
_("Trigger once while true"),
_("Run actions only once, for each time the conditions have been met."),
_("Trigger once"),
_("Advanced"),
"res/conditions/once24.png",
"res/conditions/once.png");
extension.AddEvent("Standard", _("Standard event"),
_("Standard event: Actions are run if conditions are fulfilled."),
"", "res/eventaddicon.png",
std::shared_ptr<gd::BaseEvent>(new gd::StandardEvent));
extension.AddEvent("Link", _("Link"),
_("Link to some external events"),
"", "res/lienaddicon.png",
std::shared_ptr<gd::BaseEvent>(new gd::LinkEvent));
extension.AddEvent("Comment", _("Comment"),
_("Event displaying a text in the events editor"),
"", "res/comment.png",
std::shared_ptr<gd::BaseEvent>(new gd::CommentEvent));
extension.AddEvent("While", _("While"),
_("The event is repeated while the conditions are true"),
"", "res/while.png",
std::shared_ptr<gd::BaseEvent>(new gd::WhileEvent));
extension.AddEvent("Repeat", _("Repeat"),
_("Event repeated a number of times"),
"", "res/repeat.png",
std::shared_ptr<gd::BaseEvent>(new gd::RepeatEvent));
extension.AddEvent("ForEach", _("For each object"),
_("Repeat the event for each specified object."),
"", "res/foreach.png",
std::shared_ptr<gd::BaseEvent>(new gd::ForEachEvent));
extension.AddEvent("Group", _("Group"),
_("Group containing events"),
"", "res/foreach.png",
std::shared_ptr<gd::BaseEvent>(new gd::GroupEvent));
#endif
}
}

View File

@@ -1,37 +0,0 @@
/*
* GDevelop Core
* Copyright 2008-2015 Florian Rival (Florian.Rival@gmail.com). All rights reserved.
* This project is released under the MIT License.
*/
#include "AllBuiltinExtensions.h"
#include "GDCore/Tools/Localization.h"
using namespace std;
namespace gd
{
void GD_CORE_API BuiltinExtensionsImplementer::ImplementsExternalLayoutsExtension(gd::PlatformExtension & extension)
{
extension.SetExtensionInformation("BuiltinExternalLayouts",
_("External layouts"),
_("Built-in extension providing actions and conditions related to external layouts"),
"Florian Rival",
"Open source (MIT License)");
#if defined(GD_IDE_ONLY)
extension.AddAction("CreateObjectsFromExternalLayout",
_("Create objects from an external layout"),
_("Create objects from an external layout."),
_("Create objects from the external layout _PARAM1_"),
_("External layouts"),
"res/conditions/fichier24.png",
"res/conditions/fichier.png")
.AddCodeOnlyParameter("currentScene", "")
.AddParameter("string", _("Name of the external layout"))
.AddParameter("expression", _("X position of the origin"), "",true).SetDefaultValue("0")
.AddParameter("expression", _("Y position of the origin"), "",true).SetDefaultValue("0")
.MarkAsAdvanced();
#endif
}
}

View File

@@ -1,151 +0,0 @@
/*
* GDevelop Core
* Copyright 2008-2015 Florian Rival (Florian.Rival@gmail.com). All rights reserved.
* This project is released under the MIT License.
*/
#include "AllBuiltinExtensions.h"
#include "GDCore/Tools/Localization.h"
using namespace std;
namespace gd
{
void GD_CORE_API BuiltinExtensionsImplementer::ImplementsFileExtension(gd::PlatformExtension & extension)
{
extension.SetExtensionInformation("BuiltinFile",
_("Storage and files"),
_("Built-in extension providing functions to store data and manipulate files."),
"Florian Rival",
"Open source (MIT License)");
#if defined(GD_IDE_ONLY)
extension.AddCondition("GroupExists",
_("Existence of a group"),
_("Check if an element (example : PlayerState/CurrentLevel) exists in the file.\nSpaces are forbidden in element names."),
_("_PARAM1_ exists in file _PARAM0_"),
_("Storage"),
"res/conditions/fichier24.png",
"res/conditions/fichier.png")
.AddParameter("file", _("Filename"))
.AddParameter("string", _("Group"))
.MarkAsAdvanced();
extension.AddAction("LoadFile",
_("Load a structured file in memory"),
_("This action load the structured file in memory, so as to write and read it.\nYou can open and write without using this action, but it will be slower.\nIf you use this action, do not forget to unload the file from memory.\n\nFor the native platform, the file format is XML."),
_("Load structured file _PARAM0_ in memory"),
_("Storage"),
"res/actions/fichier24.png",
"res/actions/fichier.png")
.AddParameter("file", _("File"))
.MarkAsAdvanced();
extension.AddAction("UnloadFile",
_("Close a structured file"),
_("This action close the structured file previously loaded in memory, saving all changes made."),
_("Close structured file _PARAM0_"),
_("Storage"),
"res/actions/fichier24.png",
"res/actions/fichier.png")
.AddParameter("file", _("File"))
.MarkAsAdvanced();
extension.AddAction("EcrireFichierExp",
_("Write a value"),
_("Write the result of the expression in the file, in the specified element.\nSpecify the structure leading to the element using / (example : Root/Level/Current)\nSpaces are forbidden in element names."),
_("Write _PARAM2_ in _PARAM1_ of file _PARAM0_"),
_("Storage"),
"res/actions/fichier24.png",
"res/actions/fichier.png")
.AddParameter("file", _("File"))
.AddParameter("string", _("Group"))
.AddParameter("expression", _("Expression"));
extension.AddAction("EcrireFichierTxt",
_("Write a text"),
_("Write the text in the file, in the specified element.\nSpecify the structure leading to the element using / (example : Root/Level/Current)\nSpaces are forbidden in element names."),
_("Write _PARAM2_ in _PARAM1_ of file _PARAM0_"),
_("Storage"),
"res/actions/fichier24.png",
"res/actions/fichier.png")
.AddParameter("file", _("File"))
.AddParameter("string", _("Group"))
.AddParameter("string", _("Text"));
extension.AddAction("LireFichierExp",
_("Read a value"),
_("Read the value saved in the specified element and store it in a variable.\nSpecify the structure leading to the element using / (example : Root/Level/Current)\nSpaces are forbidden in element names."),
_("Read _PARAM1_ from file _PARAM0_ and store value in _PARAM3_"),
_("Storage"),
"res/actions/fichier24.png",
"res/actions/fichier.png")
.AddParameter("file", _("File"))
.AddParameter("string", _("Group"))
.AddCodeOnlyParameter("currentScene", "")
.AddParameter("scenevar", _("Scene variables"));
extension.AddAction("LireFichierTxt",
_("Read a text"),
_("Read the text saved in the specified element and store it in a variable.\nSpecify the structure leading to the element using / (example : Root/Level/Current)\nSpaces are forbidden in element names."),
_("Read _PARAM1_ from file _PARAM0_ and store as text in _PARAM3_"),
_("Storage"),
"res/actions/fichier24.png",
"res/actions/fichier.png")
.AddParameter("file", _("File"))
.AddParameter("string", _("Group"))
.AddCodeOnlyParameter("currentScene", "")
.AddParameter("scenevar", _("Scene variables"));
extension.AddAction("DeleteGroupFichier",
_("Delete an element"),
_("This action delete the specified element from the structured file.\nSpecify the structure leading to the element using / (example : Root/Level/Current)\nSpaces are forbidden in element names."),
_("Delete _PARAM1_ from the file _PARAM0_"),
_("Storage"),
"res/actions/delete24.png",
"res/actions/delete.png")
.AddParameter("file", _("Filename"))
.AddParameter("string", _("Group"))
.MarkAsAdvanced();
extension.AddAction("DeleteFichier",
_("Delete a file"),
_("Delete the file."),
_("Delete the file _PARAM0_"),
_("Files"),
"res/actions/delete24.png",
"res/actions/delete.png")
.AddParameter("file", _("Filename"));
extension.AddCondition("FileExists",
_("A file exists"),
_("Test if the file exists."),
_("File _PARAM0_ exists"),
_("Files"),
"res/conditions/fichier24.png",
"res/conditions/fichier.png")
.AddParameter("file", _("Filename"))
.MarkAsAdvanced();
extension.AddAction("LaunchFile",
_("Open an URL or a file"),
_("This action launch the specified file or URL, in a browser (or in a new tab if the game is using the Web platform and is launched inside a browser)."),
_("Open URL (or file) _PARAM0_"),
_("Files"),
"res/actions/launchFile24.png",
"res/actions/launchFile.png")
.AddParameter("string", _("URL (or filename)"))
.MarkAsAdvanced();
extension.AddAction("ExecuteCmd",
_("Execute a command"),
_("This action execute the specified command."),
_("Execute _PARAM0_"),
_("Files"),
"res/actions/launchFile24.png",
"res/actions/launchFile.png")
.AddParameter("string", _("Command"))
.MarkAsAdvanced();
#endif
}
}

View File

@@ -1,72 +0,0 @@
/*
* GDevelop Core
* Copyright 2008-2015 Florian Rival (Florian.Rival@gmail.com). All rights reserved.
* This project is released under the MIT License.
*/
#include "AllBuiltinExtensions.h"
#include "GDCore/Tools/Localization.h"
using namespace std;
namespace gd
{
void GD_CORE_API BuiltinExtensionsImplementer::ImplementsJoystickExtension(gd::PlatformExtension & extension)
{
extension.SetExtensionInformation("BuiltinJoystick",
_("Joysticks features"),
_("Built-in extension allowing to use joysticks"),
"Florian Rival",
"Open source (MIT License)");
#if defined(GD_IDE_ONLY)
extension.AddCondition("JoystickButtonDown",
_("A button of a joystick is pressed"),
_("Test if a button of a joystick is pressed."),
_("The button _PARAM2_ of joystick _PARAM1_ is pressed"),
_("Joystick"),
"res/conditions/joystick24.png",
"res/conditions/joystick.png")
.AddCodeOnlyParameter("currentScene", "")
.AddParameter("expression", _("Joystick number (first joystick: 0)"))
.AddParameter("expression", _("Button"));
extension.AddCondition("JoystickAxis",
_("Value of an axis of a joystick"),
_("Test the value of an axis of a joystick."),
_("The value of the axis _PARAM2_ of joystick _PARAM1_ is _PARAM3__PARAM4_"),
_("Joystick"),
"res/conditions/joystick24.png",
"res/conditions/joystick.png")
.AddCodeOnlyParameter("currentScene", "")
.AddParameter("expression", _("Joystick number (first joystick: 0)"))
.AddParameter("joyaxis", _("Axis"))
.AddParameter("relationalOperator", _("Sign of the test"))
.AddParameter("expression", _("Value to test"))
.SetManipulatedType("number");
extension.AddAction("GetJoystickAxis",
_("Get the value of the axis of a joystick"),
_("Save in the variable the value of the axis of the joystick (from -100 to 100)."),
_("Save in _PARAM3_ the value of axis _PARAM2_ of joystick _PARAM1_"),
_("Joystick"),
"res/actions/joystick24.png",
"res/actions/joystick.png")
.AddCodeOnlyParameter("currentScene", "")
.AddParameter("expression", _("Joystick number (first joystick: 0)"))
.AddParameter("joyaxis", _("Axis"))
.AddParameter("scenevar", _("Save result to scene variable"))
.SetManipulatedType("number");
extension.AddExpression("GetJoystickAxis",
_("Joystick axis"),
_("Value of an axis of a joystick"),
_("Joystick"),
"res/conditions/joystick.png")
.AddCodeOnlyParameter("currentScene", "")
.AddParameter("expression", _("Joystick number (first joystick: 0)"))
.AddParameter("joyaxis", _("Axis"));
#endif
}
}

View File

@@ -1,82 +0,0 @@
/*
* GDevelop Core
* Copyright 2008-2015 Florian Rival (Florian.Rival@gmail.com). All rights reserved.
* This project is released under the MIT License.
*/
#include "AllBuiltinExtensions.h"
#include "GDCore/Tools/Localization.h"
using namespace std;
namespace gd
{
void GD_CORE_API BuiltinExtensionsImplementer::ImplementsKeyboardExtension(gd::PlatformExtension & extension)
{
extension.SetExtensionInformation("BuiltinKeyboard",
_("Keyboard features"),
_("Built-in extension allowing to use keyboard"),
"Florian Rival",
"Open source (MIT License)");
#if defined(GD_IDE_ONLY)
extension.AddCondition("KeyPressed",
_("Key pressed"),
_("Test if a key is pressed"),
_("_PARAM1_ key is pressed"),
_("Keyboard"),
"res/conditions/keyboard24.png",
"res/conditions/keyboard.png")
.AddCodeOnlyParameter("currentScene", "")
.AddParameter("key", _("Key"));
extension.AddCondition("KeyReleased",
_("Key released"),
_("Test if a key was just released"),
_("_PARAM1_ key is released"),
_("Keyboard"),
"res/conditions/keyboard24.png",
"res/conditions/keyboard.png")
.AddCodeOnlyParameter("currentScene", "")
.AddParameter("key", _("Key"));
extension.AddCondition("KeyFromTextPressed",
_("Key pressed (text expression)"),
_("Test if a key, retrieved from the result of the expression, is pressed"),
_("_PARAM1_ key is pressed"),
_("Keyboard"),
"res/conditions/keyboard24.png",
"res/conditions/keyboard.png")
.AddCodeOnlyParameter("currentScene", "")
.AddParameter("string", _("Expression generating the key to test"))
.MarkAsAdvanced();
extension.AddCondition("KeyFromTextReleased",
_("Key released (text expression)"),
_("Test if a key, retrieved from the result of the expression, was just released"),
_("_PARAM1_ key is released"),
_("Keyboard"),
"res/conditions/keyboard24.png",
"res/conditions/keyboard.png")
.AddCodeOnlyParameter("currentScene", "")
.AddParameter("string", _("Expression generating the key to test"))
.MarkAsAdvanced();
extension.AddCondition("AnyKeyPressed",
_("Any key pressed"),
_("Test if any key is pressed"),
_("Any key is pressed"),
_("Keyboard"),
"res/conditions/keyboard24.png",
"res/conditions/keyboard.png")
.AddCodeOnlyParameter("currentScene", "");
extension.AddStrExpression("LastPressedKey",
_("Last pressed key"),
_("Get the name of the latest key pressed on the keyboard"),
_("Keyboard"),
"res/conditions/keyboard.png")
.AddCodeOnlyParameter("currentScene", "");
#endif
}
}

View File

@@ -1,185 +0,0 @@
/*
* GDevelop Core
* Copyright 2008-2015 Florian Rival (Florian.Rival@gmail.com). All rights reserved.
* This project is released under the MIT License.
*/
#include "AllBuiltinExtensions.h"
#include "GDCore/Tools/Localization.h"
using namespace std;
namespace gd
{
void GD_CORE_API BuiltinExtensionsImplementer::ImplementsMathematicalToolsExtension(gd::PlatformExtension & extension)
{
extension.SetExtensionInformation("BuiltinMathematicalTools",
_("Mathematical tools"),
_("Built-in extension providing mathematical tools"),
"Florian Rival",
"Open source (MIT License)");
#if defined(GD_IDE_ONLY)
extension.AddExpression("AngleDifference", _("Difference between two angles"), _("Difference between two angles"), _("Mathematical tools"), "res/mathfunction.png")
.AddParameter("expression", _("First angle"))
.AddParameter("expression", _("Second angle"));
extension.AddExpression("mod", _("Modulo"), _("x mod y"), _("Mathematical tools"), "res/mathfunction.png")
.AddParameter("expression", _("x (as in x mod y)"))
.AddParameter("expression", _("y (as in x mod y)"));
extension.AddExpression("min", _("Minimum of two numbers"), _("Minimum of two numbers"), _("Mathematical tools"), "res/mathfunction.png")
.AddParameter("expression", _("First expression"))
.AddParameter("expression", _("Second expression"));
extension.AddExpression("max", _("Maximum of two numbers"), _("Maximum of two numbers"), _("Mathematical tools"), "res/mathfunction.png")
.AddParameter("expression", _("First expression"))
.AddParameter("expression", _("Second expression"));
extension.AddExpression("abs", _("Absolute value"), _("Absolute value"), _("Mathematical tools"), "res/mathfunction.png")
.AddParameter("expression", _("Expression"));
extension.AddExpression("acos", _("Arccosine"), _("Arccosine"), _("Mathematical tools"), "res/mathfunction.png")
.AddParameter("expression", _("Expression"));
extension.AddExpression("acosh", _("Hyperbolic arccosine"), _("Hyperbolic arccosine"), _("Mathematical tools"), "res/mathfunction.png")
.AddParameter("expression", _("Expression"));
extension.AddExpression("asin", _("Arcsine"), _("Arcsine"), _("Mathematical tools"), "res/mathfunction.png")
.AddParameter("expression", _("Expression"));
extension.AddExpression("asinh", _("Arcsine"), _("Arcsine"), _("Mathematical tools"), "res/mathfunction.png")
.AddParameter("expression", _("Expression"));
extension.AddExpression("atan", _("Arctangent"), _("Arctangent"), _("Mathematical tools"), "res/mathfunction.png")
.AddParameter("expression", _("Expression"));
extension.AddExpression("atan2", _("2 argument arctangent"), _("2 argument arctangent (atan2)"), _("Mathematical tools"), "res/mathfunction.png")
.AddParameter("expression", _("Y"))
.AddParameter("expression", _("X"));
extension.AddExpression("atanh", _("Hyperbolic arctangent"), _("Hyperbolic arctangent"), _("Mathematical tools"), "res/mathfunction.png")
.AddParameter("expression", _("Expression"));
extension.AddExpression("cbrt", _("Cube root"), _("Cube root"), _("Mathematical tools"), "res/mathfunction.png")
.AddParameter("expression", _("Expression"));
extension.AddExpression("ceil", _("Ceil (round up)"), _("Round number up to an integer"), _("Mathematical tools"), "res/mathfunction.png")
.AddParameter("expression", _("Expression"));
extension.AddExpression("floor", _("Floor (round down)"), _("Round number down to an integer"), _("Mathematical tools"), "res/mathfunction.png")
.AddParameter("expression", _("Expression"));
extension.AddExpression("cos", _("Cosine"), _("Cosine of a number"), _("Mathematical tools"), "res/mathfunction.png")
.AddParameter("expression", _("Expression"));
extension.AddExpression("cosh", _("Hyperbolic cosine"), _("Hyperbolic cosine"), _("Mathematical tools"), "res/mathfunction.png")
.AddParameter("expression", _("Expression"));
extension.AddExpression("cot", _("Cotangent"), _("Cotangent of a number"), _("Mathematical tools"), "res/mathfunction.png")
.AddParameter("expression", _("Expression"));
extension.AddExpression("csc", _("Cosecant"), _("Cosecant of a number"), _("Mathematical tools"), "res/mathfunction.png")
.AddParameter("expression", _("Expression"));
extension.AddExpression("int", _("Round"), _("Round a number"), _("Mathematical tools"), "res/mathfunction.png")
.SetHidden()
.AddParameter("expression", _("Expression"));
extension.AddExpression("rint", _("Round"), _("Round a number"), _("Mathematical tools"), "res/mathfunction.png")
.SetHidden()
.AddParameter("expression", _("Expression"));
extension.AddExpression("round", _("Round"), _("Round a number"), _("Mathematical tools"), "res/mathfunction.png")
.AddParameter("expression", _("Expression"));
extension.AddExpression("exp", _("Exponential"), _("Exponential of a number"), _("Mathematical tools"), "res/mathfunction.png")
.AddParameter("expression", _("Expression"));
extension.AddExpression("log", _("Logarithm"), _("Logarithm"), _("Mathematical tools"), "res/mathfunction.png")
.AddParameter("expression", _("Expression"));
extension.AddExpression("ln", _("Logarithm"), _("Logarithm"), _("Mathematical tools"), "res/mathfunction.png")
.SetHidden()
.AddParameter("expression", _("Expression"));
extension.AddExpression("log2", _("Base-2 logarithm"), _("Base 2 Logarithm"), _("Mathematical tools"), "res/mathfunction.png")
.AddParameter("expression", _("Expression"));
extension.AddExpression("log10", _("Base-10 logarithm"), _("Base-10 logarithm"), _("Mathematical tools"), "res/mathfunction.png")
.AddParameter("expression", _("Expression"));
extension.AddExpression("nthroot", _("Nth root"), _("Nth root of a number"), _("Mathematical tools"), "res/mathfunction.png")
.AddParameter("expression", _("Number"))
.AddParameter("expression", _("N"));
extension.AddExpression("pow", _("Power"), _("Raise a number to power n"), _("Mathematical tools"), "res/mathfunction.png")
.AddParameter("expression", _("Number"))
.AddParameter("expression", _("The exponent (n in x^n)"));
extension.AddExpression("sec", _("Secant"), _("Secant"), _("Mathematical tools"), "res/mathfunction.png")
.AddParameter("expression", _("Expression"));
extension.AddExpression("sign", _("Sign of a number"), _("Return the sign of a number (1,-1 or 0)"), _("Mathematical tools"), "res/mathfunction.png")
.AddParameter("expression", _("Expression"));
extension.AddExpression("sin", _("Sine"), _("Sine of a number"), _("Mathematical tools"), "res/mathfunction.png")
.AddParameter("expression", _("Expression"));
extension.AddExpression("sinh", _("Hyperbolic sine"), _("Hyperbolic sine"), _("Mathematical tools"), "res/mathfunction.png")
.AddParameter("expression", _("Expression"));
extension.AddExpression("sqrt", _("Square root"), _("Square root of a number"), _("Mathematical tools"), "res/mathfunction.png")
.AddParameter("expression", _("Expression"));
extension.AddExpression("tan", _("Tangent"), _("Tangent of a number"), _("Mathematical tools"), "res/mathfunction.png")
.AddParameter("expression", _("Expression"));
extension.AddExpression("tanh", _("Hyperbolic tangent"), _("Hyperbolic tangent"), _("Mathematical tools"), "res/mathfunction.png")
.AddParameter("expression", _("Expression"));
extension.AddExpression("trunc", _("Truncation"), _("Troncate a number"), _("Mathematical tools"), "res/mathfunction.png")
.AddParameter("expression", _("Expression"));
extension.AddExpression("lerp", _("Lerp (Linear interpolation)"), _("Linearly interpolate a to b by x"), _("Mathematical tools"), "res/mathfunction.png")
.AddParameter("expression", _("a (in a+(b-a)*x)"))
.AddParameter("expression", _("b (in a+(b-a)*x)"))
.AddParameter("expression", _("x (in a+(b-a)*x)"));
#endif
}
}

View File

@@ -1,260 +0,0 @@
/*
* GDevelop Core
* Copyright 2008-2015 Florian Rival (Florian.Rival@gmail.com). All rights reserved.
* This project is released under the MIT License.
*/
#include "AllBuiltinExtensions.h"
#include "GDCore/Tools/Localization.h"
using namespace std;
namespace gd
{
void GD_CORE_API BuiltinExtensionsImplementer::ImplementsMouseExtension(gd::PlatformExtension & extension)
{
extension.SetExtensionInformation("BuiltinMouse",
_("Mouse features"),
_("Built-in extension allowing to use the mouse"),
"Florian Rival",
"Open source (MIT License)");
#if defined(GD_IDE_ONLY)
extension.AddCondition("SourisSurObjet",
_("The cursor/touch is on an object"),
_("Test if the cursor is over an object, or if the object is being touched."),
_("The cursor/touch is on _PARAM0_"),
_("Mouse and touch"),
"res/conditions/surObjet24.png",
"res/conditions/surObjet.png")
.AddParameter("objectList", _("Object"))
.AddCodeOnlyParameter("currentScene", "")
.AddParameter("yesorno", _("Accurate test (yes by default)"), "", true).SetDefaultValue("yes")
.AddCodeOnlyParameter("conditionInverted", "")
.MarkAsSimple();
extension.AddAction("TouchSimulateMouse",
_("De/activate moving mouse cursor with touches"),
_("When activated, any touch made on a touchscreen will also move the mouse cursor. When deactivated, mouse and touch positions will be completely independant.\nBy default, this is activated so that you can simply use the mouse conditions to also support touchscreens. If you want to have multitouch and differentiate mouse and touches, just deactivate it with this action."),
_("Move mouse cursor when touching screen: _PARAM1_"),
_("Mouse and touch"),
"res/conditions/touch24.png",
"res/conditions/touch.png")
.AddCodeOnlyParameter("currentScene", "")
.AddParameter("yesorno", _("Activate (yes by default when game is launched)")).SetDefaultValue("yes")
.MarkAsAdvanced();
extension.AddAction("CentreSourisX",
_("Center cursor horizontally"),
_("Put the cursor in the middle of the screen horizontally."),
_("Center cursor horizontally"),
_("Mouse and touch"),
"res/actions/mouse24.png",
"res/actions/mouse.png")
.AddCodeOnlyParameter("currentScene", "")
.MarkAsAdvanced();
extension.AddAction("CentreSourisY",
_("Center cursor vertically"),
_("Put the cursor in the middle of the screen vertically."),
_("Center cursor vertically"),
_("Mouse and touch"),
"res/actions/mouse24.png",
"res/actions/mouse.png")
.AddCodeOnlyParameter("currentScene", "")
.MarkAsAdvanced();
extension.AddAction("CacheSouris",
_("Hide the cursor"),
_("Hide the cursor."),
_("Hide the cursor"),
_("Mouse and touch"),
"res/actions/mouse24.png",
"res/actions/mouse.png")
.AddCodeOnlyParameter("currentScene", "")
.MarkAsAdvanced();
extension.AddAction("MontreSouris",
_("Show the cursor"),
_("Show the cursor."),
_("Show the cursor"),
_("Mouse and touch"),
"res/actions/mouse24.png",
"res/actions/mouse.png")
.AddCodeOnlyParameter("currentScene", "")
.MarkAsAdvanced();
extension.AddAction("SetSourisXY",
_("Position the cursor of the mouse"),
_("Position the cursor at the given coordinates."),
_("Position cursor at _PARAM1_;_PARAM2_"),
_("Mouse and touch"),
"res/actions/mouse24.png",
"res/actions/mouse.png")
.AddCodeOnlyParameter("currentScene", "")
.AddParameter("expression", _("X position"))
.AddParameter("expression", _("Y position"))
.MarkAsAdvanced();
extension.AddAction("CentreSouris",
_("Center the cursor"),
_("Center the cursor on the screen."),
_("Center the cursor"),
_("Mouse and touch"),
"res/actions/mouse24.png",
"res/actions/mouse.png")
.AddCodeOnlyParameter("currentScene", "")
.MarkAsAdvanced();
extension.AddCondition("SourisX",
_("Cursor X position"),
_("Compare the X position of the cursor or of a touch."),
_("Cursor X position is _PARAM1__PARAM2_"),
_("Mouse and touch"),
"res/conditions/mouse24.png",
"res/conditions/mouse.png")
.AddCodeOnlyParameter("currentScene", "")
.AddParameter("relationalOperator", _("Sign of the test"))
.AddParameter("expression", _("X position"))
.AddParameter("layer", _("Layer (base layer if empty)"), "", true).SetDefaultValue("\"\"")
.AddParameter("expression", _("Camera number (default : 0)"), "", true).SetDefaultValue("0")
.SetManipulatedType("number");
extension.AddCondition("SourisY",
_("Cursor Y position"),
_("Compare the Y position of the cursor or of a touch."),
_("Cursor Y position is _PARAM1__PARAM2_"),
_("Mouse and touch"),
"res/conditions/mouse24.png",
"res/conditions/mouse.png")
.AddCodeOnlyParameter("currentScene", "")
.AddParameter("relationalOperator", _("Sign of the test"))
.AddParameter("expression", _("Y position"))
.AddParameter("layer", _("Layer (base layer if empty)"), "", true).SetDefaultValue("\"\"")
.AddParameter("expression", _("Camera number (default : 0)"), "", true).SetDefaultValue("0")
.SetManipulatedType("number");
extension.AddCondition("SourisBouton",
_("Mouse button down or touch held"),
_("Return true if the specified button of the mouse is down or if any touch is in contact with the screen."),
_("Touch or _PARAM1_ mouse button is down"),
_("Mouse and touch"),
"res/conditions/mouse24.png",
"res/conditions/mouse.png")
.AddCodeOnlyParameter("currentScene", "")
.AddParameter("mouse", _("Button to test"))
.MarkAsSimple();
extension.AddCondition("MouseButtonReleased",
_("Mouse button released"),
_("Return true if the specified button of the mouse was released."),
_("_PARAM1_ mouse button was released"),
_("Mouse and touch"),
"res/conditions/mouse24.png",
"res/conditions/mouse.png")
.AddCodeOnlyParameter("currentScene", "")
.AddParameter("mouse", _("Button to test"))
.MarkAsSimple();
extension.AddCondition("TouchX",
_("Touch X position"),
_("Compare the X position of a specific touch."),
_("Touch #_PARAM1_ X position is _PARAM2__PARAM3_"),
_("Mouse and touch/Multitouch"),
"res/conditions/touch24.png",
"res/conditions/touch.png")
.AddCodeOnlyParameter("currentScene", "")
.AddParameter("expression", _("Touch identifier"))
.AddParameter("relationalOperator", _("Sign of the test"))
.AddParameter("expression", _("X position"))
.AddParameter("layer", _("Layer (base layer if empty)"), "", true).SetDefaultValue("\"\"")
.AddParameter("expression", _("Camera number (default : 0)"), "", true).SetDefaultValue("0")
.SetManipulatedType("number");
extension.AddCondition("TouchY",
_("Touch Y position"),
_("Compare the Y position of a specific touch."),
_("Touch #_PARAM1_ Y position is _PARAM2__PARAM3_"),
_("Mouse and touch/Multitouch"),
"res/conditions/touch24.png",
"res/conditions/touch.png")
.AddCodeOnlyParameter("currentScene", "")
.AddParameter("expression", _("Touch identifier"))
.AddParameter("relationalOperator", _("Sign of the test"))
.AddParameter("expression", _("X position"))
.AddParameter("layer", _("Layer (base layer if empty)"), "", true).SetDefaultValue("\"\"")
.AddParameter("expression", _("Camera number (default : 0)"), "", true).SetDefaultValue("0")
.SetManipulatedType("number");
extension.AddCondition("PopStartedTouch",
_("A new touch has started"),
_("Return true if a touch has started. The touch identifier can be accessed using LastTouchId().\nAs more than one touch can have started, this condition is only true once for each touch: the next time you use it, it will be for a new touch or it will return false if there is no more touch that just started."),
_("A new touch has started"),
_("Mouse and touch/Multitouch"),
"res/conditions/touch24.png",
"res/conditions/touch.png")
.AddCodeOnlyParameter("currentScene", "");
extension.AddCondition("PopEndedTouch",
_("A touch has ended"),
_("Return true if a touch has ended. The touch identifier can be accessed using LastEndedTouchId().\nAs more than one touch can have ended, this condition is only true once for each touch: the next time you use it, it will be for a new touch or it will return false if there is no more touch that just ended."),
_("A touch has ended"),
_("Mouse and touch/Multitouch"),
"res/conditions/touch24.png",
"res/conditions/touch.png")
.AddCodeOnlyParameter("currentScene", "");
extension.AddExpression("MouseX", _("Cursor X position"), _("Cursor X position"), _("Mouse cursor"), "res/actions/mouse.png")
.AddCodeOnlyParameter("currentScene", "")
.AddParameter("layer", _("Layer"), "", true).SetDefaultValue("\"\"")
.AddParameter("camera", _("Camera"), "", true).SetDefaultValue("0");
extension.AddExpression("SourisX", _("Cursor X position"), _("Cursor X position"), _("Mouse cursor"), "res/actions/mouse.png")
.AddCodeOnlyParameter("currentScene", "")
.AddParameter("layer", _("Layer"), "", true).SetDefaultValue("\"\"")
.AddParameter("camera", _("Camera"), "", true).SetDefaultValue("0")
.SetHidden();
extension.AddExpression("MouseY", _("Cursor Y position"), _("Cursor Y position"), _("Mouse cursor"), "res/actions/mouse.png")
.AddCodeOnlyParameter("currentScene", "")
.AddParameter("layer", _("Layer"), "", true).SetDefaultValue("\"\"")
.AddParameter("camera", _("Camera"), "", true).SetDefaultValue("0");
extension.AddExpression("SourisY", _("Cursor Y position"), _("Cursor Y position"), _("Mouse cursor"), "res/actions/mouse.png")
.AddCodeOnlyParameter("currentScene", "")
.AddParameter("layer", _("Layer"), "", true).SetDefaultValue("\"\"")
.AddParameter("camera", _("Camera"), "", true).SetDefaultValue("0")
.SetHidden();
extension.AddExpression("MouseWheelDelta", _("Mouse wheel: Displacement"), _("Mouse wheel displacement"), _("Mouse cursor"), "res/actions/mouse.png")
.AddCodeOnlyParameter("currentScene", "");
extension.AddExpression("TouchX", _("Touch X position"), _("Touch X position"), _("Multitouch"), "res/conditions/touch.png")
.AddCodeOnlyParameter("currentScene", "")
.AddParameter("expression", _("Touch identifier"))
.AddParameter("layer", _("Layer"), "", true).SetDefaultValue("\"\"")
.AddParameter("camera", _("Camera"), "", true).SetDefaultValue("0");
extension.AddExpression("TouchY", _("Touch Y position"), _("Touch Y position"), _("Multitouch"), "res/conditions/touch.png")
.AddCodeOnlyParameter("currentScene", "")
.AddParameter("expression", _("Touch identifier"))
.AddParameter("layer", _("Layer"), "", true).SetDefaultValue("\"\"")
.AddParameter("camera", _("Camera"), "", true).SetDefaultValue("0");
extension.AddExpression("LastTouchId", _("Identifier of the last touch"), _("Identifier of the last touch"), _("Multitouch"), "res/conditions/touch.png")
.AddCodeOnlyParameter("currentScene", "");
extension.AddExpression("LastEndedTouchId", _("Identifier of the last ended touch"), _("Identifier of the last ended touch"), _("Multitouch"), "res/conditions/touch.png")
.AddCodeOnlyParameter("currentScene", "");
#endif
}
}

View File

@@ -1,85 +0,0 @@
/*
* GDevelop Core
* Copyright 2008-2015 Florian Rival (Florian.Rival@gmail.com). All rights reserved.
* This project is released under the MIT License.
*/
#include "AllBuiltinExtensions.h"
#include "GDCore/Tools/Localization.h"
using namespace std;
namespace gd
{
void GD_CORE_API BuiltinExtensionsImplementer::ImplementsNetworkExtension(gd::PlatformExtension & extension)
{
extension.SetExtensionInformation("BuiltinNetwork",
_("Basic internet features"),
_("Built-in extension providing network features."),
"Florian Rival",
"Open source (MIT License)");
#if defined(GD_IDE_ONLY)
extension.AddAction("EnvoiDataNet",
_("Send datas to a website"),
_("Send datas to a specified web site.\nYou need to set up a .php page on your web site so as to receive this datas.\nEnter here a password, and enter the same in the configuration of your .php page.\nRead the help file to get more informations."),
_("Send to _PARAM0_ the following datas : _PARAM2_, _PARAM3_,_PARAM4_,_PARAM5_,_PARAM6_,_PARAM7_"),
_("Network"),
"res/actions/net24.png",
"res/actions/net.png")
.AddParameter("string", _(".php page URL (don't forget the protocol http://)"))
.AddParameter("password", _("Password"))
.AddParameter("string", _("Data 1"))
.AddParameter("string", _("Data 2"), "", true)
.AddParameter("string", _("Data 3"), "", true)
.AddParameter("string", _("Data 4"), "", true)
.AddParameter("string", _("Data 5"), "", true)
.AddParameter("string", _("Data 6"), "", true)
.SetHidden();
extension.AddAction("SendRequest",
_("Send a request to a web page"),
_("Send a request to the specified web page.\n\nPlease note that for the web platform games, the game must be hosted on the same host as specified below, except if the server is configured to answer to all requests (cross-domain requests)."),
_("Send _PARAM3_ request to _PARAM0__PARAM1_ with body: _PARAM2_"),
_("Network"),
"res/actions/net24.png",
"res/actions/net.png")
.AddParameter("string", _("Host (example: http://www.some-server.org/)"))
.AddParameter("string", _("Path to page (Example: /page.php)"))
.AddParameter("string", _("Request body content"))
.AddParameter("string", _("Method: \"POST\" or \"GET\" (if empty, GET will be used)"), "", true ).SetDefaultValue("\"GET\"")
.AddParameter("string", _("Content type (application/x-www-form-urlencoded by default)"), "", true )
.AddParameter("scenevar", _("Store the response in this variable"), "", true )
.MarkAsComplex();
extension.AddAction("DownloadFile",
_("Download a file"),
_("Download a file from a web site"),
_("Download file _PARAM1_ from _PARAM0_ under the name of _PARAM2_"),
_("Network"),
"res/actions/net24.png",
"res/actions/net.png")
.AddParameter("string", _("Host (for example : http://www.website.com)"))
.AddParameter("string", _("Path to file (for example : /folder/file.txt)"))
.AddParameter("string", _("Save as"));
extension.AddAction("JSONToVariableStructure",
_("Convert JSON to variable"),
_("Parse a JSON object and store it into a variable"),
_("Parse JSON string _PARAM0_ and store it into variable _PARAM1_"),
_("Network"),
"res/actions/net24.png",
"res/actions/net.png")
.AddParameter("string", _("JSON string"))
.AddParameter("scenevar", _("Variable where store the JSON object"))
.MarkAsAdvanced();
extension.AddStrExpression("ToJSON",
_("Convert to JSON"),
_("Convert a variable to JSON"),
_("Conversion"),
"res/conditions/toujours24.png")
.AddParameter("scenevar", _("The variable to be stringify"));
#endif
}
}

View File

@@ -1,118 +0,0 @@
/*
* GDevelop Core
* Copyright 2008-2015 Florian Rival (Florian.Rival@gmail.com). All rights reserved.
* This project is released under the MIT License.
*/
#include "AllBuiltinExtensions.h"
#include "GDCore/Tools/Localization.h"
using namespace std;
namespace gd
{
void GD_CORE_API BuiltinExtensionsImplementer::ImplementsSceneExtension(gd::PlatformExtension & extension)
{
extension.SetExtensionInformation("BuiltinScene",
_("Scene management features"),
_("Built-in extension allowing to manipulate scenes"),
"Florian Rival",
"Open source (MIT License)");
#if defined(GD_IDE_ONLY)
extension.AddExpression("Random", _("Random value"), _("Random value"), _("Random"), "res/actions/position.png")
.AddParameter("expression", _("Maximum value"));
extension.AddStrExpression("CurrentSceneName", _("Current scene name"), _("Name of the current scene"), _("Scene"), "res/actions/texte.png")
.AddCodeOnlyParameter("currentScene", "");
extension.AddCondition("DepartScene",
_("At the beginning of the scene"),
_("Is true only when scene just begins."),
_("At the beginning of the scene"),
_("Scene"),
"res/conditions/depart24.png",
"res/conditions/depart.png")
.AddCodeOnlyParameter("currentScene", "")
.MarkAsSimple();
extension.AddAction("Scene",
_("Change the scene"),
_("Stop this scene and start the specified one instead."),
_("Change for scene _PARAM1_"),
_("Scene"),
"res/actions/replaceScene24.png",
"res/actions/replaceScene.png")
.AddCodeOnlyParameter("currentScene", "")
.AddParameter("string", _("Name of the new scene"))
.AddParameter("yesorno", _("Stop any other paused scenes?")).SetDefaultValue("true")
.MarkAsAdvanced();
extension.AddAction("PushScene",
_("Pause and start a new scene"),
_("Pause this scene and start the specified one.\nLater, you can use \"Stop and go back to previous scene\" action to go back to this scene."),
_("Pause the scene and start _PARAM1_"),
_("Scene"),
"res/actions/pushScene24.png",
"res/actions/pushScene.png")
.AddCodeOnlyParameter("currentScene", "")
.AddParameter("string", _("Name of the new scene"))
.MarkAsAdvanced();
extension.AddAction("PopScene",
_("Stop and go back to previous scene"),
_("Stop this scene and go back to the previous paused one.\nTo pause a scene, use \"Pause and start a new scene\" action."),
_("Stop the scene and go back to the previous paused one"),
_("Scene"),
"res/actions/popScene24.png",
"res/actions/popScene.png")
.AddCodeOnlyParameter("currentScene", "")
.MarkAsAdvanced();
extension.AddAction("Quit",
_("Quit the game"),
_("Quit the game"),
_("Quit the game"),
_("Scene"),
"res/actions/quit24.png",
"res/actions/quit.png")
.AddCodeOnlyParameter("currentScene", "")
.MarkAsAdvanced();
extension.AddAction("SceneBackground",
_("Change background color"),
_("Change the background color of the scene."),
_("Set background color to _PARAM1_"),
_("Scene"),
"res/actions/background24.png",
"res/actions/background.png")
.AddCodeOnlyParameter("currentScene", "")
.AddParameter("color", _("Color"))
.MarkAsAdvanced();
extension.AddAction("DisableInputWhenFocusIsLost",
_("Disable input when focus is lost"),
_("Set if the keyboard and mouse buttons must be taken into account even\nif the window is not active."),
_("Disable input when focus is lost: _PARAM1_"),
_("Scene"),
"res/actions/window24.png",
"res/actions/window.png")
.AddCodeOnlyParameter("currentScene", "")
.AddParameter("yesorno", _("Deactivate input when focus is lost"))
.MarkAsAdvanced();
extension.AddCondition("Egal",
_("Compare two expressions"),
_("Test the two expression"),
_("_PARAM0_ _PARAM1_ _PARAM2_"),
_("Other"),
"res/conditions/egal24.png",
"res/conditions/egal.png")
.AddParameter("expression", _("Expression 1"))
.AddParameter("relationalOperator", _("Sign of the test"))
.AddParameter("expression", _("Expression 2"))
.MarkAsAdvanced();
#endif
}
}

View File

@@ -1,17 +0,0 @@
/*
* GDevelop Core
* Copyright 2008-2015 Florian Rival (Florian.Rival@gmail.com). All rights reserved.
* This project is released under the MIT License.
*/
#include "GDCore/BuiltinExtensions/SpriteExtension/Point.h"
#include "GDCore/String.h"
Point::Point(const gd::String & name_) :
name(name_),
x(0),
y(0)
{
//ctor
}

View File

@@ -1,64 +0,0 @@
/*
* GDevelop Core
* Copyright 2008-2015 Florian Rival (Florian.Rival@gmail.com). All rights reserved.
* This project is released under the MIT License.
*/
#ifndef GDCORE_POINT_H
#define GDCORE_POINT_H
#include "GDCore/String.h"
/**
* \brief Named point used by Sprite.
*
* \ingroup SpriteObjectExtension
*/
class GD_CORE_API Point
{
public:
Point(const gd::String & name_);
virtual ~Point() {};
/**
* Change point name
*/
void SetName(const gd::String & name_) { name = name_; }
/**
* Get point name
*/
const gd::String & GetName() const { return name; }
/**
* Change point position.
*/
void SetXY(float x_, float y_) { x = x_;y = y_; }
/**
* Change point X position.
*/
void SetX(float x_) { x = x_; }
/**
* Change point Y position.
*/
void SetY(float y_) { y = y_; }
/**
* Get point X position.
*/
float GetX() const { return x; }
/**
* Get point Y position.
*/
float GetY() const { return y; }
private:
gd::String name;
float x;
float y;
};
#endif // GDCORE_POINT_H

View File

@@ -1,93 +0,0 @@
/*
* GDevelop Core
* Copyright 2008-2015 Florian Rival (Florian.Rival@gmail.com). All rights reserved.
* This project is released under the MIT License.
*/
#include "Polygon2d.h"
#include <cmath>
#include <iostream>
#include <SFML/System/Vector2.hpp>
void Polygon2d::Rotate(float angle)
{
float t,
cosa = cos(-angle),
sina = sin(-angle); //We want a clockwise rotation
for (std::size_t i = 0;i<vertices.size();++i)
{
t = vertices[i].x;
vertices[i].x = t*cosa + vertices[i].y*sina;
vertices[i].y = -t*sina + vertices[i].y*cosa;
}
}
void Polygon2d::Move(float x, float y)
{
for (std::size_t i = 0; i < vertices.size(); i++)
{
vertices[i].x += x;
vertices[i].y += y;
}
ComputeEdges();
}
void Polygon2d::ComputeEdges() const
{
sf::Vector2f v1, v2;
edges.clear();
for (std::size_t i = 0; i < vertices.size(); i++)
{
v1 = vertices[i];
if ((i + 1) >= vertices.size()) v2 = vertices[0];
else v2 = vertices[i + 1];
edges.push_back(v2 - v1);
}
}
bool Polygon2d::IsConvex() const
{
ComputeEdges();
if ( edges.size() < 3 ) return false;
bool zProductIsPositive = (edges[0].x*edges[0+1].y - edges[0].y*edges[0+1].x) > 0;
for (std::size_t i = 1;i<edges.size()-1;++i)
{
float zCrossProduct = edges[i].x*edges[i+1].y - edges[i].y*edges[i+1].x;
if ( (zCrossProduct > 0) != zProductIsPositive ) return false;
}
float lastZCrossProduct = edges[edges.size()-1].x*edges[0].y - edges[edges.size()-1].y*edges[0].x;
if ( (lastZCrossProduct > 0) != zProductIsPositive ) return false;
return true;
}
sf::Vector2f Polygon2d::ComputeCenter() const
{
sf::Vector2f center;
for (std::size_t i = 0; i < vertices.size(); i++)
{
center.x += vertices[i].x;
center.y += vertices[i].y;
}
center.x /= vertices.size();
center.y /= vertices.size();
return center;
}
Polygon2d Polygon2d::CreateRectangle(float width, float height)
{
Polygon2d rect;
rect.vertices.push_back(sf::Vector2f(-width/2.0f, -height/2.0f));
rect.vertices.push_back(sf::Vector2f(+width/2.0f, -height/2.0f));
rect.vertices.push_back(sf::Vector2f(+width/2.0f, +height/2.0f));
rect.vertices.push_back(sf::Vector2f(-width/2.0f, +height/2.0f));
return rect;
}

View File

@@ -1,71 +0,0 @@
/*
* GDevelop Core
* Copyright 2008-2015 Florian Rival (Florian.Rival@gmail.com). All rights reserved.
* This project is released under the MIT License.
*/
#ifndef GDCORE_POLYGON_H
#define GDCORE_POLYGON_H
#include <vector>
#include <SFML/System/Vector2.hpp>
/**
* \brief Represents a polygon. Usually used for collisions masks.
*
* This class stores the vertices of the polygon.
* It can also compute and store the edges ( needed by some collisions algorithms ) if ComputeEdges is called.
*
* \ingroup GameEngine
*/
class GD_CORE_API Polygon2d
{
public:
Polygon2d() {};
virtual ~Polygon2d() {};
std::vector<sf::Vector2f> vertices; ///< The vertices composing the polygon
mutable std::vector<sf::Vector2f> edges; ///< Edges. Can be computed from vertices using ComputeEdges()
/**
* Moves each vertices from the given amount.
*
* \note Edges are updated, there is no need to call ComputeEdges after calling Move.
*/
void Move(float x, float y);
/**
* Rotate the polygon.
* \param angle Angle in radians
*
* \warning Rotation is made clockwise
* \warning edges vector is not updated, you have to call ComputeEdges if needed.
*/
void Rotate(float angle);
/**
* Automatically fill edges vector using vertices.
*/
void ComputeEdges() const;
/**
* Check if the polygon is convex.
* \return true if the polygon is convex
*/
bool IsConvex() const;
/**
* Return the position of the center of the polygon
*/
sf::Vector2f ComputeCenter() const;
/** \name Tools
* Tool functions
*/
///@{
/**
* Create a rectangle
*/
static Polygon2d CreateRectangle(float width, float height);
///@}
};
#endif // GDCORE_POLYGON_H

View File

@@ -1,472 +0,0 @@
/*
* GDevelop Core
* Copyright 2008-2015 Florian Rival (Florian.Rival@gmail.com). All rights reserved.
* This project is released under the GNU Lesser General Public LicenFse.
*/
#include "GDCore/BuiltinExtensions/AllBuiltinExtensions.h"
#include "GDCore/Tools/Localization.h"
#include "GDCore/PlatformDefinition/Object.h"
#include "GDCore/BuiltinExtensions/SpriteExtension/SpriteObject.h"
using namespace std;
namespace gd
{
void GD_CORE_API BuiltinExtensionsImplementer::ImplementsSpriteExtension(gd::PlatformExtension & extension)
{
extension.SetExtensionInformation("Sprite",
_("Sprite"),
_("Extension for adding animated objects in the scene, which can contain animations with directions within each."),
"Florian Rival",
"Open source (MIT License)");
gd::ObjectMetadata & obj = extension.AddObject("Sprite",
_("Sprite"),
_("Animated object which can be used for most elements of a game"),
"CppPlatform/Extensions/spriteicon.png",
&CreateSpriteObject);
#if defined(GD_IDE_ONLY)
obj.AddAction("Opacity",
_("Change object's opacity"),
_("Change the opacity of an object."),
_("Do _PARAM1__PARAM2_ to the opacity of _PARAM0_"),
_("Visibility"),
"res/actions/opacity24.png",
"res/actions/opacity.png")
.AddParameter("object", _("Object"), "Sprite")
.AddParameter("operator", _("Modification's sign"))
.AddParameter("expression", _("Value"))
.MarkAsSimple()
.SetManipulatedType("number");
obj.AddAction("ChangeAnimation",
_("Change the animation"),
_("Modify the current animation of the object."),
_("Do _PARAM1__PARAM2_ to the number of current animation of _PARAM0_"),
_("Animations and images"),
"res/actions/animation24.png",
"res/actions/animation.png")
.AddParameter("object", _("Object"), "Sprite")
.AddParameter("operator", _("Modification's sign"))
.AddParameter("expression", _("Value"))
.MarkAsSimple()
.SetManipulatedType("number");
obj.AddAction("ChangeDirection",
_("Change the direction"),
_("Change the direction of the object.\nIf the object is set to automatically rotate, the direction is its angle.\nIf the object is in 8 directions mode, the valid directions are 0..7"),
_("Do _PARAM1__PARAM2_ to the direction of _PARAM0_"),
_("Direction"),
"res/actions/direction24.png",
"res/actions/direction.png")
.AddParameter("object", _("Object"), "Sprite")
.AddParameter("operator", _("Modification's sign"))
.AddParameter("expression", _("Value"))
.MarkAsAdvanced()
.SetManipulatedType("number");
obj.AddAction("ChangeSprite",
_("Current frame"),
_("Modify the current frame of the object"),
_("Do _PARAM1__PARAM2_ to animation frame of _PARAM0_"),
_("Animations and images"),
"res/actions/sprite24.png",
"res/actions/sprite.png")
.AddParameter("object", _("Object"), "Sprite")
.AddParameter("operator", _("Modification's sign"))
.AddParameter("expression", _("Value"))
.MarkAsAdvanced()
.SetManipulatedType("number");
obj.AddAction("PauseAnimation",
_("Pause the animation"),
_("Pause the current animation of the object"),
_("Pause the current animation of _PARAM0_"),
_("Animations and images"),
"res/actions/animation24.png",
"res/actions/animation.png")
.AddParameter("object", _("Object"), "Sprite")
.MarkAsSimple();
obj.AddAction("PlayAnimation",
_("Play the animation"),
_("Play the current animation of the object"),
_("Play the current animation of _PARAM0_"),
_("Animations and images"),
"res/actions/animation24.png",
"res/actions/animation.png")
.AddParameter("object", _("Object"), "Sprite")
.MarkAsSimple();
obj.AddAction("ChangeAnimationSpeedScale",
_("Animation speed scale"),
_("Modify the animation speed scale (1 = the default speed, >1 = faster and <1 = slower)."),
_("Do _PARAM1__PARAM2_ to the animation speed scale of _PARAM0_"),
_("Animations and images"),
"res/actions/animation24.png",
"res/actions/animation.png")
.AddParameter("object", _("Object"), "Sprite")
.AddParameter("operator", _("Modification's sign"))
.AddParameter("expression", _("Value"))
.MarkAsSimple()
.SetManipulatedType("number");
obj.AddAction("TourneVersPos",
_("Rotate an object toward a position"),
_("Rotate an object towards a position."),
_("Rotate _PARAM0_ towards _PARAM1_;_PARAM2_"),
_("Direction"),
"res/actions/direction24.png",
"res/actions/direction.png")
.AddParameter("object", _("Object to be rotated"), "Sprite")
.AddParameter("expression", _("X position"))
.AddParameter("expression", _("Y position"))
.AddParameter("expression", _("Angular speed (degrees per second)")).SetDefaultValue("0")
.AddCodeOnlyParameter("currentScene", "")
.SetHidden(); //Deprecated
obj.AddAction("ChangeScale",
_("Scale"),
_("Modify the scale of the specified object."),
_("Do _PARAM1__PARAM2_ to the scale of _PARAM0_"),
_("Size"),
"res/actions/scale24.png",
"res/actions/scale.png")
.AddParameter("object", _("Object"), "Sprite")
.AddParameter("operator", _("Modification's sign"))
.AddParameter("expression", _("Value"))
.MarkAsAdvanced();
obj.AddAction("ChangeScaleWidth",
_("Scale on X axis"),
_("Modify the scale of the width of an object."),
_("Do _PARAM1__PARAM2_ to the width's scale of _PARAM0_"),
_("Size"),
"res/actions/scale24.png",
"res/actions/scale.png")
.AddParameter("object", _("Object"), "Sprite")
.AddParameter("operator", _("Modification's sign"))
.AddParameter("expression", _("Value"))
.MarkAsAdvanced()
.SetManipulatedType("number");
obj.AddAction("ChangeScaleHeight",
_("Scale on Y axis"),
_("Modify the scale of the height of an object."),
_("Do _PARAM1__PARAM2_ to the height's scale of _PARAM0_"),
_("Size"),
"res/actions/scale24.png",
"res/actions/scale.png")
.AddParameter("object", _("Object"), "Sprite")
.AddParameter("operator", _("Modification's sign"))
.AddParameter("expression", _("Value"))
.MarkAsAdvanced()
.SetManipulatedType("number");
obj.AddCondition("Animation",
_("Current animation"),
_("Test the number of the current animation of the object."),
_("The number of the current animation of _PARAM0_ is _PARAM1__PARAM2_"),
_("Animations and images"),
"res/conditions/animation24.png",
"res/conditions/animation.png")
.AddParameter("object", _("Object"), "Sprite")
.AddParameter("relationalOperator", _("Sign of the test"))
.AddParameter("expression", _("Number to test"))
.MarkAsAdvanced()
.SetManipulatedType("number");
obj.AddCondition("Direction",
_("Current direction"),
_("Compare the direction of the object. If 8 direction mode is activated for the sprite, the value taken for direction will be from 0 to 7. Otherwise, the direction is in degrees."),
_("Direction of _PARAM0_ is _PARAM1__PARAM2_"),
_("Direction"),
"res/conditions/direction24.png",
"res/conditions/direction.png")
.AddParameter("object", _("Object"), "Sprite")
.AddParameter("relationalOperator", _("Sign of the test"))
.AddParameter("expression", _("Direction to test"))
.SetManipulatedType("number");
obj.AddCondition("Sprite",
_("Current frame"),
_("Test the number of the current animation frame."),
_("The animation frame of _PARAM0_ is _PARAM1__PARAM2_"),
_("Animations and images"),
"res/conditions/sprite24.png",
"res/conditions/sprite.png")
.AddParameter("object", _("Object"), "Sprite")
.AddParameter("relationalOperator", _("Sign of the test"))
.AddParameter("expression", _("Animation frame to test"))
.MarkAsAdvanced()
.SetManipulatedType("number");
obj.AddCondition("AnimStopped",
_("Animation paused"),
_("Test if the animation of an object is paused"),
_("The animation of _PARAM0_ is paused"),
_("Animations and images"),
"res/conditions/animation24.png",
"res/conditions/animation.png")
.AddParameter("object", _("Object"), "Sprite")
.MarkAsSimple();
obj.AddCondition("AnimationEnded",
_("Animation finished"),
_("Check if the animation being played by the Sprite object is finished."),
_("The animation of _PARAM0_ is finished"),
_("Animations and images"),
"res/conditions/animation24.png",
"res/conditions/animation.png")
.AddParameter("object", _("Object"), "Sprite")
.MarkAsSimple();
obj.AddCondition("ScaleWidth",
_("Scale on X axis"),
_("Compare the scale of the width of an object."),
_("The width's scale of _PARAM0_ is _PARAM1__PARAM2_"),
_("Size"),
"res/conditions/scaleWidth24.png",
"res/conditions/scaleWidth.png")
.AddParameter("object", _("Object"), "Sprite")
.AddParameter("relationalOperator", _("Sign of the test"))
.AddParameter("expression", _("Value to test"))
.MarkAsAdvanced()
.SetManipulatedType("number");
obj.AddCondition("ScaleHeight",
_("Scale on Y axis"),
_("Compare the scale of the height of an object."),
_("The height's scale of _PARAM0_ is _PARAM1__PARAM2_"),
_("Size"),
"res/conditions/scaleHeight24.png",
"res/conditions/scaleHeight.png")
.AddParameter("object", _("Object"), "Sprite")
.AddParameter("relationalOperator", _("Sign of the test"))
.AddParameter("expression", _("Value to test"))
.MarkAsAdvanced()
.SetManipulatedType("number");
obj.AddCondition("Opacity",
_("Opacity"),
_("Compare the opacity of an object, between 0 (fully transparent) to 255 (opaque)"),
_("The opacity of _PARAM0_ is _PARAM1__PARAM2_"),
_("Visibility"),
"res/conditions/opacity24.png",
"res/conditions/opacity.png")
.AddParameter("object", _("Object"), "Sprite")
.AddParameter("relationalOperator", _("Sign of the test"))
.AddParameter("expression", _("Value to test"))
.MarkAsSimple()
.SetManipulatedType("number");
obj.AddCondition("BlendMode",
_("Blend mode"),
_("Compare the number of the blend mode currently used by an object"),
_("The number of the current blend mode of _PARAM0_ is _PARAM1__PARAM2_"),
_("Effects"),
"res/conditions/opacity24.png",
"res/conditions/opacity.png")
.AddParameter("object", _("Object"), "Sprite")
.AddParameter("relationalOperator", _("Sign of the test"))
.AddParameter("expression", _("Value to test (0: Alpha, 1: Add, 2: Multiply, 3: None)"))
.MarkAsAdvanced()
.SetManipulatedType("number");
obj.AddAction("CopyImageOnImageOfSprite",
_("Copy an image on the current one of an object"),
_("Copy an image on the current image of an object.\nNote that the source image must be preferably kept loaded in memory."),
_("Copy image _PARAM2_ on the current of _PARAM0_ at _PARAM3_;_PARAM4_"),
_("Effects"),
"res/copy24.png",
"res/copyicon.png")
.AddParameter("object", _("Object"), "Sprite")
.AddCodeOnlyParameter("currentScene", "")
.AddParameter("string", _("Name of the source image"))
.AddParameter("expression", _("X position"))
.AddParameter("expression", _("Y position"))
.AddParameter("yesorno", _("Should the copy take in account the source transparency\?"));
obj.AddAction("CreateMaskFromColorOnActualImage", //Actual is indeed a mistake : Current should have been chosen.
_("Make a color of the image of an object transparent"),
_("Make a color of the image of an object transparent."),
_("Make color _PARAM1_ of the current image of _PARAM0_ transparent"),
_("Effects"),
"res/actions/opacity24.png",
"res/actions/opacity.png")
.AddParameter("object", _("Object"), "Sprite")
.AddParameter("color", _("Color to make transparent"));
obj.AddAction("ChangeColor",
_("Global color"),
_("Change the global color of an object. The default color is white."),
_("Change color of _PARAM0_ to _PARAM1_"),
_("Effects"),
"res/actions/color24.png",
"res/actions/color.png")
.AddParameter("object", _("Object"), "Sprite")
.AddParameter("color", _("Color"));
obj.AddAction("ChangeBlendMode",
_("Blend mode"),
_("Change the number of the blend mode of an object.\nThe default blend mode is 0 (Alpha)."),
_("Change Blend mode of _PARAM0_ to _PARAM1_"),
_("Effects"),
"res/actions/color24.png",
"res/actions/color.png")
.AddParameter("object", _("Object"), "Sprite")
.AddParameter("expression", _("Mode (0 : Alpha, 1 : Add, 2 : Multiply, 3 : None)"))
.MarkAsSimple();
obj.AddAction("FlipX",
_("Flip the object horizontally"),
_("Flip the object horizontally"),
_("Flip horizontally _PARAM0_ : _PARAM1_"),
_("Effects"),
"res/actions/flipX24.png",
"res/actions/flipX.png")
.AddParameter("object", _("Object"), "Sprite")
.AddParameter("yesorno", _("Activate flipping"))
.MarkAsSimple();
obj.AddAction("FlipY",
_("Flip the object vertically"),
_("Flip the object vertically"),
_("Flip vertically _PARAM0_ : _PARAM1_"),
_("Effects"),
"res/actions/flipY24.png",
"res/actions/flipY.png")
.AddParameter("object", _("Object"), "Sprite")
.AddParameter("yesorno", _("Activate flipping"))
.MarkAsSimple();
obj.AddCondition("FlippedX",
_("Horizontally flipped"),
_("Return true if the object is horizontally flipped"),
_("_PARAM0_ is horizontally flipped"),
_("Effects"),
"res/actions/flipX24.png",
"res/actions/flipX.png")
.AddParameter("object", _("Object"), "Sprite");
obj.AddCondition("FlippedY",
_("Vertically flipped"),
_("Return true if the object is vertically flipped"),
_("_PARAM0_ is vertically flipped"),
_("Effects"),
"res/actions/flipY24.png",
"res/actions/flipY.png")
.AddParameter("object", _("Object"), "Sprite");
obj.AddAction("TourneVers",
_("Rotate an object toward another"),
_("Rotate an object towards another."),
_("Rotate _PARAM0_ towards _PARAM1_"),
_("Direction"),
"res/actions/direction24.png",
"res/actions/direction.png")
.AddParameter("object", _("Object to be rotated"), "Sprite")
.AddParameter("objectPtr", _("Rotate toward this object"))
.AddCodeOnlyParameter("currentScene", "")
.SetHidden(); //Deprecated
obj.AddExpression("X", _("X position of a point"), _("X position of a point"), _("Position"), "res/actions/position.png")
.SetHidden()
.AddParameter("object", _("Object"), "Sprite")
.AddParameter("", _("Name of the point"), "", true);
obj.AddExpression("Y", _("Y position of a point"), _("Y position of a point"), _("Position"), "res/actions/position.png")
.SetHidden()
.AddParameter("object", _("Object"), "Sprite")
.AddParameter("", _("Name of the point"), "", true);
obj.AddExpression("PointX", _("X position of a point"), _("X position of a point"), _("Position"), "res/actions/position.png")
.AddParameter("object", _("Object"), "Sprite")
.AddParameter("", _("Name of the point"));
obj.AddExpression("PointY", _("Y position of a point"), _("Y position of a point"), _("Position"), "res/actions/position.png")
.AddParameter("object", _("Object"), "Sprite")
.AddParameter("", _("Name of the point"));
obj.AddExpression("Direc", _("Direction"), _("Direction of the object"), _("Direction"), "res/actions/direction.png")
.SetHidden()
.AddParameter("object", _("Object"), "Sprite");
obj.AddExpression("Direction", _("Direction"), _("Direction of the object"), _("Direction"), "res/actions/direction.png")
.AddParameter("object", _("Object"), "Sprite");
obj.AddExpression("Anim", _("Animation"), _("Animation of the object"), _("Animations and images"), "res/actions/animation.png")
.SetHidden()
.AddParameter("object", _("Object"), "Sprite");
obj.AddExpression("Animation", _("Animation"), _("Animation of the object"), _("Animations and images"), "res/actions/animation.png")
.AddParameter("object", _("Object"), "Sprite");
obj.AddExpression("Sprite", _("Image"), _("Animation frame of the object"), _("Animations and images"), "res/actions/sprite.png")
.AddParameter("object", _("Object"), "Sprite");
obj.AddExpression("AnimationSpeedScale", _("Animation speed scale"), _("Animation speed scale"), _("Animations and images"), "res/actions/animation.png")
.AddParameter("object", _("Object"), "Sprite");
obj.AddExpression("ScaleX", _("Scale of the width of an object"), _("Scale of the width of an object"), _("Size"), "res/actions/scaleWidth.png")
.AddParameter("object", _("Object"), "Sprite");
obj.AddExpression("ScaleY", _("Scale of the height of an object"), _("Scale of the height of an object"), _("Size"), "res/actions/scaleHeight.png")
.AddParameter("object", _("Object"), "Sprite");
extension.AddCondition("Collision",
_("Collision (Pixel perfect)"),
_("The condition is true if there is a collision between the two objects.\nThe test is pixel-perfect."),
_("_PARAM0_ is in collision with _PARAM1_ (pixel perfect)"),
_("Collision"),
"res/conditions/collision24.png",
"res/conditions/collision.png")
.AddParameter("objectList", _("Object 1"), "Sprite")
.AddParameter("objectList", _("Object 2"), "Sprite")
.AddCodeOnlyParameter("conditionInverted", "");
#endif
}
}

View File

@@ -1,129 +0,0 @@
/*
* GDevelop Core
* Copyright 2008-2015 Florian Rival (Florian.Rival@gmail.com). All rights reserved.
* This project is released under the MIT License.
*/
#include "AllBuiltinExtensions.h"
#include "GDCore/Tools/Localization.h"
using namespace std;
namespace gd
{
void GD_CORE_API BuiltinExtensionsImplementer::ImplementsStringInstructionsExtension(gd::PlatformExtension & extension)
{
extension.SetExtensionInformation("BuiltinStringInstructions",
_("Text manipulation"),
_("Built-in extension providing expressions for manipulating texts."),
"Florian Rival",
"Open source (MIT License)");
#if defined(GD_IDE_ONLY)
extension.AddStrExpression("NewLine",
_("Insert a new line"),
_("Insert a new line"),
_("Manipulation on text"),
"res/conditions/toujours24.png");
extension.AddStrExpression("FromCodePoint",
_("Get character from code point"),
_("Get character from code point"),
_("Manipulation on text"),
"res/conditions/toujours24.png")
.AddParameter("expression", _("Code point"));
extension.AddStrExpression("ToUpperCase",
_("Uppercase a text"),
_("Uppercase a text"),
_("Manipulation on text"),
"res/conditions/toujours24.png")
.AddParameter("string", _("Text"));
extension.AddStrExpression("ToLowerCase",
_("Lowercase a text"),
_("Lowercase a text"),
_("Manipulation on text"),
"res/conditions/toujours24.png")
.AddParameter("string", _("Text"));
extension.AddStrExpression("SubStr",
_("Get a portion of a text"),
_("Get a portion of a text"),
_("Manipulation on text"),
"res/conditions/toujours24.png")
.AddParameter("string", _("Text"))
.AddParameter("expression", _("Start position of the portion (the first letter is at position 0)"))
.AddParameter("expression", _("Length of the portion"));
extension.AddStrExpression("StrAt",
_("Get a character from a text"),
_("Get a character from a text"),
_("Manipulation on text"),
"res/conditions/toujours24.png")
.AddParameter("string", _("Text"))
.AddParameter("expression", _("Position of the character (the first letter is at position 0)"));
extension.AddExpression("StrLength",
_("Length of a text"),
_("Length of a text"),
_("Manipulation on text"),
"res/conditions/toujours24.png")
.AddParameter("string", _("Text"));
extension.AddExpression("StrFind",
_("Search in a text"),
_("Search in a text (return the position of the result or -1 if not found)"),
_("Manipulation on text"),
"res/conditions/toujours24.png")
.AddParameter("string", _("Text"))
.AddParameter("string", _("Text to search for"));
extension.AddExpression("StrRFind",
_("Search in a text from end"),
_("Search in a text from the end (return the position of the result or -1 if not found)"),
_("Manipulation on text"),
"res/conditions/toujours24.png")
.AddParameter("string", _("Text"))
.AddParameter("string", _("Text to search for"));
extension.AddExpression("StrFindFrom",
_("Search in a text, starting from a position"),
_("Search in a text starting from a position (return the position of the result or -1 if not found)"),
_("Manipulation on text"),
"res/conditions/toujours24.png")
.AddParameter("string", _("Text"))
.AddParameter("string", _("Text to search for"))
.AddParameter("expression", _("Position of the first character in the string to be considered in the search"));
extension.AddExpression("StrRFindFrom",
_("Search in a text from the end, starting from a position"),
_("Search in a text from the end, starting from a position (return the position of the result or -1 if not found)"),
_("Manipulation on 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"));
#endif
}
}

View File

@@ -1,154 +0,0 @@
/*
* GDevelop Core
* Copyright 2008-2015 Florian Rival (Florian.Rival@gmail.com). All rights reserved.
* This project is released under the MIT License.
*/
#include "AllBuiltinExtensions.h"
#include "GDCore/Tools/Localization.h"
using namespace std;
namespace gd
{
void GD_CORE_API BuiltinExtensionsImplementer::ImplementsTimeExtension(gd::PlatformExtension & extension)
{
extension.SetExtensionInformation("BuiltinTime",
_("Time"),
_("Built-in extension providing actions and conditions about the time."),
"Florian Rival",
"Open source (MIT License)");
#if defined(GD_IDE_ONLY)
extension.AddCondition("Timer",
_("Value of a timer"),
_("Test the elapsed time of a timer."),
_("The timer _PARAM2_ is greater than _PARAM1_ seconds"),
_("Timers and time"),
"res/conditions/timer24.png",
"res/conditions/timer.png")
.AddCodeOnlyParameter("currentScene", "")
.AddParameter("expression", _("Time in seconds"))
.AddParameter("string", _("Timer's name"));
extension.AddCondition("TimeScale",
_("Time scale"),
_("Test the time scale."),
_("The time scale is _PARAM1__PARAM2_"),
_("Timers and time"),
"res/conditions/time24.png",
"res/conditions/time.png")
.AddCodeOnlyParameter("currentScene", "")
.AddParameter("relationalOperator", _("Sign of the test"))
.AddParameter("expression", _("Value to test"))
.MarkAsAdvanced()
.SetManipulatedType("number");
extension.AddCondition("TimerPaused",
_("State of a timer"),
_("Test if specified timer is paused."),
_("The timer _PARAM1_ is paused"),
_("Timers and time"),
"res/conditions/timerPaused24.png",
"res/conditions/timerPaused.png")
.AddCodeOnlyParameter("currentScene", "")
.AddParameter("string", _("Timer's name"))
.MarkAsAdvanced();
extension.AddAction("ResetTimer",
_("Reset a timer"),
_("Reset the specified timer."),
_("Reset the timer _PARAM1_"),
_("Timers and time"),
"res/actions/timer24.png",
"res/actions/timer.png")
.AddCodeOnlyParameter("currentScene", "")
.AddParameter("string", _("Timer's name"));
extension.AddAction("PauseTimer",
_("Pause a timer"),
_("Pause a timer."),
_("Pause timer _PARAM1_"),
_("Timers and time"),
"res/actions/pauseTimer24.png",
"res/actions/pauseTimer.png")
.AddCodeOnlyParameter("currentScene", "")
.AddParameter("string", _("Timer's name"))
.MarkAsAdvanced();
extension.AddAction("UnPauseTimer",
_("Unpause a timer"),
_("Unpause a timer."),
_("Unpause timer _PARAM1_"),
_("Timers and time"),
"res/actions/unPauseTimer24.png",
"res/actions/unPauseTimer.png")
.AddCodeOnlyParameter("currentScene", "")
.AddParameter("string", _("Timer's name"))
.MarkAsAdvanced();
extension.AddAction("RemoveTimer",
_("Delete a timer"),
_("Delete a timer from memory."),
_("Delete timer _PARAM1_ from memory"),
_("Timers and time"),
"res/actions/timer24.png",
"res/actions/timer.png")
.AddCodeOnlyParameter("currentScene", "")
.AddParameter("string", _("Timer's name"))
.MarkAsAdvanced();
extension.AddAction("ChangeTimeScale",
_("Change time scale"),
_("Change the time scale of the game."),
_("Set time scale to _PARAM1_"),
_("Timers and time"),
"res/actions/time24.png",
"res/actions/time.png")
.AddCodeOnlyParameter("currentScene", "")
.AddParameter("expression", _("Scale (1 : Default, 2 : Faster, 0.5 : Slower...)"));
extension.AddExpression("TimeDelta", _("Time elapsed since the last image"), _("Time elapsed since the last image"), _("Time"), "res/actions/time.png")
.AddCodeOnlyParameter("currentScene", "");
extension.AddExpression("TempsFrame", _("Time elapsed since the last image"), _("Time elapsed since the last image"), _("Time"), "res/actions/time.png")
.SetHidden()
.AddCodeOnlyParameter("currentScene", "");
extension.AddExpression("ElapsedTime", _("Time elapsed since the last image"), _("Time elapsed since the last image"), _("Time"), "res/actions/time.png")
.SetHidden()
.AddCodeOnlyParameter("currentScene", "");
extension.AddExpression("TimerElapsedTime", _("Timer value"), _("Value of a timer"), _("Time"), "res/actions/time.png")
.AddCodeOnlyParameter("currentScene", "")
.AddParameter("string", _("Timer's name"));
extension.AddExpression("TimeFromStart", _("Time elapsed since the beginning of the scene"), _("Time elapsed since the beginning of the scene"), _("Time"), "res/actions/time.png")
.AddCodeOnlyParameter("currentScene", "")
;
extension.AddExpression("TempsDebut", _("Time elapsed since the beginning of the scene"), _("Time elapsed since the beginning of the scene"), _("Time"), "res/actions/time.png")
.SetHidden()
.AddCodeOnlyParameter("currentScene", "")
;
extension.AddExpression("TimeScale", _("Time scale"), _("Time scale"), _("Time"), "res/actions/time.png")
.AddCodeOnlyParameter("currentScene", "")
;
extension.AddExpression("TimeScale", _("Time scale"), _("Time scale"), _("Time"), "res/actions/time.png")
.SetHidden()
.AddCodeOnlyParameter("currentScene", "");
extension.AddExpression("Time", _("Current time"), _("Current time"), _("Time"), "res/actions/time.png")
.AddCodeOnlyParameter("currentScene", "")
.AddParameter("", _("Hour : hour\nMinutes : min\nSeconds : sec\nDay in the month : mday\nMonths since January : mon\nYear since 1900 : year\nDays since sunday :wday\nDays since January 1st : yday"));
#endif
}
}

View File

@@ -1,203 +0,0 @@
/*
* GDevelop Core
* Copyright 2008-2015 Florian Rival (Florian.Rival@gmail.com). All rights reserved.
* This project is released under the MIT License.
*/
#include "AllBuiltinExtensions.h"
#include "GDCore/Tools/Localization.h"
using namespace std;
namespace gd
{
void GD_CORE_API BuiltinExtensionsImplementer::ImplementsVariablesExtension(gd::PlatformExtension & extension)
{
extension.SetExtensionInformation("BuiltinVariables",
_("Variable features"),
_("Built-in extension allowing to manipulate variables"),
"Florian Rival",
"Open source (MIT License)");
#if defined(GD_IDE_ONLY)
extension.AddCondition("VarScene",
_("Value of a variable"),
_("Compare the value of a scene variable."),
_("Variable _PARAM0_ is _PARAM1__PARAM2_"),
_("Variables"),
"res/conditions/var24.png",
"res/conditions/var.png")
.AddParameter("scenevar", _("Variable"))
.AddParameter("relationalOperator", _("Sign of the test"))
.AddParameter("expression", _("Value to compare"))
.SetManipulatedType("number");
extension.AddCondition("VarSceneTxt",
_("Text of a variable"),
_("Compare the text of a scene variable."),
_("The text of variable _PARAM0_ is _PARAM1__PARAM2_"),
_("Variables"),
"res/conditions/var24.png",
"res/conditions/var.png")
.AddParameter("scenevar", _("Variable"))
.AddParameter("relationalOperator", _("Sign of the test"))
.AddParameter("string", _("Text to compare"))
.SetManipulatedType("string");
extension.AddCondition("VariableChildExists",
_("Child existence"),
_("Return true if the specified child of the variable exists."),
_("Child _PARAM1_ of variable _PARAM0_ exists"),
_("Variables/Structures"),
"res/conditions/var24.png",
"res/conditions/var.png")
.AddParameter("scenevar", _("Variable"))
.AddParameter("string", _("Name of the child"))
.MarkAsAdvanced();
extension.AddCondition("GlobalVariableChildExists",
_("Child existence"),
_("Return true if the specified child of the global variable exists."),
_("Child _PARAM1_ of global variable _PARAM0_ exists"),
_("Variables/Global variables/Structures"),
"res/conditions/var24.png",
"res/conditions/var.png")
.AddParameter("globalvar", _("Variable"))
.AddParameter("string", _("Name of the child"))
.MarkAsAdvanced();
extension.AddCondition("VarSceneDef",
_("Test if a scene variable is defined"),
_("Test if the scene variable exist."),
_("Variable _PARAM0_ is defined"),
_("Variables"),
"res/conditions/var24.png",
"res/conditions/var.png")
.AddCodeOnlyParameter("currentScene", "")
.AddParameter("string", _("Variable"))
.SetHidden();
extension.AddCondition("VarGlobal",
_("Value of a global variable"),
_("Compare the value of a global variable."),
_("Global variable _PARAM0_ is _PARAM1__PARAM2_"),
_("Variables/Global variables"),
"res/conditions/var24.png",
"res/conditions/var.png")
.AddParameter("globalvar", _("Variable"))
.AddParameter("relationalOperator", _("Sign of the test"))
.AddParameter("expression", _("Value to compare"))
.MarkAsAdvanced()
.SetManipulatedType("number");
extension.AddCondition("VarGlobalTxt",
_("Text of a global variable"),
_("Compare the text of a global variable."),
_("The text of the global variable _PARAM0_ is _PARAM1__PARAM2_"),
_("Variables/Global variables"),
"res/conditions/var24.png",
"res/conditions/var.png")
.AddParameter("globalvar", _("Variable"))
.AddParameter("relationalOperator", _("Sign of the test"))
.AddParameter("string", _("Text to compare"))
.MarkAsAdvanced()
.SetManipulatedType("string");
extension.AddCondition("VarGlobalDef",
_("Test if a global variable is defined"),
_("Test if a global variable exists"),
_("Global variable _PARAM0_ is defined"),
_("Variables/Global variables"),
"res/conditions/var24.png",
"res/conditions/var.png")
.AddCodeOnlyParameter("currentScene", "")
.AddParameter("string", _("Variable"))
.MarkAsAdvanced()
.SetHidden();
extension.AddAction("ModVarScene",
_("Value of a variable"),
_("Modify the value of a scene variable."),
_("Do _PARAM1__PARAM2_ to variable _PARAM0_"),
_("Variables"),
"res/actions/var24.png",
"res/actions/var.png")
.AddParameter("scenevar", _("Variable"))
.AddParameter("operator", _("Modification's sign"))
.AddParameter("expression", _("Value"))
.SetManipulatedType("number");
extension.AddAction("ModVarSceneTxt",
_("String of a variable"),
_("Modify the text of a scene variable."),
_("Do _PARAM1__PARAM2_ to the text of variable _PARAM0_"),
_("Variables"),
"res/actions/var24.png",
"res/actions/var.png")
.AddParameter("scenevar", _("Variable"))
.AddParameter("operator", _("Modification's sign"))
.AddParameter("string", _("Text"))
.SetManipulatedType("string");
extension.AddAction("ModVarGlobal",
_("Value of a global variable"),
_("Modify the value of a global variable"),
_("Do _PARAM1__PARAM2_ to global variable _PARAM0_"),
_("Variables/Global variables"),
"res/actions/var24.png",
"res/actions/var.png")
.AddParameter("globalvar", _("Variable"))
.AddParameter("operator", _("Modification's sign"))
.AddParameter("expression", _("Value"))
.MarkAsAdvanced()
.SetManipulatedType("number");
extension.AddAction("ModVarGlobalTxt",
_("String of a global variable"),
_("Modify the text of a global variable."),
_("Do _PARAM1__PARAM2_ to the text of global variable _PARAM0_"),
_("Variables/Global variables"),
"res/actions/var24.png",
"res/actions/var.png")
.AddParameter("globalvar", _("Variable"))
.AddParameter("operator", _("Modification's sign"))
.AddParameter("string", _("Text"))
.MarkAsAdvanced()
.SetManipulatedType("string");
extension.AddAction("VariableRemoveChild",
_("Remove a child"),
_("Remove a child from a variable."),
_("Remove child _PARAM1_ from variable _PARAM0_"),
_("Variables/Structure"),
"res/actions/var24.png",
"res/actions/var.png")
.AddParameter("scenevar", _("Variable"))
.AddParameter("string", _("Child's name"))
.MarkAsAdvanced();
extension.AddAction("GlobalVariableRemoveChild",
_("Remove a child"),
_("Remove a child from a global variable."),
_("Remove child _PARAM1_ from global variable _PARAM0_"),
_("Variables/Global variables/Structure"),
"res/actions/var24.png",
"res/actions/var.png")
.AddParameter("globalvar", _("Variable"))
.AddParameter("string", _("Child's name"))
.MarkAsAdvanced();
extension.AddExpression("Variable", _("Scene variables"), _("Scene variables"), _("Variables"), "res/actions/var.png")
.AddParameter("scenevar", _("Variable"));
extension.AddStrExpression("VariableString", _("Scene variables"), _("Text of a scene variable"), _("Variables"), "res/actions/var.png")
.AddParameter("scenevar", _("Variable"));
extension.AddExpression("GlobalVariable", _("Global variables"), _("Global variable"), _("Variables"), "res/actions/var.png")
.AddParameter("globalvar", _("Name of the global variable"));
extension.AddStrExpression("GlobalVariableString", _("Global variables"), _("Text of a global variable"), _("Variables"), "res/actions/var.png")
.AddParameter("globalvar", _("Variable"));
#endif
}
}

View File

@@ -1,95 +0,0 @@
/*
* GDevelop Core
* Copyright 2008-2015 Florian Rival (Florian.Rival@gmail.com). All rights reserved.
* This project is released under the MIT License.
*/
#include "AllBuiltinExtensions.h"
#include "GDCore/Tools/Localization.h"
using namespace std;
namespace gd
{
void GD_CORE_API BuiltinExtensionsImplementer::ImplementsWindowExtension(gd::PlatformExtension & extension)
{
extension.SetExtensionInformation("BuiltinWindow",
_("Window features"),
_("Built-in extension allowing to manipulate the game's window"),
"Florian Rival",
"Open source (MIT License)");
#if defined(GD_IDE_ONLY)
extension.AddAction("SetFullScreen",
_("De/activate fullscreen"),
_("This action activate or desactivate fullscreen."),
_("Activate fullscreen: _PARAM1_ (keep aspect ratio: _PARAM2_)"),
_("Game's window"),
"res/actions/fullscreen24.png",
"res/actions/fullscreen.png")
.AddCodeOnlyParameter("currentScene", "")
.AddParameter("yesorno", _("Activate fullscreen"))
.AddParameter("yesorno", _("Keep aspect ratio (HTML5 games only, yes by default)"), "",true).SetDefaultValue("yes");
extension.AddAction("SetWindowMargins",
_("Change window's margins"),
_("This action change the margins, in pixels, of the game's window."),
_("Set margins of game window to _PARAM1_;_PARAM2_;_PARAM3_;_PARAM4_"),
_("Game's window"),
"res/actions/window24.png",
"res/actions/window.png")
.AddCodeOnlyParameter("currentScene", "")
.AddParameter("expression", _("Top"))
.AddParameter("expression", _("Right"))
.AddParameter("expression", _("Bottom"))
.AddParameter("expression", _("Left"));
extension.AddAction("SetWindowSize",
_("Change the size of the screen"),
_("This action change the size of the game window."),
_("Change window size: _PARAM1_x_PARAM2_"),
_("Game's window"),
"res/actions/window24.png",
"res/actions/window.png")
.AddCodeOnlyParameter("currentScene", "")
.AddParameter("expression", _("Width"))
.AddParameter("expression", _("Height"))
.AddParameter("yesorno", _("Use this size as default size for new scene cameras\?\n(Yes to change extend the game area, No to stretch the game to the window's size)."));
extension.AddAction("SetWindowIcon",
_("Change window's icon"),
_("This action change the icon of the game's window."),
_("Use _PARAM1_ as icon for the game's window."),
_("Game's window"),
"res/actions/window24.png",
"res/actions/window.png")
.AddCodeOnlyParameter("currentScene", "")
.AddParameter("string", _("Name of the image to be used as the icon"));
extension.AddAction("SetWindowTitle",
_("Change window's title"),
_("This action change the title of the game window."),
_("Change window title to _PARAM1_"),
_("Game's window"),
"res/actions/window24.png",
"res/actions/window.png")
.AddCodeOnlyParameter("currentScene", "")
.AddParameter("string", _("New title"));
extension.AddExpression("SceneWindowWidth", _("Width of the scene window"), _("Width of the scene window (or scene canvas for HTML5 games)"), _("Screen"), "res/window.png")
.AddCodeOnlyParameter("currentScene", "");
extension.AddExpression("SceneWindowHeight", _("Height of the scene window"), _("Height of the scene window (or scene canvas for HTML5 games)"), _("Screen"), "res/window.png")
.AddCodeOnlyParameter("currentScene", "");
extension.AddExpression("ScreenWidth", _("Width of the screen/page"), _("Width of the screen (or the page for HTML5 games in browser)"), _("Screen"), "res/display16.png");
extension.AddExpression("ScreenHeight", _("Height of the screen/page"), _("Height of the screen (or the page for HTML5 games in browser)"), _("Screen"), "res/display16.png");
extension.AddExpression("ColorDepth", _("Color depth"), _("Color depth"), _("Screen"), "res/display16.png");
extension.AddStrExpression("WindowTitle", _("Window's title"), _("Window's title"), _("Screen"), "res/window.png")
.AddCodeOnlyParameter("currentScene", "");
#endif
}
}

View File

@@ -1,6 +1,6 @@
/*
* GDevelop Core
* Copyright 2008-2015 Florian Rival (Florian.Rival@gmail.com). All rights reserved.
* Copyright 2008-2016 Florian Rival (Florian.Rival@gmail.com). All rights reserved.
* This project is released under the MIT License.
*/

View File

@@ -71,7 +71,7 @@
*
* Download the current version of the compiler used by GDevelop on Windows here:
*
* http://sourceforge.net/projects/tdm-gcc/files/TDM-GCC%20Installer/tdm-gcc-4.9.2.exe/download
* https://sourceforge.net/projects/tdm-gcc/files/TDM-GCC%20Installer/Previous/1.1309.0/tdm-gcc-4.9.2.exe/download
*
* \section installWinCompiler_install Installation
*
@@ -222,6 +222,7 @@ brew install cmake
brew install p7zip
brew install pkgconfig
brew install wxwidgets
brew install freetype
\endcode
* If you want to generate the documentation and translations, install Doxygen and Gettext:
\code
@@ -337,7 +338,7 @@ make -j4
* \section platformstructure Structure of a platform
*
* A platform for GDevelop Core is a class inheriting from gd::Platform.<br>
* They contains the extensions of the platform (see below) and offer various methods, like gd::Platform::GetProjectExporter which
* They contains the extensions of the platform (see below) and offer various methods, like gd::Platform::GetProjectExporters which
* is called by the IDE to export a gd::Project to a stand-alone game.
*
* \subsection platformloading Platforms loading
@@ -406,7 +407,7 @@ str += " world";
str += " " + gd::String::From(2);
//str now contains "Hello world 2";
gd::string twopointfiveStr = "2.5";
gd::String twopointfiveStr = "2.5";
double twopointfive = twopointfive.To<double>();
//twopointfive == 2.5
\endcode
@@ -499,30 +500,22 @@ Actions are declared like this :
* Adding an object is made using gd::PlatformExtension::AddObject method.
*
* \code
gd::ObjectMetadata & obj = AddObject("Name",
gd::ObjectMetadata & obj = AddObject<MyObject>(
"Name",
_("Name displayed to users"),
_("Description"),
"path-to-a-32-by-32-icon.png",
&FunctionForCreatingTheObject);
* \endcode
*
* *FunctionForCreatingTheObject* is a function that must just create the object. It should look like this:
*
* \code
gd::Object * CreateTextObject(std::string name)
{
return new TextObject(name);
}
"path-to-a-32-by-32-icon.png");
* \endcode
*
* The *C++ platform* also requires that you call *AddRuntimeObject* to declare the RuntimeObject class associated to the object being declared:<br>
* You must pass as parameter the name of the class inheriting from RuntimeObject and a function used to create an instance of the
* RuntimeObject.
* It has two template parameters: the first one is the corresponding object class declared with *AddObject* (class inheriting from *gd::Object*) and the
* second one is the *RuntimeObject* class.
* You must pass as parameter the metadata from the object previously declared and the name of the class inheriting from RuntimeObject.
*
* You will also want to specify the .h file associated to the object using gd::ObjectMetadata::SetIncludeFile. For example:
* \code
//obj is the gd::ObjectMetadata returned when you called AddObject.
AddRuntimeObject(obj, "RuntimeTextObject", CreateRuntimeTextObject);
AddRuntimeObject<TextObject, RuntimeTextObject>(obj, "RuntimeTextObject");
obj.SetIncludeFile("TextObject/TextObject.h");
* \endcode
*
@@ -785,5 +778,3 @@ extern "C" ExtensionBase * GD_EXTENSION_API CreateGDExtension() {
* \brief Part of the tinyxml library
* \ingroup TinyXml
*/

View File

@@ -1,6 +1,6 @@
/*
* GDevelop Core
* Copyright 2008-2015 Florian Rival (Florian.Rival@gmail.com). All rights reserved.
* Copyright 2008-2016 Florian Rival (Florian.Rival@gmail.com). All rights reserved.
* This project is released under the MIT License.
*/
@@ -8,11 +8,11 @@
#include <wx/dcmemory.h>
#endif
#include "CommentEvent.h"
#include "GDCore/IDE/EventsRenderingHelper.h"
#include "GDCore/IDE/Dialogs/EventsEditor/EventsRenderingHelper.h"
#include "GDCore/Serialization/SerializerElement.h"
#include "GDCore/IDE/Dialogs/EditComment.h"
#include "GDCore/IDE/EventsEditorItemsAreas.h"
#include "GDCore/IDE/EventsEditorSelection.h"
#include "GDCore/IDE/Dialogs/EventsEditor/EventsEditorItemsAreas.h"
#include "GDCore/IDE/Dialogs/EventsEditor/EventsEditorSelection.h"
#include "GDCore/CommonTools.h"
using namespace std;
@@ -87,7 +87,7 @@ void CommentEvent::Render(wxDC & dc, int x, int y, unsigned int width, gd::Event
unsigned int text2Height = renderingHelper->GetHTMLRenderer().GetTotalHeight();
//Prepare background
dc.SetBrush(wxBrush(wxColour(r, v, b), wxTRANSPARENT));
dc.SetBrush(wxBrush(wxColour(r, v, b), wxBRUSHSTYLE_TRANSPARENT));
dc.SetPen(wxPen(wxColour(r/2, v/2, b/2), 1));
//Draw the background

View File

@@ -1,6 +1,6 @@
/*
* GDevelop Core
* Copyright 2008-2015 Florian Rival (Florian.Rival@gmail.com). All rights reserved.
* Copyright 2008-2016 Florian Rival (Florian.Rival@gmail.com). All rights reserved.
* This project is released under the MIT License.
*/
#ifndef COMMENTEVENT_H

View File

@@ -1,21 +1,21 @@
/*
* GDevelop Core
* Copyright 2008-2015 Florian Rival (Florian.Rival@gmail.com). All rights reserved.
* Copyright 2008-2016 Florian Rival (Florian.Rival@gmail.com). All rights reserved.
* This project is released under the MIT License.
*/
#include "ForEachEvent.h"
#include <iostream>
#include "GDCore/TinyXml/tinyxml.h"
#include "GDCore/IDE/EventsRenderingHelper.h"
#include "GDCore/IDE/EventsEditorItemsAreas.h"
#include "GDCore/IDE/EventsEditorSelection.h"
#include "GDCore/IDE/Dialogs/EventsEditor/EventsRenderingHelper.h"
#include "GDCore/IDE/Dialogs/EventsEditor/EventsEditorItemsAreas.h"
#include "GDCore/IDE/Dialogs/EventsEditor/EventsEditorSelection.h"
#include "GDCore/Serialization/SerializerElement.h"
#include "GDCore/Events/Serialization.h"
#include "GDCore/Events/EventsCodeGenerator.h"
#include "GDCore/Events/ExpressionsCodeGeneration.h"
#include "GDCore/Events/EventsCodeNameMangler.h"
#include "GDCore/Events/EventsCodeGenerationContext.h"
#include "GDCore/Events/CodeGeneration/EventsCodeGenerator.h"
#include "GDCore/Events/CodeGeneration/ExpressionsCodeGeneration.h"
#include "GDCore/Events/Tools/EventsCodeNameMangler.h"
#include "GDCore/Events/CodeGeneration/EventsCodeGenerationContext.h"
#include "GDCore/IDE/Dialogs/EditForEachEvent.h"
using namespace std;

View File

@@ -1,6 +1,6 @@
/*
* GDevelop Core
* Copyright 2008-2015 Florian Rival (Florian.Rival@gmail.com). All rights reserved.
* Copyright 2008-2016 Florian Rival (Florian.Rival@gmail.com). All rights reserved.
* This project is released under the MIT License.
*/

View File

@@ -1,6 +1,6 @@
/*
* GDevelop Core
* Copyright 2008-2015 Florian Rival (Florian.Rival@gmail.com). All rights reserved.
* Copyright 2008-2016 Florian Rival (Florian.Rival@gmail.com). All rights reserved.
* This project is released under the MIT License.
*/
@@ -10,15 +10,15 @@
#include <wx/renderer.h>
#include "GDCore/IDE/Dialogs/MainFrameWrapper.h"
#endif
#include "GDCore/IDE/EventsRenderingHelper.h"
#include "GDCore/IDE/EventsEditorItemsAreas.h"
#include "GDCore/IDE/EventsEditorSelection.h"
#include "GDCore/IDE/Dialogs/EventsEditor/EventsRenderingHelper.h"
#include "GDCore/IDE/Dialogs/EventsEditor/EventsEditorItemsAreas.h"
#include "GDCore/IDE/Dialogs/EventsEditor/EventsEditorSelection.h"
#include "GDCore/Events/Serialization.h"
#include "GDCore/Serialization/SerializerElement.h"
#include "GDCore/TinyXml/tinyxml.h"
#include "GDCore/CommonTools.h"
#include "GDCore/Events/EventsCodeGenerator.h"
#include "GDCore/Events/EventsCodeGenerationContext.h"
#include "GDCore/Events/CodeGeneration/EventsCodeGenerator.h"
#include "GDCore/Events/CodeGeneration/EventsCodeGenerationContext.h"
#include "GDCore/IDE/Dialogs/GroupEventDialog.h"
#include "GDCore/IDE/Dialogs/EventStoreDialog.h"
@@ -132,7 +132,7 @@ void GroupEvent::Render(wxDC & dc, int x, int y, unsigned int width, gd::EventsE
dc.SetTextBackground(backgroundColor);
dc.SetTextForeground(textColor);
dc.SetFont( wxFont( 12, wxDEFAULT, wxNORMAL, wxFONTWEIGHT_BOLD ) );
dc.SetFont( wxFont( 12, wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_BOLD ) );
dc.DrawText( groupTitle, x+5, y + 5 );
#endif
}
@@ -148,7 +148,7 @@ unsigned int GroupEvent::GetRenderedHeight(unsigned int width, const gd::Platfor
wxString groupTitle = name.empty() ? _("Untitled group") : wxString(name);
dc.SetFont( wxFont( 12, wxDEFAULT, wxNORMAL, wxNORMAL ) );
dc.SetFont( wxFont( 12, wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL ) );
wxRect text = dc.GetTextExtent(groupTitle);
renderedHeight = text.GetHeight()+10;

View File

@@ -1,6 +1,6 @@
/*
* GDevelop Core
* Copyright 2008-2015 Florian Rival (Florian.Rival@gmail.com). All rights reserved.
* Copyright 2008-2016 Florian Rival (Florian.Rival@gmail.com). All rights reserved.
* This project is released under the MIT License.
*/

View File

@@ -1,6 +1,6 @@
/*
* GDevelop Core
* Copyright 2008-2015 Florian Rival (Florian.Rival@gmail.com). All rights reserved.
* Copyright 2008-2016 Florian Rival (Florian.Rival@gmail.com). All rights reserved.
* This project is released under the MIT License.
*/
#include <iostream>
@@ -8,18 +8,19 @@
#if !defined(GD_NO_WX_GUI)
#include <wx/dcmemory.h>
#endif
#include "GDCore/IDE/SkinHelper.h"
#include "GDCore/IDE/wxTools/SkinHelper.h"
#include "GDCore/Serialization/SerializerElement.h"
#include "GDCore/IDE/EventsRenderingHelper.h"
#include "GDCore/PlatformDefinition/Object.h"
#include "GDCore/PlatformDefinition/Project.h"
#include "GDCore/PlatformDefinition/Layout.h"
#include "GDCore/PlatformDefinition/ExternalEvents.h"
#include "GDCore/Events/EventsCodeGenerationContext.h"
#include "GDCore/Events/EventsCodeGenerator.h"
#include "GDCore/Events/EventsCodeNameMangler.h"
#include "GDCore/IDE/Dialogs/EventsEditor/EventsRenderingHelper.h"
#include "GDCore/Project/Object.h"
#include "GDCore/Project/Project.h"
#include "GDCore/Project/Layout.h"
#include "GDCore/Project/ExternalEvents.h"
#include "GDCore/Events/CodeGeneration/EventsCodeGenerationContext.h"
#include "GDCore/Events/CodeGeneration/EventsCodeGenerator.h"
#include "GDCore/Events/Tools/EventsCodeNameMangler.h"
#include "GDCore/Events/Builtin/LinkEvent.h"
#include "GDCore/IDE/Dialogs/EditLink.h"
#include "GDCore/Events/Builtin/GroupEvent.h"
#include "GDCore/IDE/Dialogs/LinkEventEditor.h"
#include "GDCore/CommonTools.h"
using namespace std;
@@ -29,8 +30,8 @@ namespace gd
const EventsList * LinkEvent::GetLinkedEvents(const gd::Project & project) const
{
const EventsList * events = NULL;
const gd::ExternalEvents * linkedExternalEvents = NULL;
const EventsList * events = nullptr;
const gd::ExternalEvents * linkedExternalEvents = nullptr;
if ( project.HasExternalEventsNamed(GetTarget()) )
{
linkedExternalEvents = &project.GetExternalEvents(GetTarget());
@@ -39,17 +40,38 @@ const EventsList * LinkEvent::GetLinkedEvents(const gd::Project & project) const
else if ( project.HasLayoutNamed(GetTarget()) )
events = &project.GetLayout(GetTarget()).GetEvents();
//If the link only includes an events group, search it inside the layout/external events
if( includeConfig == INCLUDE_EVENTS_GROUP )
{
std::size_t i = 0;
std::size_t eventsCount = events->GetEventsCount();
for( ; i < eventsCount; ++i )
{
std::shared_ptr<const GroupEvent> groupEvent = std::dynamic_pointer_cast<const GroupEvent>(events->GetEventSmartPtr(i));
if(groupEvent && groupEvent->GetName() == eventsGroupName)
{
//Get its sub-events
events = &groupEvent->GetSubEvents();
break;
}
}
if(i >= eventsCount) //We didn't find the events group, return nullptr
events = nullptr;
}
return events;
}
void LinkEvent::ReplaceLinkByLinkedEvents(gd::Project & project, EventsList & eventList, std::size_t indexOfTheEventInThisList)
void LinkEvent::ReplaceLinkByLinkedEvents(const gd::Project & project, EventsList & eventList, std::size_t indexOfTheEventInThisList)
{
linkWasInvalid = false;
//Finding what to link to.
const EventsList * eventsToInclude = GetLinkedEvents(project);
if ( eventsToInclude != NULL )
{
std::size_t firstEvent = IncludeAllEvents() ? 0 : GetIncludeStart();
std::size_t lastEvent = IncludeAllEvents() ? eventsToInclude->size() - 1 : GetIncludeEnd();
std::size_t firstEvent = includeConfig == INCLUDE_BY_INDEX ? GetIncludeStart() : 0;
std::size_t lastEvent = includeConfig == INCLUDE_BY_INDEX ? GetIncludeEnd() : eventsToInclude->size() - 1;
//Check bounds
if ( firstEvent >= eventsToInclude->size() )
@@ -90,8 +112,6 @@ void LinkEvent::ReplaceLinkByLinkedEvents(gd::Project & project, EventsList & ev
eventList.RemoveEvent(indexOfTheEventInThisList);
return;
}
linkWasInvalid = false;
}
LinkEvent::~LinkEvent()
@@ -100,10 +120,18 @@ LinkEvent::~LinkEvent()
void LinkEvent::SerializeTo(SerializerElement & element) const
{
element.AddChild("include")
.SetAttribute("includeAll", IncludeAllEvents())
.SetAttribute("start", (int)GetIncludeStart())
.SetAttribute("end", (int)GetIncludeEnd());
SerializerElement & includeElement = element.AddChild("include")
.SetAttribute("includeConfig", static_cast<int>(GetIncludeConfig()));
if(GetIncludeConfig() == INCLUDE_EVENTS_GROUP)
{
includeElement.SetAttribute("eventsGroup", GetEventsGroupName());
}
else if(GetIncludeConfig() == INCLUDE_BY_INDEX)
{
includeElement.SetAttribute("start", static_cast<int>(GetIncludeStart()));
includeElement.SetAttribute("end", static_cast<int>(GetIncludeEnd()));
}
element.AddChild("target").SetValue(GetTarget());
}
@@ -111,17 +139,40 @@ void LinkEvent::SerializeTo(SerializerElement & element) const
void LinkEvent::UnserializeFrom(gd::Project & project, const SerializerElement & element)
{
SerializerElement & includeElement = element.GetChild("include", 0, "Limites");
SetIncludeStartAndEnd(includeElement.GetIntAttribute("start"),
includeElement.GetIntAttribute("end"));
SetIncludeAllEvents(includeElement.GetBoolAttribute("includeAll", true));
SetTarget(element.GetChild("target", 0, "Scene").GetValue().GetString());
if(includeElement.HasAttribute("includeAll"))
{
//Compatibility with GDevelop <= 4.0.92
if(includeElement.GetBoolAttribute("includeAll", true))
{
SetIncludeAllEvents();
}
else
{
SetIncludeStartAndEnd(includeElement.GetIntAttribute("start"),
includeElement.GetIntAttribute("end"));
}
}
else
{
//GDevelop > 4.0.92
IncludeConfig config = static_cast<IncludeConfig>(includeElement.GetIntAttribute("includeConfig", 0));
if(config == INCLUDE_ALL)
SetIncludeAllEvents();
else if(config == INCLUDE_EVENTS_GROUP)
SetIncludeEventsGroup(includeElement.GetStringAttribute("eventsGroup"));
else if(config == INCLUDE_BY_INDEX)
SetIncludeStartAndEnd(includeElement.GetIntAttribute("start"), includeElement.GetIntAttribute("end"));
}
}
gd::BaseEvent::EditEventReturnType LinkEvent::EditEvent(wxWindow* parent_, gd::Project & project, gd::Layout & scene_, gd::MainFrameWrapper & mainFrameWrapper_)
{
#if !defined(GD_NO_WX_GUI)
EditLink dialog(parent_, *this, project);
LinkEventEditor dialog(parent_, *this, project);
if ( dialog.ShowModal() == 0 ) return Cancelled;
#endif
@@ -152,11 +203,16 @@ void LinkEvent::Render(wxDC & dc, int x, int y, unsigned int width, gd::EventsEd
dc.SetFont(renderingHelper->GetNiceFont());
dc.DrawText( _("Link to ")+GetTarget(), x+32, y + 3 );
if ( !IncludeAllEvents() )
if ( GetIncludeConfig() == INCLUDE_BY_INDEX )
{
wxRect textRect = dc.GetTextExtent(_("Link to ")+GetTarget());
dc.DrawText( _("Include only events ")+gd::String::From(GetIncludeStart()+1)+_(" to ")+gd::String::From(GetIncludeEnd()+1), x+textRect.GetWidth()+32+10, y + 5 );
}
else if ( GetIncludeConfig() == INCLUDE_EVENTS_GROUP )
{
wxRect textRect = dc.GetTextExtent(_("Link to ")+GetTarget());
dc.DrawText( _("Include only the events group named \"")+gd::String::From(GetEventsGroupName())+_("\""), x+textRect.GetWidth()+32+10, y + 5 );
}
#endif
}

View File

@@ -1,6 +1,6 @@
/*
* GDevelop Core
* Copyright 2008-2015 Florian Rival (Florian.Rival@gmail.com). All rights reserved.
* Copyright 2008-2016 Florian Rival (Florian.Rival@gmail.com). All rights reserved.
* This project is released under the MIT License.
*/
#ifndef GDCORE_LINKEVENT_H
@@ -18,9 +18,16 @@ namespace gd
class GD_CORE_API LinkEvent : public gd::BaseEvent
{
public:
LinkEvent() : BaseEvent(), includeAll(true), includeStart(gd::String::npos), includeEnd(gd::String::npos), linkWasInvalid(false) {};
enum IncludeConfig
{
INCLUDE_ALL = 0,
INCLUDE_EVENTS_GROUP = 1,
INCLUDE_BY_INDEX = 2 // Deprecated
};
LinkEvent() : BaseEvent(), includeConfig(INCLUDE_ALL), eventsGroupName(), includeStart(gd::String::npos), includeEnd(gd::String::npos), linkWasInvalid(false) {};
virtual ~LinkEvent();
virtual gd::LinkEvent * Clone() const { return new LinkEvent(*this);}
virtual gd::LinkEvent * Clone() const { return new LinkEvent(*this); }
/**
* Get the link target (i.e. the scene or external events the link refers to).
@@ -33,19 +40,23 @@ public:
void SetTarget(const gd::String & target_) { target = target_; };
/**
* Return true if the link event must include all the events of the target.
* Return the include config.
*/
bool IncludeAllEvents() const { return includeAll; };
IncludeConfig GetIncludeConfig() const { return includeConfig; }
/**
* Return true if the link event must include all the events of the target.
*/
void SetIncludeAllEvents(bool includeAllEvents) { includeAll = includeAllEvents; };
void SetIncludeAllEvents() { includeConfig = INCLUDE_ALL; }
void SetIncludeEventsGroup(const gd::String& name) { includeConfig = INCLUDE_EVENTS_GROUP; eventsGroupName = name; }
/**
* Set the number of the first and last event to be included ( Meaningful only if includeAll was set to false, see SetIncludeAllEvents )
*/
void SetIncludeStartAndEnd(std::size_t includeStart_, std::size_t includeEnd_) { includeStart = includeStart_; includeEnd = includeEnd_; };
void SetIncludeStartAndEnd(std::size_t includeStart_, std::size_t includeEnd_) { includeConfig = INCLUDE_BY_INDEX; includeStart = includeStart_; includeEnd = includeEnd_; }
gd::String GetEventsGroupName() const { return eventsGroupName; }
/**
* Get the number of the first event to be included. (Meaningful only if includeAll was set to false, see SetIncludeAllEvents)
@@ -75,7 +86,7 @@ public:
* When implementing a platform with a link event, you should call this function when preprocessing the events
* (See gd::EventMetadata::codeGeneration).
*/
void ReplaceLinkByLinkedEvents(gd::Project & project, EventsList & eventList, std::size_t indexOfTheEventInThisList);
void ReplaceLinkByLinkedEvents(const gd::Project & project, EventsList & eventList, std::size_t indexOfTheEventInThisList);
virtual bool IsExecutable() const { return true; };
@@ -96,9 +107,14 @@ public:
private:
gd::String target; ///< The name of the external events (or scene) to be included
bool includeAll; ///< If set to true, all the events of the target should be included
std::size_t includeStart; ///< If includeAll is set to false, represents the number of the first event of the target to included.
std::size_t includeEnd; ///< If includeAll is set to false, represents the number of the last event of the target to included.
IncludeConfig includeConfig; ///< Defines which events are included by this link
gd::String eventsGroupName; ///< If includeConfig is set to INCLUDE_EVENTS_GROUP, represents the name of the events group to be included.
std::size_t includeStart; ///< If includeConfig is set to INCLUDE_BY_INDEX, represents the number of the first event of the target to included.
std::size_t includeEnd; ///< If includeConfig is set to INCLUDE_BY_INDEX, represents the number of the last event of the target to included.
bool linkWasInvalid; ///< Set to true by Preprocess if the links was invalid the last time is was processed. Used to display a warning in the events editor.
};

View File

@@ -1,18 +1,18 @@
/*
* GDevelop Core
* Copyright 2008-2015 Florian Rival (Florian.Rival@gmail.com). All rights reserved.
* Copyright 2008-2016 Florian Rival (Florian.Rival@gmail.com). All rights reserved.
* This project is released under the MIT License.
*/
#include "RepeatEvent.h"
#include "GDCore/IDE/EventsEditorItemsAreas.h"
#include "GDCore/IDE/EventsEditorSelection.h"
#include "GDCore/IDE/EventsRenderingHelper.h"
#include "GDCore/IDE/Dialogs/EventsEditor/EventsEditorItemsAreas.h"
#include "GDCore/IDE/Dialogs/EventsEditor/EventsEditorSelection.h"
#include "GDCore/IDE/Dialogs/EventsEditor/EventsRenderingHelper.h"
#include "GDCore/Events/Serialization.h"
#include "GDCore/Serialization/SerializerElement.h"
#include "GDCore/Events/EventsCodeGenerator.h"
#include "GDCore/Events/ExpressionsCodeGeneration.h"
#include "GDCore/Events/EventsCodeGenerationContext.h"
#include "GDCore/Events/CodeGeneration/EventsCodeGenerator.h"
#include "GDCore/Events/CodeGeneration/ExpressionsCodeGeneration.h"
#include "GDCore/Events/CodeGeneration/EventsCodeGenerationContext.h"
#include "GDCore/IDE/Dialogs/EditRepeatEvent.h"
using namespace std;

View File

@@ -1,6 +1,6 @@
/*
* GDevelop Core
* Copyright 2008-2015 Florian Rival (Florian.Rival@gmail.com). All rights reserved.
* Copyright 2008-2016 Florian Rival (Florian.Rival@gmail.com). All rights reserved.
* This project is released under the MIT License.
*/

View File

@@ -1,19 +1,19 @@
/*
* GDevelop Core
* Copyright 2008-2015 Florian Rival (Florian.Rival@gmail.com). All rights reserved.
* Copyright 2008-2016 Florian Rival (Florian.Rival@gmail.com). All rights reserved.
* This project is released under the MIT License.
*/
#include "StandardEvent.h"
#include "GDCore/IDE/EventsRenderingHelper.h"
#include "GDCore/IDE/EventsEditorItemsAreas.h"
#include "GDCore/IDE/EventsEditorSelection.h"
#include "GDCore/IDE/Dialogs/EventsEditor/EventsRenderingHelper.h"
#include "GDCore/IDE/Dialogs/EventsEditor/EventsEditorItemsAreas.h"
#include "GDCore/IDE/Dialogs/EventsEditor/EventsEditorSelection.h"
#include "GDCore/Events/Serialization.h"
#include "GDCore/Serialization/SerializerElement.h"
#include "GDCore/TinyXml/tinyxml.h"
#include "GDCore/CommonTools.h"
#include "GDCore/Events/EventsCodeGenerator.h"
#include "GDCore/Events/EventsCodeGenerationContext.h"
#include "GDCore/Events/CodeGeneration/EventsCodeGenerator.h"
#include "GDCore/Events/CodeGeneration/EventsCodeGenerationContext.h"
using namespace std;

View File

@@ -1,6 +1,6 @@
/*
* GDevelop Core
* Copyright 2008-2015 Florian Rival (Florian.Rival@gmail.com). All rights reserved.
* Copyright 2008-2016 Florian Rival (Florian.Rival@gmail.com). All rights reserved.
* This project is released under the MIT License.
*/

View File

@@ -1,6 +1,6 @@
/*
* GDevelop Core
* Copyright 2008-2015 Florian Rival (Florian.Rival@gmail.com). All rights reserved.
* Copyright 2008-2016 Florian Rival (Florian.Rival@gmail.com). All rights reserved.
* This project is released under the MIT License.
*/
@@ -8,17 +8,17 @@
#include "WhileEvent.h"
#if !defined(GD_NO_WX_GUI)
#include <wx/msgdlg.h>
#include "GDCore/IDE/CommonBitmapManager.h"
#include "GDCore/IDE/wxTools/CommonBitmapProvider.h"
#endif
#include "GDCore/TinyXml/tinyxml.h"
#include "GDCore/Events/EventsCodeGenerator.h"
#include "GDCore/Events/ExpressionsCodeGeneration.h"
#include "GDCore/IDE/EventsRenderingHelper.h"
#include "GDCore/IDE/EventsEditorItemsAreas.h"
#include "GDCore/IDE/EventsEditorSelection.h"
#include "GDCore/Events/CodeGeneration/EventsCodeGenerator.h"
#include "GDCore/Events/CodeGeneration/ExpressionsCodeGeneration.h"
#include "GDCore/IDE/Dialogs/EventsEditor/EventsRenderingHelper.h"
#include "GDCore/IDE/Dialogs/EventsEditor/EventsEditorItemsAreas.h"
#include "GDCore/IDE/Dialogs/EventsEditor/EventsEditorSelection.h"
#include "GDCore/Serialization/SerializerElement.h"
#include "GDCore/Events/Serialization.h"
#include "GDCore/Events/EventsCodeGenerationContext.h"
#include "GDCore/Events/CodeGeneration/EventsCodeGenerationContext.h"
using namespace std;
@@ -102,8 +102,8 @@ void WhileEvent::Render(wxDC & dc, int x, int y, unsigned int width, gd::EventsE
//Draw icon if infinite loop warning is deactivated.
if (!infiniteLoopWarning)
{
if ( gd::CommonBitmapManager::Get()->noProtection.IsOk() )
dc.DrawBitmap(gd::CommonBitmapManager::Get()->noProtection, wxPoint(x+5,y+5+18), /*useMask=*/true);
if ( gd::CommonBitmapProvider::Get()->noProtection.IsOk() )
dc.DrawBitmap(gd::CommonBitmapProvider::Get()->noProtection, wxPoint(x+5,y+5+18), /*useMask=*/true);
}
//Draw "while conditions"

View File

@@ -1,6 +1,6 @@
/*
* GDevelop Core
* Copyright 2008-2015 Florian Rival (Florian.Rival@gmail.com). All rights reserved.
* Copyright 2008-2016 Florian Rival (Florian.Rival@gmail.com). All rights reserved.
* This project is released under the MIT License.
*/

View File

@@ -0,0 +1,68 @@
/*
* GDevelop Core
* Copyright 2008-2016 Florian Rival (Florian.Rival@gmail.com). All rights reserved.
* This project is released under the MIT License.
*/
#include "GDCore/Events/CodeGeneration/EventsCodeGenerationContext.h"
#include "GDCore/Events/Tools/EventsCodeNameMangler.h"
#include "GDCore/CommonTools.h"
#include "GDCore/Events/CodeGeneration/EventsCodeGenerator.h"
#include <set>
using namespace std;
namespace gd
{
void EventsCodeGenerationContext::InheritsFrom(const EventsCodeGenerationContext & parent_)
{
parent = &parent_;
//Objects lists declared by parent became "already declared" in the child context.
alreadyDeclaredObjectsLists = parent_.alreadyDeclaredObjectsLists;
std::copy( parent_.objectsListsToBeDeclared.begin(), parent_.objectsListsToBeDeclared.end(), std::inserter( alreadyDeclaredObjectsLists, alreadyDeclaredObjectsLists.begin() ) );
std::copy( parent_.emptyObjectsListsToBeDeclared.begin(), parent_.emptyObjectsListsToBeDeclared.end(), std::inserter( alreadyDeclaredObjectsLists, alreadyDeclaredObjectsLists.begin() ) );
depthOfLastUse = parent_.depthOfLastUse;
customConditionDepth = parent_.customConditionDepth;
contextDepth = parent_.GetContextDepth()+1;
if ( parent_.maxDepthLevel )
{
maxDepthLevel = parent_.maxDepthLevel;
*maxDepthLevel = std::max(*maxDepthLevel, contextDepth);
}
}
void EventsCodeGenerationContext::ObjectsListNeeded(const gd::String & objectName)
{
if ( emptyObjectsListsToBeDeclared.find(objectName) == emptyObjectsListsToBeDeclared.end() )
objectsListsToBeDeclared.insert(objectName);
depthOfLastUse[objectName] = GetContextDepth();
}
void EventsCodeGenerationContext::EmptyObjectsListNeeded(const gd::String & objectName)
{
if ( objectsListsToBeDeclared.find(objectName) == objectsListsToBeDeclared.end() )
emptyObjectsListsToBeDeclared.insert(objectName);
depthOfLastUse[objectName] = GetContextDepth();
}
std::set<gd::String> EventsCodeGenerationContext::GetAllObjectsToBeDeclared() const
{
std::set <gd::String> allObjectListsToBeDeclared(objectsListsToBeDeclared.begin(), objectsListsToBeDeclared.end());
allObjectListsToBeDeclared.insert(emptyObjectsListsToBeDeclared.begin(), emptyObjectsListsToBeDeclared.end());
return allObjectListsToBeDeclared;
}
unsigned int EventsCodeGenerationContext::GetLastDepthObjectListWasNeeded(const gd::String & name) const
{
if ( depthOfLastUse.count(name) != 0 )
return depthOfLastUse.find(name)->second;
std::cout << "WARNING: During code generation, the last depth of an object list was 0." << std::endl;
return 0;
}
}

View File

@@ -1,6 +1,6 @@
/*
* GDevelop Core
* Copyright 2008-2015 Florian Rival (Florian.Rival@gmail.com). All rights reserved.
* Copyright 2008-2016 Florian Rival (Florian.Rival@gmail.com). All rights reserved.
* This project is released under the MIT License.
*/
#ifndef EVENTSCODEGENERATIONCONTEXT_H
@@ -32,7 +32,7 @@ public:
* Default constructor. You may want to call InheritsFrom just after.
* \param maxDepthLevel Optional pointer to an unsigned integer that will be updated to contain the maximal scope depth reached.
*/
EventsCodeGenerationContext(unsigned int * maxDepthLevel_ = NULL) : contextDepth(0), customConditionDepth(0), maxDepthLevel(maxDepthLevel_), parent(NULL) {};
EventsCodeGenerationContext(unsigned int * maxDepthLevel_ = nullptr) : contextDepth(0), customConditionDepth(0), maxDepthLevel(maxDepthLevel_), parent(NULL) {};
virtual ~EventsCodeGenerationContext() {};
/**

View File

@@ -0,0 +1,985 @@
#include <algorithm>
#include <utility>
#include "GDCore/Project/Layout.h"
#include "GDCore/Project/Project.h"
#include "GDCore/Extensions/PlatformExtension.h"
#include "GDCore/Extensions/Platform.h"
#include "GDCore/Extensions/Metadata/MetadataProvider.h"
#include "GDCore/Events/CodeGeneration/EventsCodeGenerator.h"
#include "GDCore/CommonTools.h"
#include "GDCore/Events/Parsers/ExpressionParser.h"
#include "GDCore/Events/Tools/EventsCodeNameMangler.h"
#include "GDCore/Events/CodeGeneration/EventsCodeGenerationContext.h"
#include "GDCore/Events/CodeGeneration/ExpressionsCodeGeneration.h"
#include "GDCore/Extensions/Metadata/InstructionMetadata.h"
#include "GDCore/Extensions/Metadata/ObjectMetadata.h"
#include "GDCore/Extensions/Metadata/BehaviorMetadata.h"
using namespace std;
namespace gd
{
/**
* Generate call using a relational operator.
* Relational operator position is deduced from parameters type.
* Rhs hand side expression is assumed to be placed just before the relational operator.
*
* \param Information about the instruction
* \param Arguments, in their C++ form.
* \param String to be placed at the start of the call ( the function to be called typically ). Example : MyObject->Get
* \param Arguments will be generated starting from this number. For example, set this to 1 to skip the first argument.
*/
gd::String EventsCodeGenerator::GenerateRelationalOperatorCall(const gd::InstructionMetadata & instrInfos, const vector<gd::String> & arguments, const gd::String & callStartString, std::size_t startFromArgument)
{
std::size_t relationalOperatorIndex = instrInfos.parameters.size();
for (std::size_t i = startFromArgument;i<instrInfos.parameters.size();++i)
{
if ( instrInfos.parameters[i].type == "relationalOperator" )
relationalOperatorIndex = i;
}
//Ensure that there is at least one parameter after the relational operator
if ( relationalOperatorIndex+1 >= instrInfos.parameters.size() )
{
ReportError();
return "";
}
gd::String relationalOperator = arguments[relationalOperatorIndex];
if ( relationalOperator.size() > 2 ) relationalOperator = relationalOperator.substr(1, relationalOperator.length()-1-1); //Relational operator contains quote which must be removed.
gd::String rhs = arguments[relationalOperatorIndex+1];
gd::String argumentsStr;
for (std::size_t i = startFromArgument;i<arguments.size();++i)
{
if ( i != relationalOperatorIndex && i != relationalOperatorIndex+1)
{
if ( !argumentsStr.empty() ) argumentsStr += ", ";
argumentsStr += arguments[i];
}
}
return callStartString+"("+argumentsStr+") "+relationalOperator+" "+rhs;
}
/**
* Generate call using an operator ( =,+,-,*,/ ).
* Operator position is deduced from parameters type.
* Expression is assumed to be placed just before the operator.
*
* \param Information about the instruction
* \param Arguments, in their C++ form.
* \param String to be placed at the start of the call ( the function to be called typically ). Example : MyObject->Set
* \param String to be placed at the start of the call of the getter ( the "getter" function to be called typically ). Example : MyObject->Get
* \param Arguments will be generated starting from this number. For example, set this to 1 to skip the first argument.
*/
gd::String EventsCodeGenerator::GenerateOperatorCall(const gd::InstructionMetadata & instrInfos, const vector<gd::String> & arguments, const gd::String & callStartString, const gd::String & getterStartString, std::size_t startFromArgument)
{
std::size_t operatorIndex = instrInfos.parameters.size();
for (std::size_t i = startFromArgument;i<instrInfos.parameters.size();++i)
{
if ( instrInfos.parameters[i].type == "operator" )
operatorIndex = i;
}
//Ensure that there is at least one parameter after the operator
if ( operatorIndex+1 >= instrInfos.parameters.size() )
{
ReportError();
return "";
}
gd::String operatorStr = arguments[operatorIndex];
if ( operatorStr.size() > 2 ) operatorStr = operatorStr.substr(1, operatorStr.length()-1-1); //Operator contains quote which must be removed.
gd::String rhs = arguments[operatorIndex+1];
//Generate arguments for calling the "getter" function
gd::String getterArgumentsStr;
for (std::size_t i = startFromArgument;i<arguments.size();++i)
{
if ( i != operatorIndex && i != operatorIndex+1)
{
if ( !getterArgumentsStr.empty() ) getterArgumentsStr += ", ";
getterArgumentsStr += arguments[i];
}
}
//Generate arguments for calling the function ("setter")
gd::String argumentsStr;
for (std::size_t i = startFromArgument;i<arguments.size();++i)
{
if ( i != operatorIndex && i != operatorIndex+1) //Generate classic arguments
{
if ( !argumentsStr.empty() ) argumentsStr += ", ";
argumentsStr += arguments[i];
}
if ( i == operatorIndex+1 )
{
if ( !argumentsStr.empty() ) argumentsStr += ", ";
if ( operatorStr != "=" )
argumentsStr += getterStartString+"("+getterArgumentsStr+") "+operatorStr+" ("+rhs+")";
else
argumentsStr += rhs;
}
}
return callStartString+"("+argumentsStr+")";
}
/**
* Generate call using a compound assignment operators ( =,+=,-=,*=,/= ).
* Operator position is deduced from parameters type.
* Expression is assumed to be placed just before the operator.
*
* \param Information about the instruction
* \param Arguments, in their C++ form.
* \param String to be placed at the start of the call ( the function to be called typically ). Example : MyObject->Set
* \param Arguments will be generated starting from this number. For example, set this to 1 to skip the first argument.
*/
gd::String EventsCodeGenerator::GenerateCompoundOperatorCall(const gd::InstructionMetadata & instrInfos, const vector<gd::String> & arguments, const gd::String & callStartString, std::size_t startFromArgument)
{
std::size_t operatorIndex = instrInfos.parameters.size();
for (std::size_t i = startFromArgument;i<instrInfos.parameters.size();++i)
{
if ( instrInfos.parameters[i].type == "operator" )
operatorIndex = i;
}
//Ensure that there is at least one parameter after the operator
if ( operatorIndex+1 >= instrInfos.parameters.size() )
{
ReportError();
return "";
}
gd::String operatorStr = arguments[operatorIndex];
if ( operatorStr.size() > 2 ) operatorStr = operatorStr.substr(1, operatorStr.length()-1-1); //Operator contains quote which must be removed.
gd::String rhs = arguments[operatorIndex+1];
//Generate real operator string.
if ( operatorStr == "+" ) operatorStr = "+=";
else if ( operatorStr == "-" ) operatorStr = "-=";
else if ( operatorStr == "/" ) operatorStr = "/=";
else if ( operatorStr == "*" ) operatorStr = "*=";
//Generate arguments for calling the function ("setter")
gd::String argumentsStr;
for (std::size_t i = startFromArgument;i<arguments.size();++i)
{
if ( i != operatorIndex && i != operatorIndex+1) //Generate classic arguments
{
if ( !argumentsStr.empty() ) argumentsStr += ", ";
argumentsStr += arguments[i];
}
}
return callStartString+"("+argumentsStr+") "+operatorStr+" ("+rhs+")";
}
gd::String EventsCodeGenerator::GenerateConditionCode(gd::Instruction & condition, gd::String returnBoolean, EventsCodeGenerationContext & context)
{
gd::String conditionCode;
gd::InstructionMetadata instrInfos = MetadataProvider::GetConditionMetadata(platform, condition.GetType());
AddIncludeFiles(instrInfos.codeExtraInformation.GetIncludeFiles());
maxConditionsListsSize = std::max(maxConditionsListsSize, condition.GetSubInstructions().size());
if ( instrInfos.codeExtraInformation.HasCustomCodeGenerator())
{
context.EnterCustomCondition();
conditionCode += GenerateReferenceToUpperScopeBoolean("conditionTrue", returnBoolean, context);
conditionCode += instrInfos.codeExtraInformation.customCodeGenerator(condition, *this, context);
maxCustomConditionsDepth = std::max(maxCustomConditionsDepth, context.GetCurrentConditionDepth());
context.LeaveCustomCondition();
return "{"+conditionCode+"}\n";
}
//Insert code only parameters and be sure there is no lack of parameter.
while(condition.GetParameters().size() < instrInfos.parameters.size())
{
vector < gd::Expression > parameters = condition.GetParameters();
parameters.push_back(gd::Expression(""));
condition.SetParameters(parameters);
}
//Verify that there are not mismatch between object type in parameters
for (std::size_t pNb = 0;pNb < instrInfos.parameters.size();++pNb)
{
if ( ParameterMetadata::IsObject(instrInfos.parameters[pNb].type) )
{
gd::String objectInParameter = condition.GetParameter(pNb).GetPlainString();
if ( !scene.HasObjectNamed(objectInParameter) && !project.HasObjectNamed(objectInParameter)
&& find_if(scene.GetObjectGroups().begin(), scene.GetObjectGroups().end(), bind2nd(gd::GroupHasTheSameName(), objectInParameter) ) == scene.GetObjectGroups().end()
&& find_if(project.GetObjectGroups().begin(), project.GetObjectGroups().end(), bind2nd(gd::GroupHasTheSameName(), objectInParameter) ) == project.GetObjectGroups().end() )
{
cout << "Bad object (" << objectInParameter << ") in a parameter of a condition " << condition.GetType() << endl;
condition.SetParameter(pNb, gd::Expression(""));
condition.SetType("");
}
else if ( !instrInfos.parameters[pNb].supplementaryInformation.empty()
&& gd::GetTypeOfObject(project, scene, objectInParameter) != instrInfos.parameters[pNb].supplementaryInformation )
{
cout << "Bad object type in a parameter of a condition " << condition.GetType() << endl;
cout << "Condition wanted " << instrInfos.parameters[pNb].supplementaryInformation << endl;
cout << "Condition wanted " << instrInfos.parameters[pNb].supplementaryInformation << " of type " << instrInfos.parameters[pNb].supplementaryInformation << endl;
cout << "Condition has received " << objectInParameter << " of type " << gd::GetTypeOfObject(project, scene, objectInParameter) << endl;
condition.SetParameter(pNb, gd::Expression(""));
condition.SetType("");
}
}
}
//Generate static condition if available
if ( MetadataProvider::HasCondition(platform, condition.GetType()))
{
//Prepare arguments
std::vector < std::pair<gd::String, gd::String> > supplementaryParametersTypes;
supplementaryParametersTypes.push_back(std::make_pair("conditionInverted", condition.IsInverted() ? "true" : "false"));
vector<gd::String> arguments = GenerateParametersCodes(condition.GetParameters(), instrInfos.parameters, context, &supplementaryParametersTypes);
conditionCode += GenerateFreeCondition(arguments, instrInfos, returnBoolean, condition.IsInverted(), context);
}
//Generate object condition if available
gd::String objectName = condition.GetParameters().empty() ? "" : condition.GetParameter(0).GetPlainString();
gd::String objectType = gd::GetTypeOfObject(project, scene, objectName);
if ( !objectName.empty() && MetadataProvider::HasObjectCondition(platform, objectType, condition.GetType()) && !instrInfos.parameters.empty())
{
std::vector<gd::String> realObjects = ExpandObjectsName(objectName, context);
for (std::size_t i = 0;i<realObjects.size();++i)
{
//Set up the context
const ObjectMetadata & objInfo = MetadataProvider::GetObjectMetadata(platform, objectType);
AddIncludeFiles(objInfo.includeFiles);
context.SetCurrentObject(realObjects[i]);
context.ObjectsListNeeded(realObjects[i]);
//Prepare arguments and generate the condition whole code
vector<gd::String> arguments = GenerateParametersCodes(condition.GetParameters(), instrInfos.parameters, context);
conditionCode += GenerateObjectCondition(realObjects[i], objInfo, arguments, instrInfos, returnBoolean, condition.IsInverted(), context);
context.SetNoCurrentObject();
}
}
//Generate behavior condition if available
gd::String behaviorType = gd::GetTypeOfBehavior(project, scene, condition.GetParameters().size() < 2 ? "" : condition.GetParameter(1).GetPlainString());
if (MetadataProvider::HasBehaviorCondition(platform, behaviorType, condition.GetType()) && instrInfos.parameters.size() >= 2)
{
std::vector<gd::String> realObjects = ExpandObjectsName(objectName, context);
for (std::size_t i = 0;i<realObjects.size();++i)
{
//Setup context
const BehaviorMetadata & autoInfo = MetadataProvider::GetBehaviorMetadata(platform, behaviorType);
AddIncludeFiles(autoInfo.includeFiles);
context.SetCurrentObject(realObjects[i]);
context.ObjectsListNeeded(realObjects[i]);
//Prepare arguments and generate the whole condition code
vector<gd::String> arguments = GenerateParametersCodes(condition.GetParameters(), instrInfos.parameters, context);
conditionCode += GenerateBehaviorCondition(realObjects[i], condition.GetParameter(1).GetPlainString(), autoInfo, arguments,
instrInfos, returnBoolean, condition.IsInverted(), context);
context.SetNoCurrentObject();
}
}
return conditionCode;
}
/**
* Generate code for a list of conditions.
* Bools containing conditions results are named conditionXIsTrue.
*/
gd::String EventsCodeGenerator::GenerateConditionsListCode(gd::InstructionsList & conditions, EventsCodeGenerationContext & context)
{
gd::String outputCode;
for (std::size_t i = 0;i<conditions.size();++i)
outputCode += GenerateBooleanInitializationToFalse("condition"+gd::String::From(i) +"IsTrue", context);
for (std::size_t cId =0;cId < conditions.size();++cId)
{
gd::InstructionMetadata instrInfos = MetadataProvider::GetConditionMetadata(platform, conditions[cId].GetType());
gd::String conditionCode = GenerateConditionCode(conditions[cId], "condition"+gd::String::From(cId) +"IsTrue", context);
if ( !conditions[cId].GetType().empty() )
{
for (std::size_t i = 0;i<cId;++i) //Skip conditions if one condition is false. //TODO : Can be optimized
{
if (i == 0) outputCode += "if ( "; else outputCode += " && ";
outputCode += "condition"+gd::String::From(i) +"IsTrue";
if (i == cId-1) outputCode += ") ";
}
outputCode += "{\n";
outputCode += conditionCode;
outputCode += "}";
}
}
maxConditionsListsSize = std::max(maxConditionsListsSize, conditions.size());
return outputCode;
}
/**
* Generate code for an action.
*/
gd::String EventsCodeGenerator::GenerateActionCode(gd::Instruction & action, EventsCodeGenerationContext & context)
{
gd::String actionCode;
gd::InstructionMetadata instrInfos = MetadataProvider::GetActionMetadata(platform, action.GetType());
AddIncludeFiles(instrInfos.codeExtraInformation.GetIncludeFiles());
if ( instrInfos.codeExtraInformation.HasCustomCodeGenerator() )
{
return instrInfos.codeExtraInformation.customCodeGenerator(action, *this, context);
}
//Be sure there is no lack of parameter.
while(action.GetParameters().size() < instrInfos.parameters.size())
{
vector < gd::Expression > parameters = action.GetParameters();
parameters.push_back(gd::Expression(""));
action.SetParameters(parameters);
}
//Verify that there are not mismatch between object type in parameters
for (std::size_t pNb = 0;pNb < instrInfos.parameters.size();++pNb)
{
if ( ParameterMetadata::IsObject(instrInfos.parameters[pNb].type) )
{
gd::String objectInParameter = action.GetParameter(pNb).GetPlainString();
if ( !scene.HasObjectNamed(objectInParameter) && !project.HasObjectNamed(objectInParameter)
&& find_if(scene.GetObjectGroups().begin(), scene.GetObjectGroups().end(), bind2nd(gd::GroupHasTheSameName(), objectInParameter) ) == scene.GetObjectGroups().end()
&& find_if(project.GetObjectGroups().begin(), project.GetObjectGroups().end(), bind2nd(gd::GroupHasTheSameName(), objectInParameter) ) == project.GetObjectGroups().end() )
{
cout << "Bad object (" << objectInParameter << ") in a parameter of an action " << action.GetType() << endl;
action.SetParameter(pNb, gd::Expression(""));
action.SetType("");
}
else if ( !instrInfos.parameters[pNb].supplementaryInformation.empty()
&& gd::GetTypeOfObject(project, scene, objectInParameter) != instrInfos.parameters[pNb].supplementaryInformation )
{
cout << "Bad object type in parameter "+gd::String::From(pNb)+" of an action " << action.GetType() << endl;
cout << "Action wanted " << instrInfos.parameters[pNb].supplementaryInformation << " of type " << instrInfos.parameters[pNb].supplementaryInformation << endl;
cout << "Action has received " << objectInParameter << " of type " << gd::GetTypeOfObject(project, scene, objectInParameter) << endl;
action.SetParameter(pNb, gd::Expression(""));
action.SetType("");
}
}
}
//Call free function first if available
if (MetadataProvider::HasAction(platform, action.GetType()))
{
vector<gd::String> arguments = GenerateParametersCodes(action.GetParameters(), instrInfos.parameters, context);
actionCode += GenerateFreeAction(arguments, instrInfos, context);
}
//Call object function if available
gd::String objectName = action.GetParameters().empty() ? "" : action.GetParameter(0).GetPlainString();
gd::String objectType = gd::GetTypeOfObject(project, scene, objectName);
if (MetadataProvider::HasObjectAction(platform, objectType, action.GetType()) && !instrInfos.parameters.empty())
{
std::vector<gd::String> realObjects = ExpandObjectsName(objectName, context);
for (std::size_t i = 0;i<realObjects.size();++i)
{
//Setup context
const ObjectMetadata & objInfo = MetadataProvider::GetObjectMetadata(platform, objectType);
AddIncludeFiles(objInfo.includeFiles);
context.SetCurrentObject(realObjects[i]);
context.ObjectsListNeeded(realObjects[i]);
//Prepare arguments and generate the whole action code
vector<gd::String> arguments = GenerateParametersCodes(action.GetParameters(), instrInfos.parameters, context);
actionCode += GenerateObjectAction(realObjects[i], objInfo, arguments, instrInfos, context);
context.SetNoCurrentObject();
}
}
//Assign to a behavior member function if found
gd::String behaviorType = gd::GetTypeOfBehavior(project, scene, action.GetParameters().size() < 2 ? "" : action.GetParameter(1).GetPlainString());
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)
{
//Setup context
const BehaviorMetadata & autoInfo = MetadataProvider::GetBehaviorMetadata(platform, behaviorType);
AddIncludeFiles(autoInfo.includeFiles);
context.SetCurrentObject(realObjects[i]);
context.ObjectsListNeeded(realObjects[i]);
//Prepare arguments and generate the whole action code
vector<gd::String> arguments = GenerateParametersCodes(action.GetParameters(), instrInfos.parameters, context);
actionCode += GenerateBehaviorAction(realObjects[i], action.GetParameter(1).GetPlainString(), autoInfo, arguments, instrInfos, context);
context.SetNoCurrentObject();
}
}
return actionCode;
}
/**
* Generate actions code.
*/
gd::String EventsCodeGenerator::GenerateActionsListCode(gd::InstructionsList & actions, EventsCodeGenerationContext & context)
{
gd::String outputCode;
for (std::size_t aId =0;aId < actions.size();++aId)
{
gd::InstructionMetadata instrInfos = MetadataProvider::GetActionMetadata(platform, actions[aId].GetType());
gd::String actionCode = GenerateActionCode(actions[aId], context);
outputCode += "{";
if ( !actions[aId].GetType().empty() ) outputCode += actionCode;
outputCode += "}";
}
return outputCode;
}
gd::String EventsCodeGenerator::GenerateParameterCodes(const gd::String & parameter, const gd::ParameterMetadata & metadata,
gd::EventsCodeGenerationContext & context,
const gd::String & previousParameter,
std::vector < std::pair<gd::String, gd::String> > * supplementaryParametersTypes)
{
gd::String argOutput;
if ( metadata.type == "expression" || metadata.type == "camera" )
{
CallbacksForGeneratingExpressionCode callbacks(argOutput, *this, context);
gd::ExpressionParser parser(parameter);
if ( !parser.ParseMathExpression(platform, project, scene, callbacks) )
{
cout << "Error :" << parser.firstErrorStr << " in: "<< parameter << endl;
argOutput = "0";
}
if (argOutput.empty()) argOutput = "0";
}
else if ( metadata.type == "string" || metadata.type == "layer" || metadata.type == "color" || metadata.type == "file" || metadata.type == "joyaxis" )
{
CallbacksForGeneratingExpressionCode callbacks(argOutput, *this, context);
gd::ExpressionParser parser(parameter);
if ( !parser.ParseStringExpression(platform, project, scene, callbacks) )
{
cout << "Error in text expression" << parser.firstErrorStr << endl;
argOutput = "\"\"";
}
if (argOutput.empty()) argOutput = "\"\"";
}
else if ( metadata.type == "relationalOperator" )
{
argOutput += parameter == "=" ? "==" :parameter;
if ( argOutput != "==" && argOutput != "<" && argOutput != ">" && argOutput != "<=" && argOutput != ">=" && argOutput != "!=")
{
cout << "Warning: Bad relational operator: Set to == by default." << endl;
argOutput = "==";
}
argOutput = "\""+argOutput+"\"";
}
else if ( metadata.type == "operator" )
{
argOutput += parameter;
if ( argOutput != "=" && argOutput != "+" && argOutput != "-" && argOutput != "/" && argOutput != "*")
{
cout << "Warning: Bad operator: Set to = by default." << endl;
argOutput = "=";
}
argOutput = "\""+argOutput+"\"";
}
else if ( metadata.type == "object" || metadata.type == "behavior" )
{
argOutput = "\""+ConvertToString(parameter)+"\"";
}
else if ( metadata.type == "key" )
{
argOutput = "\""+ConvertToString(parameter)+"\"";
}
else if (metadata.type == "objectvar" || metadata.type == "scenevar" || metadata.type == "globalvar" ||
metadata.type == "password" || metadata.type == "musicfile" || metadata.type == "soundfile" ||
metadata.type == "police")
{
argOutput = "\""+ConvertToString(parameter)+"\"";
}
else if ( metadata.type == "mouse" )
{
argOutput = "\""+ConvertToString(parameter)+"\"";
}
else if ( metadata.type == "yesorno" )
{
argOutput += (parameter == "yes" || parameter == "oui") ? GenerateTrue() : GenerateFalse();
}
else if ( metadata.type == "trueorfalse" )
{
argOutput += (parameter == "True" || parameter == "Vrai") ? GenerateTrue() : GenerateFalse();
}
//Code only parameter type
else if ( metadata.type == "inlineCode" )
{
argOutput += metadata.supplementaryInformation;
}
else
{
//Try supplementary types if provided
if ( supplementaryParametersTypes )
{
for (std::size_t i = 0;i<supplementaryParametersTypes->size();++i)
{
if ( (*supplementaryParametersTypes)[i].first == metadata.type )
argOutput += (*supplementaryParametersTypes)[i].second;
}
}
//Type unknown
if (argOutput.empty())
{
if ( !metadata.type.empty() ) cout << "Warning: Unknown type of parameter \"" << metadata.type << "\".";
argOutput += "\""+ConvertToString(parameter)+"\"";
}
}
return argOutput;
}
vector<gd::String> EventsCodeGenerator::GenerateParametersCodes(vector < gd::Expression > parameters, const vector < gd::ParameterMetadata > & parametersInfo, EventsCodeGenerationContext & context, std::vector < std::pair<gd::String, gd::String> > * supplementaryParametersTypes)
{
vector<gd::String> arguments;
while(parameters.size() < parametersInfo.size())
parameters.push_back(gd::Expression(""));
for (std::size_t pNb = 0;pNb < parametersInfo.size() && pNb < parameters.size();++pNb)
{
if ( parameters[pNb].GetPlainString().empty() && parametersInfo[pNb].optional )
parameters[pNb] = gd::Expression(parametersInfo[pNb].defaultValue);
gd::String argOutput = GenerateParameterCodes(parameters[pNb].GetPlainString(), parametersInfo[pNb], context,
pNb == 0 ? "" : parameters[pNb-1].GetPlainString(), supplementaryParametersTypes);
arguments.push_back(argOutput);
}
return arguments;
}
gd::String EventsCodeGenerator::GenerateObjectsDeclarationCode(EventsCodeGenerationContext & context)
{
gd::String declarationsCode;
for ( set<gd::String>::iterator it = context.objectsListsToBeDeclared.begin() ; it != context.objectsListsToBeDeclared.end(); ++it )
{
if ( context.alreadyDeclaredObjectsLists.find(*it) == context.alreadyDeclaredObjectsLists.end() )
{
declarationsCode += "std::vector<RuntimeObject*> "+GetObjectListName(*it, context)
+" = runtimeContext->GetObjectsRawPointers(\""+ConvertToString(*it)+"\");\n";
context.alreadyDeclaredObjectsLists.insert(*it);
}
else
{
//Could normally be done in one line, but clang sometimes miscompile it.
declarationsCode += "std::vector<RuntimeObject*> & "+GetObjectListName(*it, context)+"T = "+GetObjectListName(*it, context)+";\n";
declarationsCode += "std::vector<RuntimeObject*> "+GetObjectListName(*it, context)+" = "+GetObjectListName(*it, context)+"T;\n";
}
}
for ( set<gd::String>::iterator it = context.emptyObjectsListsToBeDeclared.begin() ; it != context.emptyObjectsListsToBeDeclared.end(); ++it )
{
if ( context.alreadyDeclaredObjectsLists.find(*it) == context.alreadyDeclaredObjectsLists.end() )
{
declarationsCode += "std::vector<RuntimeObject*> "+GetObjectListName(*it, context)+";\n";
context.alreadyDeclaredObjectsLists.insert(*it);
}
else
{
//Could normally be done in one line, but clang sometimes miscompile it.
declarationsCode += "std::vector<RuntimeObject*> & "+GetObjectListName(*it, context)+"T = "+GetObjectListName(*it, context)+";\n";
declarationsCode += "std::vector<RuntimeObject*> "+GetObjectListName(*it, context)+" = "+GetObjectListName(*it, context)+"T;\n";
}
}
return declarationsCode ;
}
/**
* Generate events list code.
*/
gd::String EventsCodeGenerator::GenerateEventsListCode(gd::EventsList & events, const EventsCodeGenerationContext & parentContext)
{
gd::String output;
for ( std::size_t eId = 0; eId < events.size();++eId )
{
//Each event has its own context : Objects picked in an event are totally different than the one picked in another.
gd::EventsCodeGenerationContext context;
context.InheritsFrom(parentContext); //Events in the same "level" share the same context as their parent.
gd::String eventCoreCode = events[eId].GenerateEventCode(*this, context);
gd::String scopeBegin = GenerateScopeBegin(context);
gd::String scopeEnd = GenerateScopeEnd(context);
gd::String declarationsCode = GenerateObjectsDeclarationCode(context);
output += "\n"+ scopeBegin +"\n" + declarationsCode + "\n" + eventCoreCode + "\n"+ scopeEnd +"\n";
}
return output;
}
gd::String EventsCodeGenerator::ConvertToString(gd::String plainString)
{
for (size_t i = 0;i<plainString.length();++i)
{
if ( plainString[i] == '\\' )
{
if ( i+1 >= plainString.length() || plainString[i+1] != '\"' )
{
if ( i+1 < plainString.length() )
plainString.insert(i+1, "\\");
else
plainString += ("\\");
++i;
}
}
else if ( plainString[i] == '"' )
{
plainString.insert(i, "\\");
++i;
}
}
plainString = plainString.FindAndReplace("\n", "\\n");
return plainString;
}
gd::String EventsCodeGenerator::ConvertToStringExplicit(gd::String plainString)
{
return "\""+ConvertToString(plainString)+"\"";
}
std::vector<gd::String> EventsCodeGenerator::ExpandObjectsName(const gd::String & objectName, const EventsCodeGenerationContext & context) const
{
std::vector<gd::String> realObjects;
vector< gd::ObjectGroup >::const_iterator globalGroup = find_if(project.GetObjectGroups().begin(),
project.GetObjectGroups().end(),
bind2nd(gd::GroupHasTheSameName(), objectName));
vector< gd::ObjectGroup >::const_iterator sceneGroup = find_if(scene.GetObjectGroups().begin(),
scene.GetObjectGroups().end(),
bind2nd(gd::GroupHasTheSameName(), objectName));
if ( globalGroup != project.GetObjectGroups().end() )
realObjects = (*globalGroup).GetAllObjectsNames();
else if ( sceneGroup != scene.GetObjectGroups().end() )
realObjects = (*sceneGroup).GetAllObjectsNames();
else
realObjects.push_back(objectName);
//If current object is present, use it and only it.
if ( find(realObjects.begin(), realObjects.end(), context.GetCurrentObject()) != realObjects.end() )
{
realObjects.clear();
realObjects.push_back(context.GetCurrentObject());
}
//Ensure that all returned objects actually exists.
for (std::size_t i = 0; i < realObjects.size();)
{
if ( !scene.HasObjectNamed(realObjects[i]) && !project.HasObjectNamed(realObjects[i]) )
realObjects.erase(realObjects.begin()+i);
else
++i;
}
return realObjects;
}
void EventsCodeGenerator::DeleteUselessEvents(gd::EventsList & events)
{
for ( std::size_t eId = events.size()-1; eId < events.size();--eId )
{
if ( events[eId].CanHaveSubEvents() ) //Process sub events, if any
DeleteUselessEvents(events[eId].GetSubEvents());
if ( !events[eId].IsExecutable() || events[eId].IsDisabled() ) //Delete events that are not executable
events.RemoveEvent(eId);
}
}
/**
* Call preprocessing method of each event
*/
void EventsCodeGenerator::PreprocessEventList(gd::EventsList & listEvent)
{
for ( std::size_t i = 0;i < listEvent.GetEventsCount();++i )
{
listEvent[i].Preprocess(*this, listEvent, i);
if ( i < listEvent.GetEventsCount() ) { //Be sure that that there is still an event! ( Preprocess can remove it. )
if ( listEvent[i].CanHaveSubEvents() )
PreprocessEventList( listEvent[i].GetSubEvents());
}
}
}
void EventsCodeGenerator::ReportError()
{
errorOccurred = true;
}
gd::String EventsCodeGenerator::GenerateObjectFunctionCall(gd::String objectListName,
const gd::ObjectMetadata & objMetadata,
const gd::ExpressionCodeGenerationInformation & codeInfo,
gd::String parametersStr,
gd::String defaultOutput,
gd::EventsCodeGenerationContext & context)
{
return "TODO (GenerateObjectFunctionCall)";
}
gd::String EventsCodeGenerator::GenerateObjectBehaviorFunctionCall(gd::String objectListName,
gd::String behaviorName,
const gd::BehaviorMetadata & autoInfo,
const gd::ExpressionCodeGenerationInformation & codeInfo,
gd::String parametersStr,
gd::String defaultOutput,
gd::EventsCodeGenerationContext & context)
{
return "TODO (GenerateObjectBehaviorFunctionCall)";
}
gd::String EventsCodeGenerator::GenerateFreeCondition(const std::vector<gd::String> & arguments,
const gd::InstructionMetadata & instrInfos,
const gd::String & returnBoolean,
bool conditionInverted,
gd::EventsCodeGenerationContext & context)
{
//Generate call
gd::String predicat;
if ( instrInfos.codeExtraInformation.type == "number" || instrInfos.codeExtraInformation.type == "string")
{
predicat = GenerateRelationalOperatorCall(instrInfos, arguments, instrInfos.codeExtraInformation.functionCallName);
}
else
{
gd::String argumentsStr;
for (std::size_t i = 0;i<arguments.size();++i)
{
if ( i != 0 ) argumentsStr += ", ";
argumentsStr += arguments[i];
}
predicat = instrInfos.codeExtraInformation.functionCallName+"("+argumentsStr+")";
}
//Add logical not if needed
bool conditionAlreadyTakeCareOfInversion = false;
for (std::size_t i = 0;i<instrInfos.parameters.size();++i) //Some conditions already have a "conditionInverted" parameter
{
if( instrInfos.parameters[i].type == "conditionInverted" )
conditionAlreadyTakeCareOfInversion = true;
}
if (!conditionAlreadyTakeCareOfInversion && conditionInverted) predicat = GenerateNegatedPredicat(predicat);
//Generate condition code
return returnBoolean+" = "+predicat+";\n";
}
gd::String EventsCodeGenerator::GenerateObjectCondition(const gd::String & objectName,
const gd::ObjectMetadata & objInfo,
const std::vector<gd::String> & arguments,
const gd::InstructionMetadata & instrInfos,
const gd::String & returnBoolean,
bool conditionInverted,
gd::EventsCodeGenerationContext & context)
{
//Prepare call
//Add a static_cast if necessary
gd::String objectFunctionCallNamePart =
( !instrInfos.parameters[0].supplementaryInformation.empty() ) ?
"static_cast<"+objInfo.className+"*>("+GetObjectListName(objectName, context)+"[i])->"+instrInfos.codeExtraInformation.functionCallName
: GetObjectListName(objectName, context)+"[i]->"+instrInfos.codeExtraInformation.functionCallName;
//Create call
gd::String predicat;
if ( (instrInfos.codeExtraInformation.type == "number" || instrInfos.codeExtraInformation.type == "string") )
{
predicat = GenerateRelationalOperatorCall(instrInfos, arguments, objectFunctionCallNamePart, 1);
}
else
{
gd::String argumentsStr;
for (std::size_t i = 1;i<arguments.size();++i)
{
if ( i != 1 ) argumentsStr += ", ";
argumentsStr += arguments[i];
}
predicat = objectFunctionCallNamePart+"("+argumentsStr+")";
}
if ( conditionInverted ) predicat = GenerateNegatedPredicat(predicat);
return "For each picked object \""+objectName+"\", check "+predicat+".\n";
}
gd::String EventsCodeGenerator::GenerateBehaviorCondition(const gd::String & objectName,
const gd::String & behaviorName,
const gd::BehaviorMetadata & autoInfo,
const std::vector<gd::String> & arguments,
const gd::InstructionMetadata & instrInfos,
const gd::String & returnBoolean,
bool conditionInverted,
gd::EventsCodeGenerationContext & context)
{
//Create call
gd::String predicat;
if ( (instrInfos.codeExtraInformation.type == "number" || instrInfos.codeExtraInformation.type == "string") )
{
predicat = GenerateRelationalOperatorCall(instrInfos, arguments, "", 2);
}
else
{
gd::String argumentsStr;
for (std::size_t i = 2;i<arguments.size();++i)
{
if ( i != 2 ) argumentsStr += ", ";
argumentsStr += arguments[i];
}
predicat = "("+argumentsStr+")";
}
if ( conditionInverted ) predicat = GenerateNegatedPredicat(predicat);
return "For each picked object \""+objectName+"\", check "+predicat+" for behavior \""+behaviorName+"\".\n";
}
gd::String EventsCodeGenerator::GenerateFreeAction(const std::vector<gd::String> & arguments, const gd::InstructionMetadata & instrInfos,
gd::EventsCodeGenerationContext & context)
{
//Generate call
gd::String call;
if ( instrInfos.codeExtraInformation.type == "number" || instrInfos.codeExtraInformation.type == "string" )
{
if ( instrInfos.codeExtraInformation.accessType == gd::InstructionMetadata::ExtraInformation::MutatorAndOrAccessor )
call = GenerateOperatorCall(instrInfos, arguments, instrInfos.codeExtraInformation.functionCallName, instrInfos.codeExtraInformation.optionalAssociatedInstruction);
else
call = GenerateCompoundOperatorCall(instrInfos, arguments, instrInfos.codeExtraInformation.functionCallName);
}
else
{
gd::String argumentsStr;
for (std::size_t i = 0;i<arguments.size();++i)
{
if ( i != 0 ) argumentsStr += ", ";
argumentsStr += arguments[i];
}
call = instrInfos.codeExtraInformation.functionCallName+"("+argumentsStr+")";
}
return call+";\n";
}
gd::String EventsCodeGenerator::GenerateObjectAction(const gd::String & objectName,
const gd::ObjectMetadata & objInfo,
const std::vector<gd::String> & arguments,
const gd::InstructionMetadata & instrInfos,
gd::EventsCodeGenerationContext & context)
{
//Create call
gd::String call;
if ( (instrInfos.codeExtraInformation.type == "number" || instrInfos.codeExtraInformation.type == "string") )
{
if ( instrInfos.codeExtraInformation.accessType == gd::InstructionMetadata::ExtraInformation::MutatorAndOrAccessor )
call = GenerateOperatorCall(instrInfos, arguments, instrInfos.codeExtraInformation.functionCallName, instrInfos.codeExtraInformation.optionalAssociatedInstruction,2);
else
call = GenerateCompoundOperatorCall(instrInfos, arguments, instrInfos.codeExtraInformation.functionCallName,2);
return "For each picked object \""+objectName+"\", call "+call+".\n";
}
else
{
gd::String argumentsStr;
for (std::size_t i = 2;i<arguments.size();++i)
{
if ( i != 2 ) argumentsStr += ", ";
argumentsStr += arguments[i];
}
call = instrInfos.codeExtraInformation.functionCallName+"("+argumentsStr+")";
return "For each picked object \""+objectName+"\", call "+call+"("+argumentsStr+").\n";
}
}
gd::String EventsCodeGenerator::GenerateBehaviorAction(const gd::String & objectName,
const gd::String & behaviorName,
const gd::BehaviorMetadata & autoInfo,
const std::vector<gd::String> & arguments,
const gd::InstructionMetadata & instrInfos,
gd::EventsCodeGenerationContext & context)
{
//Create call
gd::String call;
if ( (instrInfos.codeExtraInformation.type == "number" || instrInfos.codeExtraInformation.type == "string") )
{
if ( instrInfos.codeExtraInformation.accessType == gd::InstructionMetadata::ExtraInformation::MutatorAndOrAccessor )
call = GenerateOperatorCall(instrInfos, arguments, instrInfos.codeExtraInformation.functionCallName, instrInfos.codeExtraInformation.optionalAssociatedInstruction,2);
else
call = GenerateCompoundOperatorCall(instrInfos, arguments, instrInfos.codeExtraInformation.functionCallName,2);
return "For each picked object \""+objectName+"\", call "+call
+" for behavior \""+behaviorName+"\".\n";
}
else
{
gd::String argumentsStr;
for (std::size_t i = 2;i<arguments.size();++i)
{
if ( i != 2 ) argumentsStr += ", ";
argumentsStr += arguments[i];
}
call = instrInfos.codeExtraInformation.functionCallName+"("+argumentsStr+")";
return "For each picked object \""+objectName+"\", call "+call+"("+argumentsStr+")"
+" for behavior \""+behaviorName+"\".\n";
}
}
gd::String EventsCodeGenerator::GetObjectListName(const gd::String & name, const gd::EventsCodeGenerationContext & context)
{
return ManObjListName(name);
}
EventsCodeGenerator::EventsCodeGenerator(gd::Project & project_, const gd::Layout & layout, const gd::Platform & platform_) :
project(project_),
scene(layout),
platform(platform_),
errorOccurred(false),
compilationForRuntime(false),
maxCustomConditionsDepth(0),
maxConditionsListsSize(0)
{
};
}

View File

@@ -0,0 +1,474 @@
#ifndef GDCORE_EVENTSCODEGENERATOR_H
#define GDCORE_EVENTSCODEGENERATOR_H
#include "GDCore/Events/Event.h"
#include "GDCore/Events/Instruction.h"
#include "GDCore/String.h"
#include <vector>
#include <set>
#include <utility>
namespace gd { class EventsList; }
namespace gd { class Expression; }
namespace gd { class Project; }
namespace gd { class Layout; }
namespace gd { class ExternalEvents; }
namespace gd { class ParameterMetadata; }
namespace gd { class ObjectMetadata; }
namespace gd { class BehaviorMetadata; }
namespace gd { class InstructionMetadata; }
namespace gd { class EventsCodeGenerationContext; }
namespace gd { class ExpressionCodeGenerationInformation; }
namespace gd { class InstructionMetadata;}
namespace gd { class Platform;}
namespace gd
{
/**
* \brief Internal class used to generate code from events
* \todo For now, this class generates only C++ code for GD C++ Platform.
*
* \see CallbacksForGeneratingExpressionCode
*/
class GD_CORE_API EventsCodeGenerator
{
friend class CallbacksForGeneratingExpressionCode;
public:
/**
* \brief Remove non executable events from the event list.
*/
static void DeleteUselessEvents(gd::EventsList & events);
/**
* \brief Construct a code generator for the specified platform/project/layout.
*/
EventsCodeGenerator(gd::Project & project_, const gd::Layout & layout, const gd::Platform & platform_);
virtual ~EventsCodeGenerator() {};
/**
* \brief Preprocess an events list ( Replacing for example links with the linked event ).
*
* This should be called before any code generation.
*/
void PreprocessEventList(gd::EventsList & listEvent);
/**
* \brief Generate code for executing an event list
*
* \param events std::vector of events
* \param context Context used for generation
* \return C++ code
*/
gd::String GenerateEventsListCode(gd::EventsList & events, const EventsCodeGenerationContext & context);
/**
* \brief Generate code for executing a condition list
*
* The default implementation create the condition calls using C-style ifs and booleans.
*
* \param game Game used
* \param scene Scene used
* \param conditions std::vector of conditions
* \param context Context used for generation
* \return Code. Boolean containing conditions result are name conditionXIsTrue, with X = the number of the condition, starting from 0.
*/
virtual gd::String GenerateConditionsListCode(gd::InstructionsList & conditions, EventsCodeGenerationContext & context);
/**
* \brief Generate code for executing an action list
*
* The default implementation just calls repeatedly GenerateActionCode.
*
* \param game Game used
* \param scene Scene used
* \param actions std::vector of actions
* \param context Context used for generation
* \return Code
*/
virtual gd::String GenerateActionsListCode(gd::InstructionsList & actions, EventsCodeGenerationContext & context);
/**
* \brief Generate the code for a parameter of an action/condition/expression.
*
* This method uses GenerateParameterCodes to generate the parameters code.
*
* \param scene Scene used
* \param parameters std::vector of actual parameters.
* \param parametersInfo std::vector of information about parameters
* \param context Context used for generation
* \param supplementaryParametersTypes Optional std::vector of new parameters types ( std::vector of pair<gd::String,gd::String>("type", "valueToBeInserted") )
*
*/
std::vector<gd::String> GenerateParametersCodes(std::vector < gd::Expression > parameters,
const std::vector < gd::ParameterMetadata > & parametersInfo,
EventsCodeGenerationContext & context,
std::vector < std::pair<gd::String, gd::String> > * supplementaryParametersTypes = 0);
/**
* \brief Generate code for a single condition.
*
* The generation is really done in GenerateFreeCondition/GenerateObjectCondition or GenerateBehaviorCondition.
*
* \param condition instruction to be done.
* \param returnBoolean The name of the boolean that must contains the condition result.
* \param context Context used for generation
* \return Code
*/
gd::String GenerateConditionCode(gd::Instruction & condition, gd::String returnBoolean, EventsCodeGenerationContext & context);
/**
* \brief Generate code for a single action
*
* The generation is really done in GenerateFreeAction/GenerateObjectAction or GenerateBehaviorAction.
*
* \param condition instruction to be done.
* \param context Context used for generation
* \return Code
*/
gd::String GenerateActionCode(gd::Instruction & action, EventsCodeGenerationContext & context);
/**
* \brief Generate code for declaring objects lists.
*
* This method is used for each event.
*
* \param context The context to be used.
*/
virtual gd::String GenerateObjectsDeclarationCode(EventsCodeGenerationContext & context);
/**
* \brief Must convert a plain string ( with line feed, quotes ) to a string that can be inserted into code.
*
* \note It is the caller responsibility to add proper code need to create a full string.
*
* Usage example :
* \code
code += "gd::String(\""+codeGenerator.ConvertToString(name)+"\")";
/ \endcode
*
* \param plainString The string to convert
* \return plainString which can be included into the generated code.
*/
virtual gd::String ConvertToString(gd::String plainString);
/**
* \brief Convert a plain string ( with line feed, quotes ) to a string that can be inserted into code.
* The string construction must be explicit : for example, quotes must be added if the target language need quotes.
*
* Usage example :
\code
code += codeGenerator.ConvertToStringExplicit(name);
\endcode
*
* \note The default implementation simply call ConvertToString and add quotes
*
* \param plainString The string to convert
* \return plainString which can be included into the generated code.
*/
virtual gd::String ConvertToStringExplicit(gd::String plainString);
/**
* \brief Declare an include file to be added
* \note The way includes files are used may vary depending on the platform:
* - On GD C++ Platform, the includes files are added in the #include directives of the generated code.
* - On GD JS Platform, the includes files are added in the list of JS files in the index file.
*/
void AddIncludeFile(gd::String file) { if ( !file.empty() ) includeFiles.insert(file); };
/**
* \brief Declare a list of include files to be added
* \see gd::EventsCodeGenerator::AddIncludeFile
*/
void AddIncludeFiles(std::vector<gd::String> files) { for(std::size_t i = 0;i<files.size();++i) AddIncludeFile(files[i]); };
/**
* \brief Add a declaration which will be inserted after includes
*/
void AddGlobalDeclaration(gd::String declaration) { customGlobalDeclaration.insert(declaration); };
/**
* \brief Add some code before events outside the main function.
*/
void AddCustomCodeOutsideMain(gd::String code) { customCodeOutsideMain += code; };
/**
* \brief Add some code before events in the main function.
*/
void AddCustomCodeInMain(gd::String code) { customCodeInMain += code; };
/** \brief Get the set containing the include files.
*/
const std::set<gd::String> & GetIncludeFiles() const { return includeFiles; }
/** \brief Get the custom code to be inserted outside main.
*/
const gd::String & GetCustomCodeOutsideMain() const { return customCodeOutsideMain; }
/** \brief Get the custom code to be inserted inside main function.
*/
const gd::String & GetCustomCodeInMain() const { return customCodeInMain; }
/** \brief Get the custom declaration to be inserted after includes.
*/
const std::set<gd::String> & GetCustomGlobalDeclaration() const { return customGlobalDeclaration; }
/**
* \brief Return true if code generation is made for runtime only.
*/
bool GenerateCodeForRuntime() { return compilationForRuntime; }
/**
* \brief Set if the code generated is meant to be used for runtime only and not in the IDE.
*/
void SetGenerateCodeForRuntime(bool compilationForRuntime_) { compilationForRuntime = compilationForRuntime_; }
/**
* \brief Report that an error occurred during code generation ( Event code won't be generated )
*/
void ReportError();
/**
* \brief Return true if an error has occurred during code generation ( in this case, generated code is not usable )
*/
bool ErrorOccurred() const { return errorOccurred; };
/**
* \brief Get the project the code is being generated for.
*/
gd::Project & GetProject() const { return project; }
/**
* \brief Get the layout the code is being generated for.
*/
const gd::Layout & GetLayout() const { return scene; }
/**
* \brief Get the platform the code is being generated for.
*/
const gd::Platform & GetPlatform() const { return platform; }
/**
* \brief Convert a group name to the full list of objects contained in the 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 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 an action... ),
* none of the two rules below apply, and the list will only contains the context "current" object name.
*/
std::vector<gd::String> ExpandObjectsName(const gd::String & objectName, const EventsCodeGenerationContext & context) const;
/**
* \brief Get the maximum depth of custom conditions reached during code generation.
*/
size_t GetMaxCustomConditionsDepth() const { return maxCustomConditionsDepth; }
/**
* \brief Get the maximum size of a list of conditions.
*/
size_t GetMaxConditionsListsSize() const { return maxConditionsListsSize; }
/**
* \brief Generate the full name for accessing to a boolean variable used for conditions.
*
* Default implementation just returns the boolean name passed as argument.
*/
virtual gd::String GenerateBooleanFullName(const gd::String & boolName, const gd::EventsCodeGenerationContext & context ) { return boolName; }
/**
* \brief Must create a boolean. Its value must be false.
*
* The default implementation generates C-style code.
*/
virtual gd::String GenerateBooleanInitializationToFalse(const gd::String & boolName,
const gd::EventsCodeGenerationContext & context) { return "bool "+boolName+" = false;\n";}
/**
* \brief Get the full name for accessing to a list of objects
*
* Default implementation simply returns the name mangled using gd::EventsCodeNameMangler.
*/
virtual gd::String GetObjectListName(const gd::String & name, const gd::EventsCodeGenerationContext & context);
protected:
/**
* \brief Generate the code for a single parameter.
*
* Standard supported parameters type, and how they are used in code:
*
* - object : Object name -> string
* - expression : Mathematical expression -> number (double)
* - string : %Text expression -> string
* - layer, color, file, joyaxis : Same as string
* - relationalOperator : Used to make a comparison between the function resturn value and value of the parameter preceding the relationOperator parameter -> string
* - operator : Used to update a value using a setter and a getter -> string
* - key, mouse, objectvar, scenevar, globalvar, password, musicfile, soundfile, police -> string
* - trueorfalse, yesorno -> boolean ( See GenerateTrue/GenerateFalse ).
*
* <br><br>
* "Code only" parameters types:
* - inlineCode: supplementary information associated with the parameter is directly pasted in the code without change.
*
* <br><br>
* Other standard parameters type that should be implemented by platforms:
* - currentScene: Reference to the current runtime scene.
* - objectList : a map containing lists of objects which are specified by the object name in another parameter. (C++: std::map <gd::String, std::vector<RuntimeObject*> *>). Example:
* \code
AddExpression("Count", _("Object count"), _("Count the number of picked objects"), _("Objects"), "res/conditions/nbObjet.png")
.AddParameter("objectList", _("Object"))
.SetFunctionName("PickedObjectsCount").SetIncludeFile("GDCpp/Extensions/Builtin/ObjectTools.h");
* \endcode
* - objectListWithoutPicking : Same as objectList but do not pick object if they are not already picked.
* - objectPtr : Return a pointer to object specified by the object name in another parameter ( C++: RuntimeObject* ). Example:
* \code
.AddParameter("object", _("Object"))
.AddParameter("objectPtr", _("Target object"))
//The called function will be called with this signature on the C++ platform: Function(gd::String, RuntimeObject*)
* \endcode
*/
virtual gd::String GenerateParameterCodes(const gd::String & parameter, const gd::ParameterMetadata & metadata,
gd::EventsCodeGenerationContext & context,
const gd::String & previousParameter,
std::vector < std::pair<gd::String, gd::String> > * supplementaryParametersTypes);
/**
* \brief Call a function of the current object.
* \note The current object is the object being manipulated by a condition or an action.
*
* \param objectListName The full name of the object list being used
* \param objMetadata Metadata about the object being used.
* \param functionCallName The function to be called on this object.
* \param parametersStr The parameters of the function
* \param context The context : May be used to get information about the current scope.
*/
virtual gd::String GenerateObjectFunctionCall(gd::String objectListName,
const ObjectMetadata & objMetadata,
const gd::ExpressionCodeGenerationInformation & codeInfo,
gd::String parametersStr,
gd::String defaultOutput,
gd::EventsCodeGenerationContext & context);
/**
* \brief Call a function of a behavior of the current object.
* \note The current object is the object being manipulated by a condition or an action.
*
* \param objectListName The full name of the object list being used
* \param behaviorName The full name of the behavior to be used
* \param objMetadata Metadata about the behavior being used.
* \param functionCallName The function to be called on this object.
* \param parametersStr The parameters of the function
* \param context The context : May be used to get information about the current scope.
*/
virtual gd::String GenerateObjectBehaviorFunctionCall(gd::String objectListName,
gd::String behaviorName,
const gd::BehaviorMetadata & autoInfo,
const gd::ExpressionCodeGenerationInformation & codeInfo,
gd::String parametersStr,
gd::String defaultOutput,
gd::EventsCodeGenerationContext & context);
/**
* \brief Called when a new scope must be entered.
* \param context The context : Internal events of the scope have been generated, but GenerateObjectsDeclarationCode was not called.
* \param extraVariable An optional supplementary variable that should be inherited from the parent scope.
*/
virtual gd::String GenerateScopeBegin(gd::EventsCodeGenerationContext & context, const gd::String & extraVariable = "") { return "{\n"; };
/**
* \brief Called when a new must be ended.
* \param context The context : Internal events of the scope have been generated, but GenerateObjectsDeclarationCode was not called.
* \param extraVariable An optional supplementary variable that should be inherited from the parent scope.
*/
virtual gd::String GenerateScopeEnd(gd::EventsCodeGenerationContext & context, const gd::String & extraVariable = "") { return "}\n"; };
/**
* \brief Must negate a predicat.
*
* The default implementation generates C-style code : It wraps the predicat inside parenthesis and add a !.
*/
virtual gd::String GenerateNegatedPredicat(const gd::String & predicat) const { return "!("+predicat+")"; };
/**
* \brief Must create a boolean which is a reference to a boolean declared in the parent scope.
*
* The default implementation generates C-style code.
*/
virtual gd::String GenerateReferenceToUpperScopeBoolean(const gd::String & referenceName,
const gd::String & referencedBoolean,
gd::EventsCodeGenerationContext & context) { return "bool & "+referenceName+" = "+referencedBoolean+";\n";}
virtual gd::String GenerateFreeCondition(const std::vector<gd::String> & arguments,
const gd::InstructionMetadata & instrInfos,
const gd::String & returnBoolean,
bool conditionInverted,
gd::EventsCodeGenerationContext & context);
virtual gd::String GenerateObjectCondition(const gd::String & objectName,
const gd::ObjectMetadata & objInfo,
const std::vector<gd::String> & arguments,
const gd::InstructionMetadata & instrInfos,
const gd::String & returnBoolean,
bool conditionInverted,
gd::EventsCodeGenerationContext & context);
virtual gd::String GenerateBehaviorCondition(const gd::String & objectName,
const gd::String & behaviorName,
const gd::BehaviorMetadata & autoInfo,
const std::vector<gd::String> & arguments,
const gd::InstructionMetadata & instrInfos,
const gd::String & returnBoolean,
bool conditionInverted,
gd::EventsCodeGenerationContext & context);
virtual gd::String GenerateFreeAction(const std::vector<gd::String> & arguments,
const gd::InstructionMetadata & instrInfos,
gd::EventsCodeGenerationContext & context);
virtual gd::String GenerateObjectAction(const gd::String & objectName,
const gd::ObjectMetadata & objInfo,
const std::vector<gd::String> & arguments,
const gd::InstructionMetadata & instrInfos,
gd::EventsCodeGenerationContext & context);
virtual gd::String GenerateBehaviorAction(const gd::String & objectName,
const gd::String & behaviorName,
const gd::BehaviorMetadata & autoInfo,
const std::vector<gd::String> & arguments,
const gd::InstructionMetadata & instrInfos,
gd::EventsCodeGenerationContext & context);
gd::String GenerateRelationalOperatorCall(const gd::InstructionMetadata & instrInfos, const std::vector<gd::String> & arguments, const gd::String & callStartString, std::size_t startFromArgument = 0);
gd::String GenerateOperatorCall(const gd::InstructionMetadata & instrInfos, const std::vector<gd::String> & arguments, const gd::String & callStartString, const gd::String & getterStartString, std::size_t startFromArgument = 0);
gd::String GenerateCompoundOperatorCall(const gd::InstructionMetadata & instrInfos, const std::vector<gd::String> & arguments, const gd::String & callStartString, std::size_t startFromArgument = 0);
/**
* \brief Must return an expression whose value is true.
*/
gd::String GenerateTrue() const { return "true"; };
/**
* \brief Must return an expression whose value is false.
*/
gd::String GenerateFalse() const { return "false"; };
gd::Project & project; ///< The project being used.
const gd::Layout & scene; ///< The scene being generated.
const gd::Platform & platform; ///< The platform being used.
bool errorOccurred; ///< Must be set to true if an error occured.
bool compilationForRuntime; ///< Is set to true if the code generation is made for runtime only.
std::set<gd::String> includeFiles; ///< List of headers files used by instructions. A (shared) pointer is used so as context created from another one can share the same list.
gd::String customCodeOutsideMain; ///< Custom code inserted before events ( and not in events function )
gd::String customCodeInMain; ///< Custom code inserted before events ( in main function )
std::set<gd::String> customGlobalDeclaration; ///< Custom global C++ declarations inserted after includes
size_t maxCustomConditionsDepth; ///< The maximum depth value for all the custom conditions created.
size_t maxConditionsListsSize; ///< The maximum size of a list of conditions.
};
}
#endif // GDCORE_EVENTSCODEGENERATOR_H

View File

@@ -1,21 +1,21 @@
/*
* GDevelop Core
* Copyright 2008-2015 Florian Rival (Florian.Rival@gmail.com). All rights reserved.
* Copyright 2008-2016 Florian Rival (Florian.Rival@gmail.com). All rights reserved.
* This project is released under the MIT License.
*/
#include "ExpressionsCodeGeneration.h"
#include "GDCore/PlatformDefinition/Project.h"
#include "GDCore/PlatformDefinition/Layout.h"
#include "GDCore/PlatformDefinition/Platform.h"
#include "GDCore/PlatformDefinition/PlatformExtension.h"
#include "GDCore/IDE/MetadataProvider.h"
#include "GDCore/Events/ExpressionParser.h"
#include "GDCore/Events/EventsCodeGenerator.h"
#include "GDCore/Events/EventsCodeNameMangler.h"
#include "GDCore/Events/EventsCodeGenerationContext.h"
#include "GDCore/Events/ExpressionMetadata.h"
#include "GDCore/Events/ObjectMetadata.h"
#include "GDCore/Events/BehaviorMetadata.h"
#include "GDCore/Project/Project.h"
#include "GDCore/Project/Layout.h"
#include "GDCore/Extensions/Platform.h"
#include "GDCore/Extensions/PlatformExtension.h"
#include "GDCore/Extensions/Metadata/MetadataProvider.h"
#include "GDCore/Events/Parsers/ExpressionParser.h"
#include "GDCore/Events/CodeGeneration/EventsCodeGenerator.h"
#include "GDCore/Events/Tools/EventsCodeNameMangler.h"
#include "GDCore/Events/CodeGeneration/EventsCodeGenerationContext.h"
#include "GDCore/Extensions/Metadata/ExpressionMetadata.h"
#include "GDCore/Extensions/Metadata/ObjectMetadata.h"
#include "GDCore/Extensions/Metadata/BehaviorMetadata.h"
#include "GDCore/CommonTools.h"
using namespace std;
@@ -40,7 +40,7 @@ void CallbacksForGeneratingExpressionCode::OnConstantToken(gd::String text)
void CallbacksForGeneratingExpressionCode::OnStaticFunction(gd::String functionName, const std::vector<gd::Expression> & parameters, const gd::ExpressionMetadata & expressionInfo)
{
codeGenerator.AddIncludeFile(expressionInfo.codeExtraInformation.optionalIncludeFile);
codeGenerator.AddIncludeFiles(expressionInfo.codeExtraInformation.GetIncludeFiles());
//Launch custom code generator if needed
if (expressionInfo.codeExtraInformation.HasCustomCodeGenerator())
@@ -76,7 +76,7 @@ void CallbacksForGeneratingExpressionCode::OnObjectFunction(gd::String functionN
const gd::Project & project = codeGenerator.GetProject();
const gd::Layout & scene = codeGenerator.GetLayout();
codeGenerator.AddIncludeFile(expressionInfo.codeExtraInformation.optionalIncludeFile);
codeGenerator.AddIncludeFiles(expressionInfo.codeExtraInformation.GetIncludeFiles());
if ( parameters.empty() ) return;
//Launch custom code generator if needed
@@ -119,7 +119,7 @@ void CallbacksForGeneratingExpressionCode::OnObjectBehaviorFunction(gd::String f
const gd::Project & project = codeGenerator.GetProject();
const gd::Layout & scene = codeGenerator.GetLayout();
codeGenerator.AddIncludeFile(expressionInfo.codeExtraInformation.optionalIncludeFile);
codeGenerator.AddIncludeFiles(expressionInfo.codeExtraInformation.GetIncludeFiles());
if ( parameters.size() < 2 ) return;
//Launch custom code generator if needed

View File

@@ -1,6 +1,6 @@
/*
* GDevelop Core
* Copyright 2008-2015 Florian Rival (Florian.Rival@gmail.com). All rights reserved.
* Copyright 2008-2016 Florian Rival (Florian.Rival@gmail.com). All rights reserved.
* This project is released under the MIT License.
*/
#ifndef EXPRESSIONSCODEGENERATION_H
@@ -8,7 +8,7 @@
#include <vector>
#include "GDCore/String.h"
#include "GDCore/Events/ExpressionParser.h"
#include "GDCore/Events/Parsers/ExpressionParser.h"
namespace gd { class ExpressionMetadata; }
namespace gd { class Expression; }
namespace gd { class Project; }

View File

@@ -1,14 +1,14 @@
/*
* GDevelop Core
* Copyright 2008-2015 Florian Rival (Florian.Rival@gmail.com). All rights reserved.
* Copyright 2008-2016 Florian Rival (Florian.Rival@gmail.com). All rights reserved.
* This project is released under the MIT License.
*/
#include "GDCore/Events/Event.h"
#include "GDCore/Events/EventsList.h"
#include "GDCore/PlatformDefinition/Platform.h"
#include "GDCore/PlatformDefinition/PlatformExtension.h"
#include "GDCore/Events/EventsCodeGenerator.h"
#include "GDCore/Extensions/Platform.h"
#include "GDCore/Extensions/PlatformExtension.h"
#include "GDCore/Events/CodeGeneration/EventsCodeGenerator.h"
namespace gd
{

View File

@@ -1,6 +1,6 @@
/*
* GDevelop Core
* Copyright 2008-2015 Florian Rival (Florian.Rival@gmail.com). All rights reserved.
* Copyright 2008-2016 Florian Rival (Florian.Rival@gmail.com). All rights reserved.
* This project is released under the MIT License.
*/
#if defined(GD_IDE_ONLY)

View File

@@ -1,70 +0,0 @@
/*
* GDevelop Core
* Copyright 2008-2015 Florian Rival (Florian.Rival@gmail.com). All rights reserved.
* This project is released under the MIT License.
*/
#include "GDCore/Events/EventsCodeGenerationContext.h"
#include "GDCore/Events/EventsCodeNameMangler.h"
#include "GDCore/CommonTools.h"
#include "GDCore/Events/EventsCodeGenerator.h"
#include <set>
using namespace std;
namespace gd
{
void EventsCodeGenerationContext::InheritsFrom(const EventsCodeGenerationContext & parent_)
{
parent = &parent_;
//Objects lists declared by parent became "already declared" in the child context.
alreadyDeclaredObjectsLists = parent_.alreadyDeclaredObjectsLists;
for ( std::set<gd::String>::iterator it = parent_.objectsListsToBeDeclared.begin() ; it != parent_.objectsListsToBeDeclared.end(); ++it )
alreadyDeclaredObjectsLists.insert(*it);
for ( std::set<gd::String>::iterator it = parent_.emptyObjectsListsToBeDeclared.begin() ; it != parent_.emptyObjectsListsToBeDeclared.end(); ++it )
alreadyDeclaredObjectsLists.insert(*it);
depthOfLastUse = parent_.depthOfLastUse;
customConditionDepth = parent_.customConditionDepth;
contextDepth = parent_.GetContextDepth()+1;
if ( parent_.maxDepthLevel )
{
maxDepthLevel = parent_.maxDepthLevel;
*maxDepthLevel = std::max(*maxDepthLevel, contextDepth);
}
}
void EventsCodeGenerationContext::ObjectsListNeeded(const gd::String & objectName)
{
if ( emptyObjectsListsToBeDeclared.find(objectName) == emptyObjectsListsToBeDeclared.end() )
objectsListsToBeDeclared.insert(objectName);
depthOfLastUse[objectName] = GetContextDepth();
}
void EventsCodeGenerationContext::EmptyObjectsListNeeded(const gd::String & objectName)
{
if ( objectsListsToBeDeclared.find(objectName) == objectsListsToBeDeclared.end() )
emptyObjectsListsToBeDeclared.insert(objectName);
depthOfLastUse[objectName] = GetContextDepth();
}
std::set<gd::String> EventsCodeGenerationContext::GetAllObjectsToBeDeclared() const
{
std::set <gd::String> allObjectListsToBeDeclared(objectsListsToBeDeclared.begin(), objectsListsToBeDeclared.end());
allObjectListsToBeDeclared.insert(emptyObjectsListsToBeDeclared.begin(), emptyObjectsListsToBeDeclared.end());
return allObjectListsToBeDeclared;
}
unsigned int EventsCodeGenerationContext::GetLastDepthObjectListWasNeeded(const gd::String & name) const
{
if ( depthOfLastUse.count(name) != 0 )
return depthOfLastUse.find(name)->second;
std::cout << "WARNING: During code generation, the last depth of an object list was 0." << std::endl;
return 0;
}
}

View File

@@ -1,985 +0,0 @@
#include <algorithm>
#include <utility>
#include "GDCore/PlatformDefinition/Layout.h"
#include "GDCore/PlatformDefinition/Project.h"
#include "GDCore/PlatformDefinition/PlatformExtension.h"
#include "GDCore/PlatformDefinition/Platform.h"
#include "GDCore/IDE/MetadataProvider.h"
#include "GDCore/Events/EventsCodeGenerator.h"
#include "GDCore/CommonTools.h"
#include "GDCore/Events/ExpressionParser.h"
#include "GDCore/Events/EventsCodeNameMangler.h"
#include "GDCore/Events/EventsCodeGenerationContext.h"
#include "GDCore/Events/ExpressionsCodeGeneration.h"
#include "GDCore/Events/InstructionMetadata.h"
#include "GDCore/Events/ObjectMetadata.h"
#include "GDCore/Events/BehaviorMetadata.h"
using namespace std;
namespace gd
{
/**
* Generate call using a relational operator.
* Relational operator position is deduced from parameters type.
* Rhs hand side expression is assumed to be placed just before the relational operator.
*
* \param Information about the instruction
* \param Arguments, in their C++ form.
* \param String to be placed at the start of the call ( the function to be called typically ). Example : MyObject->Get
* \param Arguments will be generated starting from this number. For example, set this to 1 to skip the first argument.
*/
gd::String EventsCodeGenerator::GenerateRelationalOperatorCall(const gd::InstructionMetadata & instrInfos, const vector<gd::String> & arguments, const gd::String & callStartString, std::size_t startFromArgument)
{
std::size_t relationalOperatorIndex = instrInfos.parameters.size();
for (std::size_t i = startFromArgument;i<instrInfos.parameters.size();++i)
{
if ( instrInfos.parameters[i].type == "relationalOperator" )
relationalOperatorIndex = i;
}
//Ensure that there is at least one parameter after the relational operator
if ( relationalOperatorIndex+1 >= instrInfos.parameters.size() )
{
ReportError();
return "";
}
gd::String relationalOperator = arguments[relationalOperatorIndex];
if ( relationalOperator.size() > 2 ) relationalOperator = relationalOperator.substr(1, relationalOperator.length()-1-1); //Relational operator contains quote which must be removed.
gd::String rhs = arguments[relationalOperatorIndex+1];
gd::String argumentsStr;
for (std::size_t i = startFromArgument;i<arguments.size();++i)
{
if ( i != relationalOperatorIndex && i != relationalOperatorIndex+1)
{
if ( !argumentsStr.empty() ) argumentsStr += ", ";
argumentsStr += arguments[i];
}
}
return callStartString+"("+argumentsStr+") "+relationalOperator+" "+rhs;
}
/**
* Generate call using an operator ( =,+,-,*,/ ).
* Operator position is deduced from parameters type.
* Expression is assumed to be placed just before the operator.
*
* \param Information about the instruction
* \param Arguments, in their C++ form.
* \param String to be placed at the start of the call ( the function to be called typically ). Example : MyObject->Set
* \param String to be placed at the start of the call of the getter ( the "getter" function to be called typically ). Example : MyObject->Get
* \param Arguments will be generated starting from this number. For example, set this to 1 to skip the first argument.
*/
gd::String EventsCodeGenerator::GenerateOperatorCall(const gd::InstructionMetadata & instrInfos, const vector<gd::String> & arguments, const gd::String & callStartString, const gd::String & getterStartString, std::size_t startFromArgument)
{
std::size_t operatorIndex = instrInfos.parameters.size();
for (std::size_t i = startFromArgument;i<instrInfos.parameters.size();++i)
{
if ( instrInfos.parameters[i].type == "operator" )
operatorIndex = i;
}
//Ensure that there is at least one parameter after the operator
if ( operatorIndex+1 >= instrInfos.parameters.size() )
{
ReportError();
return "";
}
gd::String operatorStr = arguments[operatorIndex];
if ( operatorStr.size() > 2 ) operatorStr = operatorStr.substr(1, operatorStr.length()-1-1); //Operator contains quote which must be removed.
gd::String rhs = arguments[operatorIndex+1];
//Generate arguments for calling the "getter" function
gd::String getterArgumentsStr;
for (std::size_t i = startFromArgument;i<arguments.size();++i)
{
if ( i != operatorIndex && i != operatorIndex+1)
{
if ( !getterArgumentsStr.empty() ) getterArgumentsStr += ", ";
getterArgumentsStr += arguments[i];
}
}
//Generate arguments for calling the function ("setter")
gd::String argumentsStr;
for (std::size_t i = startFromArgument;i<arguments.size();++i)
{
if ( i != operatorIndex && i != operatorIndex+1) //Generate classic arguments
{
if ( !argumentsStr.empty() ) argumentsStr += ", ";
argumentsStr += arguments[i];
}
if ( i == operatorIndex+1 )
{
if ( !argumentsStr.empty() ) argumentsStr += ", ";
if ( operatorStr != "=" )
argumentsStr += getterStartString+"("+getterArgumentsStr+") "+operatorStr+" ("+rhs+")";
else
argumentsStr += rhs;
}
}
return callStartString+"("+argumentsStr+")";
}
/**
* Generate call using a compound assignment operators ( =,+=,-=,*=,/= ).
* Operator position is deduced from parameters type.
* Expression is assumed to be placed just before the operator.
*
* \param Information about the instruction
* \param Arguments, in their C++ form.
* \param String to be placed at the start of the call ( the function to be called typically ). Example : MyObject->Set
* \param Arguments will be generated starting from this number. For example, set this to 1 to skip the first argument.
*/
gd::String EventsCodeGenerator::GenerateCompoundOperatorCall(const gd::InstructionMetadata & instrInfos, const vector<gd::String> & arguments, const gd::String & callStartString, std::size_t startFromArgument)
{
std::size_t operatorIndex = instrInfos.parameters.size();
for (std::size_t i = startFromArgument;i<instrInfos.parameters.size();++i)
{
if ( instrInfos.parameters[i].type == "operator" )
operatorIndex = i;
}
//Ensure that there is at least one parameter after the operator
if ( operatorIndex+1 >= instrInfos.parameters.size() )
{
ReportError();
return "";
}
gd::String operatorStr = arguments[operatorIndex];
if ( operatorStr.size() > 2 ) operatorStr = operatorStr.substr(1, operatorStr.length()-1-1); //Operator contains quote which must be removed.
gd::String rhs = arguments[operatorIndex+1];
//Generate real operator string.
if ( operatorStr == "+" ) operatorStr = "+=";
else if ( operatorStr == "-" ) operatorStr = "-=";
else if ( operatorStr == "/" ) operatorStr = "/=";
else if ( operatorStr == "*" ) operatorStr = "*=";
//Generate arguments for calling the function ("setter")
gd::String argumentsStr;
for (std::size_t i = startFromArgument;i<arguments.size();++i)
{
if ( i != operatorIndex && i != operatorIndex+1) //Generate classic arguments
{
if ( !argumentsStr.empty() ) argumentsStr += ", ";
argumentsStr += arguments[i];
}
}
return callStartString+"("+argumentsStr+") "+operatorStr+" ("+rhs+")";
}
gd::String EventsCodeGenerator::GenerateConditionCode(gd::Instruction & condition, gd::String returnBoolean, EventsCodeGenerationContext & context)
{
gd::String conditionCode;
gd::InstructionMetadata instrInfos = MetadataProvider::GetConditionMetadata(platform, condition.GetType());
AddIncludeFile(instrInfos.codeExtraInformation.optionalIncludeFile);
maxConditionsListsSize = std::max(maxConditionsListsSize, condition.GetSubInstructions().size());
if ( instrInfos.codeExtraInformation.HasCustomCodeGenerator())
{
context.EnterCustomCondition();
conditionCode += GenerateReferenceToUpperScopeBoolean("conditionTrue", returnBoolean, context);
conditionCode += instrInfos.codeExtraInformation.customCodeGenerator(condition, *this, context);
maxCustomConditionsDepth = std::max(maxCustomConditionsDepth, context.GetCurrentConditionDepth());
context.LeaveCustomCondition();
return "{"+conditionCode+"}\n";
}
//Insert code only parameters and be sure there is no lack of parameter.
while(condition.GetParameters().size() < instrInfos.parameters.size())
{
vector < gd::Expression > parameters = condition.GetParameters();
parameters.push_back(gd::Expression(""));
condition.SetParameters(parameters);
}
//Verify that there are not mismatch between object type in parameters
for (std::size_t pNb = 0;pNb < instrInfos.parameters.size();++pNb)
{
if ( ParameterMetadata::IsObject(instrInfos.parameters[pNb].type) )
{
gd::String objectInParameter = condition.GetParameter(pNb).GetPlainString();
if ( !scene.HasObjectNamed(objectInParameter) && !project.HasObjectNamed(objectInParameter)
&& find_if(scene.GetObjectGroups().begin(), scene.GetObjectGroups().end(), bind2nd(gd::GroupHasTheSameName(), objectInParameter) ) == scene.GetObjectGroups().end()
&& find_if(project.GetObjectGroups().begin(), project.GetObjectGroups().end(), bind2nd(gd::GroupHasTheSameName(), objectInParameter) ) == project.GetObjectGroups().end() )
{
cout << "Bad object (" << objectInParameter << ") in a parameter of a condition " << condition.GetType() << endl;
condition.SetParameter(pNb, gd::Expression(""));
condition.SetType("");
}
else if ( !instrInfos.parameters[pNb].supplementaryInformation.empty()
&& gd::GetTypeOfObject(project, scene, objectInParameter) != instrInfos.parameters[pNb].supplementaryInformation )
{
cout << "Bad object type in a parameter of a condition " << condition.GetType() << endl;
cout << "Condition wanted " << instrInfos.parameters[pNb].supplementaryInformation << endl;
cout << "Condition wanted " << instrInfos.parameters[pNb].supplementaryInformation << " of type " << instrInfos.parameters[pNb].supplementaryInformation << endl;
cout << "Condition has received " << objectInParameter << " of type " << gd::GetTypeOfObject(project, scene, objectInParameter) << endl;
condition.SetParameter(pNb, gd::Expression(""));
condition.SetType("");
}
}
}
//Generate static condition if available
if ( MetadataProvider::HasCondition(platform, condition.GetType()))
{
//Prepare arguments
std::vector < std::pair<gd::String, gd::String> > supplementaryParametersTypes;
supplementaryParametersTypes.push_back(std::make_pair("conditionInverted", condition.IsInverted() ? "true" : "false"));
vector<gd::String> arguments = GenerateParametersCodes(condition.GetParameters(), instrInfos.parameters, context, &supplementaryParametersTypes);
conditionCode += GenerateFreeCondition(arguments, instrInfos, returnBoolean, condition.IsInverted(), context);
}
//Generate object condition if available
gd::String objectName = condition.GetParameters().empty() ? "" : condition.GetParameter(0).GetPlainString();
gd::String objectType = gd::GetTypeOfObject(project, scene, objectName);
if ( !objectName.empty() && MetadataProvider::HasObjectCondition(platform, objectType, condition.GetType()) && !instrInfos.parameters.empty())
{
std::vector<gd::String> realObjects = ExpandObjectsName(objectName, context);
for (std::size_t i = 0;i<realObjects.size();++i)
{
//Set up the context
const ObjectMetadata & objInfo = MetadataProvider::GetObjectMetadata(platform, objectType);
AddIncludeFiles(objInfo.includeFiles);
context.SetCurrentObject(realObjects[i]);
context.ObjectsListNeeded(realObjects[i]);
//Prepare arguments and generate the condition whole code
vector<gd::String> arguments = GenerateParametersCodes(condition.GetParameters(), instrInfos.parameters, context);
conditionCode += GenerateObjectCondition(realObjects[i], objInfo, arguments, instrInfos, returnBoolean, condition.IsInverted(), context);
context.SetNoCurrentObject();
}
}
//Generate behavior condition if available
gd::String behaviorType = gd::GetTypeOfBehavior(project, scene, condition.GetParameters().size() < 2 ? "" : condition.GetParameter(1).GetPlainString());
if (MetadataProvider::HasBehaviorCondition(platform, behaviorType, condition.GetType()) && instrInfos.parameters.size() >= 2)
{
std::vector<gd::String> realObjects = ExpandObjectsName(objectName, context);
for (std::size_t i = 0;i<realObjects.size();++i)
{
//Setup context
const BehaviorMetadata & autoInfo = MetadataProvider::GetBehaviorMetadata(platform, behaviorType);
AddIncludeFiles(autoInfo.includeFiles);
context.SetCurrentObject(realObjects[i]);
context.ObjectsListNeeded(realObjects[i]);
//Prepare arguments and generate the whole condition code
vector<gd::String> arguments = GenerateParametersCodes(condition.GetParameters(), instrInfos.parameters, context);
conditionCode += GenerateBehaviorCondition(realObjects[i], condition.GetParameter(1).GetPlainString(), autoInfo, arguments,
instrInfos, returnBoolean, condition.IsInverted(), context);
context.SetNoCurrentObject();
}
}
return conditionCode;
}
/**
* Generate code for a list of conditions.
* Bools containing conditions results are named conditionXIsTrue.
*/
gd::String EventsCodeGenerator::GenerateConditionsListCode(gd::InstructionsList & conditions, EventsCodeGenerationContext & context)
{
gd::String outputCode;
for (std::size_t i = 0;i<conditions.size();++i)
outputCode += GenerateBooleanInitializationToFalse("condition"+gd::String::From(i) +"IsTrue", context);
for (std::size_t cId =0;cId < conditions.size();++cId)
{
gd::InstructionMetadata instrInfos = MetadataProvider::GetConditionMetadata(platform, conditions[cId].GetType());
gd::String conditionCode = GenerateConditionCode(conditions[cId], "condition"+gd::String::From(cId) +"IsTrue", context);
if ( !conditions[cId].GetType().empty() )
{
for (std::size_t i = 0;i<cId;++i) //Skip conditions if one condition is false. //TODO : Can be optimized
{
if (i == 0) outputCode += "if ( "; else outputCode += " && ";
outputCode += "condition"+gd::String::From(i) +"IsTrue";
if (i == cId-1) outputCode += ") ";
}
outputCode += "{\n";
outputCode += conditionCode;
outputCode += "}";
}
}
maxConditionsListsSize = std::max(maxConditionsListsSize, conditions.size());
return outputCode;
}
/**
* Generate code for an action.
*/
gd::String EventsCodeGenerator::GenerateActionCode(gd::Instruction & action, EventsCodeGenerationContext & context)
{
gd::String actionCode;
gd::InstructionMetadata instrInfos = MetadataProvider::GetActionMetadata(platform, action.GetType());
AddIncludeFile(instrInfos.codeExtraInformation.optionalIncludeFile);
if ( instrInfos.codeExtraInformation.HasCustomCodeGenerator() )
{
return instrInfos.codeExtraInformation.customCodeGenerator(action, *this, context);
}
//Be sure there is no lack of parameter.
while(action.GetParameters().size() < instrInfos.parameters.size())
{
vector < gd::Expression > parameters = action.GetParameters();
parameters.push_back(gd::Expression(""));
action.SetParameters(parameters);
}
//Verify that there are not mismatch between object type in parameters
for (std::size_t pNb = 0;pNb < instrInfos.parameters.size();++pNb)
{
if ( ParameterMetadata::IsObject(instrInfos.parameters[pNb].type) )
{
gd::String objectInParameter = action.GetParameter(pNb).GetPlainString();
if ( !scene.HasObjectNamed(objectInParameter) && !project.HasObjectNamed(objectInParameter)
&& find_if(scene.GetObjectGroups().begin(), scene.GetObjectGroups().end(), bind2nd(gd::GroupHasTheSameName(), objectInParameter) ) == scene.GetObjectGroups().end()
&& find_if(project.GetObjectGroups().begin(), project.GetObjectGroups().end(), bind2nd(gd::GroupHasTheSameName(), objectInParameter) ) == project.GetObjectGroups().end() )
{
cout << "Bad object (" << objectInParameter << ") in a parameter of an action " << action.GetType() << endl;
action.SetParameter(pNb, gd::Expression(""));
action.SetType("");
}
else if ( !instrInfos.parameters[pNb].supplementaryInformation.empty()
&& gd::GetTypeOfObject(project, scene, objectInParameter) != instrInfos.parameters[pNb].supplementaryInformation )
{
cout << "Bad object type in parameter "+gd::String::From(pNb)+" of an action " << action.GetType() << endl;
cout << "Action wanted " << instrInfos.parameters[pNb].supplementaryInformation << " of type " << instrInfos.parameters[pNb].supplementaryInformation << endl;
cout << "Action has received " << objectInParameter << " of type " << gd::GetTypeOfObject(project, scene, objectInParameter) << endl;
action.SetParameter(pNb, gd::Expression(""));
action.SetType("");
}
}
}
//Call free function first if available
if (MetadataProvider::HasAction(platform, action.GetType()))
{
vector<gd::String> arguments = GenerateParametersCodes(action.GetParameters(), instrInfos.parameters, context);
actionCode += GenerateFreeAction(arguments, instrInfos, context);
}
//Call object function if available
gd::String objectName = action.GetParameters().empty() ? "" : action.GetParameter(0).GetPlainString();
gd::String objectType = gd::GetTypeOfObject(project, scene, objectName);
if (MetadataProvider::HasObjectAction(platform, objectType, action.GetType()) && !instrInfos.parameters.empty())
{
std::vector<gd::String> realObjects = ExpandObjectsName(objectName, context);
for (std::size_t i = 0;i<realObjects.size();++i)
{
//Setup context
const ObjectMetadata & objInfo = MetadataProvider::GetObjectMetadata(platform, objectType);
AddIncludeFiles(objInfo.includeFiles);
context.SetCurrentObject(realObjects[i]);
context.ObjectsListNeeded(realObjects[i]);
//Prepare arguments and generate the whole action code
vector<gd::String> arguments = GenerateParametersCodes(action.GetParameters(), instrInfos.parameters, context);
actionCode += GenerateObjectAction(realObjects[i], objInfo, arguments, instrInfos, context);
context.SetNoCurrentObject();
}
}
//Assign to a behavior member function if found
gd::String behaviorType = gd::GetTypeOfBehavior(project, scene, action.GetParameters().size() < 2 ? "" : action.GetParameter(1).GetPlainString());
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)
{
//Setup context
const BehaviorMetadata & autoInfo = MetadataProvider::GetBehaviorMetadata(platform, behaviorType);
AddIncludeFiles(autoInfo.includeFiles);
context.SetCurrentObject(realObjects[i]);
context.ObjectsListNeeded(realObjects[i]);
//Prepare arguments and generate the whole action code
vector<gd::String> arguments = GenerateParametersCodes(action.GetParameters(), instrInfos.parameters, context);
actionCode += GenerateBehaviorAction(realObjects[i], action.GetParameter(1).GetPlainString(), autoInfo, arguments, instrInfos, context);
context.SetNoCurrentObject();
}
}
return actionCode;
}
/**
* Generate actions code.
*/
gd::String EventsCodeGenerator::GenerateActionsListCode(gd::InstructionsList & actions, EventsCodeGenerationContext & context)
{
gd::String outputCode;
for (std::size_t aId =0;aId < actions.size();++aId)
{
gd::InstructionMetadata instrInfos = MetadataProvider::GetActionMetadata(platform, actions[aId].GetType());
gd::String actionCode = GenerateActionCode(actions[aId], context);
outputCode += "{";
if ( !actions[aId].GetType().empty() ) outputCode += actionCode;
outputCode += "}";
}
return outputCode;
}
gd::String EventsCodeGenerator::GenerateParameterCodes(const gd::String & parameter, const gd::ParameterMetadata & metadata,
gd::EventsCodeGenerationContext & context,
const gd::String & previousParameter,
std::vector < std::pair<gd::String, gd::String> > * supplementaryParametersTypes)
{
gd::String argOutput;
if ( metadata.type == "expression" || metadata.type == "camera" )
{
CallbacksForGeneratingExpressionCode callbacks(argOutput, *this, context);
gd::ExpressionParser parser(parameter);
if ( !parser.ParseMathExpression(platform, project, scene, callbacks) )
{
cout << "Error :" << parser.firstErrorStr << " in: "<< parameter << endl;
argOutput = "0";
}
if (argOutput.empty()) argOutput = "0";
}
else if ( metadata.type == "string" || metadata.type == "layer" || metadata.type == "color" || metadata.type == "file" || metadata.type == "joyaxis" )
{
CallbacksForGeneratingExpressionCode callbacks(argOutput, *this, context);
gd::ExpressionParser parser(parameter);
if ( !parser.ParseStringExpression(platform, project, scene, callbacks) )
{
cout << "Error in text expression" << parser.firstErrorStr << endl;
argOutput = "\"\"";
}
if (argOutput.empty()) argOutput = "\"\"";
}
else if ( metadata.type == "relationalOperator" )
{
argOutput += parameter == "=" ? "==" :parameter;
if ( argOutput != "==" && argOutput != "<" && argOutput != ">" && argOutput != "<=" && argOutput != ">=" && argOutput != "!=")
{
cout << "Warning: Bad relational operator: Set to == by default." << endl;
argOutput = "==";
}
argOutput = "\""+argOutput+"\"";
}
else if ( metadata.type == "operator" )
{
argOutput += parameter;
if ( argOutput != "=" && argOutput != "+" && argOutput != "-" && argOutput != "/" && argOutput != "*")
{
cout << "Warning: Bad operator: Set to = by default." << endl;
argOutput = "=";
}
argOutput = "\""+argOutput+"\"";
}
else if ( metadata.type == "object" || metadata.type == "behavior" )
{
argOutput = "\""+ConvertToString(parameter)+"\"";
}
else if ( metadata.type == "key" )
{
argOutput = "\""+ConvertToString(parameter)+"\"";
}
else if (metadata.type == "objectvar" || metadata.type == "scenevar" || metadata.type == "globalvar" ||
metadata.type == "password" || metadata.type == "musicfile" || metadata.type == "soundfile" ||
metadata.type == "police")
{
argOutput = "\""+ConvertToString(parameter)+"\"";
}
else if ( metadata.type == "mouse" )
{
argOutput = "\""+ConvertToString(parameter)+"\"";
}
else if ( metadata.type == "yesorno" )
{
argOutput += (parameter == "yes" || parameter == "oui") ? GenerateTrue() : GenerateFalse();
}
else if ( metadata.type == "trueorfalse" )
{
argOutput += (parameter == "True" || parameter == "Vrai") ? GenerateTrue() : GenerateFalse();
}
//Code only parameter type
else if ( metadata.type == "inlineCode" )
{
argOutput += metadata.supplementaryInformation;
}
else
{
//Try supplementary types if provided
if ( supplementaryParametersTypes )
{
for (std::size_t i = 0;i<supplementaryParametersTypes->size();++i)
{
if ( (*supplementaryParametersTypes)[i].first == metadata.type )
argOutput += (*supplementaryParametersTypes)[i].second;
}
}
//Type unknown
if (argOutput.empty())
{
if ( !metadata.type.empty() ) cout << "Warning: Unknown type of parameter \"" << metadata.type << "\".";
argOutput += "\""+ConvertToString(parameter)+"\"";
}
}
return argOutput;
}
vector<gd::String> EventsCodeGenerator::GenerateParametersCodes(vector < gd::Expression > parameters, const vector < gd::ParameterMetadata > & parametersInfo, EventsCodeGenerationContext & context, std::vector < std::pair<gd::String, gd::String> > * supplementaryParametersTypes)
{
vector<gd::String> arguments;
while(parameters.size() < parametersInfo.size())
parameters.push_back(gd::Expression(""));
for (std::size_t pNb = 0;pNb < parametersInfo.size() && pNb < parameters.size();++pNb)
{
if ( parameters[pNb].GetPlainString().empty() && parametersInfo[pNb].optional )
parameters[pNb] = gd::Expression(parametersInfo[pNb].defaultValue);
gd::String argOutput = GenerateParameterCodes(parameters[pNb].GetPlainString(), parametersInfo[pNb], context,
pNb == 0 ? "" : parameters[pNb-1].GetPlainString(), supplementaryParametersTypes);
arguments.push_back(argOutput);
}
return arguments;
}
gd::String EventsCodeGenerator::GenerateObjectsDeclarationCode(EventsCodeGenerationContext & context)
{
gd::String declarationsCode;
for ( set<gd::String>::iterator it = context.objectsListsToBeDeclared.begin() ; it != context.objectsListsToBeDeclared.end(); ++it )
{
if ( context.alreadyDeclaredObjectsLists.find(*it) == context.alreadyDeclaredObjectsLists.end() )
{
declarationsCode += "std::vector<RuntimeObject*> "+GetObjectListName(*it, context)
+" = runtimeContext->GetObjectsRawPointers(\""+ConvertToString(*it)+"\");\n";
context.alreadyDeclaredObjectsLists.insert(*it);
}
else
{
//Could normally be done in one line, but clang sometimes miscompile it.
declarationsCode += "std::vector<RuntimeObject*> & "+GetObjectListName(*it, context)+"T = "+GetObjectListName(*it, context)+";\n";
declarationsCode += "std::vector<RuntimeObject*> "+GetObjectListName(*it, context)+" = "+GetObjectListName(*it, context)+"T;\n";
}
}
for ( set<gd::String>::iterator it = context.emptyObjectsListsToBeDeclared.begin() ; it != context.emptyObjectsListsToBeDeclared.end(); ++it )
{
if ( context.alreadyDeclaredObjectsLists.find(*it) == context.alreadyDeclaredObjectsLists.end() )
{
declarationsCode += "std::vector<RuntimeObject*> "+GetObjectListName(*it, context)+";\n";
context.alreadyDeclaredObjectsLists.insert(*it);
}
else
{
//Could normally be done in one line, but clang sometimes miscompile it.
declarationsCode += "std::vector<RuntimeObject*> & "+GetObjectListName(*it, context)+"T = "+GetObjectListName(*it, context)+";\n";
declarationsCode += "std::vector<RuntimeObject*> "+GetObjectListName(*it, context)+" = "+GetObjectListName(*it, context)+"T;\n";
}
}
return declarationsCode ;
}
/**
* Generate events list code.
*/
gd::String EventsCodeGenerator::GenerateEventsListCode(gd::EventsList & events, const EventsCodeGenerationContext & parentContext)
{
gd::String output;
for ( std::size_t eId = 0; eId < events.size();++eId )
{
//Each event has its own context : Objects picked in an event are totally different than the one picked in another.
gd::EventsCodeGenerationContext context;
context.InheritsFrom(parentContext); //Events in the same "level" share the same context as their parent.
gd::String eventCoreCode = events[eId].GenerateEventCode(*this, context);
gd::String scopeBegin = GenerateScopeBegin(context);
gd::String scopeEnd = GenerateScopeEnd(context);
gd::String declarationsCode = GenerateObjectsDeclarationCode(context);
output += "\n"+ scopeBegin +"\n" + declarationsCode + "\n" + eventCoreCode + "\n"+ scopeEnd +"\n";
}
return output;
}
gd::String EventsCodeGenerator::ConvertToString(gd::String plainString)
{
for (size_t i = 0;i<plainString.length();++i)
{
if ( plainString[i] == '\\' )
{
if ( i+1 >= plainString.length() || plainString[i+1] != '\"' )
{
if ( i+1 < plainString.length() )
plainString.insert(i+1, "\\");
else
plainString += ("\\");
++i;
}
}
else if ( plainString[i] == '"' )
{
plainString.insert(i, "\\");
++i;
}
}
plainString = plainString.FindAndReplace("\n", "\\n");
return plainString;
}
gd::String EventsCodeGenerator::ConvertToStringExplicit(gd::String plainString)
{
return "\""+ConvertToString(plainString)+"\"";
}
std::vector<gd::String> EventsCodeGenerator::ExpandObjectsName(const gd::String & objectName, const EventsCodeGenerationContext & context) const
{
std::vector<gd::String> realObjects;
vector< gd::ObjectGroup >::const_iterator globalGroup = find_if(project.GetObjectGroups().begin(),
project.GetObjectGroups().end(),
bind2nd(gd::GroupHasTheSameName(), objectName));
vector< gd::ObjectGroup >::const_iterator sceneGroup = find_if(scene.GetObjectGroups().begin(),
scene.GetObjectGroups().end(),
bind2nd(gd::GroupHasTheSameName(), objectName));
if ( globalGroup != project.GetObjectGroups().end() )
realObjects = (*globalGroup).GetAllObjectsNames();
else if ( sceneGroup != scene.GetObjectGroups().end() )
realObjects = (*sceneGroup).GetAllObjectsNames();
else
realObjects.push_back(objectName);
//If current object is present, use it and only it.
if ( find(realObjects.begin(), realObjects.end(), context.GetCurrentObject()) != realObjects.end() )
{
realObjects.clear();
realObjects.push_back(context.GetCurrentObject());
}
//Ensure that all returned objects actually exists.
for (std::size_t i = 0; i < realObjects.size();)
{
if ( !scene.HasObjectNamed(realObjects[i]) && !project.HasObjectNamed(realObjects[i]) )
realObjects.erase(realObjects.begin()+i);
else
++i;
}
return realObjects;
}
void EventsCodeGenerator::DeleteUselessEvents(gd::EventsList & events)
{
for ( std::size_t eId = events.size()-1; eId < events.size();--eId )
{
if ( events[eId].CanHaveSubEvents() ) //Process sub events, if any
DeleteUselessEvents(events[eId].GetSubEvents());
if ( !events[eId].IsExecutable() || events[eId].IsDisabled() ) //Delete events that are not executable
events.RemoveEvent(eId);
}
}
/**
* Call preprocessing method of each event
*/
void EventsCodeGenerator::PreprocessEventList(gd::EventsList & listEvent)
{
for ( std::size_t i = 0;i < listEvent.GetEventsCount();++i )
{
listEvent[i].Preprocess(*this, listEvent, i);
if ( i < listEvent.GetEventsCount() ) { //Be sure that that there is still an event! ( Preprocess can remove it. )
if ( listEvent[i].CanHaveSubEvents() )
PreprocessEventList( listEvent[i].GetSubEvents());
}
}
}
void EventsCodeGenerator::ReportError()
{
errorOccurred = true;
}
gd::String EventsCodeGenerator::GenerateObjectFunctionCall(gd::String objectListName,
const gd::ObjectMetadata & objMetadata,
const gd::ExpressionCodeGenerationInformation & codeInfo,
gd::String parametersStr,
gd::String defaultOutput,
gd::EventsCodeGenerationContext & context)
{
return "TODO (GenerateObjectFunctionCall)";
}
gd::String EventsCodeGenerator::GenerateObjectBehaviorFunctionCall(gd::String objectListName,
gd::String behaviorName,
const gd::BehaviorMetadata & autoInfo,
const gd::ExpressionCodeGenerationInformation & codeInfo,
gd::String parametersStr,
gd::String defaultOutput,
gd::EventsCodeGenerationContext & context)
{
return "TODO (GenerateObjectBehaviorFunctionCall)";
}
gd::String EventsCodeGenerator::GenerateFreeCondition(const std::vector<gd::String> & arguments,
const gd::InstructionMetadata & instrInfos,
const gd::String & returnBoolean,
bool conditionInverted,
gd::EventsCodeGenerationContext & context)
{
//Generate call
gd::String predicat;
if ( instrInfos.codeExtraInformation.type == "number" || instrInfos.codeExtraInformation.type == "string")
{
predicat = GenerateRelationalOperatorCall(instrInfos, arguments, instrInfos.codeExtraInformation.functionCallName);
}
else
{
gd::String argumentsStr;
for (std::size_t i = 0;i<arguments.size();++i)
{
if ( i != 0 ) argumentsStr += ", ";
argumentsStr += arguments[i];
}
predicat = instrInfos.codeExtraInformation.functionCallName+"("+argumentsStr+")";
}
//Add logical not if needed
bool conditionAlreadyTakeCareOfInversion = false;
for (std::size_t i = 0;i<instrInfos.parameters.size();++i) //Some conditions already have a "conditionInverted" parameter
{
if( instrInfos.parameters[i].type == "conditionInverted" )
conditionAlreadyTakeCareOfInversion = true;
}
if (!conditionAlreadyTakeCareOfInversion && conditionInverted) predicat = GenerateNegatedPredicat(predicat);
//Generate condition code
return returnBoolean+" = "+predicat+";\n";
}
gd::String EventsCodeGenerator::GenerateObjectCondition(const gd::String & objectName,
const gd::ObjectMetadata & objInfo,
const std::vector<gd::String> & arguments,
const gd::InstructionMetadata & instrInfos,
const gd::String & returnBoolean,
bool conditionInverted,
gd::EventsCodeGenerationContext & context)
{
//Prepare call
//Add a static_cast if necessary
gd::String objectFunctionCallNamePart =
( !instrInfos.parameters[0].supplementaryInformation.empty() ) ?
"static_cast<"+objInfo.className+"*>("+GetObjectListName(objectName, context)+"[i])->"+instrInfos.codeExtraInformation.functionCallName
: GetObjectListName(objectName, context)+"[i]->"+instrInfos.codeExtraInformation.functionCallName;
//Create call
gd::String predicat;
if ( (instrInfos.codeExtraInformation.type == "number" || instrInfos.codeExtraInformation.type == "string") )
{
predicat = GenerateRelationalOperatorCall(instrInfos, arguments, objectFunctionCallNamePart, 1);
}
else
{
gd::String argumentsStr;
for (std::size_t i = 1;i<arguments.size();++i)
{
if ( i != 1 ) argumentsStr += ", ";
argumentsStr += arguments[i];
}
predicat = objectFunctionCallNamePart+"("+argumentsStr+")";
}
if ( conditionInverted ) predicat = GenerateNegatedPredicat(predicat);
return "For each picked object \""+objectName+"\", check "+predicat+".\n";
}
gd::String EventsCodeGenerator::GenerateBehaviorCondition(const gd::String & objectName,
const gd::String & behaviorName,
const gd::BehaviorMetadata & autoInfo,
const std::vector<gd::String> & arguments,
const gd::InstructionMetadata & instrInfos,
const gd::String & returnBoolean,
bool conditionInverted,
gd::EventsCodeGenerationContext & context)
{
//Create call
gd::String predicat;
if ( (instrInfos.codeExtraInformation.type == "number" || instrInfos.codeExtraInformation.type == "string") )
{
predicat = GenerateRelationalOperatorCall(instrInfos, arguments, "", 2);
}
else
{
gd::String argumentsStr;
for (std::size_t i = 2;i<arguments.size();++i)
{
if ( i != 2 ) argumentsStr += ", ";
argumentsStr += arguments[i];
}
predicat = "("+argumentsStr+")";
}
if ( conditionInverted ) predicat = GenerateNegatedPredicat(predicat);
return "For each picked object \""+objectName+"\", check "+predicat+" for behavior \""+behaviorName+"\".\n";
}
gd::String EventsCodeGenerator::GenerateFreeAction(const std::vector<gd::String> & arguments, const gd::InstructionMetadata & instrInfos,
gd::EventsCodeGenerationContext & context)
{
//Generate call
gd::String call;
if ( instrInfos.codeExtraInformation.type == "number" || instrInfos.codeExtraInformation.type == "string" )
{
if ( instrInfos.codeExtraInformation.accessType == gd::InstructionMetadata::ExtraInformation::MutatorAndOrAccessor )
call = GenerateOperatorCall(instrInfos, arguments, instrInfos.codeExtraInformation.functionCallName, instrInfos.codeExtraInformation.optionalAssociatedInstruction);
else
call = GenerateCompoundOperatorCall(instrInfos, arguments, instrInfos.codeExtraInformation.functionCallName);
}
else
{
gd::String argumentsStr;
for (std::size_t i = 0;i<arguments.size();++i)
{
if ( i != 0 ) argumentsStr += ", ";
argumentsStr += arguments[i];
}
call = instrInfos.codeExtraInformation.functionCallName+"("+argumentsStr+")";
}
return call+";\n";
}
gd::String EventsCodeGenerator::GenerateObjectAction(const gd::String & objectName,
const gd::ObjectMetadata & objInfo,
const std::vector<gd::String> & arguments,
const gd::InstructionMetadata & instrInfos,
gd::EventsCodeGenerationContext & context)
{
//Create call
gd::String call;
if ( (instrInfos.codeExtraInformation.type == "number" || instrInfos.codeExtraInformation.type == "string") )
{
if ( instrInfos.codeExtraInformation.accessType == gd::InstructionMetadata::ExtraInformation::MutatorAndOrAccessor )
call = GenerateOperatorCall(instrInfos, arguments, instrInfos.codeExtraInformation.functionCallName, instrInfos.codeExtraInformation.optionalAssociatedInstruction,2);
else
call = GenerateCompoundOperatorCall(instrInfos, arguments, instrInfos.codeExtraInformation.functionCallName,2);
return "For each picked object \""+objectName+"\", call "+call+".\n";
}
else
{
gd::String argumentsStr;
for (std::size_t i = 2;i<arguments.size();++i)
{
if ( i != 2 ) argumentsStr += ", ";
argumentsStr += arguments[i];
}
call = instrInfos.codeExtraInformation.functionCallName+"("+argumentsStr+")";
return "For each picked object \""+objectName+"\", call "+call+"("+argumentsStr+").\n";
}
}
gd::String EventsCodeGenerator::GenerateBehaviorAction(const gd::String & objectName,
const gd::String & behaviorName,
const gd::BehaviorMetadata & autoInfo,
const std::vector<gd::String> & arguments,
const gd::InstructionMetadata & instrInfos,
gd::EventsCodeGenerationContext & context)
{
//Create call
gd::String call;
if ( (instrInfos.codeExtraInformation.type == "number" || instrInfos.codeExtraInformation.type == "string") )
{
if ( instrInfos.codeExtraInformation.accessType == gd::InstructionMetadata::ExtraInformation::MutatorAndOrAccessor )
call = GenerateOperatorCall(instrInfos, arguments, instrInfos.codeExtraInformation.functionCallName, instrInfos.codeExtraInformation.optionalAssociatedInstruction,2);
else
call = GenerateCompoundOperatorCall(instrInfos, arguments, instrInfos.codeExtraInformation.functionCallName,2);
return "For each picked object \""+objectName+"\", call "+call
+" for behavior \""+behaviorName+"\".\n";
}
else
{
gd::String argumentsStr;
for (std::size_t i = 2;i<arguments.size();++i)
{
if ( i != 2 ) argumentsStr += ", ";
argumentsStr += arguments[i];
}
call = instrInfos.codeExtraInformation.functionCallName+"("+argumentsStr+")";
return "For each picked object \""+objectName+"\", call "+call+"("+argumentsStr+")"
+" for behavior \""+behaviorName+"\".\n";
}
}
gd::String EventsCodeGenerator::GetObjectListName(const gd::String & name, const gd::EventsCodeGenerationContext & context)
{
return ManObjListName(name);
}
EventsCodeGenerator::EventsCodeGenerator(gd::Project & project_, const gd::Layout & layout, const gd::Platform & platform_) :
project(project_),
scene(layout),
platform(platform_),
errorOccurred(false),
compilationForRuntime(false),
maxCustomConditionsDepth(0),
maxConditionsListsSize(0)
{
};
}

View File

@@ -1,474 +0,0 @@
#ifndef GDCORE_EVENTSCODEGENERATOR_H
#define GDCORE_EVENTSCODEGENERATOR_H
#include "GDCore/Events/Event.h"
#include "GDCore/Events/Instruction.h"
#include "GDCore/String.h"
#include <vector>
#include <set>
#include <utility>
namespace gd { class EventsList; }
namespace gd { class Expression; }
namespace gd { class Project; }
namespace gd { class Layout; }
namespace gd { class ExternalEvents; }
namespace gd { class ParameterMetadata; }
namespace gd { class ObjectMetadata; }
namespace gd { class BehaviorMetadata; }
namespace gd { class InstructionMetadata; }
namespace gd { class EventsCodeGenerationContext; }
namespace gd { class ExpressionCodeGenerationInformation; }
namespace gd { class InstructionMetadata;}
namespace gd { class Platform;}
namespace gd
{
/**
* \brief Internal class used to generate code from events
* \todo For now, this class generates only C++ code for GD C++ Platform.
*
* \see CallbacksForGeneratingExpressionCode
*/
class GD_CORE_API EventsCodeGenerator
{
friend class CallbacksForGeneratingExpressionCode;
public:
/**
* \brief Remove non executable events from the event list.
*/
static void DeleteUselessEvents(gd::EventsList & events);
/**
* \brief Construct a code generator for the specified platform/project/layout.
*/
EventsCodeGenerator(gd::Project & project_, const gd::Layout & layout, const gd::Platform & platform_);
virtual ~EventsCodeGenerator() {};
/**
* \brief Preprocess an events list ( Replacing for example links with the linked event ).
*
* This should be called before any code generation.
*/
void PreprocessEventList(gd::EventsList & listEvent);
/**
* \brief Generate code for executing an event list
*
* \param events std::vector of events
* \param context Context used for generation
* \return C++ code
*/
gd::String GenerateEventsListCode(gd::EventsList & events, const EventsCodeGenerationContext & context);
/**
* \brief Generate code for executing a condition list
*
* The default implementation create the condition calls using C-style ifs and booleans.
*
* \param game Game used
* \param scene Scene used
* \param conditions std::vector of conditions
* \param context Context used for generation
* \return Code. Boolean containing conditions result are name conditionXIsTrue, with X = the number of the condition, starting from 0.
*/
virtual gd::String GenerateConditionsListCode(gd::InstructionsList & conditions, EventsCodeGenerationContext & context);
/**
* \brief Generate code for executing an action list
*
* The default implementation just calls repeatedly GenerateActionCode.
*
* \param game Game used
* \param scene Scene used
* \param actions std::vector of actions
* \param context Context used for generation
* \return Code
*/
virtual gd::String GenerateActionsListCode(gd::InstructionsList & actions, EventsCodeGenerationContext & context);
/**
* \brief Generate the code for a parameter of an action/condition/expression.
*
* This method uses GenerateParameterCodes to generate the parameters code.
*
* \param scene Scene used
* \param parameters std::vector of actual parameters.
* \param parametersInfo std::vector of information about parameters
* \param context Context used for generation
* \param supplementaryParametersTypes Optional std::vector of new parameters types ( std::vector of pair<gd::String,gd::String>("type", "valueToBeInserted") )
*
*/
std::vector<gd::String> GenerateParametersCodes(std::vector < gd::Expression > parameters,
const std::vector < gd::ParameterMetadata > & parametersInfo,
EventsCodeGenerationContext & context,
std::vector < std::pair<gd::String, gd::String> > * supplementaryParametersTypes = 0);
/**
* \brief Generate code for a single condition.
*
* The generation is really done in GenerateFreeCondition/GenerateObjectCondition or GenerateBehaviorCondition.
*
* \param condition instruction to be done.
* \param returnBoolean The name of the boolean that must contains the condition result.
* \param context Context used for generation
* \return Code
*/
gd::String GenerateConditionCode(gd::Instruction & condition, gd::String returnBoolean, EventsCodeGenerationContext & context);
/**
* \brief Generate code for a single action
*
* The generation is really done in GenerateFreeAction/GenerateObjectAction or GenerateBehaviorAction.
*
* \param condition instruction to be done.
* \param context Context used for generation
* \return Code
*/
gd::String GenerateActionCode(gd::Instruction & action, EventsCodeGenerationContext & context);
/**
* \brief Generate code for declaring objects lists.
*
* This method is used for each event.
*
* \param context The context to be used.
*/
virtual gd::String GenerateObjectsDeclarationCode(EventsCodeGenerationContext & context);
/**
* \brief Must convert a plain string ( with line feed, quotes ) to a string that can be inserted into code.
*
* \note It is the caller responsibility to add proper code need to create a full string.
*
* Usage example :
* \code
code += "gd::String(\""+codeGenerator.ConvertToString(name)+"\")";
/ \endcode
*
* \param plainString The string to convert
* \return plainString which can be included into the generated code.
*/
virtual gd::String ConvertToString(gd::String plainString);
/**
* \brief Convert a plain string ( with line feed, quotes ) to a string that can be inserted into code.
* The string construction must be explicit : for example, quotes must be added if the target language need quotes.
*
* Usage example :
\code
code += codeGenerator.ConvertToStringExplicit(name);
\endcode
*
* \note The default implementation simply call ConvertToString and add quotes
*
* \param plainString The string to convert
* \return plainString which can be included into the generated code.
*/
virtual gd::String ConvertToStringExplicit(gd::String plainString);
/**
* \brief Declare an include file to be added
* \note The way includes files are used may vary depending on the platform:
* - On GD C++ Platform, the includes files are added in the #include directives of the generated code.
* - On GD JS Platform, the includes files are added in the list of JS files in the index file.
*/
void AddIncludeFile(gd::String file) { if ( !file.empty() ) includeFiles.insert(file); };
/**
* \brief Declare a list of include files to be added
* \see gd::EventsCodeGenerator::AddIncludeFile
*/
void AddIncludeFiles(std::vector<gd::String> files) { for(std::size_t i = 0;i<files.size();++i) AddIncludeFile(files[i]); };
/**
* \brief Add a declaration which will be inserted after includes
*/
void AddGlobalDeclaration(gd::String declaration) { customGlobalDeclaration.insert(declaration); };
/**
* \brief Add some code before events outside the main function.
*/
void AddCustomCodeOutsideMain(gd::String code) { customCodeOutsideMain += code; };
/**
* \brief Add some code before events in the main function.
*/
void AddCustomCodeInMain(gd::String code) { customCodeInMain += code; };
/** \brief Get the set containing the include files.
*/
const std::set<gd::String> & GetIncludeFiles() const { return includeFiles; }
/** \brief Get the custom code to be inserted outside main.
*/
const gd::String & GetCustomCodeOutsideMain() const { return customCodeOutsideMain; }
/** \brief Get the custom code to be inserted inside main function.
*/
const gd::String & GetCustomCodeInMain() const { return customCodeInMain; }
/** \brief Get the custom declaration to be inserted after includes.
*/
const std::set<gd::String> & GetCustomGlobalDeclaration() const { return customGlobalDeclaration; }
/**
* \brief Return true if code generation is made for runtime only.
*/
bool GenerateCodeForRuntime() { return compilationForRuntime; }
/**
* \brief Set if the code generated is meant to be used for runtime only and not in the IDE.
*/
void SetGenerateCodeForRuntime(bool compilationForRuntime_) { compilationForRuntime = compilationForRuntime_; }
/**
* \brief Report that an error occurred during code generation ( Event code won't be generated )
*/
void ReportError();
/**
* \brief Return true if an error has occurred during code generation ( in this case, generated code is not usable )
*/
bool ErrorOccurred() const { return errorOccurred; };
/**
* \brief Get the project the code is being generated for.
*/
gd::Project & GetProject() const { return project; }
/**
* \brief Get the layout the code is being generated for.
*/
const gd::Layout & GetLayout() const { return scene; }
/**
* \brief Get the platform the code is being generated for.
*/
const gd::Platform & GetPlatform() const { return platform; }
/**
* \brief Convert a group name to the full list of objects contained in the 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 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 an action... ),
* none of the two rules below apply, and the list will only contains the context "current" object name.
*/
std::vector<gd::String> ExpandObjectsName(const gd::String & objectName, const EventsCodeGenerationContext & context) const;
/**
* \brief Get the maximum depth of custom conditions reached during code generation.
*/
size_t GetMaxCustomConditionsDepth() const { return maxCustomConditionsDepth; }
/**
* \brief Get the maximum size of a list of conditions.
*/
size_t GetMaxConditionsListsSize() const { return maxConditionsListsSize; }
/**
* \brief Generate the full name for accessing to a boolean variable used for conditions.
*
* Default implementation just returns the boolean name passed as argument.
*/
virtual gd::String GenerateBooleanFullName(const gd::String & boolName, const gd::EventsCodeGenerationContext & context ) { return boolName; }
/**
* \brief Must create a boolean. Its value must be false.
*
* The default implementation generates C-style code.
*/
virtual gd::String GenerateBooleanInitializationToFalse(const gd::String & boolName,
const gd::EventsCodeGenerationContext & context) { return "bool "+boolName+" = false;\n";}
/**
* \brief Get the full name for accessing to a list of objects
*
* Default implementation simply returns the name mangled using gd::EventsCodeNameMangler.
*/
virtual gd::String GetObjectListName(const gd::String & name, const gd::EventsCodeGenerationContext & context);
protected:
/**
* \brief Generate the code for a single parameter.
*
* Standard supported parameters type, and how they are used in code:
*
* - object : Object name -> string
* - expression : Mathematical expression -> number (double)
* - string : %Text expression -> string
* - layer, color, file, joyaxis : Same as string
* - relationalOperator : Used to make a comparison between the function resturn value and value of the parameter preceding the relationOperator parameter -> string
* - operator : Used to update a value using a setter and a getter -> string
* - key, mouse, objectvar, scenevar, globalvar, password, musicfile, soundfile, police -> string
* - trueorfalse, yesorno -> boolean ( See GenerateTrue/GenerateFalse ).
*
* <br><br>
* "Code only" parameters types:
* - inlineCode: supplementary information associated with the parameter is directly pasted in the code without change.
*
* <br><br>
* Other standard parameters type that should be implemented by platforms:
* - currentScene: Reference to the current runtime scene.
* - objectList : a map containing lists of objects which are specified by the object name in another parameter. (C++: std::map <gd::String, std::vector<RuntimeObject*> *>). Example:
* \code
AddExpression("Count", _("Object count"), _("Count the number of picked objects"), _("Objects"), "res/conditions/nbObjet.png")
.AddParameter("objectList", _("Object"))
.SetFunctionName("PickedObjectsCount").SetIncludeFile("GDCpp/BuiltinExtensions/ObjectTools.h");
* \endcode
* - objectListWithoutPicking : Same as objectList but do not pick object if they are not already picked.
* - objectPtr : Return a pointer to object specified by the object name in another parameter ( C++: RuntimeObject* ). Example:
* \code
.AddParameter("object", _("Object"))
.AddParameter("objectPtr", _("Target object"))
//The called function will be called with this signature on the C++ platform: Function(gd::String, RuntimeObject*)
* \endcode
*/
virtual gd::String GenerateParameterCodes(const gd::String & parameter, const gd::ParameterMetadata & metadata,
gd::EventsCodeGenerationContext & context,
const gd::String & previousParameter,
std::vector < std::pair<gd::String, gd::String> > * supplementaryParametersTypes);
/**
* \brief Call a function of the current object.
* \note The current object is the object being manipulated by a condition or an action.
*
* \param objectListName The full name of the object list being used
* \param objMetadata Metadata about the object being used.
* \param functionCallName The function to be called on this object.
* \param parametersStr The parameters of the function
* \param context The context : May be used to get information about the current scope.
*/
virtual gd::String GenerateObjectFunctionCall(gd::String objectListName,
const ObjectMetadata & objMetadata,
const gd::ExpressionCodeGenerationInformation & codeInfo,
gd::String parametersStr,
gd::String defaultOutput,
gd::EventsCodeGenerationContext & context);
/**
* \brief Call a function of a behavior of the current object.
* \note The current object is the object being manipulated by a condition or an action.
*
* \param objectListName The full name of the object list being used
* \param behaviorName The full name of the behavior to be used
* \param objMetadata Metadata about the behavior being used.
* \param functionCallName The function to be called on this object.
* \param parametersStr The parameters of the function
* \param context The context : May be used to get information about the current scope.
*/
virtual gd::String GenerateObjectBehaviorFunctionCall(gd::String objectListName,
gd::String behaviorName,
const gd::BehaviorMetadata & autoInfo,
const gd::ExpressionCodeGenerationInformation & codeInfo,
gd::String parametersStr,
gd::String defaultOutput,
gd::EventsCodeGenerationContext & context);
/**
* \brief Called when a new scope must be entered.
* \param context The context : Internal events of the scope have been generated, but GenerateObjectsDeclarationCode was not called.
* \param extraVariable An optional supplementary variable that should be inherited from the parent scope.
*/
virtual gd::String GenerateScopeBegin(gd::EventsCodeGenerationContext & context, const gd::String & extraVariable = "") { return "{\n"; };
/**
* \brief Called when a new must be ended.
* \param context The context : Internal events of the scope have been generated, but GenerateObjectsDeclarationCode was not called.
* \param extraVariable An optional supplementary variable that should be inherited from the parent scope.
*/
virtual gd::String GenerateScopeEnd(gd::EventsCodeGenerationContext & context, const gd::String & extraVariable = "") { return "}\n"; };
/**
* \brief Must negate a predicat.
*
* The default implementation generates C-style code : It wraps the predicat inside parenthesis and add a !.
*/
virtual gd::String GenerateNegatedPredicat(const gd::String & predicat) const { return "!("+predicat+")"; };
/**
* \brief Must create a boolean which is a reference to a boolean declared in the parent scope.
*
* The default implementation generates C-style code.
*/
virtual gd::String GenerateReferenceToUpperScopeBoolean(const gd::String & referenceName,
const gd::String & referencedBoolean,
gd::EventsCodeGenerationContext & context) { return "bool & "+referenceName+" = "+referencedBoolean+";\n";}
virtual gd::String GenerateFreeCondition(const std::vector<gd::String> & arguments,
const gd::InstructionMetadata & instrInfos,
const gd::String & returnBoolean,
bool conditionInverted,
gd::EventsCodeGenerationContext & context);
virtual gd::String GenerateObjectCondition(const gd::String & objectName,
const gd::ObjectMetadata & objInfo,
const std::vector<gd::String> & arguments,
const gd::InstructionMetadata & instrInfos,
const gd::String & returnBoolean,
bool conditionInverted,
gd::EventsCodeGenerationContext & context);
virtual gd::String GenerateBehaviorCondition(const gd::String & objectName,
const gd::String & behaviorName,
const gd::BehaviorMetadata & autoInfo,
const std::vector<gd::String> & arguments,
const gd::InstructionMetadata & instrInfos,
const gd::String & returnBoolean,
bool conditionInverted,
gd::EventsCodeGenerationContext & context);
virtual gd::String GenerateFreeAction(const std::vector<gd::String> & arguments,
const gd::InstructionMetadata & instrInfos,
gd::EventsCodeGenerationContext & context);
virtual gd::String GenerateObjectAction(const gd::String & objectName,
const gd::ObjectMetadata & objInfo,
const std::vector<gd::String> & arguments,
const gd::InstructionMetadata & instrInfos,
gd::EventsCodeGenerationContext & context);
virtual gd::String GenerateBehaviorAction(const gd::String & objectName,
const gd::String & behaviorName,
const gd::BehaviorMetadata & autoInfo,
const std::vector<gd::String> & arguments,
const gd::InstructionMetadata & instrInfos,
gd::EventsCodeGenerationContext & context);
gd::String GenerateRelationalOperatorCall(const gd::InstructionMetadata & instrInfos, const std::vector<gd::String> & arguments, const gd::String & callStartString, std::size_t startFromArgument = 0);
gd::String GenerateOperatorCall(const gd::InstructionMetadata & instrInfos, const std::vector<gd::String> & arguments, const gd::String & callStartString, const gd::String & getterStartString, std::size_t startFromArgument = 0);
gd::String GenerateCompoundOperatorCall(const gd::InstructionMetadata & instrInfos, const std::vector<gd::String> & arguments, const gd::String & callStartString, std::size_t startFromArgument = 0);
/**
* \brief Must return an expression whose value is true.
*/
gd::String GenerateTrue() const { return "true"; };
/**
* \brief Must return an expression whose value is false.
*/
gd::String GenerateFalse() const { return "false"; };
gd::Project & project; ///< The project being used.
const gd::Layout & scene; ///< The scene being generated.
const gd::Platform & platform; ///< The platform being used.
bool errorOccurred; ///< Must be set to true if an error occured.
bool compilationForRuntime; ///< Is set to true if the code generation is made for runtime only.
std::set<gd::String> includeFiles; ///< List of headers files used by instructions. A (shared) pointer is used so as context created from another one can share the same list.
gd::String customCodeOutsideMain; ///< Custom code inserted before events ( and not in events function )
gd::String customCodeInMain; ///< Custom code inserted before events ( in main function )
std::set<gd::String> customGlobalDeclaration; ///< Custom global C++ declarations inserted after includes
size_t maxCustomConditionsDepth; ///< The maximum depth value for all the custom conditions created.
size_t maxConditionsListsSize; ///< The maximum size of a list of conditions.
};
}
#endif // GDCORE_EVENTSCODEGENERATOR_H

View File

@@ -1,13 +1,13 @@
/*
* GDevelop Core
* Copyright 2008-2015 Florian Rival (Florian.Rival@gmail.com). All rights reserved.
* Copyright 2008-2016 Florian Rival (Florian.Rival@gmail.com). All rights reserved.
* This project is released under the MIT License.
*/
#include "EventsList.h"
#include "GDCore/Events/Event.h"
#include "GDCore/Tools/Log.h"
#include "GDCore/PlatformDefinition/Project.h"
#include "GDCore/Project/Project.h"
#include "Serialization.h"
namespace gd

View File

@@ -1,6 +1,6 @@
/*
* GDevelop Core
* Copyright 2008-2015 Florian Rival (Florian.Rival@gmail.com). All rights reserved.
* Copyright 2008-2016 Florian Rival (Florian.Rival@gmail.com). All rights reserved.
* This project is released under the MIT License.
*/
#if defined(GD_IDE_ONLY)
@@ -74,6 +74,11 @@ public:
*/
std::shared_ptr<BaseEvent> GetEventSmartPtr(size_t index) { return events[index]; };
/**
* \brief Return the smart pointer to the event at position \a index in the events list.
*/
std::shared_ptr<const BaseEvent> GetEventSmartPtr(size_t index) const { return events[index]; };
/**
* \brief Return a reference to the event at position \a index in the events list.
*/

Some files were not shown because too many files have changed in this diff Show More