Compare commits

...

127 Commits

Author SHA1 Message Date
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
506 changed files with 89013 additions and 84783 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

@@ -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>

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

@@ -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

@@ -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

@@ -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",

View File

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

@@ -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

@@ -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

@@ -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

@@ -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

@@ -5,7 +5,7 @@ namespace AutoVersion{
//Date Version Types
static const char GDCore_DATE[] = "17";
static const char GDCore_MONTH[] = "01";
static const char GDCore_MONTH[] = "04";
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 = 91;
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,91,0
#define GDCore_RC_FILEVERSION_STRING "4, 0, 91, 0\0"
static const char GDCore_FULLVERSION_STRING[] = "4.0.91.0";
}
#endif //GDCORE_VERSION_H

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;

View File

@@ -8,7 +8,7 @@ This project is released under the MIT License.
#ifndef SCENELIGHTOBSTACLEPHYSICSDATAS_H
#define SCENELIGHTOBSTACLEPHYSICSDATAS_H
#include "GDCpp/Project/BehaviorsSharedData.h"
#include "GDCpp/Runtime/Project/BehaviorsSharedData.h"
#include "RuntimeSceneLightObstacleDatas.h"
/**

View File

@@ -10,9 +10,9 @@ This project is released under the MIT License.
#include <string>
#include <memory>
#include "GDCpp/RuntimeObject.h"
#include "GDCpp/RuntimeScene.h"
#include "GDCpp/RuntimeObjectsListsTools.h"
#include "GDCpp/Runtime/RuntimeObject.h"
#include "GDCpp/Runtime/RuntimeScene.h"
#include "GDCpp/Runtime/RuntimeObjectsListsTools.h"
#include "ObjectsLinksManager.h"
using namespace std;

View File

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

View File

@@ -12,8 +12,8 @@ This project is released under the MIT License.
#include <string>
#include <memory>
#include "GDCpp/RuntimeObject.h"
#include "GDCpp/RuntimeScene.h"
#include "GDCpp/Runtime/RuntimeObject.h"
#include "GDCpp/Runtime/RuntimeScene.h"
using namespace std;

View File

@@ -13,9 +13,9 @@ This project is released under the MIT License.
#include "GDCore/Project/ClassWithObjects.h"
#include "GDCore/Project/Layout.h"
#include "GDCore/Project/Object.h"
#include "GDCpp/RuntimeScene.h"
#include "GDCpp/RuntimeGame.h"
#include "GDCpp/RuntimeObject.h"
#include "GDCpp/Runtime/RuntimeScene.h"
#include "GDCpp/Runtime/RuntimeGame.h"
#include "GDCpp/Runtime/RuntimeObject.h"
#include "GDCpp/Extensions/Builtin/ObjectTools.h"
#include "GDCpp/Extensions/Builtin/ObjectTools.h"
#include "../LinkedObjectsTools.h"

View File

@@ -3,7 +3,7 @@
#include <string>
#include <iostream>
#include "GDCpp/String.h"
#include "GDCpp/Runtime/String.h"
class GD_EXTENSION_API ErrorManager
{

View File

@@ -7,7 +7,7 @@ This project is released under the MIT License.
#include "GDCpp/Extensions/ExtensionBase.h"
#include "GDCore/Tools/Version.h"
#include "GDCpp/CommonTools.h"
#include "GDCpp/Runtime/CommonTools.h"
#include "NetworkBehavior.h"
#include "NetworkManager.h"

View File

@@ -8,10 +8,10 @@ This project is released under the MIT License.
#include <iostream>
#include <vector>
#include <SFML/Network.hpp>
#include "GDCpp/RuntimeObject.h"
#include "GDCpp/Project/Layout.h"
#include "GDCpp/Serialization/SerializerElement.h"
#include "GDCpp/CommonTools.h"
#include "GDCpp/Runtime/RuntimeObject.h"
#include "GDCpp/Runtime/Project/Layout.h"
#include "GDCpp/Runtime/Serialization/SerializerElement.h"
#include "GDCpp/Runtime/CommonTools.h"
#include "ReceivedDataManager.h"
#include "NetworkBehaviorEditor.h"
#include "NetworkBehavior.h"

View File

@@ -8,8 +8,8 @@ This project is released under the MIT License.
#ifndef NETWORKBEHAVIOR_H
#define NETWORKBEHAVIOR_H
#include "GDCpp/Project/Behavior.h"
#include "GDCpp/Project/Object.h"
#include "GDCpp/Runtime/Project/Behavior.h"
#include "GDCpp/Runtime/Project/Object.h"
#include "SceneNetworkDatas.h"
#include <map>
namespace gd { class SerializerElement; }

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 "NetworkBehavior.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(NetworkBehaviorEditor)
const long NetworkBehaviorEditor::ID_RADIOBOX1 = wxNewId();

View File

@@ -1,7 +1,7 @@
#include "NetworkManager.h"
#include "ReceivedDataManager.h"
#include "ErrorManager.h"
#include "GDCpp/CommonTools.h"
#include "GDCpp/Runtime/CommonTools.h"
NetworkManager * NetworkManager::_singleton = NULL;

View File

@@ -5,7 +5,7 @@ Copyright (c) 2010-2016 Florian Rival (Florian.Rival@gmail.com)
This project is released under the MIT License.
*/
#include "GDCpp/RuntimeScene.h"
#include "GDCpp/Runtime/RuntimeScene.h"
#include "NetworkManager.h"
#include "ErrorManager.h"
#include "ReceivedDataManager.h"

View File

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

View File

@@ -9,7 +9,7 @@ This project is released under the MIT License.
#define RECEIVEDDATAMANAGER_H
#include <map>
#include <string>
#include "GDCpp/String.h"
#include "GDCpp/Runtime/String.h"
/**
* Singleton where is stocked receveid data from other peers.

View File

@@ -9,7 +9,7 @@ This project is released under the MIT License.
#define RUNTIMESCENENETWORKDATAS_H
#include <iostream>
#include "GDCpp/BehaviorsRuntimeSharedData.h"
#include "GDCpp/Runtime/BehaviorsRuntimeSharedData.h"
class SceneNetworkDatas;
/**

View File

@@ -8,7 +8,7 @@ This project is released under the MIT License.
#ifndef SCENENETWORKDATAS_H
#define SCENENETWORKDATAS_H
#include "GDCpp/Project/BehaviorsSharedData.h"
#include "GDCpp/Runtime/Project/BehaviorsSharedData.h"
#include "RuntimeSceneNetworkDatas.h"
/**

View File

@@ -22,11 +22,11 @@ void DeclarePanelSpriteObjectExtension(gd::PlatformExtension & extension)
"Victor Levasseur and Florian Rival",
"Open source (MIT License)");
gd::ObjectMetadata & obj = extension.AddObject("PanelSprite",
gd::ObjectMetadata & obj = extension.AddObject<PanelSpriteObject>(
"PanelSprite",
_("Panel Sprite (\"9-patch\")"),
_("An image with edges and corners that are stretched separately from the fill."),
"CppPlatform/Extensions/PanelSpriteIcon.png",
&CreatePanelSpriteObject);
"CppPlatform/Extensions/PanelSpriteIcon.png");
#if defined(GD_IDE_ONLY)
obj.SetIncludeFile("PanelSpriteObject/PanelSpriteObject.h");
@@ -133,29 +133,34 @@ void DeclarePanelSpriteObjectExtension(gd::PlatformExtension & extension)
/**
* \brief This class declares information about the extension.
*/
class Extension : public ExtensionBase
class PanelSpriteObjectCppExtension : public ExtensionBase
{
public:
/**
* Constructor of an extension declares everything the extension contains: objects, actions, conditions and expressions.
*/
Extension()
PanelSpriteObjectCppExtension()
{
DeclarePanelSpriteObjectExtension(*this);
AddRuntimeObject(GetObjectMetadata("PanelSpriteObject::PanelSprite"),
"RuntimePanelSpriteObject", CreateRuntimePanelSpriteObject);
AddRuntimeObject<PanelSpriteObject, RuntimePanelSpriteObject>(
GetObjectMetadata("PanelSpriteObject::PanelSprite"),
"RuntimePanelSpriteObject");
GD_COMPLETE_EXTENSION_COMPILATION_INFORMATION();
};
};
#if !defined(EMSCRIPTEN)
#if defined(ANDROID)
extern "C" ExtensionBase * CreateGDCppPanelSpriteObjectExtension() {
return new PanelSpriteObjectCppExtension;
}
#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 PanelSpriteObjectCppExtension;
}
#endif

View File

@@ -27,7 +27,10 @@ public:
{
DeclarePanelSpriteObjectExtension(*this);
GetObjectMetadata("PanelSpriteObject::PanelSprite").SetIncludeFile("PanelSpriteObject/panelspriteruntimeobject.js");
GetObjectMetadata("PanelSpriteObject::PanelSprite")
.SetIncludeFile("PanelSpriteObject/panelspriteruntimeobject.js")
.AddIncludeFile("PanelSpriteObject/panelspriteruntimeobject-pixi-renderer.js")
.AddIncludeFile("PanelSpriteObject/panelspriteruntimeobject-cocos-renderer.js");
GetAllActionsForObject("PanelSpriteObject::PanelSprite")["PanelSpriteObject::Width"].SetFunctionName("setWidth").SetGetter("getWidth");
GetAllConditionsForObject("PanelSpriteObject::PanelSprite")["PanelSpriteObject::Width"].SetFunctionName("getWidth");

View File

@@ -12,16 +12,16 @@ This project is released under the MIT License.
#include "GDCore/Tools/Localization.h"
#include "PanelSpriteObject.h"
#include <SFML/Graphics.hpp>
#include "GDCpp/Project/Object.h"
#include "GDCpp/ImageManager.h"
#include "GDCpp/FontManager.h"
#include "GDCpp/RuntimeScene.h"
#include "GDCpp/RuntimeGame.h"
#include "GDCpp/Project/Project.h"
#include "GDCpp/Project/InitialInstance.h"
#include "GDCpp/Polygon2d.h"
#include "GDCpp/Serialization/SerializerElement.h"
#include "GDCpp/CommonTools.h"
#include "GDCpp/Runtime/Project/Object.h"
#include "GDCpp/Runtime/ImageManager.h"
#include "GDCpp/Runtime/FontManager.h"
#include "GDCpp/Runtime/RuntimeScene.h"
#include "GDCpp/Runtime/RuntimeGame.h"
#include "GDCpp/Runtime/Project/Project.h"
#include "GDCpp/Runtime/Project/InitialInstance.h"
#include "GDCpp/Runtime/Polygon2d.h"
#include "GDCpp/Runtime/Serialization/SerializerElement.h"
#include "GDCpp/Runtime/CommonTools.h"
#include "GDCore/Tools/Localization.h"
#if defined(GD_IDE_ONLY)
@@ -79,14 +79,12 @@ void PanelSpriteObject::LoadResources(gd::Project & project, gd::Layout & layout
}
#endif
RuntimePanelSpriteObject::RuntimePanelSpriteObject(RuntimeScene & scene, const gd::Object & object) :
RuntimeObject(scene, object),
RuntimePanelSpriteObject::RuntimePanelSpriteObject(RuntimeScene & scene, const PanelSpriteObject & panelSpriteObject) :
RuntimeObject(scene, panelSpriteObject),
width(32),
height(32),
angle(0)
{
const PanelSpriteObject & panelSpriteObject = static_cast<const PanelSpriteObject&>(object);
SetRightMargin(panelSpriteObject.GetRightMargin());
SetLeftMargin(panelSpriteObject.GetLeftMargin());
SetBottomMargin(panelSpriteObject.GetBottomMargin());
@@ -112,64 +110,60 @@ bool RuntimePanelSpriteObject::Draw( sf::RenderTarget& window )
float imageWidth = texture->texture.getSize().x;
float imageHeight = texture->texture.getSize().y;
sf::Vertex vertices[] =
{
//Center part (streched)
sf::Vertex centerVertices[] = {
sf::Vertex( sf::Vector2f(-width/2 + leftMargin ,-height/2 + topMargin ), sf::Vector2f(leftMargin ,topMargin )),
sf::Vertex( sf::Vector2f(+width/2 - rightMargin,-height/2 + topMargin ), sf::Vector2f(imageWidth - rightMargin,topMargin )),
sf::Vertex( sf::Vector2f(+width/2 - rightMargin,+height/2 - bottomMargin), sf::Vector2f(imageWidth - rightMargin,imageHeight - bottomMargin)),
sf::Vertex( sf::Vector2f(-width/2 + leftMargin ,+height/2 - bottomMargin), sf::Vector2f(leftMargin ,imageHeight - bottomMargin)),
sf::Vertex( sf::Vector2f(+width/2 - rightMargin,+height/2 - bottomMargin), sf::Vector2f(imageWidth - rightMargin,imageHeight - bottomMargin)),
};
sf::Vertex topVertices[] = {
//Top-left
sf::Vertex( sf::Vector2f(-width/2 ,-height/2 ), sf::Vector2f(0 ,0 )),
sf::Vertex( sf::Vector2f(-width/2 ,-height/2 + topMargin ), sf::Vector2f(0 ,topMargin )),
sf::Vertex( sf::Vector2f(-width/2 + leftMargin ,-height/2 ), sf::Vector2f(leftMargin ,0 )),
sf::Vertex( sf::Vector2f(-width/2 + leftMargin ,-height/2 + topMargin ), sf::Vector2f(leftMargin ,topMargin )),
sf::Vertex( sf::Vector2f(-width/2 ,-height/2 + topMargin ), sf::Vector2f(0 ,topMargin )),
//Top
sf::Vertex( sf::Vector2f(-width/2 + leftMargin ,-height/2 ), sf::Vector2f(leftMargin ,0 )),
sf::Vertex( sf::Vector2f(+width/2 - rightMargin,-height/2 ), sf::Vector2f(imageWidth - rightMargin,0 )),
sf::Vertex( sf::Vector2f(+width/2 - rightMargin,-height/2 + topMargin ), sf::Vector2f(imageWidth - rightMargin,topMargin )),
sf::Vertex( sf::Vector2f(-width/2 + leftMargin ,-height/2 + topMargin ), sf::Vector2f(leftMargin ,topMargin )),
//Top-right
sf::Vertex( sf::Vector2f(+width/2 - rightMargin,-height/2 ), sf::Vector2f(imageWidth - rightMargin,0 )),
sf::Vertex( sf::Vector2f(+width/2 ,-height/2 ), sf::Vector2f(imageWidth ,0 )),
sf::Vertex( sf::Vector2f(+width/2 ,-height/2 + topMargin ), sf::Vector2f(imageWidth ,topMargin )),
sf::Vertex( sf::Vector2f(+width/2 - rightMargin,-height/2 + topMargin ), sf::Vector2f(imageWidth - rightMargin,topMargin )),
};
//Right
sf::Vertex rightVertices[] = {
sf::Vertex( sf::Vector2f(+width/2 - rightMargin,-height/2 + topMargin ), sf::Vector2f(imageWidth - rightMargin,topMargin )),
sf::Vertex( sf::Vector2f(+width/2 ,-height/2 + topMargin ), sf::Vector2f(imageWidth ,topMargin )),
sf::Vertex( sf::Vector2f(+width/2 ,+height/2 - bottomMargin), sf::Vector2f(imageWidth ,imageHeight - bottomMargin)),
sf::Vertex( sf::Vector2f(+width/2 - rightMargin,+height/2 - bottomMargin), sf::Vector2f(imageWidth - rightMargin,imageHeight - bottomMargin)),
sf::Vertex( sf::Vector2f(+width/2 ,+height/2 - bottomMargin), sf::Vector2f(imageWidth ,imageHeight - bottomMargin))
};
sf::Vertex bottomVertices[] = {
//Bottom-left
sf::Vertex( sf::Vector2f(-width/2 ,+height/2 - bottomMargin), sf::Vector2f(0 ,imageHeight - bottomMargin)),
sf::Vertex( sf::Vector2f(-width/2 ,+height/2 ), sf::Vector2f(0 ,imageHeight )),
sf::Vertex( sf::Vector2f(-width/2 + leftMargin ,+height/2 - bottomMargin), sf::Vector2f(leftMargin ,imageHeight - bottomMargin)),
sf::Vertex( sf::Vector2f(-width/2 + leftMargin ,+height/2 ), sf::Vector2f(leftMargin ,imageHeight )),
sf::Vertex( sf::Vector2f(-width/2 ,+height/2 ), sf::Vector2f(0 ,imageHeight )),
//Bottom
sf::Vertex( sf::Vector2f(-width/2 + leftMargin ,+height/2 - bottomMargin), sf::Vector2f(leftMargin ,imageHeight - bottomMargin)),
sf::Vertex( sf::Vector2f(+width/2 - rightMargin,+height/2 - bottomMargin), sf::Vector2f(imageWidth - rightMargin,imageHeight - bottomMargin)),
sf::Vertex( sf::Vector2f(+width/2 - rightMargin,+height/2 ), sf::Vector2f(imageWidth - rightMargin,imageHeight )),
sf::Vertex( sf::Vector2f(-width/2 + leftMargin ,+height/2 ), sf::Vector2f(leftMargin ,imageHeight )),
//Bottom-right
sf::Vertex( sf::Vector2f(+width/2 - rightMargin,+height/2 - bottomMargin), sf::Vector2f(imageWidth - rightMargin,imageHeight - bottomMargin)),
sf::Vertex( sf::Vector2f(+width/2 ,+height/2 - bottomMargin), sf::Vector2f(imageWidth ,imageHeight - bottomMargin)),
sf::Vertex( sf::Vector2f(+width/2 ,+height/2 ), sf::Vector2f(imageWidth ,imageHeight )),
sf::Vertex( sf::Vector2f(+width/2 - rightMargin,+height/2 ), sf::Vector2f(imageWidth - rightMargin,imageHeight )),
sf::Vertex( sf::Vector2f(+width/2 ,+height/2 ), sf::Vector2f(imageWidth ,imageHeight ))
};
//Left
sf::Vertex leftVertices[] = {
sf::Vertex( sf::Vector2f(-width/2 ,-height/2 + topMargin ), sf::Vector2f(0 ,topMargin )),
sf::Vertex( sf::Vector2f(-width/2 + leftMargin ,-height/2 + topMargin ), sf::Vector2f(leftMargin ,topMargin )),
sf::Vertex( sf::Vector2f(-width/2 + leftMargin ,+height/2 - bottomMargin), sf::Vector2f(leftMargin ,imageHeight - bottomMargin)),
sf::Vertex( sf::Vector2f(-width/2 ,+height/2 - bottomMargin), sf::Vector2f(0 ,imageHeight - bottomMargin)),
sf::Vertex( sf::Vector2f(-width/2 + leftMargin ,+height/2 - bottomMargin), sf::Vector2f(leftMargin ,imageHeight - bottomMargin))
};
sf::Transform matrix;
matrix.translate(centerPosition);
matrix.rotate(angle);
@@ -178,7 +172,11 @@ bool RuntimePanelSpriteObject::Draw( sf::RenderTarget& window )
states.transform = matrix;
states.texture = &texture->texture;
window.draw(vertices, 36, sf::Quads, states);
window.draw(centerVertices, 4, sf::TrianglesStrip, states);
window.draw(leftVertices, 4, sf::TrianglesStrip, states);
window.draw(rightVertices, 4, sf::TrianglesStrip, states);
window.draw(topVertices, 8, sf::TrianglesStrip, states);
window.draw(bottomVertices, 8, sf::TrianglesStrip, states);
return true;
}
@@ -201,66 +199,61 @@ void PanelSpriteObject::DrawInitialInstance(gd::InitialInstance & instance, sf::
float width = instance.HasCustomSize() ? instance.GetCustomWidth() : GetInitialInstanceDefaultSize(instance, project, layout).x;
float height = instance.HasCustomSize() ? instance.GetCustomHeight() : GetInitialInstanceDefaultSize(instance, project, layout).y;
sf::Vertex vertices[] =
{
//Center part (streched)
sf::Vertex centerVertices[] = {
sf::Vertex( sf::Vector2f(-width/2 + leftMargin ,-height/2 + topMargin ), sf::Vector2f(leftMargin ,topMargin )),
sf::Vertex( sf::Vector2f(+width/2 - rightMargin,-height/2 + topMargin ), sf::Vector2f(imageWidth - rightMargin,topMargin )),
sf::Vertex( sf::Vector2f(+width/2 - rightMargin,+height/2 - bottomMargin), sf::Vector2f(imageWidth - rightMargin,imageHeight - bottomMargin)),
sf::Vertex( sf::Vector2f(-width/2 + leftMargin ,+height/2 - bottomMargin), sf::Vector2f(leftMargin ,imageHeight - bottomMargin)),
sf::Vertex( sf::Vector2f(+width/2 - rightMargin,+height/2 - bottomMargin), sf::Vector2f(imageWidth - rightMargin,imageHeight - bottomMargin)),
};
sf::Vertex topVertices[] = {
//Top-left
sf::Vertex( sf::Vector2f(-width/2 ,-height/2 ), sf::Vector2f(0 ,0 )),
sf::Vertex( sf::Vector2f(-width/2 ,-height/2 + topMargin ), sf::Vector2f(0 ,topMargin )),
sf::Vertex( sf::Vector2f(-width/2 + leftMargin ,-height/2 ), sf::Vector2f(leftMargin ,0 )),
sf::Vertex( sf::Vector2f(-width/2 + leftMargin ,-height/2 + topMargin ), sf::Vector2f(leftMargin ,topMargin )),
sf::Vertex( sf::Vector2f(-width/2 ,-height/2 + topMargin ), sf::Vector2f(0 ,topMargin )),
//Top
sf::Vertex( sf::Vector2f(-width/2 + leftMargin ,-height/2 ), sf::Vector2f(leftMargin ,0 )),
sf::Vertex( sf::Vector2f(+width/2 - rightMargin,-height/2 ), sf::Vector2f(imageWidth - rightMargin,0 )),
sf::Vertex( sf::Vector2f(+width/2 - rightMargin,-height/2 + topMargin ), sf::Vector2f(imageWidth - rightMargin,topMargin )),
sf::Vertex( sf::Vector2f(-width/2 + leftMargin ,-height/2 + topMargin ), sf::Vector2f(leftMargin ,topMargin )),
//Top-right
sf::Vertex( sf::Vector2f(+width/2 - rightMargin,-height/2 ), sf::Vector2f(imageWidth - rightMargin,0 )),
sf::Vertex( sf::Vector2f(+width/2 ,-height/2 ), sf::Vector2f(imageWidth ,0 )),
sf::Vertex( sf::Vector2f(+width/2 ,-height/2 + topMargin ), sf::Vector2f(imageWidth ,topMargin )),
sf::Vertex( sf::Vector2f(+width/2 - rightMargin,-height/2 + topMargin ), sf::Vector2f(imageWidth - rightMargin,topMargin )),
};
//Right
sf::Vertex rightVertices[] = {
sf::Vertex( sf::Vector2f(+width/2 - rightMargin,-height/2 + topMargin ), sf::Vector2f(imageWidth - rightMargin,topMargin )),
sf::Vertex( sf::Vector2f(+width/2 ,-height/2 + topMargin ), sf::Vector2f(imageWidth ,topMargin )),
sf::Vertex( sf::Vector2f(+width/2 ,+height/2 - bottomMargin), sf::Vector2f(imageWidth ,imageHeight - bottomMargin)),
sf::Vertex( sf::Vector2f(+width/2 - rightMargin,+height/2 - bottomMargin), sf::Vector2f(imageWidth - rightMargin,imageHeight - bottomMargin)),
sf::Vertex( sf::Vector2f(+width/2 ,+height/2 - bottomMargin), sf::Vector2f(imageWidth ,imageHeight - bottomMargin))
};
sf::Vertex bottomVertices[] = {
//Bottom-left
sf::Vertex( sf::Vector2f(-width/2 ,+height/2 - bottomMargin), sf::Vector2f(0 ,imageHeight - bottomMargin)),
sf::Vertex( sf::Vector2f(-width/2 ,+height/2 ), sf::Vector2f(0 ,imageHeight )),
sf::Vertex( sf::Vector2f(-width/2 + leftMargin ,+height/2 - bottomMargin), sf::Vector2f(leftMargin ,imageHeight - bottomMargin)),
sf::Vertex( sf::Vector2f(-width/2 + leftMargin ,+height/2 ), sf::Vector2f(leftMargin ,imageHeight )),
sf::Vertex( sf::Vector2f(-width/2 ,+height/2 ), sf::Vector2f(0 ,imageHeight )),
//Bottom
sf::Vertex( sf::Vector2f(-width/2 + leftMargin ,+height/2 - bottomMargin), sf::Vector2f(leftMargin ,imageHeight - bottomMargin)),
sf::Vertex( sf::Vector2f(+width/2 - rightMargin,+height/2 - bottomMargin), sf::Vector2f(imageWidth - rightMargin,imageHeight - bottomMargin)),
sf::Vertex( sf::Vector2f(+width/2 - rightMargin,+height/2 ), sf::Vector2f(imageWidth - rightMargin,imageHeight )),
sf::Vertex( sf::Vector2f(-width/2 + leftMargin ,+height/2 ), sf::Vector2f(leftMargin ,imageHeight )),
//Bottom-right
sf::Vertex( sf::Vector2f(+width/2 - rightMargin,+height/2 - bottomMargin), sf::Vector2f(imageWidth - rightMargin,imageHeight - bottomMargin)),
sf::Vertex( sf::Vector2f(+width/2 ,+height/2 - bottomMargin), sf::Vector2f(imageWidth ,imageHeight - bottomMargin)),
sf::Vertex( sf::Vector2f(+width/2 ,+height/2 ), sf::Vector2f(imageWidth ,imageHeight )),
sf::Vertex( sf::Vector2f(+width/2 - rightMargin,+height/2 ), sf::Vector2f(imageWidth - rightMargin,imageHeight )),
sf::Vertex( sf::Vector2f(+width/2 ,+height/2 ), sf::Vector2f(imageWidth ,imageHeight ))
};
//Left
sf::Vertex leftVertices[] = {
sf::Vertex( sf::Vector2f(-width/2 ,-height/2 + topMargin ), sf::Vector2f(0 ,topMargin )),
sf::Vertex( sf::Vector2f(-width/2 + leftMargin ,-height/2 + topMargin ), sf::Vector2f(leftMargin ,topMargin )),
sf::Vertex( sf::Vector2f(-width/2 + leftMargin ,+height/2 - bottomMargin), sf::Vector2f(leftMargin ,imageHeight - bottomMargin)),
sf::Vertex( sf::Vector2f(-width/2 ,+height/2 - bottomMargin), sf::Vector2f(0 ,imageHeight - bottomMargin)),
sf::Vertex( sf::Vector2f(-width/2 + leftMargin ,+height/2 - bottomMargin), sf::Vector2f(leftMargin ,imageHeight - bottomMargin))
};
sf::Vector2f centerPosition = sf::Vector2f(instance.GetX()+width/2, instance.GetY()+height/2);
sf::Transform matrix;
sf::Vector2f centerPosition = sf::Vector2f(instance.GetX()+width/2, instance.GetY()+height/2);
matrix.translate(centerPosition);
matrix.rotate(instance.GetAngle());
@@ -268,9 +261,11 @@ void PanelSpriteObject::DrawInitialInstance(gd::InitialInstance & instance, sf::
states.transform = matrix;
states.texture = &texture->texture;
renderTarget.draw(vertices, 36, sf::Quads, states);
return;
renderTarget.draw(centerVertices, 4, sf::TrianglesStrip, states);
renderTarget.draw(leftVertices, 4, sf::TrianglesStrip, states);
renderTarget.draw(rightVertices, 4, sf::TrianglesStrip, states);
renderTarget.draw(topVertices, 8, sf::TrianglesStrip, states);
renderTarget.draw(bottomVertices, 8, sf::TrianglesStrip, states);
}
void PanelSpriteObject::ExposeResources(gd::ArbitraryResourceWorker & worker)
@@ -329,13 +324,3 @@ void RuntimePanelSpriteObject::ChangeAndReloadImage(const gd::String &txtName, c
textureName = txtName;
texture = scene.GetImageManager()->GetSFMLTexture(textureName);
}
RuntimeObject * CreateRuntimePanelSpriteObject(RuntimeScene & scene, const gd::Object & object)
{
return new RuntimePanelSpriteObject(scene, object);
}
gd::Object * CreatePanelSpriteObject(gd::String name)
{
return new PanelSpriteObject(name);
}

View File

@@ -7,8 +7,8 @@ This project is released under the MIT License.
#ifndef TILEDSPRITEOBJECT_H
#define TILEDSPRITEOBJECT_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;
namespace gd { class ImageManager; }
@@ -89,7 +89,7 @@ class GD_EXTENSION_API RuntimePanelSpriteObject : public RuntimeObject
{
public :
RuntimePanelSpriteObject(RuntimeScene & scene, const gd::Object & object);
RuntimePanelSpriteObject(RuntimeScene & scene, const PanelSpriteObject & panelSpriteObject);
virtual ~RuntimePanelSpriteObject() {};
virtual RuntimeObject * Clone() const { return new RuntimePanelSpriteObject(*this);}
@@ -141,8 +141,4 @@ private:
std::shared_ptr<SFMLTextureWrapper> texture;
};
RuntimeObject * CreateRuntimePanelSpriteObject(RuntimeScene & scene, const gd::Object & object);
gd::Object * CreatePanelSpriteObject(gd::String name);
#endif // TILEDSPRITEOBJECT_H

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