Compare commits

...

183 Commits

Author SHA1 Message Date
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
878 changed files with 95863 additions and 154673 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

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

@@ -26,4 +26,18 @@
/>
</dependentAssembly>
</dependency>
<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
<application>
<!-- Windows 10 -->
<supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}"/>
<!-- 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>

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

File diff suppressed because it is too large Load Diff

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

File diff suppressed because it is too large Load Diff

13255
Binaries/Output/Release_Windows/locale/fi_FI/GD.po Executable file → Normal file

File diff suppressed because it is too large Load Diff

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

File diff suppressed because it is too large Load Diff

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

File diff suppressed because it is too large Load Diff

13248
Binaries/Output/Release_Windows/locale/nl_NL/GD.po Executable file → Normal file

File diff suppressed because it is too large Load Diff

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

File diff suppressed because it is too large Load Diff

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

File diff suppressed because it is too large Load Diff

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

File diff suppressed because it is too large Load Diff

17479
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,7 +13,7 @@ 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

View File

@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="ISO-8859-1" ?>
<News>
<Version Major="4" Minor="0" Build="88" Revision="0"/>
<Info Info="La version 4.0.88 est disponible.&#x0A;&#x0A;Importants changements en interne pour supporter l'Unicode dans les jeux, c'est <20> dire la possibilit<69> de pouvoir utiliser des charact<63>res de d'autres alphabets.&#x0A;Nouvel objet AdMob, pour afficher des banni<6E>res publicitaires (ou <20>crans interstitiels) dans les jeux HTML5 export<72>s sur Android/iOS avec Intel XDK.&#x0A;Les automatismes sont maintenant appel<65>s des Comportements (Behavior en anglais).&#x0A;Nouvelle fonctionnalit<69>, la 'pile de sc<73>nes' : une nouvelle action permet de mettre en pause la sc<73>ne courante et d'en lancer une autre. On peut ensuite revenir <20> la sc<73>ne pr<70>c<EFBFBD>dente avec une autre action. Id<49>al pour faire des menus de pause, des <20>crans de combats, des <20>crans d'int<6E>rieurs de batiments..&#x0A;Am<41>lioration de l'export des jeux HTML5 pour Cordova/Intel XDK.&#x0A;Nouvel <20>diteur pour les objets textes&#x0A;Ajout de la fonctionnalit<69> 'Sauvegarder en tant que projet dossier': les projets peuvent <20>tre sauvegard<72>s avec les sc<73>nes, <20>v<EFBFBD>nements externes et agencements externes sauvegard<72>s dans diff<66>rents fichiers. Cela rend beaucoup plus facile la collaboration dans une <20>quipe.&#x0A;L'appui sur Shift dans l'<27>diteur de sc<73>ne permet de redimensionner un objet en gardant ses proportions.&#x0A;L'appui sur Shift dans l'<27>diteur de sc<73>ne permet de tourner un objet par incr<63>ment r<>guliers de 15 degr<67>s.&#x0A;La grille aimant<6E>e de l'<27>diteur de sc<73>ne s'applique aussi lors du redimensionnement d'objets.&#x0A;Am<41>lioration de l'objet Carte de Tuiles, notamment une baisse de la consommation m<>moire pour les grandes cartes.&#x0A;Am<41>lioration pour les <20>crans haute d<>finition ('retina').&#x0A;Plusieurs corrections de bugs pour la recherche de chemin, qui devrait maintenant fonctionner correctement dans tous les cas.&#x0A;Correction de la recherche dans l'<27>diteur d'objets.&#x0A;Correction de la condition sur la bordure suppl<70>mentaire du comportement 'D<>truire <20> la sortie de l'<27>cran'&#x0A;Nouvel d<>mo utilisant les fonctionnalit<EFBFBD>s Javascript 'PIXI Particles'&#x0A;Correction dans l'<27>diteur de sc<73>ne o<> les objets sur des calques cach<63>s pouvaient encore <20>tre selectionn<6E>s.&#x0A;Am<41>lioration et nettoyage du code en interne.&#x0A;Corrections pour Mac OS X dans l'<27>diteur de sc<73>ne.&#x0A;Suppression de la compilation en un fichier unique (trop instable et detect<63> comme un virus par certains antivirus).&#x0A;Ajout du support pour les molettes <20> d<>filement horizontal dans l'<27>diteur de sc<73>ne.&#x0A;Divers bugs corrig<69>s." Lien="http://compilgames.net"/>
<CommunityNews text="GDevApp est une web app de cr<EFBFBD>ation de jeux bas<EFBFBD>e sur GDevelop : venez essayer la plus avanc<EFBFBD>e des applications online de cr<EFBFBD>ation de jeux. Compatible avec les tablettes et fournie avec des superbes packs de graphismes pr<EFBFBD>-pr<EFBFBD>par<EFBFBD>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<EFBFBD>ation de jeux"/>
<Version Major="4" Minor="0" Build="89" Revision="0"/>
<Info Info="La version 4.0.89 est disponible.&#x0A;&#x0A;Ajout des traductions en Néerlandais et Finnois.&#x0A;Correction de la position par défaut des bannières AdMob.&#x0A;Amélioration et changements en interne.&#x0A;Correction de la condition 'Toujours' pour les jeux HTML5&#x0A;Correction d'un crash avec l'objet Carte de Tuiles lors de l'utilisation d'une image vide.&#x0A;Support de l'importation des fichiers TMX (créés avec Tiled Map Editor: http://www.mapeditor.org/) pour les objets Carte de Tuiles.&#x0A;Correction des actions de stockage qui n'enregistrait pas les données dans certaines conditions.&#x0A;Amélioration des performances de l'objet Panneau pour les jeux HTML5.&#x0A;Mise à jour du moteur de rendu des jeux HTML5 (pixi.js v3.0.8)&#x0A;Les fichiers Audio peuvent maintenant être ajoutés comme des ressources pour les précharger dans les jeux HTML5.&#x0A;Amélioration des performances des musiques des jeux HTML5 sur Android&#x0A;Correction pour les jeux natifs qui ne se lançaient pas dans les répertoires avec des caractères spéciaux.&#x0A;Correction de problèmes avec l'éditeur d'agencements externes.&#x0A;Correction d'une erreur 404 lors de l'aperçu de jeux HTML5 sur les distributions linux récentes." 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="4" Minor="0" Build="88" Revision="0"/>
<Info Info="Version 4.0.88 is available.&#x0A;&#x0A;Huge internal changes to have multi-language support ('Unicode') in games.&#x0A;New AdMob object, that can be used to display ad banners (or interstitial screens) in HTML5 games exported to iOS/Android with Intel XDK.&#x0A;Automatisms are now called Behaviors for objects (more intuitive and easier to understand).&#x0A;New scene stacking feature: a new action allows to pause the current scene and launch a new one. You can then go back to the previous one with another action. This makes it easy to create a pause menu, a RPG combat system, rooms/building that you enter from a map...&#x0A;Improved export of HTML5 games to Cordova/Intel XDK.&#x0A;New editor for text objects&#x0A;Add 'Save as a folder project': projects can be saved with scenes, external events and external layouts stored in a different file for each. This makes it easier to collaborate on a game as a team.&#x0A;Hold Shift in scene editor to resize object while keeping its aspect ratio.&#x0A;Hold Shift in scene editor to rotate an object in increments.&#x0A;'Snap to grid' now snaps objects when resizing them in scene editor.&#x0A;Improvements on TileMap objects, including a reduced memory consumption for large maps.&#x0A;Improvements for HDPI ('retina') screens.&#x0A;Several bugfixes for pathfinding that should now work properly in all cases.&#x0A;Fixed search not working in the objects editor.&#x0A;Fixed extra border condition of Destroy Outside Behavior.&#x0A;New PIXI Particles advanced Javascript demo.&#x0A;Fixed objects from hidden layers could still be selected and moved in scene editor&#x0A;Internal code cleaning and improvements.&#x0A;Fixes for Mac OS X in the scene editor.&#x0A;Removed compilation of native games to a single file executable (was too unstable and prone to antivirus blocking).&#x0A;Add support for horizontal mouse wheel in the scene editor.&#x0A;Fixed Vertical Synchronization and framerate limit not applied after changing the window resolution in native games&#x0A;Fix small bug in Destroy Outside behavior of HTML5 games&#x0A;Add an option to repeat borders and center textures of PanelSprite objects for HTML5 games&#x0A;Improve performances of PanelSprite objects for HTML5 games&#x0A;Fix hitboxes collision condition for HTML5 games&#x0A;Fix conflicts when exporting a game using different images with the same file name.&#x0A;Fix error when deactivating a behavior of an object that was just created.&#x0A;Fix scene editor not properly refreshed after being resized on OS X." Lien="http://compilgames.net"/>
<Version Major="4" Minor="0" Build="89" Revision="0"/>
<Info Info="Version 4.0.89 is available.&#x0A;&#x0A;Add complete Dutch translation&#x0A;Add Finnish translation&#x0A;Fix AdMob object banner default position being top of the screen&#x0A;Internal changes and improvements&#x0A;Fix 'Always' condition for HTML5 games&#x0A;Fix tilemap object crash when using an empty image&#x0A;Add support for importing TMX files (created with Tiled Map Editor: http://www.mapeditor.org/) in TiledMap objects.&#x0A;Fix storage actions not properly persisting values in some cases&#x0A;Improve performance of PanelSprite (9-patch) object for HTML5 games.&#x0A;Update the rendering engine of HTML5 games, pixi.js, to v3.0.8&#x0A;Audio files can be added as resources (like images) to preload them in HTML5 games&#x0A;Enhance performance of musics on Android&#x0A;Fix native games not launching properly when put in a directory containing unicode characters.&#x0A;Fix issues with external layouts editors.&#x0A;Wording fixes&#x0A;Fix 404 error when previewing a HTML5 game on recent linux distributions." 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

@@ -510,7 +510,7 @@
<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\BuiltinExtensions\SpriteExtension\Dialogs\SpriteObjectEditor.cpp" hdr="GDCore\Extensions\BuiltinExtensions\SpriteExtension\Dialogs\SpriteObjectEditor.h" fwddecl="0" i18n="1" name="SpriteObjectEditor" 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>

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
*
@@ -337,7 +337,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 +406,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 +499,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 +777,3 @@ extern "C" ExtensionBase * GD_EXTENSION_API CreateGDExtension() {
* \brief Part of the tinyxml library
* \ingroup TinyXml
*/

View File

@@ -19,11 +19,10 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsBaseObjectExtension(gd:
"Florian Rival",
"Open source (MIT License)");
gd::ObjectMetadata & obj = extension.AddObject("",
gd::ObjectMetadata & obj = extension.AddObject<gd::Object>("",
_("Base object"),
_("Base object"),
"res/objeticon24.png",
&CreateBaseObject);
"res/objeticon24.png");
#if defined(GD_IDE_ONLY)
obj.AddCondition("PosX",

View File

@@ -274,6 +274,20 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsCameraExtension(gd::Pla
.AddParameter("layer", _("Layer (base layer if empty)")).SetDefaultValue("\"\"")
.MarkAsAdvanced();
extension.AddAction("SetLayerEffectParameter",
_("Effect parameter"),
_("Change the parameter of an effect"),
_("Set _PARAM3_ to _PARAM4_ for effect _PARAM2_ of layer _PARAM1_"),
_("Layers and cameras/Effects"),
"res/conditions/camera24.png",
"res/conditions/camera.png")
.AddCodeOnlyParameter("currentScene", "")
.AddParameter("layer", _("Layer (base layer if empty)"), "",true).SetDefaultValue("\"\"")
.AddParameter("string", _("Effect"))
.AddParameter("string", _("Parameter name"))
.AddParameter("expression", _("New value"))
.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"))

View File

@@ -7,6 +7,7 @@
#ifndef GDCORE_ANIMATION_H
#define GDCORE_ANIMATION_H
#include <vector>
#include "GDCore/String.h"
namespace gd { class Direction; }
namespace gd
@@ -25,6 +26,16 @@ public:
Animation();
virtual ~Animation();
/**
* \brief Set the name of the animation
*/
const gd::String & GetName() const { return name; }
/**
* \brief Change the name of the animation
*/
void SetName(const gd::String & name_) { name = name_; }
/**
* \brief Return the n-th direction
*/
@@ -59,6 +70,7 @@ public:
private:
std::vector < Direction > directions;
gd::String name;
static Direction badDirection;
};

View File

@@ -7,6 +7,7 @@
#include "GDCore/Tools/Localization.h"
//(*InternalHeaders(SpriteObjectEditor)
#include <wx/bitmap.h>
#include <wx/intl.h>
#include <wx/image.h>
#include <wx/string.h>
//*)
@@ -116,6 +117,14 @@ const long SpriteObjectEditor::ID_PANEL10 = wxNewId();
const long SpriteObjectEditor::ID_MENUITEM5 = wxNewId();
const long SpriteObjectEditor::ID_MENUITEM6 = wxNewId();
const long SpriteObjectEditor::ID_MENUITEM4 = wxNewId();
const long SpriteObjectEditor::ID_MENUIDLENAME = wxNewId();
const long SpriteObjectEditor::ID_MENUWALKNAME = wxNewId();
const long SpriteObjectEditor::ID_MENURUNNAME = wxNewId();
const long SpriteObjectEditor::ID_MENUJUMPNAME = wxNewId();
const long SpriteObjectEditor::ID_MENUSHOOTNAME = wxNewId();
const long SpriteObjectEditor::ID_MENUDEADNAME = wxNewId();
const long SpriteObjectEditor::ID_MENUCUSTOMNAME = wxNewId();
const long SpriteObjectEditor::ID_MENUITEM15 = wxNewId();
const long SpriteObjectEditor::ID_MENUTIMEBETWEENFRAMES = wxNewId();
const long SpriteObjectEditor::ID_MENULOOP = wxNewId();
const long SpriteObjectEditor::ID_MENUITEM1 = wxNewId();
@@ -300,6 +309,23 @@ SpriteObjectEditor::SpriteObjectEditor(wxWindow* parent, gd::Project & game_, Sp
multipleDirectionsItem = new wxMenuItem(MenuItem2, ID_MENUITEM6, _("8 Directions"), wxEmptyString, wxITEM_RADIO);
MenuItem2->Append(multipleDirectionsItem);
animationsMenu.Append(ID_MENUITEM4, _("Type"), MenuItem2, wxEmptyString);
MenuItem13 = new wxMenu();
MenuItem15 = new wxMenuItem(MenuItem13, ID_MENUIDLENAME, _("Idle"), wxEmptyString, wxITEM_NORMAL);
MenuItem13->Append(MenuItem15);
MenuItem14 = new wxMenuItem(MenuItem13, ID_MENUWALKNAME, _("Walk"), wxEmptyString, wxITEM_NORMAL);
MenuItem13->Append(MenuItem14);
MenuItem16 = new wxMenuItem(MenuItem13, ID_MENURUNNAME, _("Run"), wxEmptyString, wxITEM_NORMAL);
MenuItem13->Append(MenuItem16);
MenuItem17 = new wxMenuItem(MenuItem13, ID_MENUJUMPNAME, _("Jump"), wxEmptyString, wxITEM_NORMAL);
MenuItem13->Append(MenuItem17);
MenuItem18 = new wxMenuItem(MenuItem13, ID_MENUSHOOTNAME, _("Shoot"), wxEmptyString, wxITEM_NORMAL);
MenuItem13->Append(MenuItem18);
MenuItem20 = new wxMenuItem(MenuItem13, ID_MENUDEADNAME, _("Dead"), wxEmptyString, wxITEM_NORMAL);
MenuItem13->Append(MenuItem20);
MenuItem13->AppendSeparator();
MenuItem19 = new wxMenuItem(MenuItem13, ID_MENUCUSTOMNAME, _("Custom name..."), wxEmptyString, wxITEM_NORMAL);
MenuItem13->Append(MenuItem19);
animationsMenu.Append(ID_MENUITEM15, _("Change the name"), MenuItem13, wxEmptyString);
MenuItem7 = new wxMenuItem((&animationsMenu), ID_MENUTIMEBETWEENFRAMES, _("Time between each image :"), wxEmptyString, wxITEM_NORMAL);
animationsMenu.Append(MenuItem7);
MenuItem8 = new wxMenuItem((&animationsMenu), ID_MENULOOP, _("Loop the animation"), wxEmptyString, wxITEM_CHECK);
@@ -380,9 +406,15 @@ SpriteObjectEditor::SpriteObjectEditor(wxWindow* parent, gd::Project & game_, Sp
previewPanel->Connect(wxEVT_PAINT,(wxObjectEventFunction)&SpriteObjectEditor::OnpreviewPanelPaint,0,this);
previewPanel->Connect(wxEVT_ERASE_BACKGROUND,(wxObjectEventFunction)&SpriteObjectEditor::OnpreviewPanelEraseBackground,0,this);
previewPanel->Connect(wxEVT_SIZE,(wxObjectEventFunction)&SpriteObjectEditor::OnpreviewPanelResize,0,this);
mgr->Connect(wxEVT_AUI_PANE_CLOSE,(wxObjectEventFunction)&SpriteObjectEditor::OnmgrPaneClose,0,this);
Connect(ID_MENUITEM5,wxEVT_COMMAND_MENU_SELECTED,(wxObjectEventFunction)&SpriteObjectEditor::OnautomaticRotationItemSelected);
Connect(ID_MENUITEM6,wxEVT_COMMAND_MENU_SELECTED,(wxObjectEventFunction)&SpriteObjectEditor::OnmultipleDirectionsItemSelected);
Connect(ID_MENUIDLENAME,wxEVT_COMMAND_MENU_SELECTED,(wxObjectEventFunction)&SpriteObjectEditor::OnSetAnimationNameIdleSelected);
Connect(ID_MENUWALKNAME,wxEVT_COMMAND_MENU_SELECTED,(wxObjectEventFunction)&SpriteObjectEditor::OnSetAnimationNameWalkSelected);
Connect(ID_MENURUNNAME,wxEVT_COMMAND_MENU_SELECTED,(wxObjectEventFunction)&SpriteObjectEditor::OnSetAnimationNameRunSelected);
Connect(ID_MENUJUMPNAME,wxEVT_COMMAND_MENU_SELECTED,(wxObjectEventFunction)&SpriteObjectEditor::OnSetAnimationNameJumpSelected);
Connect(ID_MENUSHOOTNAME,wxEVT_COMMAND_MENU_SELECTED,(wxObjectEventFunction)&SpriteObjectEditor::OnSetAnimationNameShootSelected);
Connect(ID_MENUDEADNAME,wxEVT_COMMAND_MENU_SELECTED,(wxObjectEventFunction)&SpriteObjectEditor::OnSetAnimationNameDeadSelected);
Connect(ID_MENUCUSTOMNAME,wxEVT_COMMAND_MENU_SELECTED,(wxObjectEventFunction)&SpriteObjectEditor::OnSetCustomAnimationNameSelected);
Connect(ID_MENUTIMEBETWEENFRAMES,wxEVT_COMMAND_MENU_SELECTED,(wxObjectEventFunction)&SpriteObjectEditor::OnTimeBetweenFramesSelected);
Connect(ID_MENULOOP,wxEVT_COMMAND_MENU_SELECTED,(wxObjectEventFunction)&SpriteObjectEditor::OnMenuLoopSelected);
Connect(ID_MENUITEM1,wxEVT_COMMAND_MENU_SELECTED,(wxObjectEventFunction)&SpriteObjectEditor::OnAddAnimationSelected);
@@ -399,6 +431,7 @@ SpriteObjectEditor::SpriteObjectEditor(wxWindow* parent, gd::Project & game_, Sp
Connect(ID_MENUITEM12,wxEVT_COMMAND_MENU_SELECTED,(wxObjectEventFunction)&SpriteObjectEditor::OnAddImageFromFileSelected);
Connect(ID_MENUITEM13,wxEVT_COMMAND_MENU_SELECTED,(wxObjectEventFunction)&SpriteObjectEditor::OnAddFromImageBankSelected);
//*)
mgr->Connect(wxEVT_AUI_PANE_CLOSE,(wxObjectEventFunction)&SpriteObjectEditor::OnmgrPaneClose,0,this);
imagesList->Connect(wxEVT_RIGHT_UP,(wxObjectEventFunction)&SpriteObjectEditor::OnimagesListRightClick,0,this);
Connect(ID_TREELISTCTRL1,wxEVT_COMMAND_TREELIST_ITEM_ACTIVATED,(wxObjectEventFunction)&SpriteObjectEditor::OnmaskTreeItemActivated);
Connect(ID_TREELISTCTRL1,wxEVT_COMMAND_TREELIST_ITEM_CONTEXT_MENU,(wxObjectEventFunction)&SpriteObjectEditor::OnmaskTreeItemRClick);
@@ -526,7 +559,11 @@ void SpriteObjectEditor::RefreshAnimationTree()
for (std::size_t i = 0;i<object.GetAnimationsCount();++i)
{
Animation & animation = object.GetAnimation(i);
wxTreeItemId animationItem = animationsTree->AppendItem(root, _("Animation ") + gd::String::From(i), 0, -1,
gd::String animationLabel = animation.GetName().empty() ?
wxString::Format(wxString(_("Animation %d")), i) :
wxString::Format(wxString(_("Animation %d \"%s\"")), i, animation.GetName().c_str());
wxTreeItemId animationItem = animationsTree->AppendItem(root, animationLabel, 0, -1,
new gd::TreeItemStringData(gd::String::From(i), ""));
if ( animation.useMultipleDirections )
@@ -1828,5 +1865,64 @@ void SpriteObjectEditor::OnxScrollBarScroll(wxScrollEvent& event)
imagePanel->Update();
}
void SpriteObjectEditor::OnSetAnimationNameIdleSelected(wxCommandEvent& event)
{
SetAnimationName(_("Idle"));
}
void SpriteObjectEditor::OnSetAnimationNameWalkSelected(wxCommandEvent& event)
{
SetAnimationName(_("Walk"));
}
void SpriteObjectEditor::OnSetAnimationNameRunSelected(wxCommandEvent& event)
{
SetAnimationName(_("Run"));
}
void SpriteObjectEditor::OnSetAnimationNameJumpSelected(wxCommandEvent& event)
{
SetAnimationName(_("Jump"));
}
void SpriteObjectEditor::OnSetAnimationNameShootSelected(wxCommandEvent& event)
{
SetAnimationName(_("Shoot"));
}
void SpriteObjectEditor::OnSetAnimationNameDeadSelected(wxCommandEvent& event)
{
SetAnimationName(_("Dead"));
}
void SpriteObjectEditor::OnSetCustomAnimationNameSelected(wxCommandEvent& event)
{
if (selectedAnimation >= object.GetAnimationsCount()) return;
const Animation & animation = object.GetAnimation(selectedAnimation);
gd::String name = wxGetTextFromUser(_("Enter the name of the animation:"), _("Custom name"), animation.GetName());
SetAnimationName(name);
}
void SpriteObjectEditor::SetAnimationName(gd::String newName)
{
if (selectedAnimation >= object.GetAnimationsCount()) return;
for(std::size_t i = 0;i < object.GetAnimationsCount(); ++i)
{
if (i == selectedAnimation) continue;
const gd::String & name = object.GetAnimation(i).GetName();
if (!name.empty() && name == newName)
{
wxString msg = wxString::Format(wxString(_("Animation #%d already has this name: please use a different name for each animation")), i);
wxLogWarning(msg);
return;
}
}
object.GetAnimation(selectedAnimation).SetName(newName);
RefreshAnimationTree();
}
}
#endif

View File

@@ -74,9 +74,13 @@ public:
wxMenuItem* deleteItem;
wxMenuItem* MenuItem1;
wxMenuItem* MenuItem4;
wxMenuItem* MenuItem14;
wxMenuItem* MenuItem11;
wxMenuItem* MenuItem15;
wxPanel* Panel1;
wxMenu animationsMenu;
wxMenuItem* MenuItem17;
wxMenu* MenuItem13;
wxMenuItem* MenuItem10;
wxAuiManager* AuiManager2;
wxMenuItem* removeImageItem;
@@ -88,6 +92,7 @@ public:
wxTimer previewTimer;
wxMenuItem* MenuItem3;
wxAuiManager* AuiManager3;
wxMenuItem* MenuItem20;
wxPanel* imagePanel;
wxScrollBar* yScrollBar;
wxMenu emptyImagesMenu;
@@ -98,14 +103,17 @@ public:
wxMenuItem* moveRightItem;
wxPanel* Panel2;
wxMenuItem* automaticRotationItem;
wxMenuItem* MenuItem16;
wxPanel* pointsPanel;
wxMenuItem* MenuItem9;
wxMenuItem* multipleDirectionsItem;
wxListCtrl* imagesList;
wxMenuItem* MenuItem18;
wxMenu imagesMenu;
wxMenu maskMenu;
wxPanel* imagesPanel;
wxAuiToolBar* animationToolbar;
wxMenuItem* MenuItem19;
//*)
ResourcesEditor * resourcesEditorPnl;
@@ -153,6 +161,14 @@ protected:
static const long ID_MENUITEM5;
static const long ID_MENUITEM6;
static const long ID_MENUITEM4;
static const long ID_MENUIDLENAME;
static const long ID_MENUWALKNAME;
static const long ID_MENURUNNAME;
static const long ID_MENUJUMPNAME;
static const long ID_MENUSHOOTNAME;
static const long ID_MENUDEADNAME;
static const long ID_MENUCUSTOMNAME;
static const long ID_MENUITEM15;
static const long ID_MENUTIMEBETWEENFRAMES;
static const long ID_MENULOOP;
static const long ID_MENUITEM1;
@@ -224,6 +240,13 @@ private:
void OnRotatePolygonSelected(wxCommandEvent& event);
void OnyScrollBarScroll(wxScrollEvent& event);
void OnxScrollBarScroll(wxScrollEvent& event);
void OnSetAnimationNameIdleSelected(wxCommandEvent& event);
void OnSetAnimationNameWalkSelected(wxCommandEvent& event);
void OnSetAnimationNameRunSelected(wxCommandEvent& event);
void OnSetAnimationNameJumpSelected(wxCommandEvent& event);
void OnSetAnimationNameShootSelected(wxCommandEvent& event);
void OnSetAnimationNameDeadSelected(wxCommandEvent& event);
void OnSetCustomAnimationNameSelected(wxCommandEvent& event);
//*)
void OnmaskTreeItemRClick(wxTreeListEvent& event);
void OnmaskTreeItemActivated(wxTreeListEvent& event);
@@ -238,6 +261,7 @@ private:
void RefreshCollisionMasks();
void ResetPreview();
wxBitmap GetwxBitmapFromImageResource(gd::Resource & resource);
void SetAnimationName(gd::String newName);
/**
* Return a vector containing the sprites which must be modified when editing a point

View File

@@ -20,11 +20,11 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsSpriteExtension(gd::Pla
"Florian Rival",
"Open source (MIT License)");
gd::ObjectMetadata & obj = extension.AddObject("Sprite",
gd::ObjectMetadata & obj = extension.AddObject<SpriteObject>(
"Sprite",
_("Sprite"),
_("Animated object which can be used for most elements of a game"),
"CppPlatform/Extensions/spriteicon.png",
&CreateSpriteObject);
"CppPlatform/Extensions/spriteicon.png");
#if defined(GD_IDE_ONLY)
obj.AddAction("Opacity",
@@ -43,7 +43,7 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsSpriteExtension(gd::Pla
obj.AddAction("ChangeAnimation",
_("Change the animation"),
_("Modify the current animation of the object."),
_("Change the animation of the object, using the animation number in the animations list."),
_("Do _PARAM1__PARAM2_ to the number of current animation of _PARAM0_"),
_("Animations and images"),
"res/actions/animation24.png",
@@ -55,6 +55,18 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsSpriteExtension(gd::Pla
.MarkAsSimple()
.SetManipulatedType("number");
obj.AddAction("SetAnimationName",
_("Change the animation (by name)"),
_("Change the animation of the object, using the name of the animation."),
_("Set animation of _PARAM0_ to _PARAM1_"),
_("Animations and images"),
"res/actions/animation24.png",
"res/actions/animation.png")
.AddParameter("object", _("Object"), "Sprite")
.AddParameter("string", _("Animation name"))
.MarkAsAdvanced();
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"),
@@ -183,7 +195,7 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsSpriteExtension(gd::Pla
obj.AddCondition("Animation",
_("Current animation"),
_("Test the number of the current animation of the object."),
_("Compare 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",
@@ -195,6 +207,18 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsSpriteExtension(gd::Pla
.MarkAsAdvanced()
.SetManipulatedType("number");
obj.AddCondition("AnimationName",
_("Current animation name"),
_("Check the current animation of the object."),
_("The animation of _PARAM0_ is _PARAM1_"),
_("Animations and images"),
"res/conditions/animation24.png",
"res/conditions/animation.png")
.AddParameter("object", _("Object"), "Sprite")
.AddParameter("string", _("Animation name"))
.MarkAsAdvanced();
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."),
@@ -444,6 +468,9 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsSpriteExtension(gd::Pla
obj.AddExpression("Animation", _("Animation"), _("Animation of the object"), _("Animations and images"), "res/actions/animation.png")
.AddParameter("object", _("Object"), "Sprite");
obj.AddStrExpression("AnimationName", _("Animation name"), _("Name of the 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");

View File

@@ -53,6 +53,7 @@ void SpriteObject::DoUnserializeFrom(gd::Project & project, const gd::Serializer
Animation newAnimation;
newAnimation.useMultipleDirections = animationElement.GetBoolAttribute("useMultipleDirections", false, "typeNormal");
newAnimation.SetName(animationElement.GetStringAttribute("name", ""));
//Compatibility with GD <= 3.3
if (animationElement.HasChild("Direction"))
@@ -96,6 +97,7 @@ void SpriteObject::DoSerializeTo(gd::SerializerElement & element) const
gd::SerializerElement & animationElement = animationsElement.AddChild("animation");
animationElement.SetAttribute( "useMultipleDirections", GetAnimation(k).useMultipleDirections);
animationElement.SetAttribute( "name", GetAnimation(k).GetName());
gd::SerializerElement & directionsElement = animationElement.AddChild("directions");
directionsElement.ConsiderAsArrayOf("direction");
@@ -292,13 +294,4 @@ void SpriteObject::SwapAnimations(std::size_t firstIndex, std::size_t secondInde
std::swap(animations[firstIndex], animations[secondIndex]);
}
/**
* Function creating an extension Object.
* GDevelop can not directly create an extension object
*/
gd::Object * CreateSpriteObject(gd::String name)
{
return new SpriteObject(name);
}
}

View File

@@ -105,7 +105,7 @@ public :
bool HasNoAnimations() const { return animations.empty(); }
/**
* \brief Swap the position of two sprites
* \brief Swap the position of two animations
*/
void SwapAnimations(std::size_t firstIndex, std::size_t secondIndex);
@@ -128,7 +128,5 @@ private:
static Animation badAnimation; //< Bad animation when an out of bound animation is requested.
};
GD_CORE_API gd::Object * CreateSpriteObject(gd::String name);
}
#endif // GDCORE_SPRITEOBJECT_H

View File

@@ -95,16 +95,16 @@ std::shared_ptr<gd::Object> Platform::CreateObject(gd::String type, const gd::St
return std::shared_ptr<gd::Object> (object);
}
gd::Behavior* Platform::CreateBehavior(const gd::String & behaviorType) const
std::unique_ptr<gd::Behavior> Platform::CreateBehavior(const gd::String & behaviorType) const
{
for (std::size_t i =0;i<extensionsLoaded.size();++i)
{
Behavior* behavior = extensionsLoaded[i]->CreateBehavior(behaviorType);
if ( behavior != NULL )
std::unique_ptr<gd::Behavior> behavior = extensionsLoaded[i]->CreateBehavior(behaviorType);
if ( behavior )
return behavior;
}
return NULL;
return nullptr;
}
std::shared_ptr<gd::BehaviorsSharedData> Platform::CreateBehaviorSharedDatas(const gd::String & behaviorType) const
@@ -138,9 +138,9 @@ std::shared_ptr<gd::LayoutEditorPreviewer> Platform::GetLayoutPreviewer(gd::Layo
return std::shared_ptr<gd::LayoutEditorPreviewer>(new gd::LayoutEditorPreviewer);
}
std::shared_ptr<gd::ProjectExporter> Platform::GetProjectExporter() const
std::vector<std::shared_ptr<gd::ProjectExporter>> Platform::GetProjectExporters() const
{
return std::shared_ptr<gd::ProjectExporter>(new gd::ProjectExporter);
return std::vector<std::shared_ptr<gd::ProjectExporter>>{std::shared_ptr<gd::ProjectExporter>(new gd::ProjectExporter)};
}
#endif

View File

@@ -6,10 +6,10 @@
#ifndef GDCORE_PLATFORM_H
#define GDCORE_PLATFORM_H
#include <map>
#include <memory>
#include <vector>
#include "GDCore/String.h"
#include <map>
#include "GDCore/Project/ChangesNotifier.h"
#include "GDCore/Project/LayoutEditorPreviewer.h"
namespace gd { class InstructionsMetadataHolder; }
@@ -123,7 +123,7 @@ public:
/**
* \brief Create a behavior
*/
gd::Behavior* CreateBehavior(const gd::String & type) const;
std::unique_ptr<gd::Behavior> CreateBehavior(const gd::String & type) const;
/**
* \brief Create a behavior shared data object.
@@ -169,12 +169,12 @@ public:
virtual std::shared_ptr<gd::LayoutEditorPreviewer> GetLayoutPreviewer(gd::LayoutEditorCanvas & editor) const;
/**
* \brief Must provide a gd::ProjectExporter object that will be used
* \brief Must provide at least one gd::ProjectExporter object that will be used
* by the IDE to export the project so as to be used without the IDE.
*
* The default implementation simply return a gd::ProjectExporter object doing nothing.
* The default implementation simply return a vector containing a gd::ProjectExporter object doing nothing.
*/
virtual std::shared_ptr<gd::ProjectExporter> GetProjectExporter() const;
virtual std::vector<std::shared_ptr<gd::ProjectExporter>> GetProjectExporters() const;
#endif
///@}

View File

@@ -85,17 +85,6 @@ gd::ExpressionMetadata & PlatformExtension::AddStrExpression(const gd::String &
#endif
}
gd::ObjectMetadata & PlatformExtension::AddObject(const gd::String & name,
const gd::String & fullname,
const gd::String & informations,
const gd::String & icon24x24,
CreateFunPtr createFunPtrP)
{
gd::String nameWithNamespace = GetNameSpace().empty() ? name : GetNameSpace()+name;
objectsInfos[nameWithNamespace] = ObjectMetadata(GetNameSpace(), nameWithNamespace, fullname, informations, icon24x24, createFunPtrP);
return objectsInfos[nameWithNamespace];
}
gd::BehaviorMetadata & PlatformExtension::AddBehavior(const gd::String & name,
const gd::String & fullname,
const gd::String & defaultName,
@@ -294,12 +283,12 @@ CreateFunPtr PlatformExtension::GetObjectCreationFunctionPtr(gd::String objectTy
return NULL;
}
Behavior* PlatformExtension::CreateBehavior(gd::String type) const
std::unique_ptr<gd::Behavior> PlatformExtension::CreateBehavior(gd::String type) const
{
if ( behaviorsInfo.find(type) != behaviorsInfo.end())
return behaviorsInfo.find(type)->second.Get()->Clone();
return std::unique_ptr<gd::Behavior>(behaviorsInfo.find(type)->second.Get()->Clone());
return NULL;
return nullptr;
}

View File

@@ -1,6 +1,7 @@
/*
* GDevelop Core
* Copyright 2008-2016 Florian Rival (Florian.Rival@gmail.com). All rights reserved.
* Copyright 2016 Victor Levasseur (victorlevasseur52@gmail.com)
* This project is released under the MIT License.
*/
@@ -12,6 +13,7 @@
#include "GDCore/Extensions/Metadata/ObjectMetadata.h"
#include "GDCore/Extensions/Metadata/BehaviorMetadata.h"
#include "GDCore/Extensions/Metadata/EventMetadata.h"
#include "GDCore/CommonTools.h"
#include "GDCore/String.h"
namespace gd { class Instruction; }
namespace gd { class InstructionMetadata; }
@@ -138,26 +140,19 @@ public:
/**
* \brief Declare a new object as being part of the extension.
* \note This method does nothing when used for GD C++ runtime.
* \tparam T the declared class inherited from *gd::Object*
* \param name The name of the object
* \param fullname The user friendly name of the object
* \param description The user friendly description of the object
* \param icon The 24x24 icon of the object: res/icons_[SkinName]/[iconName]24.png will be first tried,
* and then if it does not exists, the full entered name will be tried.
* \param createFunPtr The name of the function that create the object
*
* Example of the create function:
\code
gd::Object * CreateMyObject(gd::String name)
{
return new MyObject(name);
}
\endcode
*/
template<class T>
gd::ObjectMetadata & AddObject(const gd::String & name_,
const gd::String & fullname_,
const gd::String & description_,
const gd::String & icon24x24_,
CreateFunPtr createFunPtrP);
const gd::String & icon24x24_);
/**
* \brief Declare a new behavior as being part of the extension.
@@ -259,7 +254,7 @@ public:
*
* Return NULL if \a behaviorType is not provided by the extension.
*/
gd::Behavior* CreateBehavior(gd::String behaviorType) const;
std::unique_ptr<gd::Behavior> CreateBehavior(gd::String behaviorType) const;
/**
* \brief Create shared data for a behavior
@@ -461,4 +456,6 @@ private:
#endif
#include "GDCore/Extensions/PlatformExtension.inl"
#endif // GDCORE_PLATFORMEXTENSION_H

View File

@@ -0,0 +1,34 @@
/*
* GDevelop Core
* Copyright 2008-2016 Florian Rival (Florian.Rival@gmail.com). All rights reserved.
* Copyright 2016 Victor Levasseur (victorlevasseur52@gmail.com)
* This project is released under the MIT License.
*/
#ifndef GDCORE_PLATFORMEXTENSION_INL
#define GDCORE_PLATFORMEXTENSION_INL
namespace gd
{
template<class T>
gd::ObjectMetadata & PlatformExtension::AddObject(const gd::String & name,
const gd::String & fullname, const gd::String & description,
const gd::String & icon24x24)
{
gd::String nameWithNamespace = GetNameSpace().empty() ? name : GetNameSpace()+name;
objectsInfos[nameWithNamespace] = ObjectMetadata(
GetNameSpace(),
nameWithNamespace,
fullname,
informations,
icon24x24,
[](gd::String name) -> gd::Object* { return new T(name); }
);
return objectsInfos[nameWithNamespace];
}
}
#endif

View File

@@ -466,11 +466,18 @@ void ChooseVariableDialog::OnEditValueSelected(wxCommandEvent& event)
UpdateSelectedAndParentVariable();
if ( !selectedVariable || selectedVariable->IsStructure() ) return;
gd::String value = wxGetTextFromUser(_("Enter the initial value of the variable"), _("Initial value"), selectedVariable->GetString());
selectedVariable->SetString(value);
RefreshVariable(variablesList->GetSelection(), selectedVariableName, *selectedVariable);
wxTextEntryDialog editDialog(this,
_("Enter the initial value of the variable"), _("Initial value"),
selectedVariable->GetString(), wxTextEntryDialogStyle | wxTE_MULTILINE);
modificationCount++;
if (editDialog.ShowModal() == wxID_OK)
{
gd::String value = editDialog.GetValue();
selectedVariable->SetString(value);
RefreshVariable(variablesList->GetSelection(), selectedVariableName, *selectedVariable);
modificationCount++;
}
}
void ChooseVariableDialog::OnRenameSelected(wxCommandEvent& event)

View File

@@ -1,432 +0,0 @@
/*
* GDevelop Core
* 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) && !defined(GD_NO_WX_GUI)
#include "EditLayerDialog.h"
//(*InternalHeaders(EditLayerDialog)
#include <wx/bitmap.h>
#include <wx/font.h>
#include "GDCore/Tools/Localization.h"
#include <wx/image.h>
#include <wx/string.h>
//*)
#include "GDCore/Tools/Log.h"
#include "GDCore/IDE/wxTools/SkinHelper.h"
#include "GDCore/Tools/HelpFileAccess.h"
#include "GDCore/CommonTools.h"
namespace gd
{
//(*IdInit(EditLayerDialog)
const long EditLayerDialog::ID_STATICTEXT1 = wxNewId();
const long EditLayerDialog::ID_TEXTCTRL1 = wxNewId();
const long EditLayerDialog::ID_CHECKBOX1 = wxNewId();
const long EditLayerDialog::ID_STATICTEXT2 = wxNewId();
const long EditLayerDialog::ID_CHOICE1 = wxNewId();
const long EditLayerDialog::ID_BUTTON5 = wxNewId();
const long EditLayerDialog::ID_BUTTON3 = wxNewId();
const long EditLayerDialog::ID_CHECKBOX2 = wxNewId();
const long EditLayerDialog::ID_TEXTCTRL2 = wxNewId();
const long EditLayerDialog::ID_STATICTEXT4 = wxNewId();
const long EditLayerDialog::ID_TEXTCTRL3 = wxNewId();
const long EditLayerDialog::ID_CHECKBOX3 = wxNewId();
const long EditLayerDialog::ID_STATICTEXT7 = wxNewId();
const long EditLayerDialog::ID_TEXTCTRL4 = wxNewId();
const long EditLayerDialog::ID_STATICTEXT6 = wxNewId();
const long EditLayerDialog::ID_TEXTCTRL5 = wxNewId();
const long EditLayerDialog::ID_STATICTEXT8 = wxNewId();
const long EditLayerDialog::ID_TEXTCTRL6 = wxNewId();
const long EditLayerDialog::ID_STATICTEXT9 = wxNewId();
const long EditLayerDialog::ID_TEXTCTRL7 = wxNewId();
const long EditLayerDialog::ID_STATICTEXT3 = wxNewId();
const long EditLayerDialog::ID_STATICLINE1 = wxNewId();
const long EditLayerDialog::ID_STATICBITMAP2 = wxNewId();
const long EditLayerDialog::ID_HYPERLINKCTRL1 = wxNewId();
const long EditLayerDialog::ID_BUTTON2 = wxNewId();
const long EditLayerDialog::ID_BUTTON1 = wxNewId();
//*)
BEGIN_EVENT_TABLE(EditLayerDialog,wxDialog)
//(*EventTable(EditLayerDialog)
//*)
END_EVENT_TABLE()
EditLayerDialog::EditLayerDialog(wxWindow* parent, Layer & layer_) :
layer(layer_),
tempLayer(layer_)
{
//(*Initialize(EditLayerDialog)
wxStaticBoxSizer* StaticBoxSizer2;
wxFlexGridSizer* FlexGridSizer4;
wxFlexGridSizer* FlexGridSizer3;
wxFlexGridSizer* FlexGridSizer5;
wxFlexGridSizer* FlexGridSizer9;
wxFlexGridSizer* FlexGridSizer2;
wxFlexGridSizer* FlexGridSizer7;
wxFlexGridSizer* FlexGridSizer8;
wxFlexGridSizer* FlexGridSizer6;
wxStaticBoxSizer* StaticBoxSizer1;
wxFlexGridSizer* FlexGridSizer1;
wxFlexGridSizer* FlexGridSizer17;
Create(parent, wxID_ANY, _("Modify the parameters of the layer"), wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE, _T("wxID_ANY"));
FlexGridSizer1 = new wxFlexGridSizer(0, 1, 0, 0);
FlexGridSizer2 = new wxFlexGridSizer(0, 3, 0, 0);
StaticText1 = new wxStaticText(this, ID_STATICTEXT1, _("Name :"), wxDefaultPosition, wxDefaultSize, 0, _T("ID_STATICTEXT1"));
FlexGridSizer2->Add(StaticText1, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
nameEdit = new wxTextCtrl(this, ID_TEXTCTRL1, wxEmptyString, wxDefaultPosition, wxSize(129,-1), 0, wxDefaultValidator, _T("ID_TEXTCTRL1"));
FlexGridSizer2->Add(nameEdit, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
visibilityCheck = new wxCheckBox(this, ID_CHECKBOX1, _("Visible"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("ID_CHECKBOX1"));
visibilityCheck->SetValue(false);
FlexGridSizer2->Add(visibilityCheck, 1, wxALL|wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL, 5);
FlexGridSizer1->Add(FlexGridSizer2, 1, wxALL|wxEXPAND|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 0);
StaticBoxSizer1 = new wxStaticBoxSizer(wxHORIZONTAL, this, _("Cameras"));
FlexGridSizer4 = new wxFlexGridSizer(0, 1, 0, 0);
FlexGridSizer5 = new wxFlexGridSizer(0, 4, 0, 0);
StaticText2 = new wxStaticText(this, ID_STATICTEXT2, _("Camera No."), wxDefaultPosition, wxDefaultSize, 0, _T("ID_STATICTEXT2"));
FlexGridSizer5->Add(StaticText2, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
cameraChoice = new wxChoice(this, ID_CHOICE1, wxDefaultPosition, wxSize(50,-1), 0, 0, 0, wxDefaultValidator, _T("ID_CHOICE1"));
cameraChoice->Append("00");
cameraChoice->SetSelection(0);
FlexGridSizer5->Add(cameraChoice, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
deleteCameraBt = new wxButton(this, ID_BUTTON5, _("Delete"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("ID_BUTTON5"));
FlexGridSizer5->Add(deleteCameraBt, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
addCameraBt = new wxButton(this, ID_BUTTON3, _("Add another camera"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("ID_BUTTON3"));
FlexGridSizer5->Add(addCameraBt, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
FlexGridSizer4->Add(FlexGridSizer5, 1, wxALL|wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL, 0);
StaticBoxSizer2 = new wxStaticBoxSizer(wxHORIZONTAL, this, _("Editing the camera"));
FlexGridSizer6 = new wxFlexGridSizer(0, 1, 0, 0);
FlexGridSizer6->AddGrowableCol(0);
FlexGridSizer8 = new wxFlexGridSizer(0, 4, 0, 0);
sizeCheck = new wxCheckBox(this, ID_CHECKBOX2, _("Custom size :"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("ID_CHECKBOX2"));
sizeCheck->SetValue(false);
FlexGridSizer8->Add(sizeCheck, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
cameraWidthEdit = new wxTextCtrl(this, ID_TEXTCTRL2, wxEmptyString, wxDefaultPosition, wxSize(60,-1), 0, wxDefaultValidator, _T("ID_TEXTCTRL2"));
cameraWidthEdit->Disable();
FlexGridSizer8->Add(cameraWidthEdit, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
StaticText4 = new wxStaticText(this, ID_STATICTEXT4, _("x"), wxDefaultPosition, wxDefaultSize, 0, _T("ID_STATICTEXT4"));
FlexGridSizer8->Add(StaticText4, 1, wxTOP|wxBOTTOM|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
cameraHeightEdit = new wxTextCtrl(this, ID_TEXTCTRL3, wxEmptyString, wxDefaultPosition, wxSize(60,-1), 0, wxDefaultValidator, _T("ID_TEXTCTRL3"));
cameraHeightEdit->Disable();
FlexGridSizer8->Add(cameraHeightEdit, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
FlexGridSizer6->Add(FlexGridSizer8, 1, wxALL|wxEXPAND|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 0);
FlexGridSizer7 = new wxFlexGridSizer(0, 2, 0, 0);
viewportCheck = new wxCheckBox(this, ID_CHECKBOX3, _("Custom viewport :"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("ID_CHECKBOX3"));
viewportCheck->SetValue(false);
FlexGridSizer7->Add(viewportCheck, 1, wxALL|wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL, 5);
FlexGridSizer9 = new wxFlexGridSizer(0, 8, 0, 0);
StaticText7 = new wxStaticText(this, ID_STATICTEXT7, _("From"), wxDefaultPosition, wxDefaultSize, 0, _T("ID_STATICTEXT7"));
FlexGridSizer9->Add(StaticText7, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
viewportX1Edit = new wxTextCtrl(this, ID_TEXTCTRL4, _("0"), wxDefaultPosition, wxSize(40,-1), 0, wxDefaultValidator, _T("ID_TEXTCTRL4"));
viewportX1Edit->Disable();
FlexGridSizer9->Add(viewportX1Edit, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
StaticText6 = new wxStaticText(this, ID_STATICTEXT6, _(";"), wxDefaultPosition, wxDefaultSize, 0, _T("ID_STATICTEXT6"));
FlexGridSizer9->Add(StaticText6, 1, wxTOP|wxBOTTOM|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
viewportY1Edit = new wxTextCtrl(this, ID_TEXTCTRL5, _("0"), wxDefaultPosition, wxSize(40,-1), 0, wxDefaultValidator, _T("ID_TEXTCTRL5"));
viewportY1Edit->Disable();
FlexGridSizer9->Add(viewportY1Edit, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
StaticText8 = new wxStaticText(this, ID_STATICTEXT8, _("to"), wxDefaultPosition, wxDefaultSize, 0, _T("ID_STATICTEXT8"));
FlexGridSizer9->Add(StaticText8, 1, wxTOP|wxBOTTOM|wxRIGHT|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
viewportX2Edit = new wxTextCtrl(this, ID_TEXTCTRL6, _("1"), wxDefaultPosition, wxSize(40,-1), 0, wxDefaultValidator, _T("ID_TEXTCTRL6"));
viewportX2Edit->Disable();
FlexGridSizer9->Add(viewportX2Edit, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
StaticText9 = new wxStaticText(this, ID_STATICTEXT9, _(";"), wxDefaultPosition, wxDefaultSize, 0, _T("ID_STATICTEXT9"));
FlexGridSizer9->Add(StaticText9, 1, wxTOP|wxBOTTOM|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
viewportY2Edit = new wxTextCtrl(this, ID_TEXTCTRL7, _("1"), wxDefaultPosition, wxSize(40,-1), 0, wxDefaultValidator, _T("ID_TEXTCTRL7"));
viewportY2Edit->Disable();
FlexGridSizer9->Add(viewportY2Edit, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
FlexGridSizer7->Add(FlexGridSizer9, 1, wxALL|wxEXPAND|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 0);
FlexGridSizer6->Add(FlexGridSizer7, 1, wxALL|wxEXPAND|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 0);
StaticText3 = new wxStaticText(this, ID_STATICTEXT3, _("For example, a camera which takes the left side of the window would be defined with 0, 0, 0.5, 1.\nBy default, a camera has a viewport which covers the entire window."), wxDefaultPosition, wxDefaultSize, wxALIGN_RIGHT, _T("ID_STATICTEXT3"));
wxFont StaticText3Font(wxDEFAULT,wxFONTFAMILY_DEFAULT,wxFONTSTYLE_ITALIC,wxFONTWEIGHT_NORMAL,false,wxEmptyString,wxFONTENCODING_DEFAULT);
StaticText3->SetFont(StaticText3Font);
FlexGridSizer6->Add(StaticText3, 1, wxALL|wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL, 5);
StaticBoxSizer2->Add(FlexGridSizer6, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 0);
FlexGridSizer4->Add(StaticBoxSizer2, 1, wxALL|wxEXPAND|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
StaticBoxSizer1->Add(FlexGridSizer4, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 0);
FlexGridSizer1->Add(StaticBoxSizer1, 1, wxALL|wxEXPAND|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
StaticLine1 = new wxStaticLine(this, ID_STATICLINE1, wxDefaultPosition, wxSize(10,-1), wxLI_HORIZONTAL, _T("ID_STATICLINE1"));
FlexGridSizer1->Add(StaticLine1, 1, wxALL|wxEXPAND|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 0);
FlexGridSizer3 = new wxFlexGridSizer(0, 3, 0, 0);
FlexGridSizer3->AddGrowableCol(1);
FlexGridSizer17 = new wxFlexGridSizer(0, 3, 0, 0);
FlexGridSizer17->AddGrowableRow(0);
StaticBitmap2 = new wxStaticBitmap(this, ID_STATICBITMAP2, gd::SkinHelper::GetIcon("help", 16), wxDefaultPosition, wxDefaultSize, wxNO_BORDER, _T("ID_STATICBITMAP2"));
FlexGridSizer17->Add(StaticBitmap2, 1, wxTOP|wxBOTTOM|wxLEFT|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
helpBt = new wxHyperlinkCtrl(this, ID_HYPERLINKCTRL1, _("Help"), wxEmptyString, wxDefaultPosition, wxDefaultSize, wxHL_CONTEXTMENU|wxHL_ALIGN_CENTRE|wxNO_BORDER, _T("ID_HYPERLINKCTRL1"));
helpBt->SetToolTip(_("Display help about this window"));
FlexGridSizer17->Add(helpBt, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
FlexGridSizer3->Add(FlexGridSizer17, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 0);
okBt = new wxButton(this, ID_BUTTON2, _("Ok"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("ID_BUTTON2"));
FlexGridSizer3->Add(okBt, 1, wxALL|wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL, 5);
cancelBt = new wxButton(this, ID_BUTTON1, _("Cancel"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("ID_BUTTON1"));
FlexGridSizer3->Add(cancelBt, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
FlexGridSizer1->Add(FlexGridSizer3, 1, wxALL|wxEXPAND|wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL, 0);
SetSizer(FlexGridSizer1);
FlexGridSizer1->Fit(this);
FlexGridSizer1->SetSizeHints(this);
Connect(ID_CHOICE1,wxEVT_COMMAND_CHOICE_SELECTED,(wxObjectEventFunction)&EditLayerDialog::OncameraChoiceSelect);
Connect(ID_BUTTON5,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&EditLayerDialog::OndeleteCameraBtClick);
Connect(ID_BUTTON3,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&EditLayerDialog::OnaddCameraBtClick);
Connect(ID_CHECKBOX2,wxEVT_COMMAND_CHECKBOX_CLICKED,(wxObjectEventFunction)&EditLayerDialog::OnsizeCheckClick);
Connect(ID_TEXTCTRL2,wxEVT_COMMAND_TEXT_UPDATED,(wxObjectEventFunction)&EditLayerDialog::OncameraWidthEditText);
Connect(ID_TEXTCTRL3,wxEVT_COMMAND_TEXT_UPDATED,(wxObjectEventFunction)&EditLayerDialog::OncameraHeightEditText);
Connect(ID_CHECKBOX3,wxEVT_COMMAND_CHECKBOX_CLICKED,(wxObjectEventFunction)&EditLayerDialog::OnviewportCheckClick);
Connect(ID_TEXTCTRL4,wxEVT_COMMAND_TEXT_UPDATED,(wxObjectEventFunction)&EditLayerDialog::OnviewportX1EditText);
Connect(ID_TEXTCTRL5,wxEVT_COMMAND_TEXT_UPDATED,(wxObjectEventFunction)&EditLayerDialog::OnviewportX1EditText);
Connect(ID_TEXTCTRL6,wxEVT_COMMAND_TEXT_UPDATED,(wxObjectEventFunction)&EditLayerDialog::OnviewportX1EditText);
Connect(ID_TEXTCTRL7,wxEVT_COMMAND_TEXT_UPDATED,(wxObjectEventFunction)&EditLayerDialog::OnviewportX1EditText);
Connect(ID_HYPERLINKCTRL1,wxEVT_COMMAND_HYPERLINK,(wxObjectEventFunction)&EditLayerDialog::OnhelpBtClick);
Connect(ID_BUTTON2,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&EditLayerDialog::OnokBtClick);
Connect(ID_BUTTON1,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&EditLayerDialog::OncancelBtClick);
//*)
nameEdit->ChangeValue(layer.GetName());
visibilityCheck->SetValue(layer.GetVisibility());
//Can't edit the base layer's name
if ( layer.GetName() == "" )
{
nameEdit->Disable();
nameEdit->SetValue(_("Base layer"));
}
cameraChoice->Clear();
for (std::size_t i = 0;i<layer.GetCameraCount();++i)
cameraChoice->Append(gd::String::From(i));
cameraChoice->SetSelection(0);
RefreshCameraSettings();
}
EditLayerDialog::~EditLayerDialog()
{
//(*Destroy(EditLayerDialog)
//*)
}
void EditLayerDialog::OncancelBtClick(wxCommandEvent& event)
{
EndModal(0);
}
void EditLayerDialog::OnokBtClick(wxCommandEvent& event)
{
//Obligation d'avoir un nom sauf pour le calque de base
if ( nameEdit->GetValue() == "" && nameEdit->IsEnabled() )
{
gd::LogWarning(_("The name is incorrect"));
return;
}
if( layer.GetName() != "")
tempLayer.SetName(nameEdit->GetValue());
tempLayer.SetVisibility(visibilityCheck->GetValue());
layer = tempLayer;
EndModal(1);
}
void EditLayerDialog::OnaddCameraBtClick(wxCommandEvent& event)
{
cameraChoice->Append(gd::String::From(tempLayer.GetCameraCount()));
tempLayer.SetCameraCount(tempLayer.GetCameraCount()+1);
}
void EditLayerDialog::OncameraChoiceSelect(wxCommandEvent& event)
{
RefreshCameraSettings();
}
void EditLayerDialog::RefreshCameraSettings()
{
std::size_t selection = cameraChoice->GetSelection();
if (selection >= tempLayer.GetCameraCount()) return;
const Camera & camera = tempLayer.GetCamera(selection);
if ( camera.UseDefaultSize() )
{
sizeCheck->SetValue(false);
cameraWidthEdit->Enable(false);
cameraHeightEdit->Enable(false);
cameraWidthEdit->ChangeValue("");
cameraHeightEdit->ChangeValue("");
}
else
{
sizeCheck->SetValue(true);
cameraWidthEdit->Enable(true);
cameraHeightEdit->Enable(true);
cameraWidthEdit->ChangeValue(gd::String::From(camera.GetWidth()));
cameraHeightEdit->ChangeValue(gd::String::From(camera.GetHeight()));
}
viewportX1Edit->SetBackgroundColour(wxColour(255,255,255));
viewportY1Edit->SetBackgroundColour(wxColour(255,255,255));
viewportX2Edit->SetBackgroundColour(wxColour(255,255,255));
viewportY2Edit->SetBackgroundColour(wxColour(255,255,255));
if ( camera.UseDefaultViewport() )
{
viewportCheck->SetValue(false);
viewportX1Edit->Enable(false);
viewportX2Edit->Enable(false);
viewportY1Edit->Enable(false);
viewportY2Edit->Enable(false);
viewportX1Edit->ChangeValue("0");
viewportY1Edit->ChangeValue("0");
viewportX2Edit->ChangeValue("1");
viewportY2Edit->ChangeValue("1");
}
else
{
viewportCheck->SetValue(true);
viewportX1Edit->Enable(true);
viewportX2Edit->Enable(true);
viewportY1Edit->Enable(true);
viewportY2Edit->Enable(true);
viewportX1Edit->ChangeValue(gd::String::From(camera.GetViewportX1()));
viewportX2Edit->ChangeValue(gd::String::From(camera.GetViewportX2()));
viewportY1Edit->ChangeValue(gd::String::From(camera.GetViewportY1()));
viewportY2Edit->ChangeValue(gd::String::From(camera.GetViewportY2()));
}
}
void EditLayerDialog::OnsizeCheckClick(wxCommandEvent& event)
{
std::size_t selection = cameraChoice->GetSelection();
if (selection >= tempLayer.GetCameraCount()) return;
Camera & camera = tempLayer.GetCamera(selection);
camera.SetUseDefaultSize(!sizeCheck->GetValue());
RefreshCameraSettings();
}
void EditLayerDialog::OncameraWidthEditText(wxCommandEvent& event)
{
std::size_t selection = cameraChoice->GetSelection();
if (selection >= tempLayer.GetCameraCount()) return;
Camera & camera = tempLayer.GetCamera(selection);
camera.SetSize(gd::String(cameraWidthEdit->GetValue()).To<float>(), camera.GetHeight());
}
void EditLayerDialog::OncameraHeightEditText(wxCommandEvent& event)
{
std::size_t selection = cameraChoice->GetSelection();
if (selection >= tempLayer.GetCameraCount()) return;
Camera & camera = tempLayer.GetCamera(selection);
camera.SetSize(camera.GetWidth(), gd::String(cameraHeightEdit->GetValue()).To<float>());
}
void EditLayerDialog::OnviewportCheckClick(wxCommandEvent& event)
{
std::size_t selection = cameraChoice->GetSelection();
if (selection >= tempLayer.GetCameraCount()) return;
Camera & camera = tempLayer.GetCamera(selection);
camera.SetUseDefaultViewport(!viewportCheck->GetValue());
RefreshCameraSettings();
}
/**
* Update viewport coordinates
*/
void EditLayerDialog::OnviewportX1EditText(wxCommandEvent& event)
{
std::size_t selection = cameraChoice->GetSelection();
if (selection >= tempLayer.GetCameraCount()) return;
Camera & camera = tempLayer.GetCamera(selection);
float x1 = camera.GetViewportX1();
float x2 = camera.GetViewportX2();
float y1 = camera.GetViewportY1();
float y2 = camera.GetViewportY2();
{
float newValue = gd::String(viewportX1Edit->GetValue()).To<float>();
if ( newValue >= 0 && newValue <= 1)
{
x1 = newValue;
viewportX1Edit->SetBackgroundColour(wxColour(255,255,255));
}
else
viewportX1Edit->SetBackgroundColour(wxColour(254,231,231));
}
{
float newValue = gd::String(viewportY1Edit->GetValue()).To<float>();
if ( newValue >= 0 && newValue <= 1)
{
y1 = newValue;
viewportY1Edit->SetBackgroundColour(wxColour(255,255,255));
}
else
viewportY1Edit->SetBackgroundColour(wxColour(254,231,231));
}
{
float newValue = gd::String(viewportX2Edit->GetValue()).To<float>();
if ( newValue >= 0 && newValue <= 1)
{
x2 = newValue;
viewportX2Edit->SetBackgroundColour(wxColour(255,255,255));
}
else
viewportX2Edit->SetBackgroundColour(wxColour(254,231,231));
}
{
float newValue = gd::String(viewportY2Edit->GetValue()).To<float>();
if ( newValue >= 0 && newValue <= 1)
{
y2 = newValue;
viewportY2Edit->SetBackgroundColour(wxColour(255,255,255));
}
else
viewportY2Edit->SetBackgroundColour(wxColour(254,231,231));
}
camera.SetViewport(x1,y1,x2,y2);
}
void EditLayerDialog::OndeleteCameraBtClick(wxCommandEvent& event)
{
std::size_t selection = cameraChoice->GetSelection();
if (selection >= tempLayer.GetCameraCount()) return;
if ( tempLayer.GetCameraCount() == 1 )
{
gd::LogMessage(_("The layer must have at least one camera."));
return;
}
tempLayer.DeleteCamera(selection);
cameraChoice->Delete(cameraChoice->GetSelection());
cameraChoice->SetSelection(tempLayer.GetCameraCount());
RefreshCameraSettings();
}
void EditLayerDialog::OnhelpBtClick(wxCommandEvent& event)
{
gd::HelpFileAccess::Get()->OpenPage("en/game_develop/documentation/manual/editors/scene_editor/edit_layer");
}
}
#endif

View File

@@ -1,132 +0,0 @@
/*
* GDevelop Core
* 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) && !defined(GD_NO_WX_GUI)
#ifndef GDCORE_EDITLAYER_H
#define GDCORE_EDITLAYER_H
//(*Headers(EditLayerDialog)
#include <wx/sizer.h>
#include <wx/stattext.h>
#include <wx/textctrl.h>
#include <wx/checkbox.h>
#include <wx/statline.h>
#include <wx/hyperlink.h>
#include <wx/choice.h>
#include <wx/statbmp.h>
#include <wx/button.h>
#include <wx/dialog.h>
//*)
#include "GDCore/Project/Layer.h"
namespace gd
{
/**
* \brief Dialog used to edit a layer
* \todo Use a property grid to edit layers
*
* \ingroup IDEDialogs
*/
class EditLayerDialog: public wxDialog
{
public:
/**
* Default constructor
* \param parent The wxWidgets parent window
* \param layer The layer to edit
*/
EditLayerDialog(wxWindow* parent, Layer & layer_);
virtual ~EditLayerDialog();
protected:
//(*Declarations(EditLayerDialog)
wxStaticText* StaticText9;
wxStaticBitmap* StaticBitmap2;
wxTextCtrl* viewportX2Edit;
wxStaticText* StaticText2;
wxCheckBox* sizeCheck;
wxStaticText* StaticText6;
wxCheckBox* visibilityCheck;
wxStaticText* StaticText8;
wxStaticText* StaticText1;
wxStaticText* StaticText3;
wxButton* cancelBt;
wxTextCtrl* nameEdit;
wxTextCtrl* viewportY1Edit;
wxStaticText* StaticText7;
wxTextCtrl* cameraWidthEdit;
wxStaticLine* StaticLine1;
wxTextCtrl* viewportX1Edit;
wxButton* deleteCameraBt;
wxHyperlinkCtrl* helpBt;
wxButton* addCameraBt;
wxChoice* cameraChoice;
wxStaticText* StaticText4;
wxCheckBox* viewportCheck;
wxButton* okBt;
wxTextCtrl* viewportY2Edit;
wxTextCtrl* cameraHeightEdit;
//*)
//(*Identifiers(EditLayerDialog)
static const long ID_STATICTEXT1;
static const long ID_TEXTCTRL1;
static const long ID_CHECKBOX1;
static const long ID_STATICTEXT2;
static const long ID_CHOICE1;
static const long ID_BUTTON5;
static const long ID_BUTTON3;
static const long ID_CHECKBOX2;
static const long ID_TEXTCTRL2;
static const long ID_STATICTEXT4;
static const long ID_TEXTCTRL3;
static const long ID_CHECKBOX3;
static const long ID_STATICTEXT7;
static const long ID_TEXTCTRL4;
static const long ID_STATICTEXT6;
static const long ID_TEXTCTRL5;
static const long ID_STATICTEXT8;
static const long ID_TEXTCTRL6;
static const long ID_STATICTEXT9;
static const long ID_TEXTCTRL7;
static const long ID_STATICTEXT3;
static const long ID_STATICLINE1;
static const long ID_STATICBITMAP2;
static const long ID_HYPERLINKCTRL1;
static const long ID_BUTTON2;
static const long ID_BUTTON1;
//*)
private:
//(*Handlers(EditLayerDialog)
void OncancelBtClick(wxCommandEvent& event);
void OnokBtClick(wxCommandEvent& event);
void OnaddCameraBtClick(wxCommandEvent& event);
void OncameraChoiceSelect(wxCommandEvent& event);
void OnsizeCheckClick(wxCommandEvent& event);
void OncameraWidthEditText(wxCommandEvent& event);
void OncameraHeightEditText(wxCommandEvent& event);
void OnviewportCheckClick(wxCommandEvent& event);
void OnviewportX1EditText(wxCommandEvent& event);
void OndeleteCameraBtClick(wxCommandEvent& event);
void OnhelpBtClick(wxCommandEvent& event);
//*)
void RefreshCameraSettings();
Layer & layer;
Layer tempLayer;
DECLARE_EVENT_TABLE()
};
}
#endif
#endif

View File

@@ -0,0 +1,367 @@
/*
* GDevelop Core
* 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) && !defined(GD_NO_WX_GUI)
#include "LayerPropgridHelper.h"
#include "GDCore/IDE/Dialogs/PropertyDescriptor.h"
#include "GDCore/IDE/Dialogs/ChooseVariableDialog.h"
#include "GDCore/Tools/HelpFileAccess.h"
#include "GDCore/Project/Layer.h"
#include "GDCore/Project/Effect.h"
#include "GDCore/CommonTools.h"
#include "GDCore/Tools/Log.h"
#include <wx/propgrid/propgrid.h>
#include <wx/settings.h>
#include <wx/choicdlg.h>
#include <map>
namespace {
void SetDefaultParameters(gd::Effect & effect)
{
//Hardcoded default parameters of the available effects
if (effect.GetEffectName() == "Sepia") {
effect.SetParameter("opacity", 0.8);
} else if (effect.GetEffectName() == "Night") {
effect.SetParameter("intensity", 0.3);
effect.SetParameter("opacity", 1);
} else if (effect.GetEffectName() == "LightNight") {
effect.SetParameter("opacity", 1);
}
}
int GetIndexFromPropertyName(wxString propertyName)
{
if (propertyName.Find(":") == wxNOT_FOUND) return -1;
wxString cameraId = propertyName.Mid(propertyName.Find(":") + 1);
return gd::String(cameraId).To<int>();
}
}
namespace gd
{
LayerPropgridHelper::LayerPropgridHelper(gd::Project & project_, gd::Layout & layout_) :
grid(NULL),
project(project_),
layout(layout_)
{
// For now, effect names are hardcoded here.
effectNames.push_back("Night");
effectNames.push_back("LightNight");
effectNames.push_back("Sepia");
};
void LayerPropgridHelper::RefreshFrom(const Layer & layer)
{
if (!grid) return;
grid->Clear();
grid->Append(new wxPropertyCategory(_("Layer properties")) );
grid->Append(new wxStringProperty(_("Name"), "LAYER_NAME", layer.GetName()));
if (layer.GetName().empty())
{
grid->EnableProperty(grid->GetProperty("LAYER_NAME"), false);
grid->SetPropertyValue("LAYER_NAME", _("(Base layer)"));
}
grid->Append(new wxBoolProperty(_("Visible"), "LAYER_VISIBLE", layer.GetVisibility()));
grid->Append(new wxStringProperty(_("Help"), "HELP", _("Click to see help...")) );
grid->SetPropertyCell("HELP", 1, _("Help"), wxNullBitmap, wxSystemSettings::GetColour(wxSYS_COLOUR_HOTLIGHT));
grid->SetPropertyReadOnly("HELP");
//Cameras
grid->Append(new wxPropertyCategory(_("Cameras"), "CAMERAS") );
grid->Append(new wxStringProperty(_("Add a camera"), "CAMERA_ADD", _("Add...")) );
grid->SetPropertyCell("CAMERA_ADD", 1, _("Add..."), wxNullBitmap, wxSystemSettings::GetColour(wxSYS_COLOUR_HOTLIGHT));
grid->SetPropertyReadOnly("CAMERA_ADD");
for (std::size_t i = 0;i<layer.GetCameraCount();++i)
{
const gd::Camera & camera = layer.GetCamera(i);
wxString suffix = ":" + gd::String::From(i);
grid->AppendIn("CAMERAS", new wxPropertyCategory(wxString::Format(
wxString(i == 0 ? _("Camera %d") : _("Camera %d (native games only)")), i), "CAMERA" + suffix)
);
grid->Append(new wxStringProperty(_(""), "CAMERA_REMOVE" + suffix, _("Remove")) );
grid->SetPropertyCell("CAMERA_REMOVE" + suffix, 1, _("Remove"), wxNullBitmap, wxSystemSettings::GetColour(wxSYS_COLOUR_HOTLIGHT));
grid->SetPropertyReadOnly("CAMERA_REMOVE" + suffix);
grid->AppendIn(suffix, new wxBoolProperty(_("Custom size"), "CAMERA_CUSTOM_SIZE" + suffix, !camera.UseDefaultSize()));
grid->EnableProperty(grid->Append(
new wxStringProperty(_("Width"), "CAMERA_SIZE_WIDTH" + suffix, gd::String::From(camera.GetWidth()))),
!camera.UseDefaultSize());
grid->EnableProperty(grid->Append(
new wxStringProperty(_("Height"), "CAMERA_SIZE_HEIGHT" + suffix, gd::String::From(camera.GetHeight()))),
!camera.UseDefaultSize());
grid->AppendIn(suffix, new wxBoolProperty(_("Custom viewport (native games only)"), "CAMERA_CUSTOM_VIEWPORT" + suffix, !camera.UseDefaultViewport()));
grid->EnableProperty(grid->Append(
new wxStringProperty(_("Top-left x"), "CAMERA_VIEWPORT_X1" + suffix, gd::String::From(camera.GetViewportX1()))),
!camera.UseDefaultViewport());
grid->EnableProperty(grid->Append(
new wxStringProperty(_("Top-left y"), "CAMERA_VIEWPORT_Y1" + suffix, gd::String::From(camera.GetViewportY1()))),
!camera.UseDefaultViewport());
grid->EnableProperty(grid->Append(
new wxStringProperty(_("Bottom-right x"), "CAMERA_VIEWPORT_X2" + suffix, gd::String::From(camera.GetViewportX2()))),
!camera.UseDefaultViewport());
grid->EnableProperty(grid->Append(
new wxStringProperty(_("Bottom-right y"), "CAMERA_VIEWPORT_Y2" + suffix, gd::String::From(camera.GetViewportY2()))),
!camera.UseDefaultViewport());
}
//Effects
grid->Append(new wxPropertyCategory(_("Effects"), "EFFECTS") );
grid->Append(new wxStringProperty(_("Add an effect"), "EFFECT_ADD", _("Add...")) );
grid->SetPropertyCell("EFFECT_ADD", 1, _("Add..."), wxNullBitmap, wxSystemSettings::GetColour(wxSYS_COLOUR_HOTLIGHT));
grid->SetPropertyReadOnly("EFFECT_ADD");
for (std::size_t i = 0;i<layer.GetEffectsCount();++i)
{
const gd::Effect & effect = layer.GetEffect(i);
wxString suffix = ":" + gd::String::From(i);
grid->AppendIn("EFFECTS", new wxPropertyCategory(wxString::Format(wxString(_("Effect %d")), i), "EFFECT" + suffix));
grid->Append(new wxStringProperty(_(""), "EFFECT_REMOVE" + suffix, _("Remove")) );
grid->SetPropertyCell("EFFECT_REMOVE" + suffix, 1, _("Remove"), wxNullBitmap, wxSystemSettings::GetColour(wxSYS_COLOUR_HOTLIGHT));
grid->SetPropertyReadOnly("EFFECT_REMOVE" + suffix);
grid->Append(new wxStringProperty(_("Name"), "EFFECT_NAME" + suffix, effect.GetName()));
wxEnumProperty * prop = new wxEnumProperty(_("Effect"), "EFFECT_EFFECT" + suffix, effectNames);
prop->SetChoiceSelection(effectNames.Index(effect.GetEffectName()));
grid->Append(prop);
for(auto parameter : effect.GetAllParameters())
{
auto & name = parameter.first;
auto value = parameter.second;
grid->Append(new wxStringProperty(name, "EFFECT_PARAMETER_" + name + suffix, gd::String::From(value)));
}
}
grid->SetPropertyAttributeAll(wxPG_BOOL_USE_CHECKBOX, true);
}
bool LayerPropgridHelper::OnPropertySelected(Layer & layer, wxPropertyGridEvent& event)
{
if (!grid) return false;
std::map<wxString, std::function<bool(int)>> camerasProperties = {
{"CAMERA_REMOVE", [&](int cameraIndex) {
if (layer.GetCameraCount() <= 1)
{
gd::LogMessage(_("The layer must have at least one camera."));
return false;
}
layer.DeleteCamera(cameraIndex);
return true;
}},
};
std::map<wxString, std::function<bool(int)>> effectsProperties = {
{"EFFECT_REMOVE", [&](int effectIndex) {
layer.RemoveEffect(layer.GetEffect(effectIndex).GetName());
return true;
}},
};
if (event.GetColumn() == 1) //Manage button-like properties
{
if (event.GetPropertyName() == "CAMERA_ADD")
{
layer.SetCameraCount(layer.GetCameraCount() + 1);
return true;
}
else if (event.GetPropertyName() == "EFFECT_ADD")
{
if (layer.GetEffectsCount() >= 1)
{
gd::LogWarning(_("For now, only one effect by layer is supported."));
return false;
}
gd::String effectName = wxGetSingleChoice(_("Choose an effect to add to the layer"), _("Effects"), effectNames);
if (effectName.empty()) return false;
//TODO: Effect with an already existing name could be created.
SetDefaultParameters(layer.InsertNewEffect(effectName, 0));
return true;
}
else if (event.GetPropertyName() == "HELP")
{
gd::HelpFileAccess::Get()->OpenPage("en/game_develop/documentation/manual/editors/scene_editor/edit_layer");
return false;
}
else
{
for(auto it : camerasProperties)
{
if (event.GetPropertyName().StartsWith(it.first))
{
int cameraId = GetIndexFromPropertyName(event.GetPropertyName());
if (cameraId < 0 || cameraId >= layer.GetCameraCount())
return false;
return it.second(cameraId);
}
}
for(auto it : effectsProperties)
{
if (event.GetPropertyName().StartsWith(it.first))
{
int effectId = GetIndexFromPropertyName(event.GetPropertyName());
if (effectId < 0 || effectId >= layer.GetEffectsCount())
return false;
return it.second(effectId);
}
}
}
}
return false;
}
bool LayerPropgridHelper::OnPropertyChanged(Layer & layer, wxPropertyGridEvent& event)
{
if (!grid) return false;
auto validateViewportValue = [&event]() {
float value = event.GetValue().GetReal();
if (value < 0 || value > 1)
{
gd::LogMessage(_("Viewport values are a factor of the window size, and must be between 0 and 1."));
event.Veto();
return false;
}
return true;
};
auto validateCameraSize = [&event]() {
int value = event.GetValue().GetInteger();
if (value <= 0)
{
gd::LogMessage(_("A camera should have a size that is at least 1 pixel."));
event.Veto();
return false;
}
return true;
};
std::map<wxString, std::function<bool(int)>> camerasProperties = {
{"CAMERA_CUSTOM_SIZE", [&](int id) {
layer.GetCamera(id).SetUseDefaultSize(!event.GetValue().GetBool());
return true;
}},
{"CAMERA_SIZE_WIDTH", [&](int id) {
if (validateCameraSize())
{
layer.GetCamera(id).SetSize(
event.GetValue().GetInteger(),
layer.GetCamera(id).GetHeight()
);
}
return false;
}},
{"CAMERA_SIZE_HEIGHT", [&](int id) {
if (validateCameraSize())
{
layer.GetCamera(id).SetSize(
layer.GetCamera(id).GetWidth(),
event.GetValue().GetInteger()
);
}
return false;
}},
{"CAMERA_CUSTOM_VIEWPORT", [&](int id) {
layer.GetCamera(id).SetUseDefaultViewport(!event.GetValue().GetBool());
return true;
}},
{"CAMERA_VIEWPORT_X1", [&](int id) {
if (validateViewportValue())
layer.GetCamera(id).SetViewportX1(event.GetValue().GetReal());
return false;
}},
{"CAMERA_VIEWPORT_Y1", [&](int id) {
if (validateViewportValue())
layer.GetCamera(id).SetViewportY1(event.GetValue().GetReal());
return false;
}},
{"CAMERA_VIEWPORT_X2", [&](int id) {
if (validateViewportValue())
layer.GetCamera(id).SetViewportX2(event.GetValue().GetReal());
return false;
}},
{"CAMERA_VIEWPORT_Y2", [&](int id) {
if (validateViewportValue())
layer.GetCamera(id).SetViewportY2(event.GetValue().GetReal());
return false;
}}
};
std::map<wxString, std::function<bool(int)>> effectsProperties = {
{"EFFECT_NAME", [&](int id) {
layer.GetEffect(id).SetName(event.GetValue().GetString());
return false;
}},
{"EFFECT_EFFECT", [&](int id) {
unsigned int effectNameId = event.GetPropertyValue().GetLong();
if (effectNameId >= effectNames.size())
return false;
layer.GetEffect(id).SetEffectName(effectNames[effectNameId]);
return false;
}},
{"EFFECT_PARAMETER_", [&](int id) {
gd::String name = event.GetPropertyName();
size_t pos = gd::String("EFFECT_PARAMETER_").length();
name = name.substr(pos, name.find(":") - pos);
layer.GetEffect(id).SetParameter(name,
gd::String(event.GetValue().GetString()).To<float>()
);
return false;
}}
};
if (event.GetPropertyName() == "LAYER_VISIBLE")
layer.SetVisibility(event.GetValue().GetBool());
else
{
for(auto it : camerasProperties)
{
if (event.GetPropertyName().StartsWith(it.first))
{
int cameraId = GetIndexFromPropertyName(event.GetPropertyName());
if (cameraId < 0 || cameraId >= layer.GetCameraCount())
return false;
return it.second(cameraId);
}
}
for(auto it : effectsProperties)
{
if (event.GetPropertyName().StartsWith(it.first))
{
int effectId = GetIndexFromPropertyName(event.GetPropertyName());
if (effectId < 0 || effectId >= layer.GetEffectsCount())
return false;
return it.second(effectId);
}
}
}
return false;
}
}
#endif

View File

@@ -0,0 +1,55 @@
/*
* GDevelop Core
* 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) && !defined(GD_NO_WX_GUI)
#ifndef LAYERSPROPGRIDHELPER_H
#define LAYERSPROPGRIDHELPER_H
#include <wx/propgrid/propgrid.h>
#include <vector>
namespace gd { class Layer; }
namespace gd { class Project; }
namespace gd { class Layout; }
namespace gd
{
/**
* \brief Helper class used to easily use a wxPropertyGrid so as to view and edit the properties of
* a gd::Layer
*
* \ingroup IDEdialogs
*/
class GD_CORE_API LayerPropgridHelper
{
public:
/**
* \brief Default constructor.
* \param grid A pointer to the wxPropertyGrid to be used.
* \param project The project edited
* \param layout The layout being edited
*/
LayerPropgridHelper(gd::Project & project_, gd::Layout & layout_);
virtual ~LayerPropgridHelper() {};
void RefreshFrom(const Layer & layer);
bool OnPropertySelected(Layer & layer, wxPropertyGridEvent& event);
bool OnPropertyChanged(Layer & layer, wxPropertyGridEvent& event);
void SetGrid(wxPropertyGrid * grid_) { grid = grid_; }
private:
wxPropertyGrid * grid; ///< The grid used for diplaying and editing properties.
gd::Project & project;
gd::Layout & layout;
wxArrayString effectNames; ///< Hardcoded names of the available effects
};
}
#endif // LAYERSPROPGRIDHELPER_H
#endif

View File

@@ -149,15 +149,15 @@ LayoutEditorCanvas::LayoutEditorCanvas(wxWindow* parent, gd::Project & project_,
//...and pass it to the sf::RenderWindow.
#if GTK_CHECK_VERSION(3, 0, 0)
sf::RenderWindow::create(GDK_WINDOW_XID(win));
sf::RenderWindow::create(GDK_WINDOW_XID(win), sf::ContextSettings(24, 8));
#else
sf::RenderWindow::create(GDK_WINDOW_XWINDOW(win));
sf::RenderWindow::create(GDK_WINDOW_XWINDOW(win), sf::ContextSettings(24, 8));
#endif
#else
// Tested under Windows XP only (should work with X11 and other Windows versions - no idea about MacOS)
sf::RenderWindow::create(static_cast<sf::WindowHandle>(GetHandle()));
sf::RenderWindow::create(static_cast<sf::WindowHandle>(GetHandle()), sf::ContextSettings(24, 8));
#endif
@@ -575,6 +575,14 @@ void LayoutEditorCanvas::UpdateContextMenu()
if ( selectedInstances.empty() ) return;
//Can we send the objects on a higher layer ?
std::size_t highestLayer = 0;
for (auto & it : selectedInstances)
{
if (it.first == NULL) continue;
highestLayer = std::max(highestLayer, layout.GetLayerPosition(it.first->GetLayer()));
}
//Can we send the objects on a lower layer ?
std::size_t lowestLayer = layout.GetLayersCount()-1;
for (auto & it : selectedInstances)
{
@@ -585,29 +593,21 @@ void LayoutEditorCanvas::UpdateContextMenu()
if (wxMenuItem * layerUpItem = contextMenu.FindItem(ID_LAYERUPMENU))
{
layerUpItem->Enable(false);
if ( lowestLayer+1 < layout.GetLayersCount() )
if ( highestLayer+1 < layout.GetLayersCount() )
{
gd::String name = layout.GetLayer(lowestLayer+1).GetName();
gd::String name = layout.GetLayer(highestLayer+1).GetName();
if ( name == "" ) name = _("Base layer");
layerUpItem->Enable(true);
layerUpItem->SetItemLabel(_("Put the object(s) on the layer \"") + name + "\"");
}
}
//Can we send the objects on a lower layer ?
std::size_t highestLayer = 0;
for (auto & it : selectedInstances)
{
if (it.first == NULL) continue;
highestLayer = std::max(highestLayer, layout.GetLayerPosition(it.first->GetLayer()));
}
if (wxMenuItem * layerDownItem = contextMenu.FindItem(ID_LAYERUPMENU))
if (wxMenuItem * layerDownItem = contextMenu.FindItem(ID_LAYERDOWNMENU))
{
layerDownItem->Enable(false);
if ( highestLayer >= 1 )
if ( lowestLayer >= 1 )
{
gd::String name = layout.GetLayer(highestLayer-1).GetName();
gd::String name = layout.GetLayer(lowestLayer-1).GetName();
if ( name == "" ) name = _("Base layer");
layerDownItem->Enable(true);

View File

@@ -0,0 +1,22 @@
#include "GDCore/Events/EventsList.h"
#include "GDCore/Events/Event.h"
class GD_CORE_API EventsListUnfolder
{
public:
/**
* \brief Recursively unfold all the event lists containing the specified event.
* \note This is a quick and naive implementation, complexity is pretty high.
*/
static void UnfoldWhenContaining(gd::EventsList & list, const gd::BaseEvent & eventToContain) {
for(size_t i = 0;i < list.size();++i)
{
gd::BaseEvent & event = list[i];
if (event.CanHaveSubEvents() && event.GetSubEvents().Contains(eventToContain))
{
event.SetFolded(false);
UnfoldWhenContaining(event.GetSubEvents(), eventToContain);
}
}
}
};

View File

@@ -0,0 +1,38 @@
/*
* GDevelop Core
* Copyright 2008-2016 Florian Rival (Florian.Rival@gmail.com). All rights reserved.
* This project is released under the MIT License.
*/
#include "GDCore/Project/Effect.h"
#include "GDCore/Serialization/SerializerElement.h"
#include "GDCore/CommonTools.h"
namespace gd
{
#if defined(GD_IDE_ONLY)
void Effect::SerializeTo(SerializerElement & element) const
{
element.SetAttribute("name", GetName());
element.SetAttribute("effectName", GetEffectName());
SerializerElement & parametersElement = element.AddChild("parameters");
for (auto & parameter : parameters)
parametersElement.AddChild(parameter.first).SetValue(parameter.second);
}
#endif
/**
* \brief Unserialize the layer.
*/
void Effect::UnserializeFrom(const SerializerElement & element)
{
SetName(element.GetStringAttribute("name"));
SetEffectName(element.GetStringAttribute("effectName"));
parameters.clear();
const SerializerElement & parametersElement = element.GetChild("parameters");
for (auto & child : parametersElement.GetAllChildren())
SetParameter(child.first, child.second->GetValue().GetDouble());
}
}

View File

@@ -0,0 +1,56 @@
/*
* GDevelop Core
* Copyright 2008-2016 Florian Rival (Florian.Rival@gmail.com). All rights reserved.
* This project is released under the MIT License.
*/
#ifndef GDCORE_EFFECT_H
#define GDCORE_EFFECT_H
#include <map>
namespace gd { class SerializerElement; }
#include "GDCore/String.h"
namespace gd
{
/**
* \brief Represents an effect that can be applied on a layer.
*
* \see gd::Layer
* \ingroup PlatformDefinition
*/
class GD_CORE_API Effect
{
public:
Effect() {};
virtual ~Effect() {};
void SetName(const gd::String & name_) { name = name_; }
const gd::String & GetName() const { return name; }
void SetEffectName(const gd::String & effectName_) { effectName = effectName_; }
const gd::String & GetEffectName() const { return effectName; }
void SetParameter(const gd::String & name, float value) { parameters[name] = value; }
float GetParameter(const gd::String & name) { return parameters[name]; }
const std::map<gd::String, float> & GetAllParameters() const { return parameters; }
#if defined(GD_IDE_ONLY)
/**
* \brief Serialize layer.
*/
void SerializeTo(SerializerElement & element) const;
#endif
/**
* \brief Unserialize the layer.
*/
void UnserializeFrom(const SerializerElement & element);
private:
gd::String name; ///< The name of the layer
gd::String effectName; ///< The name of the effect to apply
std::map<gd::String, float> parameters;
};
}
#endif

View File

@@ -189,14 +189,18 @@ OpenGLTextureWrapper::OpenGLTextureWrapper(std::shared_ptr<SFMLTextureWrapper> s
{
sfmlTexture = sfmlTexture_;
#if !defined(ANDROID) //TODO: OpenGL
glGenTextures(1, &texture);
glBindTexture(GL_TEXTURE_2D, texture);
gluBuild2DMipmaps(GL_TEXTURE_2D, GL_RGBA, sfmlTexture->image.getSize().x, sfmlTexture->image.getSize().y, GL_RGBA, GL_UNSIGNED_BYTE, sfmlTexture->image.getPixelsPtr());
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);
#endif
}
OpenGLTextureWrapper::~OpenGLTextureWrapper()
{
#if !defined(ANDROID) //TODO: OpenGL
glDeleteTextures(1, &texture);
#endif
};

View File

@@ -4,7 +4,7 @@
* This project is released under the MIT License.
*/
#include "GDCore/Project/Layer.h"
#include "GDCore/IDE/Dialogs/EditLayerDialog.h"
#include "GDCore/Project/Effect.h"
#include "GDCore/Serialization/SerializerElement.h"
#include "GDCore/CommonTools.h"
@@ -12,6 +12,7 @@ namespace gd
{
Camera Layer::badCamera;
Effect Layer::badEffect;
Layer::Layer() :
isVisible(true)
@@ -52,6 +53,13 @@ void Layer::SerializeTo(SerializerElement & element) const
cameraElement.SetAttribute("viewportBottom", GetCamera(c).GetViewportY2());
}
SerializerElement & effectsElement = element.AddChild("effects");
effectsElement.ConsiderAsArrayOf("effect");
for (std::size_t i = 0;i<GetEffectsCount();++i)
{
SerializerElement & effectElement = effectsElement.AddChild("effect");
GetEffect(i).SerializeTo(effectElement);
}
}
#endif
@@ -105,18 +113,112 @@ void Layer::UnserializeFrom(const SerializerElement & element)
cameraElement.GetDoubleAttribute("viewportBottom")); // (sf::Rect used Right and Bottom instead of Width and Height before)
}
}
effects.clear();
SerializerElement & effectsElement = element.GetChild("effects");
effectsElement.ConsiderAsArrayOf("effect");
for (std::size_t i = 0; i < effectsElement.GetChildrenCount(); ++i)
{
const SerializerElement & effectElement = effectsElement.GetChild(i);
auto effect = std::shared_ptr<gd::Effect>(new Effect);
effect->UnserializeFrom(effectElement);
effects.push_back(effect);
}
}
#if defined(GD_IDE_ONLY) && !defined(GD_NO_WX_GUI)
/**
* Display a window to edit the layer
*/
void Layer::EditLayer()
gd::Effect & Layer::GetEffect(const gd::String & name)
{
EditLayerDialog dialog(NULL, *this);
dialog.ShowModal();
auto effect = find_if(effects.begin(), effects.end(), [&name](std::shared_ptr<gd::Effect> & effect) {
return effect->GetName() == name;
});
if ( effect != effects.end())
return **effect;
return badEffect;
}
const gd::Effect & Layer::GetEffect(const gd::String & name) const
{
auto effect = find_if(effects.begin(), effects.end(), [&name](const std::shared_ptr<gd::Effect> & effect) {
return effect->GetName() == name;
});
if ( effect != effects.end())
return **effect;
return badEffect;
}
gd::Effect & Layer::GetEffect(std::size_t index)
{
return *effects[index];
}
const gd::Effect & Layer::GetEffect (std::size_t index) const
{
return *effects[index];
}
std::size_t Layer::GetEffectsCount() const
{
return effects.size();
}
bool Layer::HasEffectNamed(const gd::String & name) const
{
return ( find_if(effects.begin(), effects.end(), [&name](const std::shared_ptr<gd::Effect> & effect) {
return effect->GetName() == name;
}) != effects.end() );
}
std::size_t Layer::GetEffectPosition(const gd::String & name) const
{
for (std::size_t i = 0;i<effects.size();++i)
{
if ( effects[i]->GetName() == name ) return i;
}
return gd::String::npos;
}
gd::Effect & Layer::InsertNewEffect(const gd::String & name, std::size_t position)
{
auto newEffect = std::shared_ptr<gd::Effect>(new Effect);
newEffect->SetName(name);
newEffect->SetEffectName(name);
if (position<effects.size())
effects.insert(effects.begin()+position, newEffect);
else
effects.push_back(newEffect);
return *newEffect;
}
void Layer::InsertEffect(const gd::Effect & effect, std::size_t position)
{
auto newEffect = std::shared_ptr<gd::Effect>(new Effect(effect));
if (position<effects.size())
effects.insert(effects.begin()+position, newEffect);
else
effects.push_back(newEffect);
}
void Layer::RemoveEffect(const gd::String & name)
{
auto effect = find_if(effects.begin(), effects.end(), [&name](const std::shared_ptr<gd::Effect> & effect) {
return effect->GetName() == name;
});
if ( effect == effects.end() ) return;
effects.erase(effect);
}
void Layer::SwapEffects(std::size_t firstEffectIndex, std::size_t secondEffectIndex)
{
if ( firstEffectIndex >= effects.size() || secondEffectIndex >= effects.size() )
return;
auto temp = effects[firstEffectIndex];
effects[firstEffectIndex] = effects[secondEffectIndex];
effects[secondEffectIndex] = temp;
}
#endif
Camera::Camera() :
defaultSize(true),

View File

@@ -7,6 +7,8 @@
#define GDCORE_LAYER_H
#include "GDCore/String.h"
#include <vector>
#include <memory>
namespace gd { class Effect; }
namespace gd { class Camera; }
namespace gd { class SerializerElement; }
@@ -45,6 +47,10 @@ public:
*/
bool GetVisibility() const { return isVisible; }
/** \name Cameras
*/
///@{
/**
* \brief Change the number of cameras inside the layer.
*/
@@ -75,12 +81,71 @@ public:
*/
inline void AddCamera(const Camera & camera) { cameras.push_back(camera); };
#if defined(GD_IDE_ONLY)
/**
* \brief Display a window to edit the layer
*/
void EditLayer();
///@}
/** \name Effects
*/
///@{
/**
* \brief Return true if the effect called "name" exists.
*/
bool HasEffectNamed(const gd::String & name) const;
/**
* \brief Return a reference to the effect called "name".
*/
Effect & GetEffect(const gd::String & name);
/**
* \brief Return a reference to the effect called "name".
*/
const Effect & GetEffect(const gd::String & name) const;
/**
* Return a reference to the effect at position "index" in the effects list
*/
Effect & GetEffect(std::size_t index);
/**
* Return a reference to the effect at position "index" in the effects list
*/
const Effect & GetEffect (std::size_t index) const;
/**
* Return the position of the effect called "name" in the effects list
*/
std::size_t GetEffectPosition(const gd::String & name) const;
/**
* Return the number of effecst.
*/
std::size_t GetEffectsCount() const;
/**
* Add a new effect at the specified position in the effects list.
*/
gd::Effect & InsertNewEffect(const gd::String & name, std::size_t position);
/**
* \brief Add the a copy of the specified effect in the effects list.
* \note No pointer or reference must be kept on the layer passed as parameter.
* \param theEffect The effect that must be copied and inserted into the effects list
* \param position Insertion position.
*/
void InsertEffect(const Effect & theEffect, std::size_t position);
/**
* Remove the specified effect.
*/
void RemoveEffect(const gd::String & name);
/**
* Swap the position of two effects.
*/
void SwapEffects(std::size_t firstEffectIndex, std::size_t secondEffectIndex);
///@}
#if defined(GD_IDE_ONLY)
/**
* \brief Serialize layer.
*/
@@ -96,9 +161,11 @@ private:
gd::String name; ///< The name of the layer
bool isVisible; ///< True if the layer is visible
std::vector < gd::Camera > cameras; ///< The camera displayed by the layer
std::vector<gd::Camera> cameras; ///< The camera displayed by the layer
std::vector<std::shared_ptr<gd::Effect>> effects; ///< The effects applied to the layer.
static gd::Camera badCamera;
static gd::Effect badEffect;
};
/**
@@ -124,17 +191,21 @@ public:
~Camera() {};
/**
* Change the viewport, i.e the area of the window where the camera will be displayed
* The coordinates must be between 0 and 1.
* \brief Change the viewport, i.e the area of the window where the camera will be displayed.
* \note The coordinates must be between 0 and 1.
*/
void SetViewport(float x1_, float y1_, float x2_, float y2_) { x1 = x1_; x2 = x2_; y1 = y1_; y2 = y2_; };
void SetViewportX1(float x1_) { x1 = x1_; };
void SetViewportY1(float y1_) { y1 = y1_; };
void SetViewportX2(float x2_) { x2 = x2_; };
void SetViewportY2(float y2_) { y2 = y2_; };
float GetViewportX1() const { return x1; };
float GetViewportY1() const { return y1; };
float GetViewportX2() const { return x2; };
float GetViewportY2() const { return y2; };
/**
* Change the size of the rendered area of the scene.
* \brief Change the size of the rendered area of the scene, in pixels.
*/
void SetSize(float width_, float height_) { width = width_; height = height_; };
float GetWidth() const { return width; };

View File

@@ -21,9 +21,7 @@ namespace gd
Object::~Object()
{
//Do not forget to delete behaviors which are managed using raw pointers.
for (std::map<gd::String, Behavior* >::const_iterator it = behaviors.begin() ; it != behaviors.end(); ++it )
delete it->second;
}
Object::Object(const gd::String & name_) :
@@ -37,13 +35,9 @@ void Object::Init(const gd::Object & object)
type = object.type;
objectVariables = object.objectVariables;
//Do not forget to delete behaviors which are managed using raw pointers.
for (std::map<gd::String, Behavior* >::const_iterator it = behaviors.begin() ; it != behaviors.end(); ++it )
delete it->second;
behaviors.clear();
for (std::map<gd::String, Behavior* >::const_iterator it = object.behaviors.begin() ; it != object.behaviors.end(); ++it )
behaviors[it->first] = it->second->Clone();
for (auto it = object.behaviors.cbegin() ; it != object.behaviors.cend(); ++it )
behaviors[it->first] = std::unique_ptr<Behavior>(it->second->Clone());
}
@@ -51,7 +45,7 @@ std::vector < gd::String > Object::GetAllBehaviorNames() const
{
std::vector < gd::String > allNameIdentifiers;
for (std::map<gd::String, Behavior* >::const_iterator it = behaviors.begin() ; it != behaviors.end(); ++it )
for (std::map<gd::String, std::unique_ptr<gd::Behavior> >::const_iterator it = behaviors.begin() ; it != behaviors.end(); ++it )
allNameIdentifiers.push_back(it->first);
return allNameIdentifiers;
@@ -59,9 +53,6 @@ std::vector < gd::String > Object::GetAllBehaviorNames() const
void Object::RemoveBehavior(const gd::String & name)
{
//Do not forget to delete behaviors which are managed using raw pointers.
delete(behaviors[name]);
behaviors.erase(name);
}
@@ -70,10 +61,10 @@ bool Object::RenameBehavior(const gd::String & name, const gd::String & newName)
if ( behaviors.find(name) == behaviors.end()
|| behaviors.find(newName) != behaviors.end() ) return false;
Behavior * aut = behaviors.find(name)->second;
std::unique_ptr<Behavior> aut = std::move(behaviors.find(name)->second);
behaviors.erase(name);
behaviors[newName] = aut;
aut->SetName(newName);
behaviors[newName] = std::move(aut);
behaviors[newName]->SetName(newName);
return true;
}
@@ -95,8 +86,9 @@ bool Object::HasBehaviorNamed(const gd::String & name) const
bool Object::AddBehavior(Behavior * behavior)
{
if (behavior && !HasBehaviorNamed(behavior->GetName())) {
behaviors[behavior->GetName()] = behavior;
if (behavior && !HasBehaviorNamed(behavior->GetName()))
{
behaviors[behavior->GetName()] = std::unique_ptr<Behavior>(behavior);
return true;
}
@@ -112,14 +104,18 @@ std::map<gd::String, gd::PropertyDescriptor> Object::GetProperties(gd::Project &
gd::Behavior * Object::AddNewBehavior(gd::Project & project, const gd::String & type, const gd::String & name)
{
Behavior * behavior = project.GetCurrentPlatform().CreateBehavior(type);
std::unique_ptr<gd::Behavior> behavior = project.GetCurrentPlatform().CreateBehavior(type);
if ( behavior != NULL ) {
if ( behavior )
{
behavior->SetName(name);
behaviors[behavior->GetName()] = behavior;
behaviors[name] = std::move(behavior);
return behaviors[name].get();
}
else
{
return nullptr;
}
return behavior;
}
sf::Vector2f Object::GetInitialInstanceDefaultSize(gd::InitialInstance & instance, gd::Project & project, gd::Layout & layout) const
@@ -170,12 +166,12 @@ void Object::UnserializeFrom(gd::Project & project, const SerializerElement & el
.FindAndReplace("Automatism", "Behavior");
gd::String autoName = behaviorElement.GetStringAttribute("name", "", "Name");
Behavior* behavior = project.CreateBehavior(autoType);
if ( behavior != NULL )
std::unique_ptr<Behavior> behavior = project.CreateBehavior(autoType);
if ( behavior )
{
behavior->SetName(autoName);
behavior->UnserializeFrom(behaviorElement);
behaviors[behavior->GetName()] = behavior;
behaviors[autoName] = std::move(behavior);
}
else
std::cout << "WARNING: Unknown behavior " << autoType << std::endl;
@@ -194,12 +190,12 @@ void Object::UnserializeFrom(gd::Project & project, const SerializerElement & el
.FindAndReplace("Automatism", "Behavior"); //Compatibility with GD <= 4
gd::String autoName = behaviorElement.GetStringAttribute("name");
Behavior* behavior = project.CreateBehavior(autoType);
if ( behavior != NULL )
std::unique_ptr<Behavior> behavior = project.CreateBehavior(autoType);
if ( behavior )
{
behavior->SetName(autoName);
behavior->UnserializeFrom(behaviorElement);
behaviors[behavior->GetName()] = behavior;
behaviors[autoName] = std::move(behavior);
}
else
std::cout << "WARNING: Unknown behavior " << autoType << std::endl;
@@ -233,8 +229,3 @@ void Object::SerializeTo(SerializerElement & element) const
#endif
}
gd::Object * CreateBaseObject(gd::String name)
{
return new gd::Object(name);
}

View File

@@ -9,10 +9,10 @@
#include "GDCore/String.h"
#include <vector>
#include <map>
#include "GDCore/Project/Behavior.h"
#include "GDCore/Project/VariablesContainer.h"
#include <SFML/System/Vector2.hpp>
namespace gd { class PropertyDescriptor; }
namespace gd { class Behavior; }
namespace gd { class Project; }
namespace gd { class Layout; }
namespace gd { class MainFrameWrapper; }
@@ -262,7 +262,7 @@ public:
/**
* \brief Get a read-only access to the map containing the behaviors.
*/
const std::map<gd::String, gd::Behavior* > & GetAllBehaviors() const {return behaviors;};
const std::map<gd::String, std::unique_ptr<gd::Behavior> > & GetAllBehaviors() const {return behaviors;};
///@}
/** \name Variable management
@@ -302,7 +302,7 @@ public:
protected:
gd::String name; ///< The full name of the object
gd::String type; ///< Which type is the object. ( To test if we can do something reserved to some objects with it )
std::map<gd::String, gd::Behavior* > behaviors; ///<Contains all behaviors of the object. Behaviors are the ownership of the object
std::map<gd::String, std::unique_ptr<gd::Behavior> > behaviors; ///<Contains all behaviors of the object. Behaviors are the ownership of the object
gd::VariablesContainer objectVariables; ///<List of the variables of the object
/**
@@ -345,6 +345,4 @@ typedef std::vector < std::shared_ptr<gd::Object> > ObjList;
*/
typedef std::shared_ptr<gd::Object> ObjSPtr;
gd::Object * GD_CORE_API CreateBaseObject(gd::String name);
#endif // GDCORE_OBJECT_H

View File

@@ -121,17 +121,17 @@ std::shared_ptr<gd::Object> Project::CreateObject(const gd::String & type, const
return std::shared_ptr<gd::Object>();
}
gd::Behavior* Project::CreateBehavior(const gd::String & type, const gd::String & platformName)
std::unique_ptr<gd::Behavior> Project::CreateBehavior(const gd::String & type, const gd::String & platformName)
{
for (std::size_t i = 0;i<platforms.size();++i)
{
if ( !platformName.empty() && platforms[i]->GetName() != platformName ) continue;
gd::Behavior* behavior = platforms[i]->CreateBehavior(type);
std::unique_ptr<gd::Behavior> behavior = platforms[i]->CreateBehavior(type);
if ( behavior ) return behavior;
}
return NULL;
return nullptr;
}
std::shared_ptr<gd::BehaviorsSharedData> Project::CreateBehaviorSharedDatas(const gd::String & type, const gd::String & platformName)

View File

@@ -6,8 +6,9 @@
#ifndef GDCORE_PROJECT_H
#define GDCORE_PROJECT_H
#include "GDCore/String.h"
#include <memory>
#include <vector>
#include "GDCore/String.h"
class wxPropertyGrid;
class wxPropertyGridEvent;
class TiXmlElement;
@@ -243,7 +244,7 @@ public:
* \param type The type of the behavior
* \param platformName The name of the platform to be used. If empty, the first platform supporting the object is used.
*/
gd::Behavior* CreateBehavior(const gd::String & type, const gd::String & platformName = "");
std::unique_ptr<gd::Behavior> CreateBehavior(const gd::String & type, const gd::String & platformName = "");
/**
* Create behavior shared data of the given type.

View File

@@ -140,7 +140,10 @@ String String::FromLocale( const std::string &localizedString )
#elif defined(EMSCRIPTEN)
return FromUTF8(localizedString); //Assume UTF8 is the current locale
#else
if(std::locale("").name().find("UTF-8") != std::string::npos)
if(std::locale("").name().find("utf-8") != std::string::npos ||
std::locale("").name().find("UTF-8") != std::string::npos ||
std::locale("").name().find("utf8") != std::string::npos ||
std::locale("").name().find("UTF8") != std::string::npos)
return FromUTF8(localizedString); //UTF8 is already the current locale
else
return FromSfString(sf::String(localizedString, std::locale(""))); //Use the current locale (std::locale("")) for conversion
@@ -189,7 +192,10 @@ std::string String::ToLocale() const
#elif defined(EMSCRIPTEN)
return m_string;
#else
if(std::locale("").name().find("UTF-8") != std::string::npos)
if(std::locale("").name().find("utf-8") != std::string::npos ||
std::locale("").name().find("UTF-8") != std::string::npos ||
std::locale("").name().find("utf8") != std::string::npos ||
std::locale("").name().find("UTF8") != std::string::npos)
return m_string; //UTF8 is already the current locale on Linux
else
return ToSfString().toAnsiString(std::locale("")); //Use the current locale for conversion
@@ -440,7 +446,7 @@ String String::FindAndReplace(String search, String replacement, bool all) const
do {
pos = result.find(search, lastPos);
lastPos = pos;
if (pos != npos)
if (pos != npos)
{
result.replace(pos, search.size(), replacement);
lastPos += replacement.size();

View File

@@ -51,6 +51,11 @@ namespace gd
}
#else
#warning System not supported for dynamic libraries loading
Handle OpenLibrary(const char* path) {return nullptr;}
void* GetSymbol(Handle library, const char* name) { return nullptr;}
void CloseLibrary(Handle library) {}
gd::String DynamicLibraryLastError() {return "";}
Handle SetLibraryGlobal(const char* path) { return nullptr; }
#endif
}

View File

@@ -4,8 +4,8 @@
namespace AutoVersion{
//Date Version Types
static const char GDCore_DATE[] = "17";
static const char GDCore_MONTH[] = "01";
static const char GDCore_DATE[] = "27";
static const char GDCore_MONTH[] = "06";
static const char GDCore_YEAR[] = "2016";
//Software Status
@@ -15,12 +15,12 @@ namespace AutoVersion{
//Standard Version Type
static const long GDCore_MAJOR = 4;
static const long GDCore_MINOR = 0;
static const long GDCore_BUILD = 89;
static const long GDCore_BUILD = 92;
static const long GDCore_REVISION = 0;
//Miscellaneous Version Types
#define GDCore_RC_FILEVERSION 4,0,89,0
#define GDCore_RC_FILEVERSION_STRING "4, 0, 89, 0\0"
static const char GDCore_FULLVERSION_STRING[] = "4.0.89.0";
#define GDCore_RC_FILEVERSION 4,0,92,0
#define GDCore_RC_FILEVERSION_STRING "4, 0, 92, 0\0"
static const char GDCore_FULLVERSION_STRING[] = "4.0.92.0";
}
#endif //GDCORE_VERSION_H

View File

@@ -5,7 +5,6 @@
<id_arg>0</id_arg>
<style>wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER|wxMAXIMIZE_BOX</style>
<object class="wxAuiManager" variable="mgr" member="yes">
<handler function="OnmgrPaneClose" entry="EVT_AUI_PANE_CLOSE" />
<object class="AuiManagerItem">
<object class="wxPanel" name="ID_PANEL1" variable="centerPanel" member="yes">
<pos>107,155</pos>
@@ -26,7 +25,7 @@
<object class="wxAuiToolBar" name="ID_AUITOOLBAR1" variable="toolbar" member="yes">
<object class="AuiToolBarItem">
<object class="wxAuiToolBarItem" name="ID_MASKITEM" variable="maskItem_" member="yes">
<bitmap code="gd::CommonBitmapProvider::GetInstance()-&gt;maskEdit16" />
<bitmap code="gd::CommonBitmapProvider::Get()-&gt;maskEdit16" />
<shorthelp>Edit the collision masks (hitbox)</shorthelp>
<itemkind>Check</itemkind>
<handler function="OnMaskEditClick" entry="EVT_TOOL" />
@@ -35,7 +34,7 @@
</object>
<object class="AuiToolBarItem">
<object class="wxAuiToolBarItem" name="ID_POINTSITEM" variable="pointsItem_" member="yes">
<bitmap code="gd::CommonBitmapProvider::GetInstance()-&gt;pointEdit16" />
<bitmap code="gd::CommonBitmapProvider::Get()-&gt;pointEdit16" />
<shorthelp>Edit the image&apos;s point</shorthelp>
<itemkind>Check</itemkind>
<handler function="OnPointEditClick" entry="EVT_TOOL" />
@@ -48,7 +47,7 @@
</object>
<object class="AuiToolBarItem">
<object class="wxAuiToolBarItem" name="ID_AUITOOLBARITEM4" variable="AuiToolBarItem9" member="yes">
<bitmap code="gd::SkinHelper::GetIcon(&quot;preview&quot;, 16)" />
<bitmap code='gd::SkinHelper::GetIcon(&quot;preview&quot;, 16)' />
<shorthelp>Preview</shorthelp>
<handler function="OnPreviewClick" entry="EVT_TOOL" />
</object>
@@ -181,7 +180,7 @@
<object class="wxAuiToolBar" name="ID_AUITOOLBAR4" variable="animationToolbar" member="yes">
<object class="AuiToolBarItem">
<object class="wxAuiToolBarItem" name="ID_AUITOOLBARITEM5" variable="AuiToolBarItem10" member="yes">
<bitmap code="gd::SkinHelper::GetIcon(&quot;add&quot;, 16)" />
<bitmap code='gd::SkinHelper::GetIcon(&quot;add&quot;, 16)' />
<shorthelp>Add an animation</shorthelp>
<handler function="OnAddAnimationSelected" entry="EVT_TOOL" />
</object>
@@ -189,7 +188,7 @@
</object>
<object class="AuiToolBarItem">
<object class="wxAuiToolBarItem" name="ID_AUITOOLBARITEM8" variable="AuiToolBarItem11" member="yes">
<bitmap code="gd::SkinHelper::GetIcon(&quot;remove&quot;, 16)" />
<bitmap code='gd::SkinHelper::GetIcon(&quot;remove&quot;, 16)' />
<shorthelp>Delete an animation</shorthelp>
<handler function="OnDeleteAnimationSelected" entry="EVT_TOOL" />
</object>
@@ -337,7 +336,7 @@
</object>
<object class="AuiToolBarItem">
<object class="wxAuiToolBarItem" name="ID_AUITOOLBARITEM7" variable="AuiToolBarItem7" member="yes">
<bitmap code="gd::SkinHelper::GetIcon(&quot;remove&quot;, 16)" />
<bitmap code='gd::SkinHelper::GetIcon(&quot;remove&quot;, 16)' />
<handler function="OnDeleteMaskClick" entry="EVT_TOOL" />
</object>
<label>Item label</label>
@@ -348,7 +347,7 @@
</object>
<object class="AuiToolBarItem">
<object class="wxAuiToolBarItem" name="ID_AUITOOLBARITEM1" variable="AuiToolBarItem1" member="yes">
<bitmap code="gd::CommonBitmapProvider::GetInstance()-&gt;defaultMask16" />
<bitmap code="gd::CommonBitmapProvider::Get()-&gt;defaultMask16" />
<shorthelp>Go back to default mask</shorthelp>
<handler function="OnDefaultMaskClick" entry="EVT_TOOL" />
</object>
@@ -360,7 +359,7 @@
</object>
<object class="AuiToolBarItem">
<object class="wxAuiToolBarItem" name="ID_MASKAPPLYWHOLEANIMITEM" variable="AuiToolBarItem8" member="yes">
<bitmap code="gd::SkinHelper::GetIcon(&quot;copy&quot;, 16)" />
<bitmap code='gd::SkinHelper::GetIcon(&quot;copy&quot;, 16)' />
<itemkind>Check</itemkind>
<handler function="OnPointEditClick" entry="EVT_TOOL" />
</object>
@@ -388,7 +387,7 @@
</object>
<object class="sizeritem">
<object class="Custom" name="ID_TREELISTCTRL1" subclass="wxTreeListCtrl" variable="maskTree" member="yes">
<creating_code>$(THIS) = new $(CLASS)($(PARENT),$(ID),$(POS),$(SIZE),$(STYLE),$(NAME));</creating_code>
<creating_code>$(THIS) = new $(CLASS)($(PARENT),$(ID),$(POS),$(SIZE),0,$(NAME));</creating_code>
<include_file>wx/treelist.h</include_file>
<style></style>
</object>
@@ -422,14 +421,14 @@
<object class="wxAuiToolBar" name="ID_AUITOOLBAR2" variable="pointToolbar" member="yes">
<object class="AuiToolBarItem">
<object class="wxAuiToolBarItem" name="ID_AUITOOLBARITEM3" variable="AuiToolBarItem3" member="yes">
<bitmap code="gd::SkinHelper::GetIcon(&quot;add&quot;, 16)" />
<bitmap code='gd::SkinHelper::GetIcon(&quot;add&quot;, 16)' />
<handler function="OnAddPointClick" entry="EVT_TOOL" />
</object>
<label>Item label</label>
</object>
<object class="AuiToolBarItem">
<object class="wxAuiToolBarItem" name="ID_DELETEPOINTITEM" variable="AuiToolBarItem5" member="yes">
<bitmap code="gd::SkinHelper::GetIcon(&quot;remove&quot;, 16)" />
<bitmap code='gd::SkinHelper::GetIcon(&quot;remove&quot;, 16)' />
<handler function="OnDeletePointClick" entry="EVT_TOOL" />
</object>
<label>Item label</label>
@@ -440,7 +439,7 @@
</object>
<object class="AuiToolBarItem">
<object class="wxAuiToolBarItem" name="ID_POINTAPPLYWHOLEANIMITEM" variable="AuiToolBarItem4" member="yes">
<bitmap code="gd::SkinHelper::GetIcon(&quot;copy&quot;, 16)" />
<bitmap code='gd::SkinHelper::GetIcon(&quot;copy&quot;, 16)' />
<shorthelp>Apply changes to the whole animation</shorthelp>
<itemkind>Check</itemkind>
</object>
@@ -522,6 +521,38 @@
<radio>1</radio>
</object>
</object>
<object class="wxMenu" name="ID_MENUITEM15" variable="MenuItem13" member="yes">
<label>Change the name</label>
<object class="wxMenuItem" name="ID_MENUIDLENAME" variable="MenuItem15" member="yes">
<label>Idle</label>
<handler function="OnSetAnimationNameIdleSelected" entry="EVT_MENU" />
</object>
<object class="wxMenuItem" name="ID_MENUWALKNAME" variable="MenuItem14" member="yes">
<label>Walk</label>
<handler function="OnSetAnimationNameWalkSelected" entry="EVT_MENU" />
</object>
<object class="wxMenuItem" name="ID_MENURUNNAME" variable="MenuItem16" member="yes">
<label>Run</label>
<handler function="OnSetAnimationNameRunSelected" entry="EVT_MENU" />
</object>
<object class="wxMenuItem" name="ID_MENUJUMPNAME" variable="MenuItem17" member="yes">
<label>Jump</label>
<handler function="OnSetAnimationNameJumpSelected" entry="EVT_MENU" />
</object>
<object class="wxMenuItem" name="ID_MENUSHOOTNAME" variable="MenuItem18" member="yes">
<label>Shoot</label>
<handler function="OnSetAnimationNameShootSelected" entry="EVT_MENU" />
</object>
<object class="wxMenuItem" name="ID_MENUDEADNAME" variable="MenuItem20" member="yes">
<label>Dead</label>
<handler function="OnSetAnimationNameDeadSelected" entry="EVT_MENU" />
</object>
<object class="separator" />
<object class="wxMenuItem" name="ID_MENUCUSTOMNAME" variable="MenuItem19" member="yes">
<label>Custom name...</label>
<handler function="OnSetCustomAnimationNameSelected" entry="EVT_MENU" />
</object>
</object>
<object class="wxMenuItem" name="ID_MENUTIMEBETWEENFRAMES" variable="MenuItem7" member="yes">
<label>Time between each image :</label>
<handler function="OnTimeBetweenFramesSelected" entry="EVT_MENU" />
@@ -534,13 +565,13 @@
<object class="separator" />
<object class="wxMenuItem" name="ID_MENUITEM1" variable="MenuItem1" member="yes">
<label>Add an animation</label>
<bitmap code="gd::SkinHelper::GetIcon(&quot;add&quot;, 16)" />
<bitmap code='gd::SkinHelper::GetIcon(&quot;add&quot;, 16)' />
<handler function="OnAddAnimationSelected" entry="EVT_MENU" />
</object>
<object class="separator" />
<object class="wxMenuItem" name="ID_MENUITEM2" variable="deleteItem" member="yes">
<label>Delete</label>
<bitmap code="gd::SkinHelper::GetIcon(&quot;remove&quot;, 16)" />
<bitmap code='gd::SkinHelper::GetIcon(&quot;remove&quot;, 16)' />
<handler function="OnDeleteAnimationSelected" entry="EVT_MENU" />
</object>
<object class="wxMenuItem" name="ID_MENUITEM3" variable="MenuItem3" member="yes">
@@ -550,7 +581,7 @@
<object class="wxMenu" variable="imagesMenu" member="yes">
<object class="wxMenuItem" name="ID_MENUITEM7" variable="MenuItem4" member="yes">
<label>Add an image from a file</label>
<bitmap code="gd::SkinHelper::GetIcon(&quot;add&quot;, 16)" />
<bitmap code='gd::SkinHelper::GetIcon(&quot;add&quot;, 16)' />
<handler function="OnAddImageFromFileSelected" entry="EVT_MENU" />
</object>
<object class="wxMenuItem" name="ID_MENUITEM11" variable="MenuItem9" member="yes">
@@ -566,13 +597,13 @@
<object class="wxMenuItem" name="ID_MENUITEM9" variable="moveLeftItem" member="yes">
<label>Move left</label>
<accel>J</accel>
<bitmap code="gd::SkinHelper::GetIcon(&quot;left&quot;, 16)" />
<bitmap code='gd::SkinHelper::GetIcon(&quot;left&quot;, 16)' />
<handler function="OnMoveLeftSelected" entry="EVT_MENU" />
</object>
<object class="wxMenuItem" name="ID_MENUITEM10" variable="moveRightItem" member="yes">
<label>Move right</label>
<accel>K</accel>
<bitmap code="gd::SkinHelper::GetIcon(&quot;right&quot;, 16)" />
<bitmap code='gd::SkinHelper::GetIcon(&quot;right&quot;, 16)' />
<handler function="OnMoveRightSelected" entry="EVT_MENU" />
</object>
</object>
@@ -598,7 +629,7 @@
<object class="wxMenu" variable="emptyImagesMenu" member="yes">
<object class="wxMenuItem" name="ID_MENUITEM12" variable="MenuItem10" member="yes">
<label>Add an image from a file</label>
<bitmap code="gd::SkinHelper::GetIcon(&quot;add&quot;, 16)" />
<bitmap code='gd::SkinHelper::GetIcon(&quot;add&quot;, 16)' />
<handler function="OnAddImageFromFileSelected" entry="EVT_MENU" />
</object>
<object class="wxMenuItem" name="ID_MENUITEM13" variable="MenuItem11" member="yes">

View File

@@ -7,7 +7,7 @@ This project is released under the MIT License.
#include "AESTools.h"
#include "GDCpp/Tools/AES.h"
#include "GDCpp/Runtime/Tools/AES.h"
#include <iostream>
#include <fstream>
#include <string>

View File

@@ -8,7 +8,7 @@ This project is released under the MIT License.
#ifndef AESACTIONS_H_INCLUDED
#define AESACTIONS_H_INCLUDED
#include "GDCpp/String.h"
#include "GDCpp/Runtime/String.h"
namespace GDpriv
{

View File

@@ -6,14 +6,14 @@ This project is released under the MIT License.
*/
#include <SFML/Graphics.hpp>
#include "GDCpp/Project/Object.h"
#include "GDCpp/Runtime/Project/Object.h"
#include "GDCore/Tools/Localization.h"
#include "GDCore/IDE/Project/ArbitraryResourceWorker.h"
#include "GDCore/IDE/Dialogs/PropertyDescriptor.h"
#include "GDCpp/ImageManager.h"
#include "GDCpp/Serialization/SerializerElement.h"
#include "GDCpp/Project/InitialInstance.h"
#include "GDCpp/CommonTools.h"
#include "GDCpp/Runtime/ImageManager.h"
#include "GDCpp/Runtime/Serialization/SerializerElement.h"
#include "GDCpp/Runtime/Project/InitialInstance.h"
#include "GDCpp/Runtime/CommonTools.h"
#include "AdMobObject.h"
#if defined(GD_IDE_ONLY) && !defined(GD_NO_WX_GUI)

View File

@@ -8,8 +8,8 @@ This project is released under the MIT License.
#ifndef ADMOBOBJECT_H
#define ADMOBOBJECT_H
#include "GDCpp/Project/Object.h"
#include "GDCpp/String.h"
#include "GDCpp/Runtime/Project/Object.h"
#include "GDCpp/Runtime/String.h"
namespace gd { class InitialInstance; }
namespace gd { class Project; }
namespace sf { class Texture; }

View File

@@ -18,11 +18,11 @@ void DeclareAdMobObjectExtension(gd::PlatformExtension & extension)
"Florian Rival",
"Open source (MIT License)");
gd::ObjectMetadata & obj = extension.AddObject("AdMob",
gd::ObjectMetadata & obj = extension.AddObject<AdMobObject>(
"AdMob",
_("AdMob banner"),
_("Display an ad banner or interstitial screen using AdMob"),
"JsPlatform/Extensions/admobicon.png",
&CreateAdMobObject);
"JsPlatform/Extensions/admobicon.png");
obj.SetHelpUrl("/gdevelop/documentation/manual/built_admob");

View File

@@ -10,8 +10,8 @@ This project is released under the MIT License.
#include <algorithm>
#include <vector>
#include "GDCpp/CommonTools.h"
#include "GDCpp/TinyXml/tinyxml.h"
#include "GDCpp/Runtime/CommonTools.h"
#include "GDCpp/Runtime/TinyXml/tinyxml.h"
namespace AdvancedXML
{

View File

@@ -9,7 +9,7 @@ This project is released under the MIT License.
#define ADVANCEDXMLREFMANAGER_H_INCLUDED
#include <map>
#include "GDCpp/String.h"
#include "GDCpp/Runtime/String.h"
class TiXmlNode;
class RuntimeScene;

View File

@@ -6,8 +6,8 @@ This project is released under the MIT License.
*/
#include "AdvancedXMLTools.h"
#include "GDCpp/RuntimeScene.h"
#include "GDCpp/TinyXml/tinyxml.h"
#include "GDCpp/Runtime/RuntimeScene.h"
#include "GDCpp/Runtime/TinyXml/tinyxml.h"
#include "AdvancedXMLRefManager.h"
#include <iostream>

View File

@@ -9,7 +9,7 @@ This project is released under the MIT License.
#define ADVANCEDXMLACTIONS_H_INCLUDED
#include <string>
#include "GDCpp/String.h"
#include "GDCpp/Runtime/String.h"
class RuntimeScene;

View File

@@ -13,19 +13,19 @@ This project is released under the MIT License.
#include "Box3DObject.h"
#include <SFML/Graphics.hpp>
#include <SFML/OpenGL.hpp>
#include "GDCpp/Project/Project.h"
#include "GDCpp/RuntimeScene.h"
#include "GDCpp/RuntimeGame.h"
#include "GDCpp/Project/Object.h"
#include "GDCpp/ImageManager.h"
#include "GDCpp/FontManager.h"
#include "GDCpp/Project/InitialInstance.h"
#include "GDCpp/Polygon2d.h"
#include "GDCpp/Runtime/Project/Project.h"
#include "GDCpp/Runtime/RuntimeScene.h"
#include "GDCpp/Runtime/RuntimeGame.h"
#include "GDCpp/Runtime/Project/Object.h"
#include "GDCpp/Runtime/ImageManager.h"
#include "GDCpp/Runtime/FontManager.h"
#include "GDCpp/Runtime/Project/InitialInstance.h"
#include "GDCpp/Runtime/Polygon2d.h"
#include "GDCore/Serialization/SerializerElement.h"
#include "GDCore/Tools/Localization.h"
#if defined(GD_IDE_ONLY)
#include "GDCpp/CommonTools.h"
#include "GDCpp/Runtime/CommonTools.h"
#include "Box3DObjectEditor.h"
#include "GDCore/IDE/Dialogs/MainFrameWrapper.h"
#include "GDCore/IDE/Dialogs/PropertyDescriptor.h"
@@ -196,14 +196,13 @@ bool RuntimeBox3DObject::Draw( sf::RenderTarget& window )
return true;
}
RuntimeBox3DObject::RuntimeBox3DObject(RuntimeScene & scene, const gd::Object & object) :
RuntimeObject(scene, object),
RuntimeBox3DObject::RuntimeBox3DObject(RuntimeScene & scene, const Box3DObject & box3DObject) :
RuntimeObject(scene, box3DObject),
zPosition(0),
yaw(0),
pitch(0),
roll(0)
{
const Box3DObject & box3DObject = static_cast<const Box3DObject&>(object);
SetWidth(box3DObject.GetWidth());
SetHeight(box3DObject.GetHeight());
@@ -413,13 +412,3 @@ std::size_t RuntimeBox3DObject::GetNumberOfProperties() const
return 7;
}
#endif
RuntimeObject * CreateRuntimeBox3DObject(RuntimeScene & scene, const gd::Object & object)
{
return new RuntimeBox3DObject(scene, object);
}
gd::Object * CreateBox3DObject(gd::String name)
{
return new Box3DObject(name);
}

View File

@@ -8,8 +8,8 @@ This project is released under the MIT License.
#ifndef BOX3DOBJECT_H
#define BOX3DOBJECT_H
#include "GDCpp/Project/Object.h"
#include "GDCpp/RuntimeObject.h"
#include "GDCpp/Runtime/Project/Object.h"
#include "GDCpp/Runtime/RuntimeObject.h"
#include <memory>
class SFMLTextureWrapper;
class RuntimeScene;
@@ -85,7 +85,7 @@ class GD_EXTENSION_API RuntimeBox3DObject : public RuntimeObject
{
public :
RuntimeBox3DObject(RuntimeScene & scene, const gd::Object & object);
RuntimeBox3DObject(RuntimeScene & scene, const Box3DObject & box3DObject);
virtual ~RuntimeBox3DObject() {};
virtual RuntimeObject * Clone() const { return new RuntimeBox3DObject(*this);}
@@ -142,8 +142,4 @@ private:
std::shared_ptr<SFMLTextureWrapper> backTexture;
};
RuntimeObject * CreateRuntimeBox3DObject(RuntimeScene & scene, const gd::Object & object);
gd::Object * CreateBox3DObject(gd::String name);
#endif // BOX3DOBJECT_H

View File

@@ -15,8 +15,8 @@ This project is released under the MIT License.
#include <wx/string.h>
//*)
#include "GDCore/Tools/Log.h"
#include "GDCpp/Project/Project.h"
#include "GDCpp/CommonTools.h"
#include "GDCpp/Runtime/Project/Project.h"
#include "GDCpp/Runtime/CommonTools.h"
#include "GDCore/IDE/Dialogs/MainFrameWrapper.h"
#include "GDCore/IDE/wxTools/SkinHelper.h"
#include "GDCore/IDE/Dialogs/ResourcesEditor.h"

View File

@@ -30,13 +30,14 @@ public:
"Open source (MIT License)");
{
gd::ObjectMetadata & obj = AddObject("Box3D",
gd::ObjectMetadata & obj = AddObject<Box3DObject>(
"Box3D",
_("3D Box"),
_("Displays a 3D Box"),
"CppPlatform/Extensions/Box3Dicon.png",
&CreateBox3DObject);
"CppPlatform/Extensions/Box3Dicon.png");
AddRuntimeObject(obj, "RuntimeBox3DObject", &CreateRuntimeBox3DObject);
AddRuntimeObject<Box3DObject, RuntimeBox3DObject>(
obj, "RuntimeBox3DObject");
#if defined(GD_IDE_ONLY)

View File

@@ -12,9 +12,9 @@ This project is released under the MIT License.
#include <vector>
#include <algorithm>
#include "GDCpp/Project/Object.h"
#include "GDCpp/RuntimeScene.h"
#include "GDCpp/Project/Variable.h"
#include "GDCpp/Runtime/Project/Object.h"
#include "GDCpp/Runtime/RuntimeScene.h"
#include "GDCpp/Runtime/Project/Variable.h"
//Windows build uses native windows-dialogs
#if defined(WINDOWS)

View File

@@ -8,7 +8,7 @@ This project is released under the MIT License.
#ifndef COMMONDIALOGS_H_INCLUDED
#define COMMONDIALOGS_H_INCLUDED
#include "GDCpp/String.h"
#include "GDCpp/Runtime/String.h"
class RuntimeScene;
namespace gd { class Variable; }

View File

@@ -9,12 +9,12 @@ This project is released under the MIT License.
#include <iostream>
#include <SFML/Graphics.hpp>
#include "DestroyOutsideBehavior.h"
#include "GDCpp/Project/Layout.h"
#include "GDCpp/RuntimeLayer.h"
#include "GDCpp/Serialization/SerializerElement.h"
#include "GDCpp/RuntimeScene.h"
#include "GDCpp/RuntimeObject.h"
#include "GDCpp/CommonTools.h"
#include "GDCpp/Runtime/Project/Layout.h"
#include "GDCpp/Runtime/RuntimeLayer.h"
#include "GDCpp/Runtime/Serialization/SerializerElement.h"
#include "GDCpp/Runtime/RuntimeScene.h"
#include "GDCpp/Runtime/RuntimeObject.h"
#include "GDCpp/Runtime/CommonTools.h"
DestroyOutsideBehavior::DestroyOutsideBehavior() :
extraBorder(0)

View File

@@ -7,8 +7,8 @@ This project is released under the MIT License.
#ifndef DRAGGABLEBEHAVIOR_H
#define DRAGGABLEBEHAVIOR_H
#include "GDCpp/Project/Behavior.h"
#include "GDCpp/Project/Object.h"
#include "GDCpp/Runtime/Project/Behavior.h"
#include "GDCpp/Runtime/Project/Object.h"
#include <SFML/System/Vector2.hpp>
#include <map>
class RuntimeScene;

View File

@@ -67,26 +67,30 @@ void DeclareDestroyOutsideBehaviorExtension(gd::PlatformExtension & extension)
/**
* \brief This class declares information about the extension.
*/
class Extension : public ExtensionBase
class DestroyOutsideBehaviorCppExtension : public ExtensionBase
{
public:
/**
* Constructor of an extension declares everything the extension contains: objects, actions, conditions and expressions.
*/
Extension()
DestroyOutsideBehaviorCppExtension()
{
DeclareDestroyOutsideBehaviorExtension(*this);
GD_COMPLETE_EXTENSION_COMPILATION_INFORMATION();
};
};
#if !defined(EMSCRIPTEN)
#if defined(ANDROID)
extern "C" ExtensionBase * CreateGDCppDestroyOutsideBehaviorExtension() {
return new DestroyOutsideBehaviorCppExtension;
}
#elif !defined(EMSCRIPTEN)
/**
* Used by GDevelop to create the extension class
* -- Do not need to be modified. --
*/
extern "C" ExtensionBase * GD_EXTENSION_API CreateGDExtension() {
return new Extension;
return new DestroyOutsideBehaviorCppExtension;
}
#endif

View File

@@ -9,12 +9,12 @@ This project is released under the MIT License.
#include <iostream>
#include <SFML/Graphics.hpp>
#include "DraggableBehavior.h"
#include "GDCpp/Project/Layout.h"
#include "GDCpp/RuntimeLayer.h"
#include "GDCpp/Serialization/SerializerElement.h"
#include "GDCpp/RuntimeScene.h"
#include "GDCpp/RuntimeObject.h"
#include "GDCpp/CommonTools.h"
#include "GDCpp/Runtime/Project/Layout.h"
#include "GDCpp/Runtime/RuntimeLayer.h"
#include "GDCpp/Runtime/Serialization/SerializerElement.h"
#include "GDCpp/Runtime/RuntimeScene.h"
#include "GDCpp/Runtime/RuntimeObject.h"
#include "GDCpp/Runtime/CommonTools.h"
bool DraggableBehavior::somethingDragged = false;
bool DraggableBehavior::leftPressedLastFrame = false;

View File

@@ -7,8 +7,8 @@ This project is released under the MIT License.
#ifndef DRAGGABLEBEHAVIOR_H
#define DRAGGABLEBEHAVIOR_H
#include "GDCpp/Project/Behavior.h"
#include "GDCpp/Project/Object.h"
#include "GDCpp/Runtime/Project/Behavior.h"
#include "GDCpp/Runtime/Project/Object.h"
#include <SFML/System/Vector2.hpp>
#include <map>
class RuntimeScene;

View File

@@ -1,7 +1,7 @@
describe('gdjs.DraggableRuntimeBehavior', function() {
var runtimeGame = new gdjs.RuntimeGame({variables: [], properties: {windowWidth: 800, windowHeight: 600}});
var runtimeScene = new gdjs.RuntimeScene(runtimeGame, null);
var runtimeScene = new gdjs.RuntimeScene(runtimeGame);
runtimeScene.loadFromScene({
layers:[{name:"", visibility: true}],
variables: [],

View File

@@ -12,9 +12,9 @@ This project is released under the MIT License.
#include "GDCore/Events/CodeGeneration/EventsCodeGenerator.h"
#include "GDCore/Events/Tools/EventsCodeNameMangler.h"
#include "GDCpp/Extensions/CppPlatform.h"
#include "GDCpp/Project/Project.h"
#include "GDCpp/Project/Layout.h"
#include "GDCpp/CommonTools.h"
#include "GDCpp/Runtime/Project/Project.h"
#include "GDCpp/Runtime/Project/Layout.h"
#include "GDCpp/Runtime/CommonTools.h"
#if defined(GD_IDE_ONLY)
#include "GDCore/Events/Parsers/ExpressionParser.h"
#include "GDCore/Events/Instruction.h"

View File

@@ -9,14 +9,14 @@ This project is released under the MIT License.
#include "GDCore/Events/Serialization.h"
#include "FunctionEvent.h"
#include "GDCpp/RuntimeScene.h"
#include "GDCpp/CommonTools.h"
#include "GDCpp/Runtime/RuntimeScene.h"
#include "GDCpp/Runtime/CommonTools.h"
#include "GDCore/Events/Builtin/LinkEvent.h"
#include "GDCore/Events/CodeGeneration/EventsCodeGenerationContext.h"
#include "GDCore/Events/CodeGeneration/EventsCodeGenerator.h"
#include "GDCore/Events/Tools/EventsCodeNameMangler.h"
#include "GDCore/Serialization/SerializerElement.h"
#include "GDCpp/TinyXml/tinyxml.h"
#include "GDCpp/Runtime/TinyXml/tinyxml.h"
#include "GDCore/IDE/Dialogs/EventsEditor/EventsRenderingHelper.h"
#include "GDCore/IDE/Dialogs/EventsEditor/EventsEditorItemsAreas.h"
#include "GDCore/IDE/Dialogs/EventsEditor/EventsEditorSelection.h"

View File

@@ -11,8 +11,8 @@ This project is released under the MIT License.
#define FUNCTIONEVENT_H
#include "GDCore/Events/EventsList.h"
#include "GDCore/Events/Event.h"
#include "GDCpp/CommonTools.h"
#include "GDCpp/SceneNameMangler.h"
#include "GDCpp/Runtime/CommonTools.h"
#include "GDCpp/Runtime/SceneNameMangler.h"
class RuntimeScene;
namespace gd { class Instruction; }
namespace gd { class SerializerElement; }

View File

@@ -10,9 +10,9 @@
#include <wx/string.h>
//*)
#include "GDCore/IDE/Dialogs/ChooseObjectDialog.h"
#include "GDCpp/CommonTools.h"
#include "GDCpp/Project/Project.h"
#include "GDCpp/Project/Layout.h"
#include "GDCpp/Runtime/CommonTools.h"
#include "GDCpp/Runtime/Project/Project.h"
#include "GDCpp/Runtime/Project/Layout.h"
#include "FunctionEvent.h"
//(*IdInit(FunctionEventEditorDlg)

View File

@@ -5,7 +5,7 @@ Copyright (c) 2008-2016 Florian Rival (Florian.Rival@gmail.com)
This project is released under the MIT License.
*/
#include "FunctionTools.h"
#include "GDCpp/profile.h"
#include "GDCpp/Runtime/profile.h"
namespace GDpriv
{

View File

@@ -9,7 +9,7 @@ This project is released under the MIT License.
#define FUNCTIONTOOLS_H
#include <string>
#include <vector>
#include "GDCpp/String.h"
#include "GDCpp/Runtime/String.h"
namespace GDpriv
{

View File

@@ -30,13 +30,14 @@ public:
"Florian Rival",
"Open source (MIT License)");
gd::ObjectMetadata & obj = AddObject("Light",
gd::ObjectMetadata & obj = AddObject<LightObject>(
"Light",
_("Light"),
_("Emits light that can be stopped by objects"),
"CppPlatform/Extensions/lightIcon32.png",
&CreateLightObject);
"CppPlatform/Extensions/lightIcon32.png");
AddRuntimeObject(obj, "RuntimeLightObject", CreateRuntimeLightObject);
AddRuntimeObject<LightObject, RuntimeLightObject>(
obj, "RuntimeLightObject");
#if defined(GD_IDE_ONLY)
LightObject::LoadEdittimeIcon();

View File

@@ -10,20 +10,20 @@ This project is released under the MIT License.
#endif
#include <SFML/Graphics.hpp>
#include "GDCore/Tools/Localization.h"
#include "GDCpp/Project/Object.h"
#include "GDCpp/RuntimeScene.h"
#include "GDCpp/ImageManager.h"
#include "GDCpp/Serialization/SerializerElement.h"
#include "GDCpp/FontManager.h"
#include "GDCpp/Project/InitialInstance.h"
#include "GDCpp/Polygon2d.h"
#include "GDCpp/CommonTools.h"
#include "GDCpp/Runtime/Project/Object.h"
#include "GDCpp/Runtime/RuntimeScene.h"
#include "GDCpp/Runtime/ImageManager.h"
#include "GDCpp/Runtime/Serialization/SerializerElement.h"
#include "GDCpp/Runtime/FontManager.h"
#include "GDCpp/Runtime/Project/InitialInstance.h"
#include "GDCpp/Runtime/Polygon2d.h"
#include "GDCpp/Runtime/CommonTools.h"
#include "GDCore/Tools/Localization.h"
#include "LightObject.h"
#include "LightManager.h"
#if defined(GD_IDE_ONLY)
#include "GDCpp/CommonTools.h"
#include "GDCpp/Runtime/CommonTools.h"
#include "GDCore/IDE/Project/ArbitraryResourceWorker.h"
#include "GDCore/IDE/Dialogs/MainFrameWrapper.h"
#include "LightObjectEditor.h"
@@ -89,12 +89,10 @@ void LightObject::DoSerializeTo(gd::SerializerElement & element) const
}
#endif
RuntimeLightObject::RuntimeLightObject(RuntimeScene & scene, const gd::Object & object) :
RuntimeObject(scene, object),
RuntimeLightObject::RuntimeLightObject(RuntimeScene & scene, const LightObject & lightObject) :
RuntimeObject(scene, lightObject),
angle(0)
{
const LightObject & lightObject = static_cast<const LightObject&>(object);
globalLight = lightObject.IsGlobalLight();
globalLightColor = lightObject.GetGlobalColor();
light = Light(sf::Vector2f(GetX(),GetY()), lightObject.GetIntensity(), lightObject.GetRadius(), lightObject.GetQuality(), lightObject.GetColor());
@@ -297,13 +295,3 @@ void RuntimeLightObject::SetGlobalColor(const gd::String & colorStr)
SetGlobalColor(sf::Color( colors[0].To<int>(),colors[1].To<int>(),colors[2].To<int>() ));
}
RuntimeObject * CreateRuntimeLightObject(RuntimeScene & scene, const gd::Object & object)
{
return new RuntimeLightObject(scene, object);
}
gd::Object * CreateLightObject(gd::String name)
{
return new LightObject(name);
}

View File

@@ -8,8 +8,8 @@ This project is released under the MIT License.
#ifndef LightObject_H
#define LightObject_H
#include "GDCpp/Project/Object.h"
#include "GDCpp/RuntimeObject.h"
#include "GDCpp/Runtime/Project/Object.h"
#include "GDCpp/Runtime/RuntimeObject.h"
#include <memory>
#include <SFML/Graphics/Color.hpp>
@@ -92,7 +92,7 @@ class GD_EXTENSION_API RuntimeLightObject : public RuntimeObject
{
public :
RuntimeLightObject(RuntimeScene & scene, const gd::Object & object);
RuntimeLightObject(RuntimeScene & scene, const LightObject & lightObject);
virtual ~RuntimeLightObject() {};
virtual RuntimeObject * Clone() const { return new RuntimeLightObject(*this);}
@@ -154,8 +154,4 @@ private:
sf::Color globalLightColor;
};
gd::Object * CreateLightObject(gd::String name);
RuntimeObject * CreateRuntimeLightObject(RuntimeScene & scene, const gd::Object & object);
#endif // LightObject_H

View File

@@ -16,8 +16,8 @@ This project is released under the MIT License.
#include <wx/colordlg.h>
#include <wx/filedlg.h>
#include "GDCore/IDE/Dialogs/MainFrameWrapper.h"
#include "GDCpp/CommonTools.h"
#include "GDCpp/Project/Project.h"
#include "GDCpp/Runtime/CommonTools.h"
#include "GDCpp/Runtime/Project/Project.h"
#include "LightObject.h"
#include "SceneLightObstacleDatas.h"

View File

@@ -8,8 +8,8 @@ This project is released under the MIT License.
#include "LightObstacleBehavior.h"
#include "LightObstacleBehaviorEditor.h"
#include "LightObject.h"
#include "GDCpp/Project/Layout.h"
#include "GDCpp/Serialization/SerializerElement.h"
#include "GDCpp/Runtime/Project/Layout.h"
#include "GDCpp/Runtime/Serialization/SerializerElement.h"
#include <SFML/Graphics.hpp>
#include <iostream>
#include <cmath>

View File

@@ -27,13 +27,13 @@ freely, subject to the following restrictions:
#ifndef LIGHTOBSTACLEBEHAVIOR_H
#define LIGHTOBSTACLEBEHAVIOR_H
#include "GDCpp/Project/Behavior.h"
#include "GDCpp/RuntimeObject.h"
#include "GDCpp/Runtime/Project/Behavior.h"
#include "GDCpp/Runtime/RuntimeObject.h"
#include "Light.h"
#include "LightManager.h"
#include <map>
#include <set>
#include "GDCpp/RuntimeScene.h"
#include "GDCpp/Runtime/RuntimeScene.h"
namespace gd { class SerializerElement; }
namespace gd { class Layout; }
class LightObstacleBehaviorEditor;

View File

@@ -12,11 +12,11 @@ This project is released under the MIT License.
#include <wx/intl.h>
#include <wx/string.h>
//*)
#include "GDCpp/Project/Project.h"
#include "GDCpp/Runtime/Project/Project.h"
#include "LightObstacleBehavior.h"
#include "GDCore/IDE/Dialogs/MainFrameWrapper.h"
#include "GDCpp/CommonTools.h"
#include "GDCpp/Project/Layout.h"
#include "GDCpp/Runtime/CommonTools.h"
#include "GDCpp/Runtime/Project/Layout.h"
//(*IdInit(LightObstacleBehaviorEditor)
//*)

View File

@@ -8,7 +8,7 @@ This project is released under the MIT License.
#ifndef RUNTIMESCENELIGHTOBSTACLEDATAS_H
#define RUNTIMESCENELIGHTOBSTACLEDATAS_H
#include <vector>
#include "GDCpp/BehaviorsRuntimeSharedData.h"
#include "GDCpp/Runtime/BehaviorsRuntimeSharedData.h"
class SceneLightObstacleDatas;
class LightObstacleBehavior;

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