mirror of
https://github.com/4ian/GDevelop.git
synced 2025-10-15 10:19:04 +00:00
Compare commits
254 Commits
refactor/u
...
v5.0.0-bet
Author | SHA1 | Date | |
---|---|---|---|
![]() |
7530b4e137 | ||
![]() |
e0adc2a924 | ||
![]() |
a4227dac78 | ||
![]() |
4e76f28fd3 | ||
![]() |
3b89284fd2 | ||
![]() |
dd8a0c7158 | ||
![]() |
641d87b097 | ||
![]() |
64dbab1bce | ||
![]() |
dc4e68dd21 | ||
![]() |
9d3cd9f110 | ||
![]() |
eb5687dc7b | ||
![]() |
9eb548452a | ||
![]() |
4ac3516336 | ||
![]() |
e3aed61390 | ||
![]() |
479584c3ef | ||
![]() |
3fc3d1e235 | ||
![]() |
448e543658 | ||
![]() |
eb1abbd539 | ||
![]() |
48420c6b79 | ||
![]() |
a6d7c032ac | ||
![]() |
2f8840b2cf | ||
![]() |
5df3afdb67 | ||
![]() |
df2185a505 | ||
![]() |
1d67453454 | ||
![]() |
217cd9639f | ||
![]() |
9f91654628 | ||
![]() |
e0602d347b | ||
![]() |
f14e02e739 | ||
![]() |
f3ef26dae5 | ||
![]() |
eda1f9b770 | ||
![]() |
10e296bff7 | ||
![]() |
73dc3a93ea | ||
![]() |
42ddf9b41a | ||
![]() |
17ac7cf091 | ||
![]() |
3f04f0ea92 | ||
![]() |
7c57881359 | ||
![]() |
e29c2d033c | ||
![]() |
8bae458b65 | ||
![]() |
854d03ff0e | ||
![]() |
5243ae0d5b | ||
![]() |
73f6636163 | ||
![]() |
276f262fe7 | ||
![]() |
7abff84cc8 | ||
![]() |
07c4f6f485 | ||
![]() |
942d6f8413 | ||
![]() |
20f10efc3d | ||
![]() |
c75c6f3df1 | ||
![]() |
e75db3a626 | ||
![]() |
04f248b2d2 | ||
![]() |
50adbfaae9 | ||
![]() |
ec9a629124 | ||
![]() |
977dc27bd0 | ||
![]() |
6108088979 | ||
![]() |
1d3f516e6f | ||
![]() |
81aa68e69d | ||
![]() |
8891c91d61 | ||
![]() |
702c8a459d | ||
![]() |
6164c6fe02 | ||
![]() |
a45c34f11d | ||
![]() |
38dd36cd44 | ||
![]() |
1b3f7309b0 | ||
![]() |
c9ed8f25ce | ||
![]() |
a6dab9a29f | ||
![]() |
ea7b07d2e4 | ||
![]() |
f917db411f | ||
![]() |
7e6cb643b8 | ||
![]() |
11e18d7bc4 | ||
![]() |
56158e18f3 | ||
![]() |
1651893a61 | ||
![]() |
2809f53af8 | ||
![]() |
0c045d6e79 | ||
![]() |
721b021b0a | ||
![]() |
9763d6523c | ||
![]() |
bfd6b1c542 | ||
![]() |
1d860ba852 | ||
![]() |
20ad0d5e75 | ||
![]() |
4c02468aa4 | ||
![]() |
00f5cc2e54 | ||
![]() |
44be843ea6 | ||
![]() |
24cbe2caca | ||
![]() |
367e25707b | ||
![]() |
852620fcfd | ||
![]() |
4d229f32fa | ||
![]() |
3af0cd862f | ||
![]() |
0cf7c6748e | ||
![]() |
411f05720f | ||
![]() |
722278fe21 | ||
![]() |
bd8db5f573 | ||
![]() |
d0247c7df3 | ||
![]() |
dcd1cfc789 | ||
![]() |
bf4c2a426e | ||
![]() |
e10f3ca277 | ||
![]() |
16e9e8fa64 | ||
![]() |
ef1ead6c90 | ||
![]() |
5449bc1ba4 | ||
![]() |
656f05e81e | ||
![]() |
c4ba5f43fb | ||
![]() |
41a275ca8e | ||
![]() |
2c9ec0d866 | ||
![]() |
cd32e51134 | ||
![]() |
b1d81d4836 | ||
![]() |
3fa3e57b24 | ||
![]() |
a4a436b935 | ||
![]() |
f4224c4322 | ||
![]() |
af21bc5aea | ||
![]() |
af64a7d1ca | ||
![]() |
62ed3d56c4 | ||
![]() |
0cfe95ab3e | ||
![]() |
e6dba8332e | ||
![]() |
00cd8df672 | ||
![]() |
940fe63e16 | ||
![]() |
59b6694316 | ||
![]() |
0883c86d0e | ||
![]() |
3c6f490344 | ||
![]() |
5e3e0db9f3 | ||
![]() |
bfee61e9e8 | ||
![]() |
097dd779f6 | ||
![]() |
52453b7c58 | ||
![]() |
dd2ac68dab | ||
![]() |
6ea50f8114 | ||
![]() |
ec05ec6ea1 | ||
![]() |
3e7c5394ce | ||
![]() |
55aae059ff | ||
![]() |
61a20f1af8 | ||
![]() |
60170609e9 | ||
![]() |
0c55b3b8d4 | ||
![]() |
6b16934184 | ||
![]() |
c15acdde83 | ||
![]() |
209dafc269 | ||
![]() |
757c9502ef | ||
![]() |
be8ab96c4c | ||
![]() |
1600091249 | ||
![]() |
45b6caa06e | ||
![]() |
59754d1c27 | ||
![]() |
656881a11a | ||
![]() |
5e91bdf811 | ||
![]() |
e6d0f6ed4c | ||
![]() |
864acd3988 | ||
![]() |
630ece0f7e | ||
![]() |
3b102a74b7 | ||
![]() |
5096ecee24 | ||
![]() |
29f1d873a6 | ||
![]() |
088e3acae2 | ||
![]() |
0fbe7a62e8 | ||
![]() |
9e4849f218 | ||
![]() |
db536894a4 | ||
![]() |
a63c44b5ca | ||
![]() |
8756276793 | ||
![]() |
878f64d024 | ||
![]() |
bd09c58439 | ||
![]() |
c645d4a2d6 | ||
![]() |
45e03d61a0 | ||
![]() |
d924cd90bd | ||
![]() |
455fe8193a | ||
![]() |
1eb5113283 | ||
![]() |
3687c24e71 | ||
![]() |
8d75a8373d | ||
![]() |
3fed377c6c | ||
![]() |
957ab3f53b | ||
![]() |
e7e338805b | ||
![]() |
83d0c4cc65 | ||
![]() |
13461429f2 | ||
![]() |
b0fd36daff | ||
![]() |
2e84b2e648 | ||
![]() |
2b4d263410 | ||
![]() |
64343d7043 | ||
![]() |
3e9c4d594c | ||
![]() |
657ca85324 | ||
![]() |
6ac9c0a0ee | ||
![]() |
009a05e021 | ||
![]() |
6c2ea56da6 | ||
![]() |
a8ae298194 | ||
![]() |
dda2effad0 | ||
![]() |
4da0149b6b | ||
![]() |
9602caaccc | ||
![]() |
be2892b759 | ||
![]() |
e1552f649c | ||
![]() |
74bbd45265 | ||
![]() |
5aa32f0eca | ||
![]() |
23987f63c7 | ||
![]() |
d415d3cbee | ||
![]() |
f7f32d6be5 | ||
![]() |
b223175bf9 | ||
![]() |
47463e6ca2 | ||
![]() |
e289059d1f | ||
![]() |
6320d19043 | ||
![]() |
833ae75632 | ||
![]() |
6058a4b1be | ||
![]() |
52173ac07d | ||
![]() |
a55ad60038 | ||
![]() |
0ef235261f | ||
![]() |
3bd9432b5e | ||
![]() |
6fd82f4f30 | ||
![]() |
5572536bff | ||
![]() |
ab197464cc | ||
![]() |
00f2873f48 | ||
![]() |
c4329cac4f | ||
![]() |
4917c7ca2a | ||
![]() |
13c0c8992b | ||
![]() |
06dc0c5323 | ||
![]() |
6039342fcf | ||
![]() |
32c98d4dd4 | ||
![]() |
3a05067ea2 | ||
![]() |
d9bcf3daca | ||
![]() |
29577af049 | ||
![]() |
5b5f213bd5 | ||
![]() |
19a00ce2dc | ||
![]() |
c243200370 | ||
![]() |
09edeaa96b | ||
![]() |
c94964b2db | ||
![]() |
b40f51e03c | ||
![]() |
4319ddcd0f | ||
![]() |
f0163fc1d1 | ||
![]() |
f5be2c73ce | ||
![]() |
a4b0f316f1 | ||
![]() |
efa9ea4ea2 | ||
![]() |
5170ff509c | ||
![]() |
2471021114 | ||
![]() |
3f956289dc | ||
![]() |
f731ae8b21 | ||
![]() |
76dfe55e25 | ||
![]() |
22d46711df | ||
![]() |
ca5198a08d | ||
![]() |
037551ec77 | ||
![]() |
3c309c200f | ||
![]() |
6231cbc5f1 | ||
![]() |
9e98605030 | ||
![]() |
6834efbb9a | ||
![]() |
c74fbc6c43 | ||
![]() |
949f370118 | ||
![]() |
91359e4674 | ||
![]() |
f790fff439 | ||
![]() |
e13384dbb7 | ||
![]() |
0c0539bb2a | ||
![]() |
caf089489b | ||
![]() |
18c0f05bb3 | ||
![]() |
a9a0faaaaa | ||
![]() |
df166e4d5d | ||
![]() |
f661b41d74 | ||
![]() |
00e887e5f9 | ||
![]() |
e6fc7aac9d | ||
![]() |
65346edc4a | ||
![]() |
3620e0aef6 | ||
![]() |
0211ab40e4 | ||
![]() |
ae945fc0bc | ||
![]() |
4537dbf723 | ||
![]() |
94358cd265 | ||
![]() |
337a36ee90 | ||
![]() |
07fd7f77bd | ||
![]() |
69a774bec1 | ||
![]() |
dc9200feb5 | ||
![]() |
e7d1f99470 | ||
![]() |
76165908fc | ||
![]() |
b19a27e6cf |
@@ -19,7 +19,7 @@ jobs:
|
||||
|
||||
- run:
|
||||
name: Install Emscripten (for GDevelop.js)
|
||||
command: git clone https://github.com/juj/emsdk.git && cd emsdk && ./emsdk install sdk-1.37.37-64bit && ./emsdk activate sdk-1.37.37-64bit && cd ..
|
||||
command: git clone https://github.com/juj/emsdk.git && cd emsdk && ./emsdk install sdk-fastcomp-1.37.37-64bit && ./emsdk activate sdk-fastcomp-1.37.37-64bit && cd ..
|
||||
|
||||
- run:
|
||||
name: Install Wine for Electron builder
|
||||
|
5
.gitignore
vendored
5
.gitignore
vendored
@@ -1,8 +1,5 @@
|
||||
/Core/GDCore/Tools/VersionPriv.h
|
||||
/docs/GDJS Runtime Documentation
|
||||
/docs/GDJS Documentation
|
||||
/docs/GDCpp Documentation
|
||||
/docs/GDCore Documentation
|
||||
/docs
|
||||
/ExtLibs/SFML
|
||||
/ExtLibs/*.7z
|
||||
/scripts/logs/*.txt
|
||||
|
@@ -48,7 +48,7 @@ before_install:
|
||||
#use SFML.
|
||||
- "export DISPLAY=:99.0"
|
||||
# This workaround is required to avoid libstdc++ errors (Emscripten requires a recent version of libstdc++)
|
||||
- wget -q -O libstdc++6 http://security.ubuntu.com/ubuntu/pool/main/g/gcc-5/libstdc++6_5.4.0-6ubuntu1~16.04.10_amd64.deb
|
||||
- wget -q -O libstdc++6 http://security.ubuntu.com/ubuntu/pool/main/g/gcc-5/libstdc++6_5.4.0-6ubuntu1~16.04.12_amd64.deb
|
||||
- sudo dpkg --force-all -i libstdc++6
|
||||
|
||||
install:
|
||||
@@ -63,8 +63,8 @@ install:
|
||||
# Install Emscripten (for GDevelop.js)
|
||||
- git clone https://github.com/juj/emsdk.git
|
||||
- cd emsdk
|
||||
- ./emsdk install sdk-1.37.37-64bit
|
||||
- ./emsdk activate sdk-1.37.37-64bit
|
||||
- ./emsdk install sdk-fastcomp-1.37.37-64bit
|
||||
- ./emsdk activate sdk-fastcomp-1.37.37-64bit
|
||||
- source ./emsdk_env.sh
|
||||
- cd ..
|
||||
# Install GDevelop.js dependencies and compile it
|
||||
|
5
.vscode/settings.json
vendored
5
.vscode/settings.json
vendored
@@ -2,6 +2,7 @@
|
||||
{
|
||||
"files.associations": {
|
||||
"*.idl": "java",
|
||||
"Fastfile": "ruby",
|
||||
"iosfwd": "cpp",
|
||||
"functional": "cpp",
|
||||
"type_traits": "cpp",
|
||||
@@ -80,7 +81,9 @@
|
||||
"__hash": "cpp",
|
||||
"__debug": "cpp",
|
||||
"__threading_support": "cpp",
|
||||
"any": "cpp"
|
||||
"any": "cpp",
|
||||
"array": "cpp",
|
||||
"cinttypes": "cpp"
|
||||
},
|
||||
"files.exclude": {
|
||||
"Binaries/*build*": true,
|
||||
|
@@ -1,592 +1,25 @@
|
||||
/**
|
||||
* \mainpage GDevelop Core
|
||||
* \image html gdlogo.png
|
||||
* \section welcome Welcome
|
||||
* \section welcome GDevelop Core documentation
|
||||
*
|
||||
* The **GDevelop Core** library contains the main concepts, classes and tools that are used by the *platforms* and the *GDevelop IDE*.<br>
|
||||
* This ensures that the IDE, or any tool based on GDevelop Core, is able to work with projects based on any arbitrary platform.
|
||||
*
|
||||
* Two official platforms are available for GDevelop:
|
||||
* - The *C++ Platform* (GDCpp) to create native games.
|
||||
* - The *JS Platform* (GDJS) to create HTML5 games.
|
||||
* The **GDevelop Core** library contains the structure of a GDevelop game, classes and tools that are used by the *platforms* and the *GDevelop IDE*.
|
||||
*
|
||||
* \section gettingstarted Getting started
|
||||
* First, please refer to these pages to install the required tools and to get help about setting up a basic extension:<br>
|
||||
*
|
||||
* -# \subpage setupDevEnv
|
||||
* -# \ref overview
|
||||
* -# \ref writeANewExtension
|
||||
* In most cases, you should start by <a href="https://github.com/4ian/GDevelop/blob/master/newIDE/README.md">installing and launching the development version of GDevelop</a>.
|
||||
*
|
||||
* You can also read \subpage recommendedToolsAndConventions.
|
||||
* - If you're interested in writing extensions for GDevelop, read <a href="https://github.com/4ian/GDevelop/blob/master/newIDE/README-extensions.md">the documentation about extensions</a>.
|
||||
* - If you want to dig more into how GDevelop is architectured and work on the core, read <a href="https://github.com/4ian/GDevelop/blob/master/Core/GDevelop-Architecture-Overview.md">GDevelop Architecture Overview</a>. Then, you can browse this reference to get more information about a class or function.
|
||||
*
|
||||
* \section aboutdoc About this documentation
|
||||
* \section other Other documentations
|
||||
*
|
||||
* If you never used GDevelop Core before, take a look at \ref overview.
|
||||
*
|
||||
* As everything that is developed around GDevelop is based on this library, you should take a look at it quite often: platforms, extensions
|
||||
* and the IDE are intensively using the classes and tools offered by GDCore.
|
||||
* When developing an extension for the C++ or JS platform, read these documentations:
|
||||
* GDevelop is architectured around a `Core` (this library), platforms (`GDJS`, `GDCpp`) and extensions (`Extensions` folder). The editor (`newIDE` folder) is using all of these libraries.
|
||||
*
|
||||
* - [Open GDevelop C++ Platform documentation](../GDCpp Documentation/index.html)
|
||||
* - [Open GDevelop JS Platform documentation](../GDJS Documentation/index.html)
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* \page setupDevEnv Setting up the development environment
|
||||
*
|
||||
* If you didn't already downloaded GDevelop, get and extract the source from [GitHub](https://github.com/4ian/GD).
|
||||
*
|
||||
* Follow these steps to be able to compile GDevelop, it's super easy:
|
||||
*
|
||||
* <b>Windows</b>
|
||||
*
|
||||
* -# \subpage installWinCompiler
|
||||
* -# \ref installAndUseCMake
|
||||
* <br>
|
||||
*
|
||||
* <b>GNU/Linux</b>
|
||||
* -# \subpage installLinuxLib
|
||||
* -# \subpage installAndUseCMake
|
||||
*
|
||||
* <b>OS X</b>
|
||||
* -# \subpage installMacOSTools
|
||||
* -# \ref installAndUseCMake
|
||||
*
|
||||
* See the recommended tools and conventions for working on GDevelop on this page:
|
||||
* \subpage recommendedToolsAndConventions
|
||||
*/
|
||||
|
||||
/**
|
||||
* \page installWinCompiler (Windows) Install TDM-GCC compiler
|
||||
*
|
||||
* GDevelop is compiled with TDM-GCC under Windows.<br>
|
||||
* So as to prevent incompatibilities between the compiler (and the standard C++ library provided with) used by GDevelop and
|
||||
* the compiler used by the extensions, GDevelop require the extensions and the platforms to use the same version of TDM-GCC.
|
||||
*
|
||||
* While a recent GCC version should work, if you compile GDevelop for an "official" distribution it's better
|
||||
* to use the specific version provided here.
|
||||
*
|
||||
* \section installWinCompiler_download Download
|
||||
*
|
||||
* Download the current version of the compiler used by GDevelop on Windows here:
|
||||
*
|
||||
* https://sourceforge.net/projects/tdm-gcc/files/TDM-GCC%20Installer/Previous/1.1309.0/tdm-gcc-4.9.2.exe/download
|
||||
*
|
||||
* \section installWinCompiler_install Installation
|
||||
*
|
||||
* The installation is fairly simple :<br>
|
||||
* <br>
|
||||
* - Launch the installer.<br>
|
||||
* - Choose Create.<br>
|
||||
|
||||
\image html compilerInstall1.png
|
||||
|
||||
* - Choose an installation directory.<br>
|
||||
|
||||
\image html compilerInstall2.png
|
||||
|
||||
* - Choose the components to be installed. You don't have to change anything, the default options are good enough.<br>
|
||||
|
||||
\image html compilerInstall3.png
|
||||
|
||||
* - Click on install so as to launch the installation process.<br>
|
||||
*/
|
||||
|
||||
/**
|
||||
* \page installAndUseCMake (All) Install CMake & launch the build
|
||||
*
|
||||
* Building is done using CMake: it is an open-source build system that can generate build files for lots of IDE and build tools (Makefiles...).
|
||||
*
|
||||
* \section installAndUseCMake_download Download and install CMake
|
||||
*
|
||||
* First, install CMake:
|
||||
* Download it [here](http://www.cmake.org/cmake/resources/software.html) for Windows, get it using your package manager if you're
|
||||
* using a Linux distribution or using Homebrew for Mac OS X.
|
||||
*
|
||||
* \section installAndUseCMake_use Using CMake to generate the build files
|
||||
* Using CMake is not difficult and require only a few clicks/commands to enter. Windows users may use
|
||||
* the GUI as shown in the next section. Linux and Mac OS X users may prefer to use the command line as shown
|
||||
* as the end of this page.
|
||||
*
|
||||
* \subsection installAndUseCMake_use_gui Using the GUI
|
||||
*
|
||||
* - Start the CMake user interface (_cmake-gui_). Choose the GD root directory as the source directory, and Binaries/build as the directory where to build the binaries:
|
||||
|
||||
\image html usecmake1.png
|
||||
|
||||
* - Click on *Configure*. If asked to create the build directory, answer yes. Choose then your favorite generator: *MinGW Makefiles* (on Windows) or *Unix Makefiles* (on Linux/OS X) generate a traditional Makefile that can be built using the
|
||||
* *mingw32-make* (on Windows) or *make* (on Linux/OS X) command. You can also choose the *Ninja* generator to use the [Ninja build system](http://martine.github.io/ninja/).
|
||||
|
||||
\image html usecmake2.png
|
||||
|
||||
* - When you click on Finish, CMake do a first configuration. If **errors occurred*, make sure that you have download all required development libraries.
|
||||
* - Adjust any variable if necessary (no changes is needed by default), then click on Generate.
|
||||
|
||||
\image html usecmake3.png
|
||||
|
||||
* - You can then launch a terminal/command prompt, go to the build folder (`cd path/to/GD/Binaries/build`) and launch the build
|
||||
* using the generator you've choosen: `mingw32-make`, or `make` on Linux/OS X.
|
||||
*
|
||||
* \subsection installAndUseCMake_use_cmd Using the command line
|
||||
*
|
||||
* Using the commandline with CMake is also easy:
|
||||
*
|
||||
* ~~~~~~~~~~~~~~~~~~~~~
|
||||
* cd /path/to/GD/Binaries
|
||||
* mkdir build
|
||||
* cd build
|
||||
* cmake ../..
|
||||
* make
|
||||
* ~~~~~~~~~~~~~~~~~~~~~
|
||||
*
|
||||
* For Windows, replace `cmake ../..` by `cmake ../.. -G "MinGW Makefiles"` and `make` by `mingw32-make`.
|
||||
*
|
||||
* or using the fast [Ninja build system](http://martine.github.io/ninja/) :
|
||||
* ~~~~~~~~~~~~~~~~~~~~~
|
||||
* cd /path/to/GD/Binaries
|
||||
* mkdir build
|
||||
* cd build
|
||||
* cmake ../.. -G "Ninja"
|
||||
* ninja
|
||||
* ~~~~~~~~~~~~~~~~~~~~~
|
||||
*
|
||||
* \section installAndUseCMake_launch Launch GDevelop
|
||||
*
|
||||
* Binaries are created into *Binaries/Output/Release_{OS}* folder.
|
||||
*
|
||||
* To launch GDevelop in Windows, double click on **GDIDE**. For Linux, launch **StartGDevelop.sh**.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \page installLinuxLib (Linux) Install development files
|
||||
*
|
||||
* \section installLibs Install development libraries
|
||||
*
|
||||
* GDevelop is compiled with gcc under Linux.<br>
|
||||
* You need to have some packages to be installed before starting to build GD. These packages can vary according to the distribution you use.
|
||||
* On Ubuntu, you may want to install these packages:
|
||||
\code
|
||||
sudo apt-get install libopenal-dev
|
||||
sudo apt-get install libjpeg-dev
|
||||
sudo apt-get install libglew-dev
|
||||
sudo apt-get install libudev-dev
|
||||
sudo apt-get install libxrandr-dev
|
||||
sudo apt-get install libsndfile1-dev
|
||||
sudo apt-get install libglu1-mesa-dev
|
||||
sudo apt-get install libfreetype6-dev
|
||||
\endcode
|
||||
* Make sure you also have some basic tools installed:
|
||||
\code
|
||||
sudo apt-get install build-essential
|
||||
sudo apt-get install p7zip-full
|
||||
sudo apt-get install curl
|
||||
\endcode
|
||||
*
|
||||
* If you want to package the app, you can also install:
|
||||
\code
|
||||
sudo apt-get install devscripts
|
||||
\endcode
|
||||
*
|
||||
*
|
||||
* \subsection installcmake Install CMake
|
||||
* You'll need CMake to build GDevelop: See more on \subpage installAndUseCMake.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \page installMacOSTools (Mac OS X) Install development tools
|
||||
*
|
||||
* Make sure that you have Apple Developer Tools installed (if you have Xcode and git, that should be the case).
|
||||
*
|
||||
* \section installTools Install development tools
|
||||
*
|
||||
* The simplest way of installing dependencies required by GDevelop is to use [Homebrew](http://brew.sh/). Install it
|
||||
* and install these packages, using the terminal:
|
||||
\code
|
||||
brew install cmake
|
||||
brew install p7zip
|
||||
brew install pkgconfig
|
||||
brew install freetype
|
||||
\endcode
|
||||
* If you want to generate the documentation and translations, install Doxygen and Gettext:
|
||||
\code
|
||||
brew install doxygen
|
||||
brew install gettext
|
||||
\endcode
|
||||
*
|
||||
* \section launchCompilation Launch compilation
|
||||
*
|
||||
* You should be able to compile GD using CMake. Go with a terminal to the GD source folder:
|
||||
\code
|
||||
cd /path/to/GD
|
||||
mkdir build && cd build
|
||||
cmake ../..
|
||||
make -j4
|
||||
\endcode
|
||||
*
|
||||
* More information about compilation here: \ref installAndUseCMake
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* \page recommendedToolsAndConventions Recommended tools and advices to work with GD
|
||||
*
|
||||
* \section git Git and GitHub
|
||||
*
|
||||
* Git is an amazing *version control system*. If you never used it before, take a look at some tutorials, there
|
||||
* are plenty of them on the internet.<br>
|
||||
* Windows users could be interested in using [TortoiseGit](code.google.com/p/tortoisegit) or the official
|
||||
* [GitHub client](https://windows.github.com/).
|
||||
*
|
||||
* \subsection pullrequest Submitting code thanks to Pull Request.
|
||||
*
|
||||
* Using *Pull request*, you can easily submit your changes so that they are integrated into the official
|
||||
* GDevelop repository (http://github.com/4ian/gd).
|
||||
*
|
||||
* See this article on *GitHub help* about pull requests: https://help.github.com/articles/using-pull-requests.<br>
|
||||
* Pull requests are extremely easy to use and the best way to contribute to GD!
|
||||
*
|
||||
* ------
|
||||
*
|
||||
* \section codingstyle Coding style
|
||||
*
|
||||
* As a rule of thumb, try to retain the original coding style used in a file when editing it, or look at other
|
||||
* files when creating a new extension/dialog/feature/class.
|
||||
*
|
||||
* For both C++ and Javascript, *code indentation* should be 4 spaces (or tab set to a width of 4 spaces).<br>
|
||||
* Lines should be cutted when reaching column 110 so that two files can be displayed side-by-side on a same screen.
|
||||
* When cutting a line, indent the new lines with an additional 4 spaces.
|
||||
*
|
||||
* \subsection cpp C++
|
||||
*
|
||||
* *Naming* conventions:
|
||||
* - Classes should be *CamelCase* (starting with a capital).
|
||||
* - All variables (including member variables) should be *camelCase* (no capital for the first letter).
|
||||
* - All functions (including class methods) should be *CamelCase* (starting with a capital).
|
||||
*
|
||||
* *Comments*:
|
||||
* - Comment your classes and functions using *Doxygen* comments.
|
||||
*
|
||||
* \subsection js Javascript
|
||||
*
|
||||
* *Naming* conventions:
|
||||
* - "Classes" should be *CamelCase* (starting with a capital).
|
||||
* - All variables (including member variables) should be *camelCase* (no capital for the first letter).
|
||||
* - All functions (including class methods) should be *camelCase* (no capital for the first letter).
|
||||
*
|
||||
* *Comments*:
|
||||
* - Comment your classes and functions using *yuidoc* comments.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \page overview Overview of GDCore
|
||||
*
|
||||
* \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::GetProjectExporters which
|
||||
* is called by the IDE to export a gd::Project to a stand-alone game.
|
||||
*
|
||||
* \subsection platformloading Platforms loading
|
||||
* A platform is stored in memory and managed by gd::PlatformManager. It loaded from a dynamic library file (.dll on windows, .so on Linux)
|
||||
* thanks to gd::PlatformLoader.<br>
|
||||
* It is responsibility of the IDE, or any other application using GDCore,
|
||||
* to call the appropriate method of gd::PlatformLoader to trigger the loading of the platforms when needed.
|
||||
*
|
||||
* gd::PlatformLoader search for two symbols in the dynamic library file: *CreateGDPlatform* and
|
||||
* *DestroyGDPlatform*. These symbols must exists and must create (or destroy) the platform class. For example:
|
||||
*
|
||||
* ~~~~~~~~~~~~~~~~~~~~~
|
||||
* extern "C" gd::Platform * GD_API CreateGDPlatform() {
|
||||
* return &JsPlatform::Get(); //Return the singleton object representing the JS Platform
|
||||
* }
|
||||
*
|
||||
* extern "C" void GD_API DestroyGDPlatform() {
|
||||
* JsPlatform::DestroySingleton(); //Destroy the singleton.
|
||||
* }
|
||||
* ~~~~~~~~~~~~~~~~~~~~~
|
||||
*
|
||||
* The platform dynamic library file is often located inside <i>GDevelop directory</i>/xxxPlatform (*xxx* being replaced by the platform acronym).
|
||||
*
|
||||
* In this folder, the platform can store basically anything it needs. For example, both GDJS and GDCpp are storing a folder called *Runtime* containing
|
||||
* the game engine.
|
||||
* If there is a sub directory called *Extensions*, the gd::PlatformLoader tries to load the extensions contained inside (see below).
|
||||
*
|
||||
* \section extensionsstructure Structure of an extension
|
||||
*
|
||||
* **Extensions** are seen by GDevelop Core as classes inheriting from gd::PlatformExtension.<br>
|
||||
* They are stored inside the platform they belong to, and they are also loaded from a dynamic library file thanks to gd::ExtensionsLoader. The main
|
||||
* job of an extension is to <b>declare</b> everything it provides: objects, actions and conditions, behaviors, expressions.<br>
|
||||
* This is done directly using the standard method provided by gd::PlatformExtension, notably:
|
||||
* - gd::PlatformExtension::AddCondition and gd::PlatformExtension::AddAction,
|
||||
* - gd::PlatformExtension::AddExpression (and gd::PlatformExtension::AddStrExpression),
|
||||
* - gd::PlatformExtension::AddObject and gd::PlatformExtension::AddBehavior
|
||||
*
|
||||
*
|
||||
* Some platforms (like the C++ Platform) offer another base class which must be used instead of gd::PlatformExtension when declaring a platorm: as this base class
|
||||
* inherits from gd::PlatformExtension, standard methods still work, but you may be able to declare some others features (the C++ Platform offers
|
||||
* the possibility of declaring debugger related functions).
|
||||
*
|
||||
* \subsection extensionloading Extensions loading
|
||||
*
|
||||
* A single dynamic library file can contains an extension for more than one platform:<br>
|
||||
* You just have to declare a class deriving from gd::PlatformExtension for each platform supported, and a creation function for each platform
|
||||
* (the C++ platform expects a function called *CreateGDExtension* while JS Platform search for a function called *CreateGDJSExtension*).
|
||||
*
|
||||
* \subsection extensionexample Edit or write a new extension
|
||||
*
|
||||
* Refer to these pages for more information about extensions:
|
||||
* - \subpage AboutExtensionCpp
|
||||
* - \subpage writeANewExtension
|
||||
*
|
||||
* \section utf8section UTF8 strings
|
||||
*
|
||||
* Most parts of the codebase support UTF8 strings thanks to gd::String class. gd::String is a wrapper around std::string, exposing a similar
|
||||
* interface as well as a few tool member functions and operators that are all UTF8 aware.
|
||||
*
|
||||
* Its usage is easy, especially if you're familiar with std::string. Some extra functions can be really useful, in particular
|
||||
* the ones to convert the string from/to a number.
|
||||
*
|
||||
\code
|
||||
gd::String str = "Hello";
|
||||
str += " world";
|
||||
str += " " + gd::String::From(2);
|
||||
//str now contains "Hello world 2";
|
||||
|
||||
gd::String twopointfiveStr = "2.5";
|
||||
double twopointfive = twopointfive.To<double>();
|
||||
//twopointfive == 2.5
|
||||
\endcode
|
||||
*
|
||||
*
|
||||
* For more information, see the complete reference of the class. Tests cases have also been made for most functions.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \page writeANewExtension Write a new extension
|
||||
*
|
||||
* \section writeANewExtension_createNewExtension Create a new extension
|
||||
*
|
||||
* Creation of a new extension can be made by following these steps:<br>
|
||||
*
|
||||
* - Copy the directory of an extension and rename it:
|
||||
* \image html createnew1.png
|
||||
* - Rename then the sources files :
|
||||
* \image html createnew2.png
|
||||
* - Open the *CMakeLists.txt* file and replace every occurrence of the extension old name with the new name.<br>
|
||||
* - Open all the source files and again, replace every occurrence of the extension old name with the new name.<br>
|
||||
* - In the *Extensions* directory, open the *CMakeLists.txt* file and add a line such as <code>ADD_SUBDIRECTORY(MyExtension)</code>.
|
||||
* You can then start to modify the extension.<br>
|
||||
* If your extension is fairly simple, you can create it from the AES Extension. <br>
|
||||
* If your extension need an object, you can use for instance the TextObject Extension as a starting point.<br>
|
||||
* <br>
|
||||
* - You can compile your extension by relaunching CMake like described [here](\ref installAndUseCMake). After doing that, just compile as usual.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* \page AboutExtensionCpp About Extension.cpp
|
||||
*
|
||||
* An extension has to define (usually in a file called *Extension.cpp* for the C++ Platform or *JsExtension.cpp* for the JS Platform)
|
||||
* a class that is derived from the gd::PlatformExtension class. This class contains, in its constructor, the declarations
|
||||
* of everything that is provided by the extension.
|
||||
|
||||
* \section extensionDeclaration Declare the extension information
|
||||
|
||||
* The declarations are made using the methods provided by gd::PlatformExtension.
|
||||
*
|
||||
* The first declaration if often the information about the extension:
|
||||
|
||||
* \code
|
||||
Extension()
|
||||
{
|
||||
SetExtensionInformation("TextObject",
|
||||
_("Text object"),
|
||||
_("Extension allowing to use an object displaying a text."),
|
||||
"Florian Rival",
|
||||
"Open Source (MIT License)");
|
||||
* \endcode
|
||||
|
||||
The first parameter is the name of the extension. Choose carefully the name of the extension, as projects are directly referring to it.
|
||||
|
||||
* \section instructionsDeclaration Declare actions, conditions and expressions
|
||||
|
||||
Actions are declared like this :
|
||||
|
||||
* \code
|
||||
AddAction("ActionName",
|
||||
_("Name displayed to users"),
|
||||
_("Description"),
|
||||
_("Sentence displayed in event editor"),
|
||||
_("Category"),
|
||||
"path-to-an-24-by-24-icon-file.png",
|
||||
"path-to-an-16-by-16-icon-file.png")
|
||||
.AddParameter("theTypeOfTheParameter", _("Parameter1"))
|
||||
.AddParameter("theTypeOfTheParameter", _("Parameter2"))
|
||||
.SetFunctionName("MyFunctionName").SetIncludeFile("MyExtension/MyIncludeFile.h");
|
||||
|
||||
* \endcode
|
||||
* Declare conditions and expressions in a similar way.<br>
|
||||
* Parameters are added using gd::InstructionMetadata::AddParameter.
|
||||
*
|
||||
* The last line set the function name that will be called when generating the code of an event using the action:<br>
|
||||
* You can either do it after declaring the function, or later using this syntax:
|
||||
*
|
||||
* \code
|
||||
GetAllActions()["ExtensionName::ActionName"].SetFunctionName("MyFunctionName");
|
||||
* \endcode
|
||||
*
|
||||
* Both methods are ok, but the latest allows to use the same code to declare an extension for the C++ and JS platform,
|
||||
* then customize the names of the functions to call.
|
||||
*
|
||||
* \section objectsDeclaration Declare objects
|
||||
*
|
||||
* Adding an object is made using gd::PlatformExtension::AddObject method.
|
||||
*
|
||||
* \code
|
||||
gd::ObjectMetadata & obj = AddObject<MyObject>(
|
||||
"Name",
|
||||
_("Name displayed to users"),
|
||||
_("Description"),
|
||||
"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>
|
||||
* 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<TextObject, RuntimeTextObject>(obj, "RuntimeTextObject");
|
||||
obj.SetIncludeFile("TextObject/TextObject.h");
|
||||
* \endcode
|
||||
*
|
||||
* You can then declare the actions, conditions, and expressions related to the objects, using the AddAction/AddCondition/AddExpression methods provided
|
||||
* by <i>obj</i>.
|
||||
|
||||
* \section eventsDeclaration Declaring events
|
||||
*
|
||||
* Events are declared like this :
|
||||
* \code
|
||||
AddEvent("Name",
|
||||
_("Name displayed to users"),
|
||||
"Description",
|
||||
"Group",
|
||||
"path-to-a-16-by-16-icon.png",
|
||||
std::make_shared<EventClassName>())
|
||||
* \endcode
|
||||
*
|
||||
* The event must be able to generate its code when events are being translated to C++ or Javascript:<br>
|
||||
* This is done by calling SetCodeGenerator. For example:
|
||||
*
|
||||
* \code
|
||||
AddEvent("Standard",
|
||||
_("Standard event"),
|
||||
_("Standard event: Actions are run if conditions are fulfilled."),
|
||||
"",
|
||||
"res/eventaddicon.png",
|
||||
std::make_shared<gd::StandardEvent>())
|
||||
.SetCodeGenerator(std::shared_ptr<gd::EventMetadata::CodeGenerator>(codeGen));
|
||||
* \endcode
|
||||
|
||||
* \section behaviorsDeclaration Declaring the behaviors
|
||||
|
||||
Behaviors are declared like objects:
|
||||
|
||||
|
||||
* \code
|
||||
gd::BehaviorMetadata & aut = AddBehavior("Name",
|
||||
_("Name displayed to users"),
|
||||
_("DefaultNameUsedInEditor"),
|
||||
_("Description."),
|
||||
"Group",
|
||||
"path-to-a-32-by-32-icon.png",
|
||||
"BehaviorClassName",
|
||||
std::make_shared<BehaviorClassName>(),
|
||||
std::make_shared<BehaviorSharedDataClassName>());
|
||||
* \endcode
|
||||
* The last line can be replaced by <code>std::shared_ptr<gd::BehaviorsSharedData>()</code> if no shared data are being used.
|
||||
*
|
||||
* You can then declare the actions, conditions, and expressions related to the behavior like objects:<br>
|
||||
* Call AddAction/AddCondition/AddExpression on the <i>aut</i> object.
|
||||
|
||||
* \section excludingNonRuntimeDeclaration (C++ platform) Excluding elements declaration from runtime
|
||||
* When your extension is compiled for the C++ platform Runtime, GDevelop does not known anything about action/condition or even events classes.<br>
|
||||
* You have then to exclude all actions/conditions/expressions/events declaration from extension at runtime (only Extension/Object/Behaviors declarations have to be kept).
|
||||
|
||||
* Use the *<code>GD_IDE_ONLY</code> define* to achieve this goal, as demonstrated in this skeleton of a complete extension declaration:
|
||||
* \code
|
||||
class Extension : public ExtensionBase //For C++ platform, extensions must derive from ExtensionBase
|
||||
{
|
||||
public:
|
||||
Extension()
|
||||
{
|
||||
SetExtensionInformation("MyExtension",
|
||||
_("Extension name"),
|
||||
_("Extension declaration"),
|
||||
"Author",
|
||||
"license");
|
||||
|
||||
#if defined(GD_IDE_ONLY)
|
||||
AddAction(...);
|
||||
AddCondition(...);
|
||||
AddExpression(...);
|
||||
#endif
|
||||
|
||||
{
|
||||
gd::ObjectMetadata & obj = AddObject("ObjectName",
|
||||
_("Object name"),
|
||||
_("Description"),
|
||||
"CppPlatform/Extensions/myicon.png",
|
||||
&CreateMyObject,
|
||||
&DestroyMyObject);
|
||||
|
||||
AddRuntimeObject(obj, "RuntimeObjectName", CreateRuntimeObjectName);
|
||||
|
||||
#if defined(GD_IDE_ONLY)
|
||||
obj.SetIncludeFile("MyExtension/MyIncludeFile.h");
|
||||
|
||||
obj.AddAction(...);
|
||||
obj.AddCondition(...);
|
||||
obj.AddExpression(...);
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
{
|
||||
gd::BehaviorMetadata & aut = AddBehavior("BehaviorName",
|
||||
_("Behavior name"),
|
||||
"defaultGDname",
|
||||
_("Description"),
|
||||
"",
|
||||
"CppPlatform/Extensions/myicon.png",
|
||||
"PhysicsBehavior",
|
||||
std::make_shared<BehaviorClassName>(),
|
||||
std::make_shared<BehaviorSharedDataClassName>());
|
||||
|
||||
#if defined(GD_IDE_ONLY)
|
||||
behaviorInfo.SetIncludeFile("MyExtension/MyIncludeFile.h");
|
||||
|
||||
aut.AddAction(...);
|
||||
aut.AddCondition(...);
|
||||
aut.AddExpression(...);
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
GD_COMPLETE_EXTENSION_COMPILATION_INFORMATION();
|
||||
};
|
||||
virtual ~Extension() {};
|
||||
};
|
||||
|
||||
// Used by GDevelop to create the extension class
|
||||
// -- Do not need to be modified. --
|
||||
extern "C" ExtensionBase * GD_EXTENSION_API CreateGDExtension() {
|
||||
return new Extension;
|
||||
}
|
||||
* \endcode
|
||||
* - <a href="https://github.com/4ian/GDevelop/blob/master/newIDE/README.md">Getting started with the editor</a>
|
||||
* - <a href="https://github.com/4ian/GDevelop/blob/master/newIDE/README-extensions.md">Getting started with the extensions</a>
|
||||
*/
|
||||
|
||||
/**
|
||||
|
58
Core/GDCore/Events/CodeGeneration/EffectsCodeGenerator.cpp
Normal file
58
Core/GDCore/Events/CodeGeneration/EffectsCodeGenerator.cpp
Normal file
@@ -0,0 +1,58 @@
|
||||
/*
|
||||
* GDevelop Core
|
||||
* Copyright 2008-present Florian Rival (Florian.Rival@gmail.com). All rights
|
||||
* reserved. This project is released under the MIT License.
|
||||
*/
|
||||
#include <iostream>
|
||||
#include "EffectsCodeGenerator.h"
|
||||
#include "GDCore/Extensions/Metadata/EffectMetadata.h"
|
||||
#include "GDCore/Extensions/Metadata/MetadataProvider.h"
|
||||
#include "GDCore/Project/Effect.h"
|
||||
#include "GDCore/Project/Layer.h"
|
||||
#include "GDCore/Project/Layout.h"
|
||||
#include "GDCore/Project/Project.h"
|
||||
|
||||
namespace gd {
|
||||
|
||||
void ExposeProjectEffects(
|
||||
const gd::Project& project,
|
||||
const std::function<void(const gd::Effect& effect)>& worker) {
|
||||
// See also gd::Project::ExposeResources for a method that traverse the whole
|
||||
// project (this time for resources) and
|
||||
// WholeProjectRefactorer::ExposeProjectEvents.
|
||||
|
||||
// Add layouts effects
|
||||
for (std::size_t s = 0; s < project.GetLayoutsCount(); s++) {
|
||||
auto& layout = project.GetLayout(s);
|
||||
|
||||
for (std::size_t l = 0; l < layout.GetLayersCount(); ++l) {
|
||||
auto& layer = layout.GetLayer(l);
|
||||
|
||||
for (std::size_t e = 0; e < layer.GetEffectsCount(); ++e) {
|
||||
auto& effect = layer.GetEffect(e);
|
||||
worker(effect);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void EffectsCodeGenerator::GenerateEffectsIncludeFiles(
|
||||
const gd::Platform& platform,
|
||||
const gd::Project& project,
|
||||
std::set<gd::String>& includeFiles) {
|
||||
ExposeProjectEffects(
|
||||
project, [&platform, &includeFiles](const gd::Effect& effect) {
|
||||
// TODO: this browse all the extensions every time we're trying to find
|
||||
// a new effect. Might be a good idea to rework MetadataProvider to be
|
||||
// faster (not sure if it is a bottleneck at all though - but could be
|
||||
// for events code generation).
|
||||
const gd::EffectMetadata& effectMetadata =
|
||||
MetadataProvider::GetEffectMetadata(platform,
|
||||
effect.GetEffectType());
|
||||
|
||||
for (auto& includeFile : effectMetadata.GetIncludeFiles())
|
||||
includeFiles.insert(includeFile);
|
||||
});
|
||||
}
|
||||
|
||||
} // namespace gd
|
35
Core/GDCore/Events/CodeGeneration/EffectsCodeGenerator.h
Normal file
35
Core/GDCore/Events/CodeGeneration/EffectsCodeGenerator.h
Normal file
@@ -0,0 +1,35 @@
|
||||
/*
|
||||
* GDevelop Core
|
||||
* Copyright 2008-present Florian Rival (Florian.Rival@gmail.com). All rights
|
||||
* reserved. This project is released under the MIT License.
|
||||
*/
|
||||
#ifndef GDCORE_EffectsCodeGenerator_H
|
||||
#define GDCORE_EffectsCodeGenerator_H
|
||||
|
||||
#include <set>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
#include "GDCore/String.h"
|
||||
namespace gd {
|
||||
class Project;
|
||||
class Platform;
|
||||
} // namespace gd
|
||||
|
||||
namespace gd {
|
||||
|
||||
/**
|
||||
* \brief Internal class used to generate code from events
|
||||
*/
|
||||
class GD_CORE_API EffectsCodeGenerator {
|
||||
public:
|
||||
/**
|
||||
* \brief Add all the include files required by the project effects.
|
||||
*/
|
||||
static void GenerateEffectsIncludeFiles(const gd::Platform& platform,
|
||||
const gd::Project& project,
|
||||
std::set<gd::String>& includeFiles);
|
||||
};
|
||||
|
||||
} // namespace gd
|
||||
|
||||
#endif // GDCORE_EffectsCodeGenerator_H
|
@@ -864,9 +864,9 @@ bool ExpressionParser::PrepareParameter(
|
||||
const size_t positionInExpression) {
|
||||
if (ParameterMetadata::IsExpression("number", parametersInfo.type)) {
|
||||
if (parametersInfo.optional && parameter.GetPlainString().empty())
|
||||
parameter = parametersInfo.defaultValue.empty()
|
||||
parameter = parametersInfo.GetDefaultValue().empty()
|
||||
? gd::Expression("0")
|
||||
: gd::Expression(parametersInfo.defaultValue);
|
||||
: gd::Expression(parametersInfo.GetDefaultValue());
|
||||
|
||||
if (!callbacks.OnSubMathExpression(platform, project, layout, parameter)) {
|
||||
firstErrorStr = callbacks.firstErrorStr;
|
||||
@@ -876,9 +876,9 @@ bool ExpressionParser::PrepareParameter(
|
||||
}
|
||||
} else if (ParameterMetadata::IsExpression("string", parametersInfo.type)) {
|
||||
if (parametersInfo.optional && parameter.GetPlainString().empty())
|
||||
parameter = parametersInfo.defaultValue.empty()
|
||||
parameter = parametersInfo.GetDefaultValue().empty()
|
||||
? gd::Expression("\"\"")
|
||||
: gd::Expression(parametersInfo.defaultValue);
|
||||
: gd::Expression(parametersInfo.GetDefaultValue());
|
||||
|
||||
if (!callbacks.OnSubTextExpression(platform, project, layout, parameter)) {
|
||||
firstErrorStr = callbacks.firstErrorStr;
|
||||
|
@@ -35,10 +35,11 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsAudioExtension(
|
||||
.AddParameter("expression", _("Channel identifier"))
|
||||
.AddParameter("yesorno", _("Repeat the sound"), "", true)
|
||||
.SetDefaultValue("no")
|
||||
.AddParameter(
|
||||
"expression", _("Volume (from 0 to 100, 100 by default)"), "", true)
|
||||
.AddParameter("expression", _("Volume"), "", true)
|
||||
.SetParameterLongDescription(_("From 0 to 100, 100 by default."))
|
||||
.SetDefaultValue("100")
|
||||
.AddParameter("expression", _("Pitch (speed) (1 by default)"), "", true)
|
||||
.AddParameter("expression", _("Pitch (speed)"), "", true)
|
||||
.SetParameterLongDescription(_("1 by default."))
|
||||
.SetDefaultValue("1")
|
||||
.MarkAsAdvanced();
|
||||
|
||||
@@ -93,10 +94,11 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsAudioExtension(
|
||||
.AddParameter("expression", _("Channel identifier"))
|
||||
.AddParameter("yesorno", _("Repeat the sound"), "", true)
|
||||
.SetDefaultValue("no")
|
||||
.AddParameter(
|
||||
"expression", _("Volume (from 0 to 100, 100 by default)"), "", true)
|
||||
.AddParameter("expression", _("Volume"), "", true)
|
||||
.SetParameterLongDescription(_("From 0 to 100, 100 by default."))
|
||||
.SetDefaultValue("100")
|
||||
.AddParameter("expression", _("Pitch (speed) (1 by default)"), "", true)
|
||||
.AddParameter("expression", _("Pitch (speed)"), "", true)
|
||||
.SetParameterLongDescription(_("1 by default."))
|
||||
.SetDefaultValue("1")
|
||||
.MarkAsAdvanced();
|
||||
|
||||
@@ -141,117 +143,97 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsAudioExtension(
|
||||
_("Volume of the sound on a channel"),
|
||||
_("This action modifies the volume of the sound on the "
|
||||
"specified channel. The volume is between 0 and 100."),
|
||||
_("Do _PARAM2__PARAM3_ to the volume of the sound on channel "
|
||||
"_PARAM1_"),
|
||||
_("the volume of the sound on channel _PARAM1_"),
|
||||
_("Audio/Sounds on channels"),
|
||||
"res/actions/sonVolume24.png",
|
||||
"res/actions/sonVolume.png")
|
||||
.AddCodeOnlyParameter("currentScene", "")
|
||||
.AddParameter("expression", _("Channel identifier"))
|
||||
.AddParameter("operator", _("Modification's sign"))
|
||||
.AddParameter("expression", _("Value"))
|
||||
.MarkAsAdvanced()
|
||||
.SetManipulatedType("number");
|
||||
.UseStandardOperatorParameters("number")
|
||||
.MarkAsAdvanced();
|
||||
|
||||
extension
|
||||
.AddAction("ModVolumeMusicCanal",
|
||||
_("Volume of the music on a channel"),
|
||||
_("This action modifies the volume of the music on the "
|
||||
"specified channel. The volume is between 0 and 100."),
|
||||
_("Do _PARAM2__PARAM3_ to the volume of the music on channel "
|
||||
"_PARAM1_"),
|
||||
_("the volume of the music on channel _PARAM1_"),
|
||||
_("Audio/Music on channels"),
|
||||
"res/actions/musicVolume24.png",
|
||||
"res/actions/musicVolume.png")
|
||||
.AddCodeOnlyParameter("currentScene", "")
|
||||
.AddParameter("expression", _("Channel identifier"))
|
||||
.AddParameter("operator", _("Modification's sign"))
|
||||
.AddParameter("expression", _("Value"))
|
||||
.MarkAsAdvanced()
|
||||
.SetManipulatedType("number");
|
||||
.UseStandardOperatorParameters("number")
|
||||
.MarkAsAdvanced();
|
||||
|
||||
extension
|
||||
.AddAction("ModGlobalVolume",
|
||||
_("Game global volume"),
|
||||
_("This action modifies the global volume of the game. The "
|
||||
"volume is between 0 and 100."),
|
||||
_("Do _PARAM1__PARAM2_ to global sound level"),
|
||||
_("the global sound level"),
|
||||
_("Audio"),
|
||||
"res/actions/volume24.png",
|
||||
"res/actions/volume.png")
|
||||
.AddCodeOnlyParameter("currentScene", "")
|
||||
.AddParameter("operator", _("Modification's sign"))
|
||||
.AddParameter("expression", _("Value"))
|
||||
.MarkAsSimple()
|
||||
.SetManipulatedType("number");
|
||||
.UseStandardOperatorParameters("number")
|
||||
.MarkAsSimple();
|
||||
|
||||
extension
|
||||
.AddAction("ModPitchSoundChannel",
|
||||
_("Pitch of the sound of a channel"),
|
||||
_("This action modifies the pitch (speed) of the sound on a "
|
||||
"channel.\n1 is the default pitch."),
|
||||
_("Do _PARAM2__PARAM3_ to the pitch of the sound on channel "
|
||||
"_PARAM1_"),
|
||||
_("the pitch of the sound on channel _PARAM1_"),
|
||||
_("Audio/Sounds on channels"),
|
||||
"res/actions/son24.png",
|
||||
"res/actions/son.png")
|
||||
.AddCodeOnlyParameter("currentScene", "")
|
||||
.AddParameter("expression", _("Channel identifier"))
|
||||
.AddParameter("operator", _("Modification's sign"))
|
||||
.AddParameter("expression", _("Value"))
|
||||
.MarkAsAdvanced()
|
||||
.SetManipulatedType("number");
|
||||
.UseStandardOperatorParameters("number")
|
||||
.MarkAsAdvanced();
|
||||
|
||||
extension
|
||||
.AddAction("ModPitchMusicChannel",
|
||||
_("Pitch of the music on a channel"),
|
||||
_("This action modifies the pitch of the music on the "
|
||||
"specified channel. 1 is the default pitch"),
|
||||
_("Do _PARAM2__PARAM3_ to the pitch of the music on channel "
|
||||
"_PARAM1_"),
|
||||
_("the pitch of the music on channel _PARAM1_"),
|
||||
_("Audio/Music on channels"),
|
||||
"res/actions/music24.png",
|
||||
"res/actions/music.png")
|
||||
.AddCodeOnlyParameter("currentScene", "")
|
||||
.AddParameter("expression", _("Channel identifier"))
|
||||
.AddParameter("operator", _("Modification's sign"))
|
||||
.AddParameter("expression", _("Value"))
|
||||
.MarkAsAdvanced()
|
||||
.SetManipulatedType("number");
|
||||
.UseStandardOperatorParameters("number")
|
||||
.MarkAsAdvanced();
|
||||
|
||||
extension
|
||||
.AddAction("ModPlayingOffsetSoundChannel",
|
||||
_("Playing offset of the sound on a channel"),
|
||||
_("This action modifies the playing offset of the sound on a "
|
||||
"channel"),
|
||||
_("Do _PARAM2__PARAM3_ to the playing offset of the sound on "
|
||||
"channel _PARAM1_"),
|
||||
_("the playing offset of the sound on channel _PARAM1_"),
|
||||
_("Audio/Sounds on channels"),
|
||||
"res/actions/son24.png",
|
||||
"res/actions/son.png")
|
||||
.AddCodeOnlyParameter("currentScene", "")
|
||||
.AddParameter("expression", _("Channel identifier"))
|
||||
.AddParameter("operator", _("Modification's sign"))
|
||||
.AddParameter("expression", _("Value"))
|
||||
.MarkAsAdvanced()
|
||||
.SetManipulatedType("number");
|
||||
.UseStandardOperatorParameters("number")
|
||||
.MarkAsAdvanced();
|
||||
|
||||
extension
|
||||
.AddAction("ModPlayingOffsetMusicChannel",
|
||||
_("Playing offset of the music on a channel"),
|
||||
_("This action modifies the playing offset of the music on "
|
||||
"the specified channel"),
|
||||
_("Do _PARAM2__PARAM3_ to the playing offset of the music on "
|
||||
"channel _PARAM1_"),
|
||||
_("the playing offset of the music on channel _PARAM1_"),
|
||||
_("Audio/Music on channels"),
|
||||
"res/actions/music24.png",
|
||||
"res/actions/music.png")
|
||||
.AddCodeOnlyParameter("currentScene", "")
|
||||
.AddParameter("expression", _("Channel identifier"))
|
||||
.AddParameter("operator", _("Modification's sign"))
|
||||
.AddParameter("expression", _("Value"))
|
||||
.MarkAsAdvanced()
|
||||
.SetManipulatedType("number");
|
||||
.UseStandardOperatorParameters("number")
|
||||
.MarkAsAdvanced();
|
||||
|
||||
extension
|
||||
.AddAction("PlaySound",
|
||||
@@ -265,10 +247,11 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsAudioExtension(
|
||||
.AddParameter("soundfile", _("Audio file (or audio resource name)"))
|
||||
.AddParameter("yesorno", _("Repeat the sound"), "", true)
|
||||
.SetDefaultValue("no")
|
||||
.AddParameter(
|
||||
"expression", _("Volume (from 0 to 100, 100 by default)"), "", true)
|
||||
.AddParameter("expression", _("Volume"), "", true)
|
||||
.SetParameterLongDescription(_("From 0 to 100, 100 by default."))
|
||||
.SetDefaultValue("100")
|
||||
.AddParameter("expression", _("Pitch (speed) (1 by default)"), "", true)
|
||||
.AddParameter("expression", _("Pitch (speed)"), "", true)
|
||||
.SetParameterLongDescription(_("1 by default."))
|
||||
.SetDefaultValue("1")
|
||||
.MarkAsSimple();
|
||||
|
||||
@@ -284,10 +267,11 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsAudioExtension(
|
||||
.AddParameter("musicfile", _("Audio file (or audio resource name)"))
|
||||
.AddParameter("yesorno", _("Repeat the sound"), "", true)
|
||||
.SetDefaultValue("no")
|
||||
.AddParameter(
|
||||
"expression", _("Volume (from 0 to 100, 100 by default)"), "", true)
|
||||
.AddParameter("expression", _("Volume"), "", true)
|
||||
.SetParameterLongDescription(_("From 0 to 100, 100 by default."))
|
||||
.SetDefaultValue("100")
|
||||
.AddParameter("expression", _("Pitch (speed) (1 by default)"), "", true)
|
||||
.AddParameter("expression", _("Pitch (speed)"), "", true)
|
||||
.SetParameterLongDescription(_("1 by default."))
|
||||
.SetDefaultValue("1")
|
||||
.MarkAsSimple();
|
||||
|
||||
@@ -369,16 +353,14 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsAudioExtension(
|
||||
_("Volume of the sound on a channel"),
|
||||
_("Test the volume of the sound on the specified channel. The volume "
|
||||
"is between 0 and 100."),
|
||||
_("The volume of the sound on channel _PARAM1_ is _PARAM2__PARAM3_"),
|
||||
_("the volume of the sound on channel _PARAM1_"),
|
||||
_("Audio/Sounds on channels"),
|
||||
"res/conditions/sonVolume24.png",
|
||||
"res/conditions/sonVolume.png")
|
||||
.AddCodeOnlyParameter("currentScene", "")
|
||||
.AddParameter("expression", _("Channel identifier"))
|
||||
.AddParameter("relationalOperator", _("Sign of the test"))
|
||||
.AddParameter("expression", _("Volume to test"))
|
||||
.MarkAsAdvanced()
|
||||
.SetManipulatedType("number");
|
||||
.UseStandardRelationalOperatorParameters("number")
|
||||
.MarkAsAdvanced();
|
||||
|
||||
extension
|
||||
.AddCondition(
|
||||
@@ -386,30 +368,26 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsAudioExtension(
|
||||
_("Volume of the music on a channel"),
|
||||
_("Test the volume of the music on a specified channel. The volume "
|
||||
"is between 0 and 100."),
|
||||
_("The volume of the music on channel _PARAM1_ is _PARAM2__PARAM3_"),
|
||||
_("the volume of the music on channel _PARAM1_"),
|
||||
_("Audio/Music on channels"),
|
||||
"res/conditions/musicVolume24.png",
|
||||
"res/conditions/musicVolume.png")
|
||||
.AddCodeOnlyParameter("currentScene", "")
|
||||
.AddParameter("expression", _("Channel identifier"))
|
||||
.AddParameter("relationalOperator", _("Sign of the test"))
|
||||
.AddParameter("expression", _("Volume to test"))
|
||||
.MarkAsAdvanced()
|
||||
.SetManipulatedType("number");
|
||||
.UseStandardRelationalOperatorParameters("number")
|
||||
.MarkAsAdvanced();
|
||||
|
||||
extension
|
||||
.AddCondition(
|
||||
"GlobalVolume",
|
||||
_("Global volume"),
|
||||
_("Test the global sound level. The volume is between 0 and 100."),
|
||||
_("The global game volume is _PARAM1__PARAM2_"),
|
||||
_("the global game volume"),
|
||||
_("Audio"),
|
||||
"res/conditions/volume24.png",
|
||||
"res/conditions/volume.png")
|
||||
.AddCodeOnlyParameter("currentScene", "")
|
||||
.AddParameter("relationalOperator", _("Sign of the test"))
|
||||
.AddParameter("expression", _("Volume to test"))
|
||||
.SetManipulatedType("number");
|
||||
.UseStandardRelationalOperatorParameters("number");
|
||||
|
||||
extension
|
||||
.AddCondition(
|
||||
@@ -417,16 +395,14 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsAudioExtension(
|
||||
_("Pitch of the sound of a channel"),
|
||||
_("Test the pitch of the sound on the specified channel. 1 is the "
|
||||
"default pitch."),
|
||||
_("The pitch of the sound on channel _PARAM1_ is _PARAM2__PARAM3_"),
|
||||
_("the pitch of the sound on channel _PARAM1_"),
|
||||
_("Audio/Sounds on channels"),
|
||||
"res/conditions/sonVolume24.png",
|
||||
"res/conditions/sonVolume.png")
|
||||
.AddCodeOnlyParameter("currentScene", "")
|
||||
.AddParameter("expression", _("Channel identifier"))
|
||||
.AddParameter("relationalOperator", _("Sign of the test"))
|
||||
.AddParameter("expression", _("Pitch to test"))
|
||||
.MarkAsAdvanced()
|
||||
.SetManipulatedType("number");
|
||||
.UseStandardRelationalOperatorParameters("number")
|
||||
.MarkAsAdvanced();
|
||||
|
||||
extension
|
||||
.AddCondition(
|
||||
@@ -434,50 +410,42 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsAudioExtension(
|
||||
_("Pitch of the music on a channel"),
|
||||
_("Test the pitch (speed) of the music on a specified channel. 1 is "
|
||||
"the default pitch."),
|
||||
_("The pitch of the music on channel _PARAM1_ is _PARAM2__PARAM3_"),
|
||||
_("the pitch of the music on channel _PARAM1_"),
|
||||
_("Audio/Music on channels"),
|
||||
"res/conditions/musicVolume24.png",
|
||||
"res/conditions/musicVolume.png")
|
||||
.AddCodeOnlyParameter("currentScene", "")
|
||||
.AddParameter("expression", _("Channel identifier"))
|
||||
.AddParameter("relationalOperator", _("Sign of the test"))
|
||||
.AddParameter("expression", _("Pitch to test"))
|
||||
.MarkAsAdvanced()
|
||||
.SetManipulatedType("number");
|
||||
.UseStandardRelationalOperatorParameters("number")
|
||||
.MarkAsAdvanced();
|
||||
|
||||
extension
|
||||
.AddCondition(
|
||||
"SoundChannelPlayingOffset",
|
||||
_("Playing offset of the sound on a channel"),
|
||||
_("Test the playing offset of the sound on the specified channel."),
|
||||
_("The playing offset of the sound on channel _PARAM1_ is "
|
||||
"_PARAM2__PARAM3_"),
|
||||
_("the playing offset of the sound on channel _PARAM1_"),
|
||||
_("Audio/Sounds on channels"),
|
||||
"res/conditions/sonVolume24.png",
|
||||
"res/conditions/sonVolume.png")
|
||||
.AddCodeOnlyParameter("currentScene", "")
|
||||
.AddParameter("expression", _("Channel identifier"))
|
||||
.AddParameter("relationalOperator", _("Sign of the test"))
|
||||
.AddParameter("expression", _("Playing position (in seconds)"))
|
||||
.MarkAsAdvanced()
|
||||
.SetManipulatedType("number");
|
||||
.UseStandardRelationalOperatorParameters("number")
|
||||
.MarkAsAdvanced();
|
||||
|
||||
extension
|
||||
.AddCondition(
|
||||
"MusicChannelPlayingOffset",
|
||||
_("Playing offset of the music on a channel"),
|
||||
_("Test the playing offset of the music on the specified channel."),
|
||||
_("The playing offset of the music on channel _PARAM1_ is "
|
||||
"_PARAM2__PARAM3_"),
|
||||
_("the playing offset of the music on channel _PARAM1_"),
|
||||
_("Audio/Music on channels"),
|
||||
"res/conditions/musicVolume24.png",
|
||||
"res/conditions/musicVolume.png")
|
||||
.AddCodeOnlyParameter("currentScene", "")
|
||||
.AddParameter("expression", _("Channel identifier"))
|
||||
.AddParameter("relationalOperator", _("Sign of the test"))
|
||||
.AddParameter("expression", _("Playing position (in seconds)"))
|
||||
.MarkAsAdvanced()
|
||||
.SetManipulatedType("number");
|
||||
.UseStandardRelationalOperatorParameters("number")
|
||||
.MarkAsAdvanced();
|
||||
|
||||
extension
|
||||
.AddExpression("SoundChannelPlayingOffset",
|
||||
|
@@ -27,64 +27,56 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsBaseObjectExtension(
|
||||
obj.AddCondition("PosX",
|
||||
_("Compare X position of an object"),
|
||||
_("Compare the X position of the object."),
|
||||
_("The X position of _PARAM0_ is _PARAM1__PARAM2_"),
|
||||
_("the X position"),
|
||||
_("Position"),
|
||||
"res/conditions/position24.png",
|
||||
"res/conditions/position.png")
|
||||
|
||||
.AddParameter("object", _("Object"))
|
||||
.AddParameter("relationalOperator", _("Sign of the test"))
|
||||
.AddParameter("expression", _("X position"))
|
||||
.MarkAsSimple()
|
||||
.SetManipulatedType("number");
|
||||
.UseStandardRelationalOperatorParameters("number")
|
||||
.MarkAsSimple();
|
||||
|
||||
obj.AddAction("MettreX",
|
||||
_("X position of an object"),
|
||||
_("Change the X position of an object."),
|
||||
_("Do _PARAM1__PARAM2_ to the X position of _PARAM0_"),
|
||||
_("the X position"),
|
||||
_("Position"),
|
||||
"res/actions/position24.png",
|
||||
"res/actions/position.png")
|
||||
|
||||
.AddParameter("object", _("Object"))
|
||||
.AddParameter("operator", _("Modification's sign"))
|
||||
.AddParameter("expression", _("Value"))
|
||||
.MarkAsSimple()
|
||||
.SetManipulatedType("number");
|
||||
.UseStandardOperatorParameters("number")
|
||||
.MarkAsSimple();
|
||||
|
||||
obj.AddCondition("PosY",
|
||||
_("Compare Y position of an object"),
|
||||
_("Compare the Y position of an object."),
|
||||
_("The Y position of _PARAM0_ is _PARAM1__PARAM2_"),
|
||||
_("the Y position"),
|
||||
_("Position"),
|
||||
"res/conditions/position24.png",
|
||||
"res/conditions/position.png")
|
||||
|
||||
.AddParameter("object", _("Object"))
|
||||
.AddParameter("relationalOperator", _("Sign of the test"))
|
||||
.AddParameter("expression", _("Y position"))
|
||||
.MarkAsSimple()
|
||||
.SetManipulatedType("number");
|
||||
.UseStandardRelationalOperatorParameters("number")
|
||||
.MarkAsSimple();
|
||||
|
||||
obj.AddAction("MettreY",
|
||||
_("Y position of an object"),
|
||||
_("Change the Y position of an object."),
|
||||
_("Do _PARAM1__PARAM2_ to the Y position of _PARAM0_"),
|
||||
_("the Y position"),
|
||||
_("Position"),
|
||||
"res/actions/position24.png",
|
||||
"res/actions/position.png")
|
||||
|
||||
.AddParameter("object", _("Object"))
|
||||
.AddParameter("operator", _("Modification's sign"))
|
||||
.AddParameter("expression", _("Value"))
|
||||
.MarkAsSimple()
|
||||
.SetManipulatedType("number");
|
||||
.UseStandardOperatorParameters("number")
|
||||
.MarkAsSimple();
|
||||
|
||||
obj.AddAction(
|
||||
"MettreXY",
|
||||
_("Position of an object"),
|
||||
_("Change the position of an object."),
|
||||
_("Do _PARAM1__PARAM2_;_PARAM3__PARAM4_ to the position of _PARAM0_"),
|
||||
_("Change the position of _PARAM0_: _PARAM1_ _PARAM2_ (x axis), _PARAM3_ _PARAM4_ (y axis)"),
|
||||
_("Position"),
|
||||
"res/actions/position24.png",
|
||||
"res/actions/position.png")
|
||||
@@ -117,15 +109,13 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsBaseObjectExtension(
|
||||
obj.AddAction("SetAngle",
|
||||
_("Angle"),
|
||||
_("Change the angle of rotation of an object."),
|
||||
_("Do _PARAM1__PARAM2_ to angle of _PARAM0_"),
|
||||
_("the angle"),
|
||||
_("Angle"),
|
||||
"res/actions/direction24.png",
|
||||
"res/actions/direction.png")
|
||||
|
||||
.AddParameter("object", _("Object"))
|
||||
.AddParameter("operator", _("Modification's sign"))
|
||||
.AddParameter("expression", _("Value"))
|
||||
.SetManipulatedType("number");
|
||||
.UseStandardOperatorParameters("number");
|
||||
|
||||
obj.AddAction("Rotate",
|
||||
_("Rotate"),
|
||||
@@ -152,9 +142,8 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsBaseObjectExtension(
|
||||
|
||||
.AddParameter("object", _("Object"))
|
||||
.AddParameter("expression", _("Angle to rotate towards (in degrees)"))
|
||||
.AddParameter(
|
||||
"expression",
|
||||
_("Angular speed (in degrees per second) (0 for immediate rotation)"))
|
||||
.AddParameter("expression", _("Angular speed (in degrees per second)"))
|
||||
.SetParameterLongDescription(_("Enter 0 for an immediate rotation."))
|
||||
.AddCodeOnlyParameter("currentScene", "");
|
||||
|
||||
obj.AddAction(
|
||||
@@ -170,9 +159,8 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsBaseObjectExtension(
|
||||
.AddParameter("object", _("Object"))
|
||||
.AddParameter("expression", _("X position"))
|
||||
.AddParameter("expression", _("Y position"))
|
||||
.AddParameter(
|
||||
"expression",
|
||||
_("Angular speed (in degrees per second) (0 for immediate rotation)"))
|
||||
.AddParameter("expression", _("Angular speed (in degrees per second)"))
|
||||
.SetParameterLongDescription(_("Enter 0 for an immediate rotation."))
|
||||
.AddCodeOnlyParameter("currentScene", "")
|
||||
.MarkAsAdvanced();
|
||||
|
||||
@@ -250,7 +238,7 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsBaseObjectExtension(
|
||||
obj.AddAction("Arreter",
|
||||
_("Stop the object"),
|
||||
_("Stop the object by deleting all of its forces."),
|
||||
_("Stop object _PARAM0_"),
|
||||
_("Stop _PARAM0_ (remove all forces)"),
|
||||
_("Movement"),
|
||||
"res/actions/arreter24.png",
|
||||
"res/actions/arreter.png")
|
||||
@@ -261,7 +249,7 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsBaseObjectExtension(
|
||||
obj.AddAction("Delete",
|
||||
_("Delete an object"),
|
||||
_("Delete the specified object."),
|
||||
_("Delete object _PARAM0_"),
|
||||
_("Delete _PARAM0_"),
|
||||
_("Objects"),
|
||||
"res/actions/delete24.png",
|
||||
"res/actions/delete.png")
|
||||
@@ -273,15 +261,13 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsBaseObjectExtension(
|
||||
obj.AddAction("ChangePlan",
|
||||
_("Z order"),
|
||||
_("Modify the Z-order of an object"),
|
||||
_("Do _PARAM1__PARAM2_ to Z-order of _PARAM0_"),
|
||||
_("the z-order"),
|
||||
_("Z order"),
|
||||
"res/actions/planicon24.png",
|
||||
"res/actions/planicon.png")
|
||||
|
||||
.AddParameter("object", _("Object"))
|
||||
.AddParameter("operator", _("Modification's sign"))
|
||||
.AddParameter("expression", _("Value"))
|
||||
.SetManipulatedType("number");
|
||||
.UseStandardOperatorParameters("number");
|
||||
|
||||
obj.AddAction("ChangeLayer",
|
||||
_("Layer"),
|
||||
@@ -299,31 +285,27 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsBaseObjectExtension(
|
||||
obj.AddAction("ModVarObjet",
|
||||
_("Modify a variable of an object"),
|
||||
_("Modify the value of a variable of an object"),
|
||||
_("Do _PARAM2__PARAM3_ to variable _PARAM1_ of _PARAM0_"),
|
||||
_("the variable _PARAM1_"),
|
||||
_("Variables"),
|
||||
"res/actions/var24.png",
|
||||
"res/actions/var.png")
|
||||
|
||||
.AddParameter("object", _("Object"))
|
||||
.AddParameter("objectvar", _("Variable"))
|
||||
.AddParameter("operator", _("Modification's sign"))
|
||||
.AddParameter("expression", _("Value"))
|
||||
.SetManipulatedType("number");
|
||||
.UseStandardOperatorParameters("number");
|
||||
|
||||
obj.AddAction(
|
||||
"ModVarObjetTxt",
|
||||
_("Modify the text of a variable of an object"),
|
||||
_("Modify the text of a variable of an object"),
|
||||
_("Do _PARAM2__PARAM3_ to the text of variable _PARAM1_ of _PARAM0_"),
|
||||
_("the text of variable _PARAM1_"),
|
||||
_("Variables"),
|
||||
"res/actions/var24.png",
|
||||
"res/actions/var.png")
|
||||
|
||||
.AddParameter("object", _("Object"))
|
||||
.AddParameter("objectvar", _("Variable"))
|
||||
.AddParameter("operator", _("Modification's sign"))
|
||||
.AddParameter("string", _("Text"))
|
||||
.SetManipulatedType("string");
|
||||
.UseStandardOperatorParameters("string");
|
||||
|
||||
obj.AddCondition(
|
||||
"ObjectVariableChildExists",
|
||||
@@ -364,7 +346,7 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsBaseObjectExtension(
|
||||
obj.AddAction("Cache",
|
||||
_("Hide"),
|
||||
_("Hide the specified object."),
|
||||
_("Hide the object _PARAM0_"),
|
||||
_("Hide _PARAM0_"),
|
||||
_("Visibility"),
|
||||
"res/actions/visibilite24.png",
|
||||
"res/actions/visibilite.png")
|
||||
@@ -375,7 +357,7 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsBaseObjectExtension(
|
||||
obj.AddAction("Montre",
|
||||
_("Show"),
|
||||
_("Show the specified object"),
|
||||
_("Show object _PARAM0_"),
|
||||
_("Show _PARAM0_"),
|
||||
_("Visibility"),
|
||||
"res/actions/visibilite24.png",
|
||||
"res/actions/visibilite.png")
|
||||
@@ -387,30 +369,26 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsBaseObjectExtension(
|
||||
obj.AddCondition("Angle",
|
||||
_("Angle"),
|
||||
_("Compare the angle of the specified object."),
|
||||
_("Angle of _PARAM0_ is _PARAM1__PARAM2_ deg."),
|
||||
_("the angle (in degrees)"),
|
||||
_("Angle"),
|
||||
"res/conditions/direction24.png",
|
||||
"res/conditions/direction.png")
|
||||
|
||||
.AddParameter("object", _("Object"))
|
||||
.AddParameter("relationalOperator", _("Sign of the test"))
|
||||
.AddParameter("expression", _("Value to compare (in degrees)"))
|
||||
.MarkAsAdvanced()
|
||||
.SetManipulatedType("number");
|
||||
.UseStandardRelationalOperatorParameters("number")
|
||||
.MarkAsAdvanced();
|
||||
|
||||
obj.AddCondition("Plan",
|
||||
_("Compare Z order"),
|
||||
_("Compare the Z-order of the specified object."),
|
||||
_("Z Order of _PARAM0_ is _PARAM1__PARAM2_"),
|
||||
_("the z Order"),
|
||||
_("Z order"),
|
||||
"res/conditions/planicon24.png",
|
||||
"res/conditions/planicon.png")
|
||||
|
||||
.AddParameter("object", _("Object"))
|
||||
.AddParameter("relationalOperator", _("Sign of the test"))
|
||||
.AddParameter("expression", _("Z order"))
|
||||
.MarkAsAdvanced()
|
||||
.SetManipulatedType("number");
|
||||
.UseStandardRelationalOperatorParameters("number")
|
||||
.MarkAsAdvanced();
|
||||
|
||||
obj.AddCondition("Layer",
|
||||
_("Compare layer"),
|
||||
@@ -427,7 +405,7 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsBaseObjectExtension(
|
||||
obj.AddCondition("Visible",
|
||||
_("Visibility of an object"),
|
||||
_("Check if an object is visible."),
|
||||
_("The object _PARAM0_ is visible"),
|
||||
_("_PARAM0_ is visible (not marked as hidden)"),
|
||||
_("Visibility"),
|
||||
"res/conditions/visibilite24.png",
|
||||
"res/conditions/visibilite.png")
|
||||
@@ -460,16 +438,14 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsBaseObjectExtension(
|
||||
obj.AddCondition("Vitesse",
|
||||
_("Speed"),
|
||||
_("Compare the overall speed of an object"),
|
||||
_("Overall speed of _PARAM0_ is _PARAM1__PARAM2_"),
|
||||
_("the overall speed"),
|
||||
_("Movement"),
|
||||
"res/conditions/vitesse24.png",
|
||||
"res/conditions/vitesse.png")
|
||||
|
||||
.AddParameter("object", _("Object"))
|
||||
.AddParameter("relationalOperator", _("Sign of the test"))
|
||||
.AddParameter("expression", _("Speed"))
|
||||
.MarkAsAdvanced()
|
||||
.SetManipulatedType("number");
|
||||
.UseStandardRelationalOperatorParameters("number")
|
||||
.MarkAsAdvanced();
|
||||
|
||||
obj.AddCondition("AngleOfDisplacement",
|
||||
_("Angle of movement"),
|
||||
@@ -488,31 +464,27 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsBaseObjectExtension(
|
||||
obj.AddCondition("VarObjet",
|
||||
_("Value of an object's variable"),
|
||||
_("Compare the value of a variable of an object."),
|
||||
_("Variable _PARAM1_ of _PARAM0_ is _PARAM2__PARAM3_"),
|
||||
_("the variable _PARAM1_"),
|
||||
_("Variables"),
|
||||
"res/conditions/var24.png",
|
||||
"res/conditions/var.png")
|
||||
|
||||
.AddParameter("object", _("Object"))
|
||||
.AddParameter("objectvar", _("Variable"))
|
||||
.AddParameter("relationalOperator", _("Sign of the test"))
|
||||
.AddParameter("expression", _("Value to compare"))
|
||||
.SetManipulatedType("number");
|
||||
.UseStandardRelationalOperatorParameters("number");
|
||||
|
||||
obj.AddCondition(
|
||||
"VarObjetTxt",
|
||||
_("Text of an object's variable"),
|
||||
_("Compare the text of a variable of an object."),
|
||||
_("The text of variable _PARAM1_ of _PARAM0_ is _PARAM2__PARAM3_"),
|
||||
_("the text of variable _PARAM1_"),
|
||||
_("Variables"),
|
||||
"res/conditions/var24.png",
|
||||
"res/conditions/var.png")
|
||||
|
||||
.AddParameter("object", _("Object"))
|
||||
.AddParameter("objectvar", _("Variable"))
|
||||
.AddParameter("relationalOperator", _("Sign of the test"))
|
||||
.AddParameter("string", _("Text to test"))
|
||||
.SetManipulatedType("string");
|
||||
.UseStandardRelationalOperatorParameters("string");
|
||||
|
||||
obj.AddCondition("VarObjetDef",
|
||||
_("Variable defined"),
|
||||
@@ -906,11 +878,13 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsBaseObjectExtension(
|
||||
"res/actions/create24.png",
|
||||
"res/actions/create.png")
|
||||
.AddCodeOnlyParameter("objectsContext", "")
|
||||
.AddParameter(
|
||||
"objectListWithoutPicking",
|
||||
_("Groups containing objects that can be created by the action"))
|
||||
.AddParameter("string",
|
||||
_("Text representing the name of the object to create"))
|
||||
.AddParameter("objectListWithoutPicking", _("Group of potential objects"))
|
||||
.SetParameterLongDescription(
|
||||
_("Group containing objects that can be created by the action."))
|
||||
.AddParameter("string", _("Name of the object to create"))
|
||||
.SetParameterLongDescription(_(
|
||||
"Text representing the name of the object to create. If no objects "
|
||||
"with this name are found in the group, no object will be created."))
|
||||
.AddParameter("expression", _("X position"))
|
||||
.AddParameter("expression", _("Y position"))
|
||||
.AddParameter("layer", _("Layer (base layer if empty)"), "", true)
|
||||
@@ -919,11 +893,12 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsBaseObjectExtension(
|
||||
|
||||
extension
|
||||
.AddAction("AjoutObjConcern",
|
||||
_("Pick all objects"),
|
||||
_("Pick all the specified objects. When you pick all objects, "
|
||||
_("Pick all instances"),
|
||||
_("Pick all instances of the specified object(s). When you "
|
||||
"pick all instances, "
|
||||
"the next conditions and actions of this event work on all "
|
||||
"of them."),
|
||||
_("Pick all _PARAM1_ objects"),
|
||||
_("Pick all instances of _PARAM1_"),
|
||||
_("Objects"),
|
||||
"res/actions/add24.png",
|
||||
"res/actions/add.png")
|
||||
@@ -1045,15 +1020,13 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsBaseObjectExtension(
|
||||
"compare that number to a value. If previous conditions on the "
|
||||
"objects have not been used, this condition counts how many of "
|
||||
"these objects exist in the current scene."),
|
||||
_("The number of _PARAM0_ objects is _PARAM1__PARAM2_"),
|
||||
_("the number objects"),
|
||||
_("Objects"),
|
||||
"res/conditions/nbObjet24.png",
|
||||
"res/conditions/nbObjet.png")
|
||||
.AddParameter("objectList", _("Object"))
|
||||
.AddParameter("relationalOperator", _("Sign of the test"))
|
||||
.AddParameter("expression", _("Value to compare"))
|
||||
.MarkAsSimple()
|
||||
.SetManipulatedType("number");
|
||||
.UseStandardRelationalOperatorParameters("number")
|
||||
.MarkAsSimple();
|
||||
|
||||
extension
|
||||
.AddCondition(
|
||||
@@ -1113,12 +1086,14 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsBaseObjectExtension(
|
||||
.AddParameter("expression", _("Ray source Y position"))
|
||||
.AddParameter("expression", _("Ray angle (in degrees)"))
|
||||
.AddParameter("expression", _("Ray maximum distance (in pixels)"))
|
||||
.AddParameter(
|
||||
"scenevar",
|
||||
_("Variable where to store the X position of the intersection"))
|
||||
.AddParameter(
|
||||
"scenevar",
|
||||
_("Variable where to store the Y position of the intersection"))
|
||||
.AddParameter("scenevar", _("Result X position scene variable"))
|
||||
.SetParameterLongDescription(
|
||||
_("Scene variable where to store the X position of the intersection. "
|
||||
"If no intersection is found, the variable won't be changed."))
|
||||
.AddParameter("scenevar", _("Result Y position scene variable"))
|
||||
.SetParameterLongDescription(
|
||||
_("Scene variable where to store the Y position of the intersection. "
|
||||
"If no intersection is found, the variable won't be changed."))
|
||||
.AddCodeOnlyParameter("conditionInverted", "")
|
||||
.MarkAsAdvanced();
|
||||
|
||||
@@ -1141,12 +1116,14 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsBaseObjectExtension(
|
||||
.AddParameter("expression", _("Ray source Y position"))
|
||||
.AddParameter("expression", _("Ray target X position"))
|
||||
.AddParameter("expression", _("Ray target Y position"))
|
||||
.AddParameter(
|
||||
"scenevar",
|
||||
_("Variable where to store the X position of the intersection"))
|
||||
.AddParameter(
|
||||
"scenevar",
|
||||
_("Variable where to store the Y position of the intersection"))
|
||||
.AddParameter("scenevar", _("Result X position scene variable"))
|
||||
.SetParameterLongDescription(
|
||||
_("Scene variable where to store the X position of the intersection. "
|
||||
"If no intersection is found, the variable won't be changed."))
|
||||
.AddParameter("scenevar", _("Result Y position scene variable"))
|
||||
.SetParameterLongDescription(
|
||||
_("Scene variable where to store the Y position of the intersection. "
|
||||
"If no intersection is found, the variable won't be changed."))
|
||||
.AddCodeOnlyParameter("conditionInverted", "")
|
||||
.MarkAsAdvanced();
|
||||
|
||||
|
@@ -24,86 +24,73 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsCameraExtension(
|
||||
.AddCondition("CameraX",
|
||||
_("Camera center X position"),
|
||||
_("Compare the X position of the center of a camera."),
|
||||
_("X position of camera _PARAM4_ is _PARAM1__PARAM2_ "
|
||||
"(layer: _PARAM3_)"),
|
||||
_("the x position of camera _PARAM4_ (layer: _PARAM3_)"),
|
||||
_("Layers and cameras"),
|
||||
"res/conditions/camera24.png",
|
||||
"res/conditions/camera.png")
|
||||
.AddCodeOnlyParameter("currentScene", "")
|
||||
.AddParameter("relationalOperator", _("Sign of the test"))
|
||||
.AddParameter("expression", _("Value to compare"))
|
||||
.UseStandardRelationalOperatorParameters("number")
|
||||
.AddParameter("layer", _("Layer (base layer if empty)"), "", true)
|
||||
.SetDefaultValue("\"\"")
|
||||
.AddParameter("expression", _("Camera number (default : 0)"), "", true)
|
||||
.SetDefaultValue("0")
|
||||
.MarkAsAdvanced()
|
||||
.SetManipulatedType("number");
|
||||
.MarkAsAdvanced();
|
||||
|
||||
extension
|
||||
.AddCondition("CameraY",
|
||||
_("Camera center Y position"),
|
||||
_("Compare the Y position of the center of a camera."),
|
||||
_("The Y position of camera _PARAM4_ is _PARAM1__PARAM2_ "
|
||||
"(layer: _PARAM3_)"),
|
||||
_("the Y position of camera _PARAM4_ (layer: _PARAM3_)"),
|
||||
_("Layers and cameras"),
|
||||
"res/conditions/camera24.png",
|
||||
"res/conditions/camera.png")
|
||||
.AddCodeOnlyParameter("currentScene", "")
|
||||
.AddParameter("relationalOperator", _("Sign of the test"))
|
||||
.AddParameter("expression", _("Value to compare"))
|
||||
.UseStandardRelationalOperatorParameters("number")
|
||||
.AddParameter("layer", _("Layer (base layer if empty)"))
|
||||
.SetDefaultValue("\"\"")
|
||||
.AddParameter("expression", _("Camera number (default : 0)"))
|
||||
.SetDefaultValue("0")
|
||||
.MarkAsAdvanced()
|
||||
.SetManipulatedType("number");
|
||||
.MarkAsAdvanced();
|
||||
|
||||
extension
|
||||
.AddAction(
|
||||
"CameraX",
|
||||
_("Camera center X position"),
|
||||
_("Change the X position of the center of the specified camera."),
|
||||
_("Do _PARAM1__PARAM2_ to X position of camera _PARAM4_ (layer: "
|
||||
"_PARAM3_)"),
|
||||
_("the x position of camera _PARAM4_ (layer: _PARAM3_)"),
|
||||
_("Layers and cameras"),
|
||||
"res/conditions/camera24.png",
|
||||
"res/conditions/camera.png")
|
||||
.AddCodeOnlyParameter("currentScene", "")
|
||||
.AddParameter("operator", _("Modification's sign"))
|
||||
.AddParameter("expression", _("Value"))
|
||||
.UseStandardOperatorParameters("number")
|
||||
.AddParameter("layer", _("Layer (base layer if empty)"), "", true)
|
||||
.SetDefaultValue("\"\"")
|
||||
.AddParameter("expression", _("Camera number (default : 0)"), "", true)
|
||||
.SetDefaultValue("0")
|
||||
.MarkAsAdvanced()
|
||||
.SetManipulatedType("number");
|
||||
.MarkAsAdvanced();
|
||||
|
||||
extension
|
||||
.AddAction(
|
||||
"CameraY",
|
||||
_("Camera center Y position"),
|
||||
_("Change the Y position of the center of the specified camera."),
|
||||
_("Do _PARAM1__PARAM2_ to Y position of camera _PARAM4_ (layer: "
|
||||
"_PARAM3_)"),
|
||||
_("the y position of camera _PARAM4_ (layer: _PARAM3_)"),
|
||||
_("Layers and cameras"),
|
||||
"res/conditions/camera24.png",
|
||||
"res/conditions/camera.png")
|
||||
.AddCodeOnlyParameter("currentScene", "")
|
||||
.AddParameter("operator", _("Modification's sign"))
|
||||
.AddParameter("expression", _("Value"))
|
||||
.UseStandardOperatorParameters("number")
|
||||
.AddParameter("layer", _("Layer (base layer if empty)"), "", true)
|
||||
.SetDefaultValue("\"\"")
|
||||
.AddParameter("expression", _("Camera number (default : 0)"), "", true)
|
||||
.SetDefaultValue("0")
|
||||
.MarkAsAdvanced()
|
||||
.SetManipulatedType("number");
|
||||
.MarkAsAdvanced();
|
||||
|
||||
extension
|
||||
.AddCondition("CameraWidth",
|
||||
_("Width of a camera"),
|
||||
_("Test the width of a camera of a layer"),
|
||||
_("The width of camera _PARAM2_ of layer _PARAM1_ is "
|
||||
"_PARAM3__PARAM4_"),
|
||||
_("the width of camera _PARAM2_ of layer _PARAM1_"),
|
||||
_("Layers and cameras"),
|
||||
"res/conditions/camera24.png",
|
||||
"res/conditions/camera.png")
|
||||
@@ -111,17 +98,14 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsCameraExtension(
|
||||
.AddParameter("layer", _("Layer"))
|
||||
.SetDefaultValue("\"\"")
|
||||
.AddParameter("expression", _("Camera number"))
|
||||
.AddParameter("relationalOperator", _("Sign of the test"))
|
||||
.AddParameter("expression", _("Value to compare"))
|
||||
.MarkAsAdvanced()
|
||||
.SetManipulatedType("number");
|
||||
.UseStandardRelationalOperatorParameters("number")
|
||||
.MarkAsAdvanced();
|
||||
|
||||
extension
|
||||
.AddCondition("CameraHeight",
|
||||
_("Height of a camera"),
|
||||
_("Test the height of a camera of a layer"),
|
||||
_("The height of camera _PARAM2_ of layer _PARAM1_ is "
|
||||
"_PARAM3__PARAM4_"),
|
||||
_("the height of camera _PARAM2_ of layer _PARAM1_"),
|
||||
_("Layers and cameras"),
|
||||
"res/conditions/camera24.png",
|
||||
"res/conditions/camera.png")
|
||||
@@ -129,48 +113,40 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsCameraExtension(
|
||||
.AddParameter("layer", _("Layer (base layer if empty)"))
|
||||
.SetDefaultValue("\"\"")
|
||||
.AddParameter("expression", _("Camera number"))
|
||||
.AddParameter("relationalOperator", _("Sign of the test"))
|
||||
.AddParameter("expression", _("Value to compare"))
|
||||
.MarkAsAdvanced()
|
||||
.SetManipulatedType("number");
|
||||
.UseStandardRelationalOperatorParameters("number")
|
||||
.MarkAsAdvanced();
|
||||
|
||||
extension
|
||||
.AddCondition("CameraAngle",
|
||||
_("Angle of a camera of a layer"),
|
||||
_("Test a camera angle."),
|
||||
_("Angle of camera is _PARAM1__PARAM2_ (layer: _PARAM3_, "
|
||||
"camera: _PARAM4_)"),
|
||||
_("the angle of camera (layer: _PARAM3_, camera: _PARAM4_)"),
|
||||
_("Layers and cameras"),
|
||||
"res/conditions/camera24.png",
|
||||
"res/conditions/camera.png")
|
||||
.AddCodeOnlyParameter("currentScene", "")
|
||||
.AddParameter("relationalOperator", _("Sign of the test"))
|
||||
.AddParameter("expression", _("Value to compare"))
|
||||
.UseStandardRelationalOperatorParameters("number")
|
||||
.AddParameter("layer", _("Layer (base layer if empty)"), "", true)
|
||||
.SetDefaultValue("\"\"")
|
||||
.AddParameter("expression", _("Camera number (default : 0)"), "", true)
|
||||
.SetDefaultValue("0")
|
||||
.MarkAsAdvanced()
|
||||
.SetManipulatedType("number");
|
||||
.MarkAsAdvanced();
|
||||
|
||||
extension
|
||||
.AddAction("RotateCamera",
|
||||
_("Change camera angle"),
|
||||
_("This action modifies the angle of a camera in the "
|
||||
"specified layer."),
|
||||
_("Do _PARAM1__PARAM2_ to angle of camera (layer: _PARAM3_, "
|
||||
"camera: _PARAM4_)"),
|
||||
_("the angle of camera (layer: _PARAM3_, camera: _PARAM4_)"),
|
||||
_("Layers and cameras"),
|
||||
"res/actions/camera24.png",
|
||||
"res/actions/camera.png")
|
||||
.AddCodeOnlyParameter("currentScene", "")
|
||||
.AddParameter("operator", _("Modification's sign"))
|
||||
.AddParameter("expression", _("Value"))
|
||||
.UseStandardOperatorParameters("number")
|
||||
.AddParameter("layer", _("Layer (base layer if empty)"), "", true)
|
||||
.SetDefaultValue("\"\"")
|
||||
.AddParameter("expression", _("Camera number (default : 0)"), "", true)
|
||||
.SetDefaultValue("0")
|
||||
.SetManipulatedType("number");
|
||||
.SetDefaultValue("0");
|
||||
|
||||
extension
|
||||
.AddAction("AddCamera",
|
||||
@@ -380,8 +356,10 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsCameraExtension(
|
||||
extension
|
||||
.AddAction(
|
||||
"SetLayerEffectParameter",
|
||||
_("Effect parameter"),
|
||||
_("Change the parameter of an effect"),
|
||||
_("Effect parameter (number)"),
|
||||
_("Change the value of a parameter of an effect.") + "\n" +
|
||||
_("You can find the parameter names (and change the effect "
|
||||
"names) in the effects window."),
|
||||
_("Set _PARAM3_ to _PARAM4_ for effect _PARAM2_ of layer _PARAM1_"),
|
||||
_("Layers and cameras/Effects"),
|
||||
"res/conditions/camera24.png",
|
||||
@@ -395,11 +373,13 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsCameraExtension(
|
||||
.MarkAsAdvanced();
|
||||
|
||||
extension
|
||||
.AddCondition(
|
||||
"LayerEffectEnabled",
|
||||
_("Layer effect is enabled"),
|
||||
_("The effect on a layer is enabled"),
|
||||
_("Effect _PARAM2_ on layer _PARAM1_ is enabled"),
|
||||
.AddAction(
|
||||
"SetLayerEffectStringParameter",
|
||||
_("Effect parameter (string)"),
|
||||
_("Change the value (string) of a parameter of an effect.") + "\n" +
|
||||
_("You can find the parameter names (and change the effect "
|
||||
"names) in the effects window."),
|
||||
_("Set _PARAM3_ to _PARAM4_ for effect _PARAM2_ of layer _PARAM1_"),
|
||||
_("Layers and cameras/Effects"),
|
||||
"res/conditions/camera24.png",
|
||||
"res/conditions/camera.png")
|
||||
@@ -407,14 +387,18 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsCameraExtension(
|
||||
.AddParameter("layer", _("Layer (base layer if empty)"), "", true)
|
||||
.SetDefaultValue("\"\"")
|
||||
.AddParameter("string", _("Effect"))
|
||||
.AddParameter("string", _("Parameter name"))
|
||||
.AddParameter("string", _("New value"))
|
||||
.MarkAsAdvanced();
|
||||
|
||||
extension
|
||||
.AddAction(
|
||||
"EnableLayerEffect",
|
||||
_("Enable layer effect"),
|
||||
_("Enable an effect on a layer"),
|
||||
_("Enable effect _PARAM2_ on layer _PARAM1_: _PARAM3_"),
|
||||
"SetLayerEffectBooleanParameter",
|
||||
_("Effect parameter (enable or disable)"),
|
||||
_("Enable or disable a parameter of an effect.") + "\n" +
|
||||
_("You can find the parameter names (and change the effect "
|
||||
"names) in the effects window."),
|
||||
_("Enable _PARAM3_ for effect _PARAM2_ of layer _PARAM1_: _PARAM4_"),
|
||||
_("Layers and cameras/Effects"),
|
||||
"res/conditions/camera24.png",
|
||||
"res/conditions/camera.png")
|
||||
@@ -422,6 +406,36 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsCameraExtension(
|
||||
.AddParameter("layer", _("Layer (base layer if empty)"), "", true)
|
||||
.SetDefaultValue("\"\"")
|
||||
.AddParameter("string", _("Effect"))
|
||||
.AddParameter("string", _("Parameter name"))
|
||||
.AddParameter("yesorno", _("Enable this parameter"))
|
||||
.MarkAsAdvanced();
|
||||
|
||||
extension
|
||||
.AddCondition("LayerEffectEnabled",
|
||||
_("Layer effect is enabled"),
|
||||
_("The effect on a layer is enabled"),
|
||||
_("Effect _PARAM2_ on layer _PARAM1_ is enabled"),
|
||||
_("Layers and cameras/Effects"),
|
||||
"res/conditions/camera24.png",
|
||||
"res/conditions/camera.png")
|
||||
.AddCodeOnlyParameter("currentScene", "")
|
||||
.AddParameter("layer", _("Layer (base layer if empty)"), "", true)
|
||||
.SetDefaultValue("\"\"")
|
||||
.AddParameter("string", _("Effect"))
|
||||
.MarkAsAdvanced();
|
||||
|
||||
extension
|
||||
.AddAction("EnableLayerEffect",
|
||||
_("Enable layer effect"),
|
||||
_("Enable an effect on a layer"),
|
||||
_("Enable effect _PARAM2_ on layer _PARAM1_: _PARAM3_"),
|
||||
_("Layers and cameras/Effects"),
|
||||
"res/conditions/camera24.png",
|
||||
"res/conditions/camera.png")
|
||||
.AddCodeOnlyParameter("currentScene", "")
|
||||
.AddParameter("layer", _("Layer (base layer if empty)"), "", true)
|
||||
.SetDefaultValue("\"\"")
|
||||
.AddParameter("string", _("Effect"))
|
||||
.AddParameter("yesorno", _("Enable"), "", true)
|
||||
.MarkAsAdvanced();
|
||||
|
||||
@@ -430,17 +444,15 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsCameraExtension(
|
||||
"LayerTimeScale",
|
||||
_("Layer time scale"),
|
||||
_("Compare the time scale applied to the objects of the layer."),
|
||||
_("The time scale of layer _PARAM1_ is _PARAM2__PARAM3_"),
|
||||
_("the time scale of layer _PARAM1_"),
|
||||
_("Layers and cameras/Time"),
|
||||
"res/conditions/time24.png",
|
||||
"res/conditions/time.png")
|
||||
.AddCodeOnlyParameter("currentScene", "")
|
||||
.AddParameter("layer", _("Layer (base layer if empty)"), "", true)
|
||||
.SetDefaultValue("\"\"")
|
||||
.AddParameter("relationalOperator", _("Sign of the test"))
|
||||
.AddParameter("expression", _("Value to compare"))
|
||||
.MarkAsAdvanced()
|
||||
.SetManipulatedType("number");
|
||||
.UseStandardRelationalOperatorParameters("number")
|
||||
.MarkAsAdvanced();
|
||||
|
||||
extension
|
||||
.AddAction(
|
||||
|
@@ -98,7 +98,7 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsFileExtension(
|
||||
.AddAction(
|
||||
"LireFichierExp",
|
||||
_("Read a value"),
|
||||
_("Read the value saved in the specified element and store it in a "
|
||||
_("Read the value saved in the specified element and store it in a scene"
|
||||
"variable.\nSpecify the structure leading to the element using / "
|
||||
"(example : Root/Level/Current)\nSpaces are forbidden in element "
|
||||
"names."),
|
||||
@@ -115,7 +115,7 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsFileExtension(
|
||||
.AddAction(
|
||||
"LireFichierTxt",
|
||||
_("Read a text"),
|
||||
_("Read the text saved in the specified element and store it in a "
|
||||
_("Read the text saved in the specified element and store it in a scene "
|
||||
"variable.\nSpecify the structure leading to the element using / "
|
||||
"(example : Root/Level/Current)\nSpaces are forbidden in element "
|
||||
"names."),
|
||||
|
@@ -37,17 +37,14 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsJoystickExtension(
|
||||
.AddCondition("JoystickAxis",
|
||||
_("Value of an axis of a joystick"),
|
||||
_("Test the value of an axis of a joystick."),
|
||||
_("The value of the axis _PARAM2_ of joystick _PARAM1_ is "
|
||||
"_PARAM3__PARAM4_"),
|
||||
_("the value of the axis _PARAM2_ of joystick _PARAM1_"),
|
||||
_("Joystick"),
|
||||
"res/conditions/joystick24.png",
|
||||
"res/conditions/joystick.png")
|
||||
.AddCodeOnlyParameter("currentScene", "")
|
||||
.AddParameter("expression", _("Joystick number (first joystick: 0)"))
|
||||
.AddParameter("joyaxis", _("Axis"))
|
||||
.AddParameter("relationalOperator", _("Sign of the test"))
|
||||
.AddParameter("expression", _("Value to compare"))
|
||||
.SetManipulatedType("number");
|
||||
.UseStandardRelationalOperatorParameters("number");
|
||||
|
||||
extension
|
||||
.AddAction(
|
||||
|
@@ -21,6 +21,16 @@ BuiltinExtensionsImplementer::ImplementsMathematicalToolsExtension(
|
||||
|
||||
#if defined(GD_IDE_ONLY)
|
||||
|
||||
extension
|
||||
.AddExpression("clamp",
|
||||
_("Clamp (restrict a value to a given range)"),
|
||||
_("Restrict a value to a given range"),
|
||||
_("Mathematical tools"),
|
||||
"res/mathfunction.png")
|
||||
.AddParameter("expression", _("Value"))
|
||||
.AddParameter("expression", _("Min"))
|
||||
.AddParameter("expression", _("Max"));
|
||||
|
||||
extension
|
||||
.AddExpression("AngleDifference",
|
||||
_("Difference between two angles"),
|
||||
@@ -322,7 +332,7 @@ BuiltinExtensionsImplementer::ImplementsMathematicalToolsExtension(
|
||||
extension
|
||||
.AddExpression("trunc",
|
||||
_("Truncation"),
|
||||
_("Troncate a number"),
|
||||
_("Truncate a number"),
|
||||
_("Mathematical tools"),
|
||||
"res/mathfunction.png")
|
||||
.AddParameter("expression", _("Expression"));
|
||||
|
@@ -164,35 +164,31 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsMouseExtension(
|
||||
.AddCondition("SourisX",
|
||||
_("Cursor X position"),
|
||||
_("Compare the X position of the cursor or of a touch."),
|
||||
_("Cursor X position is _PARAM1__PARAM2_"),
|
||||
_("the cursor X position"),
|
||||
_("Mouse and touch"),
|
||||
"res/conditions/mouse24.png",
|
||||
"res/conditions/mouse.png")
|
||||
.AddCodeOnlyParameter("currentScene", "")
|
||||
.AddParameter("relationalOperator", _("Sign of the test"))
|
||||
.AddParameter("expression", _("X position"))
|
||||
.UseStandardRelationalOperatorParameters("number")
|
||||
.AddParameter("layer", _("Layer (base layer if empty)"), "", true)
|
||||
.SetDefaultValue("\"\"")
|
||||
.AddParameter("expression", _("Camera number (default : 0)"), "", true)
|
||||
.SetDefaultValue("0")
|
||||
.SetManipulatedType("number");
|
||||
.SetDefaultValue("0");
|
||||
|
||||
extension
|
||||
.AddCondition("SourisY",
|
||||
_("Cursor Y position"),
|
||||
_("Compare the Y position of the cursor or of a touch."),
|
||||
_("Cursor Y position is _PARAM1__PARAM2_"),
|
||||
_("the cursor Y position"),
|
||||
_("Mouse and touch"),
|
||||
"res/conditions/mouse24.png",
|
||||
"res/conditions/mouse.png")
|
||||
.AddCodeOnlyParameter("currentScene", "")
|
||||
.AddParameter("relationalOperator", _("Sign of the test"))
|
||||
.AddParameter("expression", _("Y position"))
|
||||
.UseStandardRelationalOperatorParameters("number")
|
||||
.AddParameter("layer", _("Layer (base layer if empty)"), "", true)
|
||||
.SetDefaultValue("\"\"")
|
||||
.AddParameter("expression", _("Camera number (default : 0)"), "", true)
|
||||
.SetDefaultValue("0")
|
||||
.SetManipulatedType("number");
|
||||
.SetDefaultValue("0");
|
||||
|
||||
extension
|
||||
.AddCondition("SourisBouton",
|
||||
@@ -224,37 +220,33 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsMouseExtension(
|
||||
.AddCondition("TouchX",
|
||||
_("Touch X position"),
|
||||
_("Compare the X position of a specific touch."),
|
||||
_("Touch #_PARAM1_ X position is _PARAM2__PARAM3_"),
|
||||
_("the touch #_PARAM1_ X position"),
|
||||
_("Mouse and touch/Multitouch"),
|
||||
"res/conditions/touch24.png",
|
||||
"res/conditions/touch.png")
|
||||
.AddCodeOnlyParameter("currentScene", "")
|
||||
.AddParameter("expression", _("Touch identifier"))
|
||||
.AddParameter("relationalOperator", _("Sign of the test"))
|
||||
.AddParameter("expression", _("X position"))
|
||||
.UseStandardRelationalOperatorParameters("number")
|
||||
.AddParameter("layer", _("Layer (base layer if empty)"), "", true)
|
||||
.SetDefaultValue("\"\"")
|
||||
.AddParameter("expression", _("Camera number (default : 0)"), "", true)
|
||||
.SetDefaultValue("0")
|
||||
.SetManipulatedType("number");
|
||||
.SetDefaultValue("0");
|
||||
|
||||
extension
|
||||
.AddCondition("TouchY",
|
||||
_("Touch Y position"),
|
||||
_("Compare the Y position of a specific touch."),
|
||||
_("Touch #_PARAM1_ Y position is _PARAM2__PARAM3_"),
|
||||
_("the touch #_PARAM1_ Y position"),
|
||||
_("Mouse and touch/Multitouch"),
|
||||
"res/conditions/touch24.png",
|
||||
"res/conditions/touch.png")
|
||||
.AddCodeOnlyParameter("currentScene", "")
|
||||
.AddParameter("expression", _("Touch identifier"))
|
||||
.AddParameter("relationalOperator", _("Sign of the test"))
|
||||
.AddParameter("expression", _("Y position"))
|
||||
.UseStandardRelationalOperatorParameters("number")
|
||||
.AddParameter("layer", _("Layer (base layer if empty)"), "", true)
|
||||
.SetDefaultValue("\"\"")
|
||||
.AddParameter("expression", _("Camera number (default : 0)"), "", true)
|
||||
.SetDefaultValue("0")
|
||||
.SetManipulatedType("number");
|
||||
.SetDefaultValue("0");
|
||||
|
||||
extension
|
||||
.AddCondition(
|
||||
|
@@ -26,29 +26,31 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsNetworkExtension(
|
||||
"SendRequest",
|
||||
_("Send a request to a web page"),
|
||||
_("Send a request to the specified web page.\n\nPlease note that for "
|
||||
"the web platform games, the game must be hosted on the same host "
|
||||
"the web games, the game must be hosted on the same host "
|
||||
"as specified below, except if the server is configured to answer "
|
||||
"to all requests (cross-domain requests)."),
|
||||
_("Send _PARAM3_ request to _PARAM0__PARAM1_ with body: _PARAM2_"),
|
||||
_("Network"),
|
||||
"res/actions/net24.png",
|
||||
"res/actions/net.png")
|
||||
.AddParameter("string", _("Host (example: http://www.some-server.org/)"))
|
||||
.AddParameter("string", _("Path to page (Example: /page.php)"))
|
||||
.AddParameter("string", _("Host, with protocol"))
|
||||
.SetParameterLongDescription(
|
||||
_("Example: \"http://example.com/\"."))
|
||||
.AddParameter("string", _("Path"))
|
||||
.SetParameterLongDescription(_("Example: \"/user/123\" or \"/some-page.php\"."))
|
||||
.AddParameter("string", _("Request body content"))
|
||||
.AddParameter(
|
||||
"string",
|
||||
_("Method: \"POST\" or \"GET\" (if empty, GET will be used)"),
|
||||
"",
|
||||
true)
|
||||
.AddParameter("string", _("Method: \"POST\" or \"GET\""), "", true)
|
||||
.SetParameterLongDescription(_("If empty, \"GET\" will be used."))
|
||||
.SetDefaultValue("\"GET\"")
|
||||
.AddParameter(
|
||||
"string",
|
||||
_("Content type (application/x-www-form-urlencoded by default)"),
|
||||
"",
|
||||
true)
|
||||
.AddParameter(
|
||||
"scenevar", _("Store the response in this variable"), "", true)
|
||||
.AddParameter("string", _("Content type"), "", true)
|
||||
.SetParameterLongDescription(
|
||||
_("If empty, \"application/x-www-form-urlencoded\" will be used."))
|
||||
.AddParameter("scenevar", _("Reponse scene variable"), "", true)
|
||||
.SetParameterLongDescription(
|
||||
_("The response of the server will be stored, as a string, in this "
|
||||
"variable. If the server returns *JSON*, you may want to use the "
|
||||
"action \"Convert JSON to a scene variable\" afterwards, to "
|
||||
"explore the results with a *structure variable*."))
|
||||
.MarkAsComplex();
|
||||
|
||||
extension
|
||||
@@ -68,8 +70,8 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsNetworkExtension(
|
||||
extension
|
||||
.AddAction(
|
||||
"JSONToVariableStructure",
|
||||
_("Convert JSON to a variable"),
|
||||
_("Parse a JSON object and store it into a variable"),
|
||||
_("Convert JSON to a scene variable"),
|
||||
_("Parse a JSON object and store it into a scene variable"),
|
||||
_("Parse JSON string _PARAM0_ and store it into variable _PARAM1_"),
|
||||
_("Network"),
|
||||
"res/actions/net24.png",
|
||||
@@ -109,11 +111,11 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsNetworkExtension(
|
||||
|
||||
extension
|
||||
.AddStrExpression("ToJSON",
|
||||
_("Convert variable to JSON"),
|
||||
_("Convert a variable to JSON"),
|
||||
_("Convert scene variable to JSON"),
|
||||
_("Convert a scene variable to JSON"),
|
||||
_("Conversion"),
|
||||
"res/conditions/toujours24.png")
|
||||
.AddParameter("scenevar", _("The variable to be stringified"));
|
||||
.AddParameter("scenevar", _("Scene variable to be stringified"));
|
||||
|
||||
extension
|
||||
.AddStrExpression("GlobalVarToJSON",
|
||||
|
@@ -91,6 +91,18 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsSceneExtension(
|
||||
.AddCodeOnlyParameter("currentScene", "")
|
||||
.MarkAsSimple();
|
||||
|
||||
extension
|
||||
.AddCondition("SceneJustResumed",
|
||||
_("Scene just resumed"),
|
||||
_("The scene has just resumed after being paused."),
|
||||
_("Scene just resumed"),
|
||||
_("Scene"),
|
||||
"res/conditions/depart24.png",
|
||||
"res/conditions/depart.png")
|
||||
.SetHelpPath("/interface/scene-editor/events")
|
||||
.AddCodeOnlyParameter("currentScene", "")
|
||||
.MarkAsSimple();
|
||||
|
||||
extension
|
||||
.AddAction("Scene",
|
||||
_("Change the scene"),
|
||||
|
@@ -31,35 +31,30 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsSpriteExtension(
|
||||
|
||||
#if defined(GD_IDE_ONLY)
|
||||
obj.AddAction("Opacity",
|
||||
_("Change Sprite opacity"),
|
||||
_("Change sprite opacity"),
|
||||
_("Change the opacity of a Sprite. 0 is fully transparent, 255 "
|
||||
"is opaque (default)."),
|
||||
_("Do _PARAM1__PARAM2_ to the opacity of _PARAM0_"),
|
||||
_("the opacity"),
|
||||
_("Visibility"),
|
||||
"res/actions/opacity24.png",
|
||||
"res/actions/opacity.png")
|
||||
|
||||
.AddParameter("object", _("Object"), "Sprite")
|
||||
.AddParameter("operator", _("Modification's sign"))
|
||||
.AddParameter("expression", _("Value (between 0 and 255)"))
|
||||
.MarkAsSimple()
|
||||
.SetManipulatedType("number");
|
||||
.UseStandardOperatorParameters("number")
|
||||
.MarkAsSimple();
|
||||
|
||||
obj.AddAction("ChangeAnimation",
|
||||
_("Change the animation"),
|
||||
_("Change the animation of the object, using the animation "
|
||||
"number in the animations list."),
|
||||
_("Do _PARAM1__PARAM2_ to the number of current animation of "
|
||||
"_PARAM0_"),
|
||||
_("the number of the animation"),
|
||||
_("Animations and images"),
|
||||
"res/actions/animation24.png",
|
||||
"res/actions/animation.png")
|
||||
|
||||
.AddParameter("object", _("Object"), "Sprite")
|
||||
.AddParameter("operator", _("Modification's sign"))
|
||||
.AddParameter("expression", _("Value"))
|
||||
.MarkAsSimple()
|
||||
.SetManipulatedType("number");
|
||||
.UseStandardOperatorParameters("number")
|
||||
.MarkAsSimple();
|
||||
|
||||
obj.AddAction("SetAnimationName",
|
||||
_("Change the animation (by name)"),
|
||||
@@ -80,35 +75,31 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsSpriteExtension(
|
||||
_("Change the direction of the object.\nIf the object is set to "
|
||||
"automatically rotate, the direction is its angle.\nIf the object "
|
||||
"is in 8 directions mode, the valid directions are 0..7"),
|
||||
_("Do _PARAM1__PARAM2_ to the direction of _PARAM0_"),
|
||||
_("the direction"),
|
||||
_("Direction"),
|
||||
"res/actions/direction24.png",
|
||||
"res/actions/direction.png")
|
||||
|
||||
.AddParameter("object", _("Object"), "Sprite")
|
||||
.AddParameter("operator", _("Modification's sign"))
|
||||
.AddParameter("expression", _("Value"))
|
||||
.MarkAsAdvanced()
|
||||
.SetManipulatedType("number");
|
||||
.UseStandardOperatorParameters("number")
|
||||
.MarkAsAdvanced();
|
||||
|
||||
obj.AddAction("ChangeSprite",
|
||||
_("Current frame"),
|
||||
_("Modify the current frame of the object"),
|
||||
_("Do _PARAM1__PARAM2_ to animation frame of _PARAM0_"),
|
||||
_("the animation frame"),
|
||||
_("Animations and images"),
|
||||
"res/actions/sprite24.png",
|
||||
"res/actions/sprite.png")
|
||||
|
||||
.AddParameter("object", _("Object"), "Sprite")
|
||||
.AddParameter("operator", _("Modification's sign"))
|
||||
.AddParameter("expression", _("Value"))
|
||||
.MarkAsAdvanced()
|
||||
.SetManipulatedType("number");
|
||||
.UseStandardOperatorParameters("number")
|
||||
.MarkAsAdvanced();
|
||||
|
||||
obj.AddAction("PauseAnimation",
|
||||
_("Pause the animation"),
|
||||
_("Pause the current animation of the object"),
|
||||
_("Pause the current animation of _PARAM0_"),
|
||||
_("Pause the animation of the object"),
|
||||
_("Pause the animation of _PARAM0_"),
|
||||
_("Animations and images"),
|
||||
"res/actions/animation24.png",
|
||||
"res/actions/animation.png")
|
||||
@@ -118,8 +109,8 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsSpriteExtension(
|
||||
|
||||
obj.AddAction("PlayAnimation",
|
||||
_("Play the animation"),
|
||||
_("Play the current animation of the object"),
|
||||
_("Play the current animation of _PARAM0_"),
|
||||
_("Play the animation of the object"),
|
||||
_("Play the animation of _PARAM0_"),
|
||||
_("Animations and images"),
|
||||
"res/actions/animation24.png",
|
||||
"res/actions/animation.png")
|
||||
@@ -132,16 +123,14 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsSpriteExtension(
|
||||
_("Animation speed scale"),
|
||||
_("Modify the animation speed scale (1 = the default speed, >1 = "
|
||||
"faster and <1 = slower)."),
|
||||
_("Do _PARAM1__PARAM2_ to the animation speed scale of _PARAM0_"),
|
||||
_("the animation speed scale"),
|
||||
_("Animations and images"),
|
||||
"res/actions/animation24.png",
|
||||
"res/actions/animation.png")
|
||||
|
||||
.AddParameter("object", _("Object"), "Sprite")
|
||||
.AddParameter("operator", _("Modification's sign"))
|
||||
.AddParameter("expression", _("Value"))
|
||||
.MarkAsSimple()
|
||||
.SetManipulatedType("number");
|
||||
.UseStandardOperatorParameters("number")
|
||||
.MarkAsSimple();
|
||||
|
||||
obj.AddAction("TourneVersPos",
|
||||
_("Rotate an object toward a position"),
|
||||
@@ -162,91 +151,79 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsSpriteExtension(
|
||||
obj.AddAction("ChangeScale",
|
||||
_("Scale"),
|
||||
_("Modify the scale of the specified object."),
|
||||
_("Do _PARAM1__PARAM2_ to the scale of _PARAM0_"),
|
||||
_("the scale"),
|
||||
_("Size"),
|
||||
"res/actions/scale24.png",
|
||||
"res/actions/scale.png")
|
||||
|
||||
.AddParameter("object", _("Object"), "Sprite")
|
||||
.AddParameter("operator", _("Modification's sign"))
|
||||
.AddParameter("expression", _("Value"))
|
||||
.UseStandardOperatorParameters("number")
|
||||
.MarkAsAdvanced();
|
||||
|
||||
obj.AddAction("ChangeScaleWidth",
|
||||
_("Scale on X axis"),
|
||||
_("Modify the scale of the width of an object."),
|
||||
_("Do _PARAM1__PARAM2_ to the width's scale of _PARAM0_"),
|
||||
_("the width's scale"),
|
||||
_("Size"),
|
||||
"res/actions/scale24.png",
|
||||
"res/actions/scale.png")
|
||||
|
||||
.AddParameter("object", _("Object"), "Sprite")
|
||||
.AddParameter("operator", _("Modification's sign"))
|
||||
.AddParameter("expression", _("Value"))
|
||||
.MarkAsAdvanced()
|
||||
.SetManipulatedType("number");
|
||||
.UseStandardOperatorParameters("number")
|
||||
.MarkAsAdvanced();
|
||||
|
||||
obj.AddAction("ChangeScaleHeight",
|
||||
_("Scale on Y axis"),
|
||||
_("Modify the scale of the height of an object."),
|
||||
_("Do _PARAM1__PARAM2_ to the height's scale of _PARAM0_"),
|
||||
_("the height's scale"),
|
||||
_("Size"),
|
||||
"res/actions/scale24.png",
|
||||
"res/actions/scale.png")
|
||||
|
||||
.AddParameter("object", _("Object"), "Sprite")
|
||||
.AddParameter("operator", _("Modification's sign"))
|
||||
.AddParameter("expression", _("Value"))
|
||||
.MarkAsAdvanced()
|
||||
.SetManipulatedType("number");
|
||||
.UseStandardOperatorParameters("number")
|
||||
.MarkAsAdvanced();
|
||||
|
||||
obj.AddAction("ChangeWidth",
|
||||
_("Width"),
|
||||
_("Change the width of a Sprite object."),
|
||||
_("Do _PARAM1__PARAM2_ to the width of _PARAM0_"),
|
||||
_("the width"),
|
||||
_("Size"),
|
||||
"res/actions/scale24.png",
|
||||
"res/actions/scale.png")
|
||||
|
||||
.AddParameter("object", _("Object"), "Sprite")
|
||||
.AddParameter("operator", _("Modification's sign"))
|
||||
.AddParameter("expression", _("Value"))
|
||||
.MarkAsAdvanced()
|
||||
.SetManipulatedType("number");
|
||||
.UseStandardOperatorParameters("number")
|
||||
.MarkAsAdvanced();
|
||||
|
||||
obj.AddAction("ChangeHeight",
|
||||
_("Height"),
|
||||
_("Change the height of a Sprite object."),
|
||||
_("Do _PARAM1__PARAM2_ to the height of _PARAM0_"),
|
||||
_("the height"),
|
||||
_("Size"),
|
||||
"res/actions/scale24.png",
|
||||
"res/actions/scale.png")
|
||||
|
||||
.AddParameter("object", _("Object"), "Sprite")
|
||||
.AddParameter("operator", _("Modification's sign"))
|
||||
.AddParameter("expression", _("Value"))
|
||||
.MarkAsAdvanced()
|
||||
.SetManipulatedType("number");
|
||||
.UseStandardOperatorParameters("number")
|
||||
.MarkAsAdvanced();
|
||||
|
||||
obj.AddCondition(
|
||||
"Animation",
|
||||
_("Current animation"),
|
||||
_("Compare the number of the current animation of the object."),
|
||||
_("The number of the current animation of _PARAM0_ is "
|
||||
"_PARAM1__PARAM2_"),
|
||||
_("Compare the number of the animation played by the object."),
|
||||
_("the number of the animation"),
|
||||
_("Animations and images"),
|
||||
"res/conditions/animation24.png",
|
||||
"res/conditions/animation.png")
|
||||
|
||||
.AddParameter("object", _("Object"), "Sprite")
|
||||
.AddParameter("relationalOperator", _("Sign of the test"))
|
||||
.AddParameter("expression", _("Number to test"))
|
||||
.MarkAsAdvanced()
|
||||
.SetManipulatedType("number");
|
||||
.UseStandardRelationalOperatorParameters("number")
|
||||
.MarkAsAdvanced();
|
||||
|
||||
obj.AddCondition("AnimationName",
|
||||
_("Current animation name"),
|
||||
_("Check the current animation of the object."),
|
||||
_("Check the animation by played by the object."),
|
||||
_("The animation of _PARAM0_ is _PARAM1_"),
|
||||
_("Animations and images"),
|
||||
"res/conditions/animation24.png",
|
||||
@@ -262,33 +239,29 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsSpriteExtension(
|
||||
_("Compare the direction of the object. If 8 direction mode is "
|
||||
"activated for the sprite, the value taken for direction will be "
|
||||
"from 0 to 7. Otherwise, the direction is in degrees."),
|
||||
_("Direction of _PARAM0_ is _PARAM1__PARAM2_"),
|
||||
_("the direction"),
|
||||
_("Direction"),
|
||||
"res/conditions/direction24.png",
|
||||
"res/conditions/direction.png")
|
||||
|
||||
.AddParameter("object", _("Object"), "Sprite")
|
||||
.AddParameter("relationalOperator", _("Sign of the test"))
|
||||
.AddParameter("expression", _("Direction to test"))
|
||||
.SetManipulatedType("number");
|
||||
.UseStandardRelationalOperatorParameters("number");
|
||||
|
||||
obj.AddCondition("Sprite",
|
||||
_("Current frame"),
|
||||
_("Test the number of the current animation frame."),
|
||||
_("The animation frame of _PARAM0_ is _PARAM1__PARAM2_"),
|
||||
_("Compare the index of the current frame in the animation displayed by the specified object. The first frame in an animation starts at index 0."),
|
||||
_("the animation frame"),
|
||||
_("Animations and images"),
|
||||
"res/conditions/sprite24.png",
|
||||
"res/conditions/sprite.png")
|
||||
|
||||
.AddParameter("object", _("Object"), "Sprite")
|
||||
.AddParameter("relationalOperator", _("Sign of the test"))
|
||||
.AddParameter("expression", _("Animation frame to test"))
|
||||
.MarkAsAdvanced()
|
||||
.SetManipulatedType("number");
|
||||
.UseStandardRelationalOperatorParameters("number")
|
||||
.MarkAsAdvanced();
|
||||
|
||||
obj.AddCondition("AnimStopped",
|
||||
_("Animation paused"),
|
||||
_("Test if the animation of an object is paused"),
|
||||
_("Check if the animation of an object is paused."),
|
||||
_("The animation of _PARAM0_ is paused"),
|
||||
_("Animations and images"),
|
||||
"res/conditions/animation24.png",
|
||||
@@ -312,62 +285,52 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsSpriteExtension(
|
||||
obj.AddCondition("ScaleWidth",
|
||||
_("Scale on X axis"),
|
||||
_("Compare the scale of the width of an object."),
|
||||
_("The width's scale of _PARAM0_ is _PARAM1__PARAM2_"),
|
||||
_("the width's scale"),
|
||||
_("Size"),
|
||||
"res/conditions/scaleWidth24.png",
|
||||
"res/conditions/scaleWidth.png")
|
||||
|
||||
.AddParameter("object", _("Object"), "Sprite")
|
||||
.AddParameter("relationalOperator", _("Sign of the test"))
|
||||
.AddParameter("expression", _("Value to compare"))
|
||||
.MarkAsAdvanced()
|
||||
.SetManipulatedType("number");
|
||||
.UseStandardRelationalOperatorParameters("number")
|
||||
.MarkAsAdvanced();
|
||||
|
||||
obj.AddCondition("ScaleHeight",
|
||||
_("Scale on Y axis"),
|
||||
_("Compare the scale of the height of an object."),
|
||||
_("The height's scale of _PARAM0_ is _PARAM1__PARAM2_"),
|
||||
_("the height's scale"),
|
||||
_("Size"),
|
||||
"res/conditions/scaleHeight24.png",
|
||||
"res/conditions/scaleHeight.png")
|
||||
|
||||
.AddParameter("object", _("Object"), "Sprite")
|
||||
.AddParameter("relationalOperator", _("Sign of the test"))
|
||||
.AddParameter("expression", _("Value to compare"))
|
||||
.MarkAsAdvanced()
|
||||
.SetManipulatedType("number");
|
||||
.UseStandardRelationalOperatorParameters("number")
|
||||
.MarkAsAdvanced();
|
||||
|
||||
obj.AddCondition("Opacity",
|
||||
_("Opacity"),
|
||||
_("Compare the opacity of a Sprite, between 0 (fully "
|
||||
"transparent) to 255 (opaque)."),
|
||||
_("The opacity of _PARAM0_ is _PARAM1__PARAM2_"),
|
||||
_("the opacity"),
|
||||
_("Visibility"),
|
||||
"res/conditions/opacity24.png",
|
||||
"res/conditions/opacity.png")
|
||||
|
||||
.AddParameter("object", _("Object"), "Sprite")
|
||||
.AddParameter("relationalOperator", _("Sign of the test"))
|
||||
.AddParameter("expression", _("Value to compare"))
|
||||
.MarkAsSimple()
|
||||
.SetManipulatedType("number");
|
||||
.UseStandardRelationalOperatorParameters("number")
|
||||
.MarkAsSimple();
|
||||
|
||||
obj.AddCondition(
|
||||
"BlendMode",
|
||||
_("Blend mode"),
|
||||
_("Compare the number of the blend mode currently used by an object"),
|
||||
_("The number of the current blend mode of _PARAM0_ is "
|
||||
"_PARAM1__PARAM2_"),
|
||||
_("the number of the current blend mode"),
|
||||
_("Effects"),
|
||||
"res/conditions/opacity24.png",
|
||||
"res/conditions/opacity.png")
|
||||
|
||||
.AddParameter("object", _("Object"), "Sprite")
|
||||
.AddParameter("relationalOperator", _("Sign of the test"))
|
||||
.AddParameter("expression",
|
||||
_("Value to compare (0: Alpha, 1: Add, 2: Multiply, 3: None)"))
|
||||
.MarkAsAdvanced()
|
||||
.SetManipulatedType("number");
|
||||
.UseStandardRelationalOperatorParameters("number")
|
||||
.MarkAsAdvanced();
|
||||
|
||||
obj.AddAction("CopyImageOnImageOfSprite",
|
||||
_("Copy an image on the current one of an object"),
|
||||
|
@@ -38,15 +38,13 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsTimeExtension(
|
||||
.AddCondition("TimeScale",
|
||||
_("Time scale"),
|
||||
_("Test the time scale."),
|
||||
_("The time scale is _PARAM1__PARAM2_"),
|
||||
_("the time scale"),
|
||||
_("Timers and time"),
|
||||
"res/conditions/time24.png",
|
||||
"res/conditions/time.png")
|
||||
.AddCodeOnlyParameter("currentScene", "")
|
||||
.AddParameter("relationalOperator", _("Sign of the test"))
|
||||
.AddParameter("expression", _("Value to compare"))
|
||||
.MarkAsAdvanced()
|
||||
.SetManipulatedType("number");
|
||||
.UseStandardRelationalOperatorParameters("number")
|
||||
.MarkAsAdvanced();
|
||||
|
||||
extension
|
||||
.AddCondition("TimerPaused",
|
||||
|
@@ -25,27 +25,23 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsVariablesExtension(
|
||||
.AddCondition("VarScene",
|
||||
_("Value of a scene variable"),
|
||||
_("Compare the value of a scene variable."),
|
||||
_("Scene variable _PARAM0_ is _PARAM1__PARAM2_"),
|
||||
_("the scene variable _PARAM0_"),
|
||||
_("Variables"),
|
||||
"res/conditions/var24.png",
|
||||
"res/conditions/var.png")
|
||||
.AddParameter("scenevar", _("Variable"))
|
||||
.AddParameter("relationalOperator", _("Sign of the test"))
|
||||
.AddParameter("expression", _("Value to compare"))
|
||||
.SetManipulatedType("number");
|
||||
.UseStandardRelationalOperatorParameters("number");
|
||||
|
||||
extension
|
||||
.AddCondition("VarSceneTxt",
|
||||
_("Text of a scene variable"),
|
||||
_("Compare the text of a scene variable."),
|
||||
_("The text of scene variable _PARAM0_ is _PARAM1__PARAM2_"),
|
||||
_("the text of scene variable _PARAM0_"),
|
||||
_("Variables"),
|
||||
"res/conditions/var24.png",
|
||||
"res/conditions/var.png")
|
||||
.AddParameter("scenevar", _("Variable"))
|
||||
.AddParameter("relationalOperator", _("Sign of the test"))
|
||||
.AddParameter("string", _("Text to compare"))
|
||||
.SetManipulatedType("string");
|
||||
.UseStandardRelationalOperatorParameters("string");
|
||||
|
||||
extension
|
||||
.AddCondition(
|
||||
@@ -89,30 +85,26 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsVariablesExtension(
|
||||
.AddCondition("VarGlobal",
|
||||
_("Value of a global variable"),
|
||||
_("Compare the value of a global variable."),
|
||||
_("Global variable _PARAM0_ is _PARAM1__PARAM2_"),
|
||||
_("the global variable _PARAM0_"),
|
||||
_("Variables/Global variables"),
|
||||
"res/conditions/var24.png",
|
||||
"res/conditions/var.png")
|
||||
.AddParameter("globalvar", _("Variable"))
|
||||
.AddParameter("relationalOperator", _("Sign of the test"))
|
||||
.AddParameter("expression", _("Value to compare"))
|
||||
.MarkAsAdvanced()
|
||||
.SetManipulatedType("number");
|
||||
.UseStandardRelationalOperatorParameters("number")
|
||||
.MarkAsAdvanced();
|
||||
|
||||
extension
|
||||
.AddCondition(
|
||||
"VarGlobalTxt",
|
||||
_("Text of a global variable"),
|
||||
_("Compare the text of a global variable."),
|
||||
_("The text of the global variable _PARAM0_ is _PARAM1__PARAM2_"),
|
||||
_("the text of the global variable _PARAM0_"),
|
||||
_("Variables/Global variables"),
|
||||
"res/conditions/var24.png",
|
||||
"res/conditions/var.png")
|
||||
.AddParameter("globalvar", _("Variable"))
|
||||
.AddParameter("relationalOperator", _("Sign of the test"))
|
||||
.AddParameter("string", _("Text to compare"))
|
||||
.MarkAsAdvanced()
|
||||
.SetManipulatedType("string");
|
||||
.UseStandardRelationalOperatorParameters("string")
|
||||
.MarkAsAdvanced();
|
||||
|
||||
extension
|
||||
.AddCondition("VarGlobalDef",
|
||||
@@ -131,56 +123,48 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsVariablesExtension(
|
||||
.AddAction("ModVarScene",
|
||||
_("Value of a scene variable"),
|
||||
_("Modify the value of a scene variable."),
|
||||
_("Do _PARAM1__PARAM2_ to scene variable _PARAM0_"),
|
||||
_("the scene variable _PARAM0_"),
|
||||
_("Variables"),
|
||||
"res/actions/var24.png",
|
||||
"res/actions/var.png")
|
||||
.AddParameter("scenevar", _("Variable"))
|
||||
.AddParameter("operator", _("Modification's sign"))
|
||||
.AddParameter("expression", _("Value"))
|
||||
.SetManipulatedType("number");
|
||||
.UseStandardOperatorParameters("number");
|
||||
|
||||
extension
|
||||
.AddAction("ModVarSceneTxt",
|
||||
_("String of a scene variable"),
|
||||
_("Modify the text of a scene variable."),
|
||||
_("Do _PARAM1__PARAM2_ to the text of scene variable _PARAM0_"),
|
||||
_("the text of scene variable _PARAM0_"),
|
||||
_("Variables"),
|
||||
"res/actions/var24.png",
|
||||
"res/actions/var.png")
|
||||
.AddParameter("scenevar", _("Variable"))
|
||||
.AddParameter("operator", _("Modification's sign"))
|
||||
.AddParameter("string", _("Text"))
|
||||
.SetManipulatedType("string");
|
||||
.UseStandardOperatorParameters("string");
|
||||
|
||||
extension
|
||||
.AddAction("ModVarGlobal",
|
||||
_("Value of a global variable"),
|
||||
_("Modify the value of a global variable"),
|
||||
_("Do _PARAM1__PARAM2_ to global variable _PARAM0_"),
|
||||
_("the global variable _PARAM0_"),
|
||||
_("Variables/Global variables"),
|
||||
"res/actions/var24.png",
|
||||
"res/actions/var.png")
|
||||
.AddParameter("globalvar", _("Variable"))
|
||||
.AddParameter("operator", _("Modification's sign"))
|
||||
.AddParameter("expression", _("Value"))
|
||||
.MarkAsAdvanced()
|
||||
.SetManipulatedType("number");
|
||||
.UseStandardOperatorParameters("number")
|
||||
.MarkAsAdvanced();
|
||||
|
||||
extension
|
||||
.AddAction(
|
||||
"ModVarGlobalTxt",
|
||||
_("String of a global variable"),
|
||||
_("Modify the text of a global variable."),
|
||||
_("Do _PARAM1__PARAM2_ to the text of global variable _PARAM0_"),
|
||||
_("the text of global variable _PARAM0_"),
|
||||
_("Variables/Global variables"),
|
||||
"res/actions/var24.png",
|
||||
"res/actions/var.png")
|
||||
.AddParameter("globalvar", _("Variable"))
|
||||
.AddParameter("operator", _("Modification's sign"))
|
||||
.AddParameter("string", _("Text"))
|
||||
.MarkAsAdvanced()
|
||||
.SetManipulatedType("string");
|
||||
.UseStandardOperatorParameters("string")
|
||||
.MarkAsAdvanced();
|
||||
|
||||
extension
|
||||
.AddAction("VariableRemoveChild",
|
||||
|
@@ -27,7 +27,7 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsWindowExtension(
|
||||
_("De/activate fullscreen"),
|
||||
_("This action activates or deactivates fullscreen."),
|
||||
_("Activate fullscreen: _PARAM1_ (keep aspect ratio: _PARAM2_)"),
|
||||
_("Game's window"),
|
||||
_("Game's window and resolution"),
|
||||
"res/actions/fullscreen24.png",
|
||||
"res/actions/fullscreen.png")
|
||||
.AddCodeOnlyParameter("currentScene", "")
|
||||
@@ -41,11 +41,11 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsWindowExtension(
|
||||
extension
|
||||
.AddAction("SetWindowMargins",
|
||||
_("Change the window's margins"),
|
||||
_("This action changes the margins, in pixels, of the game's "
|
||||
"window."),
|
||||
_("This action changes the margins, in pixels, between the "
|
||||
"game frame and the window borders."),
|
||||
_("Set margins of game window to "
|
||||
"_PARAM1_;_PARAM2_;_PARAM3_;_PARAM4_"),
|
||||
_("Game's window"),
|
||||
_("Game's window and resolution"),
|
||||
"res/actions/window24.png",
|
||||
"res/actions/window.png")
|
||||
.AddCodeOnlyParameter("currentScene", "")
|
||||
@@ -55,28 +55,81 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsWindowExtension(
|
||||
.AddParameter("expression", _("Left"));
|
||||
|
||||
extension
|
||||
.AddAction("SetWindowSize",
|
||||
_("Change the size of the window"),
|
||||
_("This action changes the size of the game's window."),
|
||||
_("Change window size: _PARAM1_x_PARAM2_"),
|
||||
_("Game's window"),
|
||||
.AddAction("SetGameResolutionSize",
|
||||
_("Change the resolution of the game"),
|
||||
_("Changes the resolution of the game, effectively changing "
|
||||
"the game area size. This won't change the size of the "
|
||||
"window in which the game is running."),
|
||||
_("Set game resolution to _PARAM1_x_PARAM2_"),
|
||||
_("Game's window and resolution"),
|
||||
"res/actions/window24.png",
|
||||
"res/actions/window.png")
|
||||
.AddCodeOnlyParameter("currentScene", "")
|
||||
.AddParameter("expression", _("Width"))
|
||||
.AddParameter("expression", _("Height"));
|
||||
|
||||
extension
|
||||
.AddAction(
|
||||
"SetWindowSize",
|
||||
_("Change the size of the game window"),
|
||||
_("This action changes the size of the game window. Note that this "
|
||||
"will only work on platform supporting this operation: games "
|
||||
"running in browsers or on mobile phones can not update their "
|
||||
"window size. Game resolution can still be updated."),
|
||||
_("Set game window size to _PARAM1_x_PARAM2_ (also update game "
|
||||
"resolution: _PARAM3_)"),
|
||||
_("Game's window and resolution"),
|
||||
"res/actions/window24.png",
|
||||
"res/actions/window.png")
|
||||
.AddCodeOnlyParameter("currentScene", "")
|
||||
.AddParameter("expression", _("Width"))
|
||||
.AddParameter("expression", _("Height"))
|
||||
.AddParameter(
|
||||
"yesorno",
|
||||
_("Do you want to use this size as the default size for new scene "
|
||||
"cameras\?\n(Yes to change the size of the game's viewable "
|
||||
"area,\nNo to stretch the game to the window's size)."));
|
||||
.AddParameter("yesorno",
|
||||
_("Also update the game resolution? If not, the game will "
|
||||
"be stretched or reduced to fit in the window."));
|
||||
|
||||
extension
|
||||
.AddAction("SetGameResolutionResizeMode",
|
||||
_("Change the game resolution resize mode"),
|
||||
_("Set if the width or the height of the game resolution "
|
||||
"should be changed to fit the game window - or if the game "
|
||||
"resolution should not be updated automatically."),
|
||||
_("Set game resolution resize mode to _PARAM1_"),
|
||||
_("Game's window and resolution"),
|
||||
"res/actions/window24.png",
|
||||
"res/actions/window.png")
|
||||
.AddCodeOnlyParameter("currentScene", "")
|
||||
.AddParameter("stringWithSelector",
|
||||
_("Resize mode"),
|
||||
"[\"adaptWidth\", \"adaptHeight\", \"\"]",
|
||||
false)
|
||||
.SetParameterLongDescription(
|
||||
_("Empty to disable resizing. \"adaptWidth\" will update the game "
|
||||
"width to fit in the window or screen. \"adaptHeight\" will do the "
|
||||
"same but with the game height."));
|
||||
|
||||
extension
|
||||
.AddAction("SetAdaptGameResolutionAtRuntime",
|
||||
_("Automatically adapt the game resolution"),
|
||||
_("Set if the game resolution should be automatically adapted "
|
||||
"when the game window or screen size change. This will only "
|
||||
"be the case if the game resolution resize mode is "
|
||||
"configured to adapt the width or the height of the game."),
|
||||
_("Automatically adapt the game resolution: _PARAM1_"),
|
||||
_("Game's window and resolution"),
|
||||
"res/actions/window24.png",
|
||||
"res/actions/window.png")
|
||||
.AddCodeOnlyParameter("currentScene", "")
|
||||
.AddParameter("yesorno",
|
||||
_("Update resolution during the game to fit the screen or "
|
||||
"window size?"));
|
||||
|
||||
extension
|
||||
.AddAction("SetWindowIcon",
|
||||
_("Change the window's icon"),
|
||||
_("This action changes the icon of the game's window."),
|
||||
_("Use _PARAM1_ as the icon for the game's window."),
|
||||
_("Game's window"),
|
||||
_("Game's window and resolution"),
|
||||
"res/actions/window24.png",
|
||||
"res/actions/window.png")
|
||||
.AddCodeOnlyParameter("currentScene", "")
|
||||
@@ -87,7 +140,7 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsWindowExtension(
|
||||
_("Change the window's title"),
|
||||
_("This action changes the title of the game's window."),
|
||||
_("Change window title to _PARAM1_"),
|
||||
_("Game's window"),
|
||||
_("Game's window and resolution"),
|
||||
"res/actions/window24.png",
|
||||
"res/actions/window.png")
|
||||
.AddCodeOnlyParameter("currentScene", "")
|
||||
|
@@ -59,7 +59,8 @@ gd::InstructionMetadata& BehaviorMetadata::AddCondition(
|
||||
group,
|
||||
icon,
|
||||
smallicon)
|
||||
.SetHelpPath(GetHelpPath());
|
||||
.SetHelpPath(GetHelpPath())
|
||||
.SetIsBehaviorInstruction();
|
||||
return conditionsInfos[nameWithNamespace];
|
||||
#endif
|
||||
}
|
||||
@@ -83,7 +84,8 @@ gd::InstructionMetadata& BehaviorMetadata::AddAction(
|
||||
group,
|
||||
icon,
|
||||
smallicon)
|
||||
.SetHelpPath(GetHelpPath());
|
||||
.SetHelpPath(GetHelpPath())
|
||||
.SetIsBehaviorInstruction();
|
||||
return actionsInfos[nameWithNamespace];
|
||||
#endif
|
||||
}
|
||||
@@ -107,7 +109,8 @@ gd::InstructionMetadata& BehaviorMetadata::AddScopedCondition(
|
||||
group,
|
||||
icon,
|
||||
smallicon)
|
||||
.SetHelpPath(GetHelpPath());
|
||||
.SetHelpPath(GetHelpPath())
|
||||
.SetIsBehaviorInstruction();
|
||||
return conditionsInfos[nameWithNamespace];
|
||||
#endif
|
||||
}
|
||||
@@ -131,7 +134,8 @@ gd::InstructionMetadata& BehaviorMetadata::AddScopedAction(
|
||||
group,
|
||||
icon,
|
||||
smallicon)
|
||||
.SetHelpPath(GetHelpPath());
|
||||
.SetHelpPath(GetHelpPath())
|
||||
.SetIsBehaviorInstruction();
|
||||
return actionsInfos[nameWithNamespace];
|
||||
#endif
|
||||
}
|
||||
|
25
Core/GDCore/Extensions/Metadata/EffectMetadata.cpp
Normal file
25
Core/GDCore/Extensions/Metadata/EffectMetadata.cpp
Normal file
@@ -0,0 +1,25 @@
|
||||
/*
|
||||
* GDevelop Core
|
||||
* Copyright 2008-present Florian Rival (Florian.Rival@gmail.com). All rights
|
||||
* reserved. This project is released under the MIT License.
|
||||
*/
|
||||
#include "EffectMetadata.h"
|
||||
|
||||
namespace gd {
|
||||
|
||||
EffectMetadata::EffectMetadata(const gd::String& type_) : type(type_) {}
|
||||
|
||||
EffectMetadata& EffectMetadata::SetIncludeFile(const gd::String& includeFile) {
|
||||
includeFiles.clear();
|
||||
includeFiles.push_back(includeFile);
|
||||
return *this;
|
||||
}
|
||||
|
||||
EffectMetadata& EffectMetadata::AddIncludeFile(const gd::String& includeFile) {
|
||||
if (std::find(includeFiles.begin(), includeFiles.end(), includeFile) ==
|
||||
includeFiles.end())
|
||||
includeFiles.push_back(includeFile);
|
||||
return *this;
|
||||
}
|
||||
|
||||
} // namespace gd
|
121
Core/GDCore/Extensions/Metadata/EffectMetadata.h
Normal file
121
Core/GDCore/Extensions/Metadata/EffectMetadata.h
Normal file
@@ -0,0 +1,121 @@
|
||||
/*
|
||||
* GDevelop Core
|
||||
* Copyright 2008-present Florian Rival (Florian.Rival@gmail.com). All rights
|
||||
* reserved. This project is released under the MIT License.
|
||||
*/
|
||||
#ifndef EFFECTMETADATA_H
|
||||
#define EFFECTMETADATA_H
|
||||
#include <functional>
|
||||
#include <map>
|
||||
#include <memory>
|
||||
#include "GDCore/Project/PropertyDescriptor.h"
|
||||
#include "GDCore/String.h"
|
||||
|
||||
namespace gd {
|
||||
|
||||
/**
|
||||
* \brief Contains user-friendly information about an effect.
|
||||
*
|
||||
* \ingroup Events
|
||||
*/
|
||||
class GD_CORE_API EffectMetadata {
|
||||
public:
|
||||
/**
|
||||
* \brief Construct an effect metadata, with the given type
|
||||
*/
|
||||
EffectMetadata(const gd::String& type_);
|
||||
|
||||
/**
|
||||
* \brief Default constructor, only used for initializing `badEffectMetadata`.
|
||||
*/
|
||||
EffectMetadata() {}
|
||||
|
||||
virtual ~EffectMetadata(){};
|
||||
|
||||
/**
|
||||
* \brief Set the name shown to the user.
|
||||
*/
|
||||
EffectMetadata& SetFullName(const gd::String& fullname_) {
|
||||
fullname = fullname_;
|
||||
return *this;
|
||||
};
|
||||
|
||||
/**
|
||||
* \brief Set the description shown to the user.
|
||||
*/
|
||||
EffectMetadata& SetDescription(const gd::String& description_) {
|
||||
description = description_;
|
||||
return *this;
|
||||
};
|
||||
|
||||
/**
|
||||
* Set the help path of the effect, relative to the documentation root.
|
||||
*/
|
||||
EffectMetadata& SetHelpPath(const gd::String& path) {
|
||||
helpPath = path;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Clear any existing include file and add the specified include file.
|
||||
*/
|
||||
EffectMetadata& SetIncludeFile(const gd::String& includeFile);
|
||||
|
||||
/**
|
||||
* \brief Add a file to the already existing include files.
|
||||
*/
|
||||
EffectMetadata& AddIncludeFile(const gd::String& includeFile);
|
||||
|
||||
/**
|
||||
* \brief Return a reference to the properties of this effect.
|
||||
*/
|
||||
std::map<gd::String, gd::PropertyDescriptor>& GetProperties() {
|
||||
return properties;
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Return a (const) reference to the properties of this effect.
|
||||
*/
|
||||
const std::map<gd::String, gd::PropertyDescriptor>& GetProperties() const {
|
||||
return properties;
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Get the help path of the effect, relative to the documentation root.
|
||||
*/
|
||||
const gd::String& GetHelpPath() const { return helpPath; }
|
||||
|
||||
/**
|
||||
* \brief Get the type of the effect (its internal name, like "BlackAndWhite").
|
||||
*/
|
||||
const gd::String& GetType() const { return type; }
|
||||
|
||||
/**
|
||||
* \brief Get the user facing name of the effect (like "Black and White").
|
||||
*/
|
||||
const gd::String& GetFullName() const { return fullname; }
|
||||
|
||||
/**
|
||||
* \brief Get the user friendly description of the effect.
|
||||
*/
|
||||
const gd::String& GetDescription() const { return description; }
|
||||
|
||||
/**
|
||||
* \brief Get the required include files for this effect.
|
||||
*/
|
||||
const std::vector<gd::String>& GetIncludeFiles() const {
|
||||
return includeFiles;
|
||||
}
|
||||
|
||||
private:
|
||||
gd::String extensionNamespace;
|
||||
gd::String type;
|
||||
gd::String helpPath;
|
||||
gd::String fullname;
|
||||
gd::String description;
|
||||
std::vector<gd::String> includeFiles;
|
||||
std::map<gd::String, gd::PropertyDescriptor> properties;
|
||||
};
|
||||
|
||||
} // namespace gd
|
||||
#endif // EFFECTMETADATA_H
|
@@ -200,7 +200,17 @@ class GD_CORE_API ExpressionMetadata {
|
||||
* \see AddParameter
|
||||
*/
|
||||
ExpressionMetadata& SetDefaultValue(gd::String defaultValue_) {
|
||||
if (!parameters.empty()) parameters.back().defaultValue = defaultValue_;
|
||||
if (!parameters.empty()) parameters.back().SetDefaultValue(defaultValue_);
|
||||
return *this;
|
||||
};
|
||||
|
||||
/**
|
||||
* \brief Set the long description shown in the editor for the last added parameter.
|
||||
*
|
||||
* \see AddParameter
|
||||
*/
|
||||
ExpressionMetadata &SetParameterLongDescription(gd::String longDescription) {
|
||||
if (!parameters.empty()) parameters.back().SetLongDescription(longDescription);
|
||||
return *this;
|
||||
};
|
||||
|
||||
|
@@ -3,23 +3,24 @@
|
||||
* Copyright 2008-2016 Florian Rival (Florian.Rival@gmail.com). All rights
|
||||
* reserved. This project is released under the MIT License.
|
||||
*/
|
||||
#include "InstructionMetadata.h"
|
||||
#include <algorithm>
|
||||
#include "GDCore/CommonTools.h"
|
||||
#include "GDCore/Serialization/SerializerElement.h"
|
||||
#include "GDCore/Tools/Localization.h"
|
||||
#include "InstructionMetadata.h"
|
||||
|
||||
namespace gd {
|
||||
InstructionMetadata::InstructionMetadata()
|
||||
: sentence(
|
||||
"Unknown or unsupported instruction"), // Avoid translating this
|
||||
// string, so that it's safe
|
||||
// and *fast* to use a
|
||||
// InstructionMetadata.
|
||||
: sentence("Unknown or unsupported instruction"), // Avoid translating this
|
||||
// string, so that it's
|
||||
// safe and *fast* to use
|
||||
// a InstructionMetadata.
|
||||
canHaveSubInstructions(false),
|
||||
hidden(true),
|
||||
usageComplexity(5),
|
||||
isPrivate(false) {}
|
||||
isPrivate(false),
|
||||
isObjectInstruction(false),
|
||||
isBehaviorInstruction(false) {}
|
||||
|
||||
InstructionMetadata::InstructionMetadata(const gd::String& extensionNamespace_,
|
||||
const gd::String& name_,
|
||||
@@ -40,8 +41,9 @@ InstructionMetadata::InstructionMetadata(const gd::String& extensionNamespace_,
|
||||
extensionNamespace(extensionNamespace_),
|
||||
hidden(false),
|
||||
usageComplexity(5),
|
||||
isPrivate(false) {
|
||||
}
|
||||
isPrivate(false),
|
||||
isObjectInstruction(false),
|
||||
isBehaviorInstruction(false) {}
|
||||
|
||||
ParameterMetadata::ParameterMetadata() : optional(false), codeOnly(false) {}
|
||||
|
||||
@@ -86,11 +88,82 @@ InstructionMetadata& InstructionMetadata::AddCodeOnlyParameter(
|
||||
return *this;
|
||||
}
|
||||
|
||||
InstructionMetadata& InstructionMetadata::UseStandardOperatorParameters(
|
||||
const gd::String& type) {
|
||||
SetManipulatedType(type);
|
||||
|
||||
AddParameter("operator", _("Modification's sign"));
|
||||
AddParameter(type == "number" ? "expression" : type, _("Value"));
|
||||
size_t operatorParamIndex = parameters.size() - 2;
|
||||
size_t valueParamIndex = parameters.size() - 1;
|
||||
|
||||
if (isObjectInstruction || isBehaviorInstruction) {
|
||||
gd::String templateSentence =
|
||||
_("Change <subject> of _PARAM0_: <operator> <value>");
|
||||
|
||||
sentence =
|
||||
templateSentence.FindAndReplace("<subject>", sentence)
|
||||
.FindAndReplace(
|
||||
"<operator>",
|
||||
"_PARAM" + gd::String::From(operatorParamIndex) + "_")
|
||||
.FindAndReplace("<value>",
|
||||
"_PARAM" + gd::String::From(valueParamIndex) + "_");
|
||||
} else {
|
||||
gd::String templateSentence = _("Change <subject>: <operator> <value>");
|
||||
|
||||
sentence =
|
||||
templateSentence.FindAndReplace("<subject>", sentence)
|
||||
.FindAndReplace(
|
||||
"<operator>",
|
||||
"_PARAM" + gd::String::From(operatorParamIndex) + "_")
|
||||
.FindAndReplace("<value>",
|
||||
"_PARAM" + gd::String::From(valueParamIndex) + "_");
|
||||
}
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
InstructionMetadata&
|
||||
InstructionMetadata::UseStandardRelationalOperatorParameters(
|
||||
const gd::String& type) {
|
||||
SetManipulatedType(type);
|
||||
|
||||
AddParameter("relationalOperator", _("Sign of the test"));
|
||||
AddParameter(type == "number" ? "expression" : type, _("Value to compare"));
|
||||
size_t operatorParamIndex = parameters.size() - 2;
|
||||
size_t valueParamIndex = parameters.size() - 1;
|
||||
|
||||
if (isObjectInstruction || isBehaviorInstruction) {
|
||||
gd::String templateSentence = _("<subject> of _PARAM0_ <operator> <value>");
|
||||
|
||||
sentence =
|
||||
templateSentence.FindAndReplace("<subject>", sentence)
|
||||
.FindAndReplace(
|
||||
"<operator>",
|
||||
"_PARAM" + gd::String::From(operatorParamIndex) + "_")
|
||||
.FindAndReplace("<value>",
|
||||
"_PARAM" + gd::String::From(valueParamIndex) + "_");
|
||||
} else {
|
||||
gd::String templateSentence = _("<subject> <operator> <value>");
|
||||
|
||||
sentence =
|
||||
templateSentence.FindAndReplace("<subject>", sentence)
|
||||
.FindAndReplace(
|
||||
"<operator>",
|
||||
"_PARAM" + gd::String::From(operatorParamIndex) + "_")
|
||||
.FindAndReplace("<value>",
|
||||
"_PARAM" + gd::String::From(valueParamIndex) + "_");
|
||||
}
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
void ParameterMetadata::SerializeTo(SerializerElement& element) const {
|
||||
element.SetAttribute("type", type);
|
||||
element.SetAttribute("supplementaryInformation", supplementaryInformation);
|
||||
element.SetAttribute("optional", optional);
|
||||
element.SetAttribute("description", description);
|
||||
element.SetAttribute("longDescription", longDescription);
|
||||
element.SetAttribute("codeOnly", codeOnly);
|
||||
element.SetAttribute("defaultValue", defaultValue);
|
||||
element.SetAttribute("name", name);
|
||||
@@ -102,6 +175,7 @@ void ParameterMetadata::UnserializeFrom(const SerializerElement& element) {
|
||||
element.GetStringAttribute("supplementaryInformation");
|
||||
optional = element.GetBoolAttribute("optional");
|
||||
description = element.GetStringAttribute("description");
|
||||
longDescription = element.GetStringAttribute("longDescription");
|
||||
codeOnly = element.GetBoolAttribute("codeOnly");
|
||||
defaultValue = element.GetStringAttribute("defaultValue");
|
||||
name = element.GetStringAttribute("name");
|
||||
|
@@ -139,6 +139,19 @@ class GD_CORE_API ParameterMetadata {
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Get the user friendly, long description for the parameter.
|
||||
*/
|
||||
const gd::String &GetLongDescription() const { return longDescription; }
|
||||
|
||||
/**
|
||||
* \brief Set the user friendly, long description for the parameter.
|
||||
*/
|
||||
ParameterMetadata &SetLongDescription(const gd::String &longDescription_) {
|
||||
longDescription = longDescription_;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Return true if the type of the parameter is "object", "objectPtr" or
|
||||
* "objectList".
|
||||
@@ -207,11 +220,12 @@ class GD_CORE_API ParameterMetadata {
|
||||
gd::String description; ///< Description shown in editor
|
||||
bool codeOnly; ///< True if parameter is relative to code generation only,
|
||||
///< i.e. must not be shown in editor
|
||||
gd::String defaultValue; ///< Used as a default value in editor or if an
|
||||
///< optional parameter is empty.
|
||||
private:
|
||||
gd::String name; ///< The name of the parameter to be used in code
|
||||
///< generation. Optional.
|
||||
gd::String longDescription; ///< Long description shown in the editor.
|
||||
gd::String defaultValue; ///< Used as a default value in editor or if an
|
||||
///< optional parameter is empty.
|
||||
gd::String name; ///< The name of the parameter to be used in code
|
||||
///< generation. Optional.
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -319,44 +333,93 @@ class GD_CORE_API InstructionMetadata {
|
||||
bool IsHidden() const { return hidden; }
|
||||
|
||||
/**
|
||||
* \brief Add a parameter to the instruction ( condition or action )
|
||||
* information class. \param type One of the type handled by GDevelop. This
|
||||
* \brief Add a parameter to the instruction metadata.
|
||||
*
|
||||
* \param type One of the type handled by GDevelop. This
|
||||
* will also determine the type of the argument used when calling the function
|
||||
* in the generated code. \see EventsCodeGenerator::GenerateParametersCodes
|
||||
* in the generated code.
|
||||
* \param description Description for parameter
|
||||
* \param optionalObjectType If type is "object", this parameter will describe
|
||||
* which objects are allowed. If it is empty, all objects are allowed. \param
|
||||
* parameterIsOptional true if the parameter must be optional, false
|
||||
* which objects are allowed. If it is empty, all objects are allowed.
|
||||
* \param parameterIsOptional true if the parameter must be optional, false
|
||||
* otherwise.
|
||||
*
|
||||
* \see EventsCodeGenerator::GenerateParametersCodes
|
||||
*/
|
||||
InstructionMetadata &AddParameter(const gd::String &type,
|
||||
const gd::String &description,
|
||||
const gd::String &label,
|
||||
const gd::String &optionalObjectType = "",
|
||||
bool parameterIsOptional = false);
|
||||
|
||||
/**
|
||||
* \brief Add a parameter not displayed in editor.
|
||||
*
|
||||
* \param type One of the type handled by GDevelop. This will also determine
|
||||
* the type of the argument used when calling the function in C++ code. \see
|
||||
* EventsCodeGenerator::GenerateParametersCodes \param
|
||||
* supplementaryInformation Can be used if needed. For example, when type ==
|
||||
* "inlineCode", the content of supplementaryInformation is inserted in the
|
||||
* generated C++ code.
|
||||
* the type of the argument used when calling the function in the generated
|
||||
* code. \param supplementaryInformation Depends on `type`. For example, when
|
||||
* `type == "inlineCode"`, the content of supplementaryInformation is inserted
|
||||
* in the generated code.
|
||||
*
|
||||
* \see EventsCodeGenerator::GenerateParametersCodes
|
||||
*/
|
||||
InstructionMetadata &AddCodeOnlyParameter(
|
||||
const gd::String &type, const gd::String &supplementaryInformation);
|
||||
|
||||
/**
|
||||
* \brief Set the default value used in editor (or if an optional parameter is
|
||||
* empty during code generation) for the latest added parameter.
|
||||
* empty during code generation) for the last added parameter.
|
||||
*
|
||||
* \see AddParameter
|
||||
*/
|
||||
InstructionMetadata &SetDefaultValue(gd::String defaultValue_) {
|
||||
if (!parameters.empty()) parameters.back().defaultValue = defaultValue_;
|
||||
InstructionMetadata &SetDefaultValue(const gd::String &defaultValue_) {
|
||||
if (!parameters.empty()) parameters.back().SetDefaultValue(defaultValue_);
|
||||
return *this;
|
||||
};
|
||||
|
||||
/**
|
||||
* \brief Set the long description shown in the editor for the last added
|
||||
* parameter.
|
||||
*
|
||||
* \see AddParameter
|
||||
*/
|
||||
InstructionMetadata &SetParameterLongDescription(
|
||||
const gd::String &longDescription) {
|
||||
if (!parameters.empty())
|
||||
parameters.back().SetLongDescription(longDescription);
|
||||
return *this;
|
||||
};
|
||||
|
||||
/**
|
||||
* \brief Add the default parameters for an instruction manipulating the
|
||||
* specified type ("string", "number") with the default operators.
|
||||
*/
|
||||
InstructionMetadata &UseStandardOperatorParameters(const gd::String &type);
|
||||
|
||||
/**
|
||||
* \brief Add the default parameters for an instruction comparing the
|
||||
* specified type ("string", "number") with the default relational operators.
|
||||
*/
|
||||
InstructionMetadata &UseStandardRelationalOperatorParameters(
|
||||
const gd::String &type);
|
||||
|
||||
/**
|
||||
* \brief Mark the instruction as an object instruction. Automatically called
|
||||
* when using `AddAction`/`AddCondition` on an `ObjectMetadata`.
|
||||
*/
|
||||
InstructionMetadata &SetIsObjectInstruction() {
|
||||
isObjectInstruction = true;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Mark the instruction as a behavior instruction. Automatically called
|
||||
* when using `AddAction`/`AddCondition` on a `BehaviorMetadata`.
|
||||
*/
|
||||
InstructionMetadata &SetIsBehaviorInstruction() {
|
||||
isBehaviorInstruction = true;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Consider that the instruction is easy for an user to understand.
|
||||
*/
|
||||
@@ -425,7 +488,7 @@ class GD_CORE_API InstructionMetadata {
|
||||
* obj.AddAction("String",
|
||||
* _("Change the string"),
|
||||
* _("Change the string of a text"),
|
||||
* _("Do _PARAM1__PARAM2_ to the string of _PARAM0_"),
|
||||
* _("the string"),
|
||||
* _("Text"),
|
||||
* "CppPlatform/Extensions/text24.png",
|
||||
* "CppPlatform/Extensions/text.png");
|
||||
@@ -558,6 +621,8 @@ class GD_CORE_API InstructionMetadata {
|
||||
int usageComplexity; ///< Evaluate the instruction from 0 (simple&easy to
|
||||
///< use) to 10 (complex to understand)
|
||||
bool isPrivate;
|
||||
bool isObjectInstruction;
|
||||
bool isBehaviorInstruction;
|
||||
};
|
||||
|
||||
} // namespace gd
|
||||
|
@@ -8,6 +8,7 @@
|
||||
#include "GDCore/Extensions/Metadata/BehaviorMetadata.h"
|
||||
#include "GDCore/Extensions/Metadata/InstructionMetadata.h"
|
||||
#include "GDCore/Extensions/Metadata/ObjectMetadata.h"
|
||||
#include "GDCore/Extensions/Metadata/EffectMetadata.h"
|
||||
#include "GDCore/Extensions/Platform.h"
|
||||
#include "GDCore/Extensions/PlatformExtension.h"
|
||||
#include "GDCore/String.h"
|
||||
@@ -18,6 +19,7 @@ namespace gd {
|
||||
|
||||
gd::BehaviorMetadata MetadataProvider::badBehaviorInfo;
|
||||
gd::ObjectMetadata MetadataProvider::badObjectInfo;
|
||||
gd::EffectMetadata MetadataProvider::badEffectMetadata;
|
||||
gd::InstructionMetadata MetadataProvider::badInstructionMetadata;
|
||||
gd::ExpressionMetadata MetadataProvider::badExpressionMetadata;
|
||||
gd::ExpressionMetadata MetadataProvider::badStrExpressionMetadata;
|
||||
@@ -63,6 +65,26 @@ const ObjectMetadata& MetadataProvider::GetObjectMetadata(
|
||||
return GetExtensionAndObjectMetadata(platform, objectType).GetMetadata();
|
||||
}
|
||||
|
||||
ExtensionAndMetadata<EffectMetadata>
|
||||
MetadataProvider::GetExtensionAndEffectMetadata(const gd::Platform& platform,
|
||||
gd::String type) {
|
||||
for (auto& extension : platform.GetAllPlatformExtensions()) {
|
||||
auto objectsTypes = extension->GetExtensionEffectTypes();
|
||||
for (std::size_t j = 0; j < objectsTypes.size(); ++j) {
|
||||
if (objectsTypes[j] == type)
|
||||
return ExtensionAndMetadata<EffectMetadata>(
|
||||
*extension, extension->GetEffectMetadata(type));
|
||||
}
|
||||
}
|
||||
|
||||
return ExtensionAndMetadata<EffectMetadata>(badExtension, badEffectMetadata);
|
||||
}
|
||||
|
||||
const EffectMetadata& MetadataProvider::GetEffectMetadata(
|
||||
const gd::Platform& platform, gd::String objectType) {
|
||||
return GetExtensionAndEffectMetadata(platform, objectType).GetMetadata();
|
||||
}
|
||||
|
||||
ExtensionAndMetadata<InstructionMetadata>
|
||||
MetadataProvider::GetExtensionAndActionMetadata(const gd::Platform& platform,
|
||||
gd::String actionType) {
|
||||
|
@@ -10,6 +10,7 @@
|
||||
namespace gd {
|
||||
class BehaviorMetadata;
|
||||
class ObjectMetadata;
|
||||
class EffectMetadata;
|
||||
class ExpressionMetadata;
|
||||
class ExpressionMetadata;
|
||||
class Platform;
|
||||
@@ -71,6 +72,12 @@ class GD_CORE_API MetadataProvider {
|
||||
static ExtensionAndMetadata<ObjectMetadata> GetExtensionAndObjectMetadata(
|
||||
const gd::Platform& platform, gd::String type);
|
||||
|
||||
/**
|
||||
* Get the metadata about an effect, and its associated extension.
|
||||
*/
|
||||
static ExtensionAndMetadata<EffectMetadata> GetExtensionAndEffectMetadata(
|
||||
const gd::Platform& platform, gd::String type);
|
||||
|
||||
/**
|
||||
* Get the metadata of an action, and its associated extension.
|
||||
* Works for object, behaviors and static actions.
|
||||
@@ -151,6 +158,12 @@ class GD_CORE_API MetadataProvider {
|
||||
static const ObjectMetadata& GetObjectMetadata(const gd::Platform& platform,
|
||||
gd::String type);
|
||||
|
||||
/**
|
||||
* Get the metadata about an effect.
|
||||
*/
|
||||
static const EffectMetadata& GetEffectMetadata(const gd::Platform& platform,
|
||||
gd::String type);
|
||||
|
||||
/**
|
||||
* Get the metadata of an action.
|
||||
* Works for object, behaviors and static actions.
|
||||
@@ -308,6 +321,7 @@ class GD_CORE_API MetadataProvider {
|
||||
static PlatformExtension badExtension;
|
||||
static BehaviorMetadata badBehaviorInfo;
|
||||
static ObjectMetadata badObjectInfo;
|
||||
static EffectMetadata badEffectMetadata;
|
||||
static gd::InstructionMetadata badInstructionMetadata;
|
||||
static gd::ExpressionMetadata badExpressionMetadata;
|
||||
static gd::ExpressionMetadata badStrExpressionMetadata;
|
||||
|
@@ -77,7 +77,8 @@ gd::InstructionMetadata& ObjectMetadata::AddCondition(
|
||||
group,
|
||||
icon,
|
||||
smallicon)
|
||||
.SetHelpPath(GetHelpPath());
|
||||
.SetHelpPath(GetHelpPath())
|
||||
.SetIsObjectInstruction();
|
||||
return conditionsInfos[nameWithNamespace];
|
||||
#endif
|
||||
}
|
||||
@@ -101,7 +102,8 @@ gd::InstructionMetadata& ObjectMetadata::AddAction(
|
||||
group,
|
||||
icon,
|
||||
smallicon)
|
||||
.SetHelpPath(GetHelpPath());
|
||||
.SetHelpPath(GetHelpPath())
|
||||
.SetIsObjectInstruction();
|
||||
return actionsInfos[nameWithNamespace];
|
||||
#endif
|
||||
}
|
||||
|
@@ -67,7 +67,7 @@ void ParameterMetadataTools::IterateOverParameters(
|
||||
pNb < parameters.size() ? parameters[pNb].GetPlainString() : "";
|
||||
const gd::String& parameterValueOrDefault =
|
||||
parameterValue.empty() && parameterMetadata.optional
|
||||
? parameterMetadata.defaultValue
|
||||
? parameterMetadata.GetDefaultValue()
|
||||
: parameterValue;
|
||||
|
||||
fn(parameterMetadata, parameterValueOrDefault, lastObjectName);
|
||||
@@ -100,4 +100,4 @@ size_t ParameterMetadataTools::GetObjectParameterIndexFor(
|
||||
return gd::String::npos;
|
||||
}
|
||||
|
||||
} // namespace gd
|
||||
} // namespace gd
|
||||
|
@@ -162,6 +162,13 @@ gd::BehaviorMetadata& PlatformExtension::AddBehavior(
|
||||
return behaviorsInfo[nameWithNamespace];
|
||||
}
|
||||
|
||||
gd::EffectMetadata& PlatformExtension::AddEffect(const gd::String& name) {
|
||||
gd::String nameWithNamespace =
|
||||
GetNameSpace().empty() ? name : GetNameSpace() + name;
|
||||
effectsMetadata[nameWithNamespace] = EffectMetadata(nameWithNamespace);
|
||||
return effectsMetadata[nameWithNamespace];
|
||||
}
|
||||
|
||||
gd::EventMetadata& PlatformExtension::AddEvent(
|
||||
const gd::String& name_,
|
||||
const gd::String& fullname_,
|
||||
@@ -207,6 +214,14 @@ std::vector<gd::String> PlatformExtension::GetExtensionObjectsTypes() const {
|
||||
return objects;
|
||||
}
|
||||
|
||||
std::vector<gd::String> PlatformExtension::GetExtensionEffectTypes() const {
|
||||
std::vector<gd::String> effectNames;
|
||||
for (auto& it : effectsMetadata)
|
||||
effectNames.push_back(it.first);
|
||||
|
||||
return effectNames;
|
||||
}
|
||||
|
||||
gd::ObjectMetadata& PlatformExtension::GetObjectMetadata(
|
||||
const gd::String& objectType) {
|
||||
if (objectsInfos.find(objectType) != objectsInfos.end())
|
||||
@@ -227,6 +242,16 @@ gd::BehaviorMetadata& PlatformExtension::GetBehaviorMetadata(
|
||||
return badBehaviorMetadata;
|
||||
}
|
||||
|
||||
gd::EffectMetadata& PlatformExtension::GetEffectMetadata(
|
||||
const gd::String& effectName) {
|
||||
if (effectsMetadata.find(effectName) != effectsMetadata.end())
|
||||
return effectsMetadata.find(effectName)->second;
|
||||
|
||||
std::cout << "Warning: Effect with name \"" << effectName
|
||||
<< "\" not found in an extension!" << std::endl;
|
||||
return badEffectMetadata;
|
||||
}
|
||||
|
||||
std::vector<gd::String> PlatformExtension::GetBehaviorsTypes() const {
|
||||
std::vector<gd::String> behaviors;
|
||||
|
||||
@@ -379,6 +404,7 @@ void PlatformExtension::SetNameSpace(gd::String nameSpace_) {
|
||||
name == "BuiltinCommonConversions" ||
|
||||
name == "BuiltinStringInstructions" ||
|
||||
name == "BuiltinMathematicalTools" ||
|
||||
name == "Effects" || // Well-known effects are not namespaced.
|
||||
name == "CommonDialogs") // New name for BuiltinInterface
|
||||
{
|
||||
nameSpace = "";
|
||||
|
@@ -14,6 +14,7 @@
|
||||
#include "GDCore/Extensions/Metadata/BehaviorMetadata.h"
|
||||
#include "GDCore/Extensions/Metadata/EventMetadata.h"
|
||||
#include "GDCore/Extensions/Metadata/ObjectMetadata.h"
|
||||
#include "GDCore/Extensions/Metadata/EffectMetadata.h"
|
||||
#include "GDCore/String.h"
|
||||
#include "GDCore/Tools/VersionPriv.h"
|
||||
|
||||
@@ -23,6 +24,7 @@ class InstructionMetadata;
|
||||
class ExpressionMetadata;
|
||||
class ObjectMetadata;
|
||||
class BehaviorMetadata;
|
||||
class EffectMetadata;
|
||||
class BaseEvent;
|
||||
class EventMetadata;
|
||||
class EventCodeGenerator;
|
||||
@@ -206,6 +208,12 @@ class GD_CORE_API PlatformExtension {
|
||||
std::shared_ptr<gd::Behavior> instance,
|
||||
std::shared_ptr<gd::BehaviorsSharedData> sharedDatasInstance);
|
||||
|
||||
/**
|
||||
* \brief Declare a new effect as being part of the extension.
|
||||
* \param name The internal name of the effect (also called effect type).
|
||||
*/
|
||||
gd::EffectMetadata& AddEffect(const gd::String& name_);
|
||||
|
||||
/**
|
||||
* \brief Declare a new event as being part of the extension.
|
||||
* \note This method does nothing when used for GD C++ runtime.
|
||||
@@ -284,6 +292,12 @@ class GD_CORE_API PlatformExtension {
|
||||
*/
|
||||
CreateFunPtr GetObjectCreationFunctionPtr(gd::String objectType) const;
|
||||
|
||||
/**
|
||||
* \brief Return a vector containing all the effect types provided by the
|
||||
* extension.
|
||||
*/
|
||||
std::vector<gd::String> GetExtensionEffectTypes() const;
|
||||
|
||||
/**
|
||||
* \brief Create a custom event.
|
||||
*
|
||||
@@ -318,6 +332,11 @@ class GD_CORE_API PlatformExtension {
|
||||
*/
|
||||
BehaviorMetadata& GetBehaviorMetadata(const gd::String& behaviorType);
|
||||
|
||||
/**
|
||||
* \brief Return the metadata for the effect with the given name.
|
||||
*/
|
||||
EffectMetadata& GetEffectMetadata(const gd::String& effectName);
|
||||
|
||||
/**
|
||||
* \brief Return a map containing all the events provided by the extension
|
||||
*/
|
||||
@@ -455,6 +474,7 @@ class GD_CORE_API PlatformExtension {
|
||||
|
||||
std::map<gd::String, gd::ObjectMetadata> objectsInfos;
|
||||
std::map<gd::String, gd::BehaviorMetadata> behaviorsInfo;
|
||||
std::map<gd::String, gd::EffectMetadata> effectsMetadata;
|
||||
#if defined(GD_IDE_ONLY)
|
||||
std::map<gd::String, gd::InstructionMetadata> conditionsInfos;
|
||||
std::map<gd::String, gd::InstructionMetadata> actionsInfos;
|
||||
@@ -465,6 +485,7 @@ class GD_CORE_API PlatformExtension {
|
||||
|
||||
ObjectMetadata badObjectMetadata;
|
||||
BehaviorMetadata badBehaviorMetadata;
|
||||
EffectMetadata badEffectMetadata;
|
||||
#if defined(GD_IDE_ONLY)
|
||||
static std::map<gd::String, gd::InstructionMetadata>
|
||||
badConditionsMetadata; ///< Used when a condition is not found in the
|
||||
|
@@ -100,13 +100,6 @@ class GD_CORE_API AbstractFileSystem {
|
||||
virtual bool CopyFile(const gd::String& file,
|
||||
const gd::String& destination) = 0;
|
||||
|
||||
/**
|
||||
* \brief Copy a whole directory
|
||||
* \return true if the operation succeeded.
|
||||
*/
|
||||
virtual bool CopyDir(const gd::String& source,
|
||||
const gd::String& destination) = 0;
|
||||
|
||||
/**
|
||||
* \brief Write the content of a string to a file.
|
||||
* \return true if the operation succeeded.
|
||||
|
175
Core/GDCore/IDE/Events/ExpressionsParameterMover.cpp
Normal file
175
Core/GDCore/IDE/Events/ExpressionsParameterMover.cpp
Normal file
@@ -0,0 +1,175 @@
|
||||
/*
|
||||
* GDevelop Core
|
||||
* Copyright 2008-present Florian Rival (Florian.Rival@gmail.com). All rights
|
||||
* reserved. This project is released under the MIT License.
|
||||
*/
|
||||
#include "GDCore/IDE/Events/ExpressionsParameterMover.h"
|
||||
#include <map>
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
#include "GDCore/Events/Event.h"
|
||||
#include "GDCore/Events/EventsList.h"
|
||||
#include "GDCore/Events/Parsers/ExpressionParser2.h"
|
||||
#include "GDCore/Events/Parsers/ExpressionParser2NodePrinter.h"
|
||||
#include "GDCore/Events/Parsers/ExpressionParser2NodeWorker.h"
|
||||
#include "GDCore/Extensions/Metadata/MetadataProvider.h"
|
||||
#include "GDCore/IDE/Events/ExpressionValidator.h"
|
||||
#include "GDCore/Project/Layout.h"
|
||||
#include "GDCore/Project/Project.h"
|
||||
#include "GDCore/String.h"
|
||||
#include "GDCore/Tools/Log.h"
|
||||
|
||||
namespace gd {
|
||||
|
||||
/**
|
||||
* \brief Go through the nodes and change the position of a parameter of the
|
||||
* given function.
|
||||
*
|
||||
* \see gd::ExpressionParser2
|
||||
*/
|
||||
class GD_CORE_API ExpressionParameterMover
|
||||
: public ExpressionParser2NodeWorker {
|
||||
public:
|
||||
ExpressionParameterMover(const gd::ObjectsContainer& globalObjectsContainer_,
|
||||
const gd::ObjectsContainer& objectsContainer_,
|
||||
const gd::String& behaviorType_,
|
||||
const gd::String& objectType_,
|
||||
const gd::String& functionName_,
|
||||
std::size_t oldIndex_,
|
||||
std::size_t newIndex_)
|
||||
: hasDoneMoving(false),
|
||||
globalObjectsContainer(globalObjectsContainer_),
|
||||
objectsContainer(objectsContainer_),
|
||||
behaviorType(behaviorType_),
|
||||
objectType(objectType_),
|
||||
functionName(functionName_),
|
||||
oldIndex(oldIndex_),
|
||||
newIndex(newIndex_){};
|
||||
virtual ~ExpressionParameterMover(){};
|
||||
|
||||
bool HasDoneMoving() const { return hasDoneMoving; }
|
||||
|
||||
protected:
|
||||
void OnVisitSubExpressionNode(SubExpressionNode& node) override {
|
||||
node.expression->Visit(*this);
|
||||
}
|
||||
void OnVisitOperatorNode(OperatorNode& node) override {
|
||||
node.leftHandSide->Visit(*this);
|
||||
node.rightHandSide->Visit(*this);
|
||||
}
|
||||
void OnVisitUnaryOperatorNode(UnaryOperatorNode& node) override {
|
||||
node.factor->Visit(*this);
|
||||
}
|
||||
void OnVisitNumberNode(NumberNode& node) override {}
|
||||
void OnVisitTextNode(TextNode& node) override {}
|
||||
void OnVisitVariableNode(VariableNode& node) override {
|
||||
if (node.child) node.child->Visit(*this);
|
||||
}
|
||||
void OnVisitVariableAccessorNode(VariableAccessorNode& node) override {
|
||||
if (node.child) node.child->Visit(*this);
|
||||
}
|
||||
void OnVisitVariableBracketAccessorNode(
|
||||
VariableBracketAccessorNode& node) override {
|
||||
node.expression->Visit(*this);
|
||||
if (node.child) node.child->Visit(*this);
|
||||
}
|
||||
void OnVisitIdentifierNode(IdentifierNode& node) override {}
|
||||
void OnVisitFunctionNode(FunctionNode& node) override {
|
||||
auto moveParameter =
|
||||
[this](std::vector<std::unique_ptr<gd::ExpressionNode>>& parameters) {
|
||||
if (oldIndex >= parameters.size() || newIndex >= parameters.size())
|
||||
return;
|
||||
|
||||
auto movedParameterNode = std::move(parameters[oldIndex]);
|
||||
parameters.erase(parameters.begin() + oldIndex);
|
||||
parameters.insert(parameters.begin() + newIndex,
|
||||
std::move(movedParameterNode));
|
||||
};
|
||||
|
||||
if (node.functionName == functionName) {
|
||||
if (!objectType.empty() && !node.objectName.empty()) {
|
||||
// Move parameter of an object function
|
||||
const gd::String& thisObjectType = gd::GetTypeOfObject(
|
||||
globalObjectsContainer, objectsContainer, node.objectName);
|
||||
if (thisObjectType == behaviorType) {
|
||||
moveParameter(node.parameters);
|
||||
hasDoneMoving = true;
|
||||
}
|
||||
} else if (!behaviorType.empty() && !node.behaviorName.empty()) {
|
||||
// Move parameter of a behavior function
|
||||
const gd::String& thisBehaviorType = gd::GetTypeOfBehavior(
|
||||
globalObjectsContainer, objectsContainer, node.behaviorName);
|
||||
if (thisBehaviorType == behaviorType) {
|
||||
moveParameter(node.parameters);
|
||||
hasDoneMoving = true;
|
||||
}
|
||||
} else {
|
||||
// Move parameter of a free function
|
||||
moveParameter(node.parameters);
|
||||
hasDoneMoving = true;
|
||||
}
|
||||
}
|
||||
for (auto& parameter : node.parameters) {
|
||||
parameter->Visit(*this);
|
||||
}
|
||||
}
|
||||
void OnVisitEmptyNode(EmptyNode& node) override {}
|
||||
|
||||
private:
|
||||
bool hasDoneMoving;
|
||||
const gd::ObjectsContainer& globalObjectsContainer;
|
||||
const gd::ObjectsContainer& objectsContainer;
|
||||
const gd::String& behaviorType; // The behavior type for which the expression
|
||||
// must be replaced (optional)
|
||||
const gd::String& objectType; // The object type for which the expression
|
||||
// must be replaced (optional)
|
||||
const gd::String& functionName;
|
||||
std::size_t oldIndex;
|
||||
std::size_t newIndex;
|
||||
};
|
||||
|
||||
bool ExpressionsParameterMover::DoVisitInstruction(gd::Instruction& instruction,
|
||||
bool isCondition) {
|
||||
auto& metadata = isCondition ? gd::MetadataProvider::GetConditionMetadata(
|
||||
platform, instruction.GetType())
|
||||
: gd::MetadataProvider::GetActionMetadata(
|
||||
platform, instruction.GetType());
|
||||
|
||||
for (std::size_t pNb = 0; pNb < metadata.parameters.size() &&
|
||||
pNb < instruction.GetParametersCount();
|
||||
++pNb) {
|
||||
const gd::String& type = metadata.parameters[pNb].type;
|
||||
const gd::String& expression =
|
||||
instruction.GetParameter(pNb).GetPlainString();
|
||||
|
||||
gd::ExpressionParser2 parser(
|
||||
platform, GetGlobalObjectsContainer(), GetObjectsContainer());
|
||||
|
||||
auto node = gd::ParameterMetadata::IsExpression("number", type)
|
||||
? parser.ParseExpression("number", expression)
|
||||
: (gd::ParameterMetadata::IsExpression("string", type)
|
||||
? parser.ParseExpression("string", expression)
|
||||
: std::unique_ptr<gd::ExpressionNode>());
|
||||
if (node) {
|
||||
ExpressionParameterMover mover(GetGlobalObjectsContainer(),
|
||||
GetObjectsContainer(),
|
||||
behaviorType,
|
||||
objectType,
|
||||
functionName,
|
||||
oldIndex,
|
||||
newIndex);
|
||||
node->Visit(mover);
|
||||
|
||||
if (mover.HasDoneMoving()) {
|
||||
instruction.SetParameter(
|
||||
pNb, ExpressionParser2NodePrinter::PrintNode(*node));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
ExpressionsParameterMover::~ExpressionsParameterMover() {}
|
||||
|
||||
} // namespace gd
|
85
Core/GDCore/IDE/Events/ExpressionsParameterMover.h
Normal file
85
Core/GDCore/IDE/Events/ExpressionsParameterMover.h
Normal file
@@ -0,0 +1,85 @@
|
||||
/*
|
||||
* GDevelop Core
|
||||
* Copyright 2008-present Florian Rival (Florian.Rival@gmail.com). All rights
|
||||
* reserved. This project is released under the MIT License.
|
||||
*/
|
||||
#ifndef ExpressionsParameterMover_H
|
||||
#define ExpressionsParameterMover_H
|
||||
#include <map>
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
#include "GDCore/IDE/Events/ArbitraryEventsWorker.h"
|
||||
#include "GDCore/String.h"
|
||||
namespace gd {
|
||||
class BaseEvent;
|
||||
class Platform;
|
||||
class EventsList;
|
||||
} // namespace gd
|
||||
|
||||
namespace gd {
|
||||
|
||||
/**
|
||||
* \brief Move in expressions, in parameters of actions or conditions, a
|
||||
* parameter from one position to another.
|
||||
*
|
||||
* \see InstructionsParameterMover
|
||||
* \ingroup IDE
|
||||
*/
|
||||
class GD_CORE_API ExpressionsParameterMover
|
||||
: public ArbitraryEventsWorkerWithContext {
|
||||
public:
|
||||
ExpressionsParameterMover(const gd::Platform &platform_)
|
||||
: platform(platform_){};
|
||||
virtual ~ExpressionsParameterMover();
|
||||
|
||||
ExpressionsParameterMover &SetFreeExpressionMovedParameter(
|
||||
const gd::String &functionName_,
|
||||
std::size_t oldIndex_,
|
||||
std::size_t newIndex_) {
|
||||
objectType = "";
|
||||
behaviorType = "";
|
||||
functionName = functionName_;
|
||||
oldIndex = oldIndex_;
|
||||
newIndex = newIndex_;
|
||||
return *this;
|
||||
}
|
||||
ExpressionsParameterMover &SetObjectExpressionMovedParameter(
|
||||
const gd::String &objectType_,
|
||||
const gd::String &functionName_,
|
||||
std::size_t oldIndex_,
|
||||
std::size_t newIndex_) {
|
||||
objectType = objectType_;
|
||||
behaviorType = "";
|
||||
functionName = functionName_;
|
||||
oldIndex = oldIndex_;
|
||||
newIndex = newIndex_;
|
||||
return *this;
|
||||
};
|
||||
ExpressionsParameterMover &SetBehaviorExpressionMovedParameter(
|
||||
const gd::String &behaviorType_,
|
||||
const gd::String &functionName_,
|
||||
std::size_t oldIndex_,
|
||||
std::size_t newIndex_) {
|
||||
objectType = "";
|
||||
behaviorType = behaviorType_;
|
||||
functionName = functionName_;
|
||||
oldIndex = oldIndex_;
|
||||
newIndex = newIndex_;
|
||||
return *this;
|
||||
};
|
||||
|
||||
private:
|
||||
bool DoVisitInstruction(gd::Instruction &instruction,
|
||||
bool isCondition) override;
|
||||
|
||||
const gd::Platform &platform;
|
||||
gd::String functionName;
|
||||
std::size_t oldIndex;
|
||||
std::size_t newIndex;
|
||||
gd::String behaviorType;
|
||||
gd::String objectType;
|
||||
};
|
||||
|
||||
} // namespace gd
|
||||
|
||||
#endif // ExpressionsParameterMover_H
|
37
Core/GDCore/IDE/Events/InstructionsParameterMover.cpp
Normal file
37
Core/GDCore/IDE/Events/InstructionsParameterMover.cpp
Normal file
@@ -0,0 +1,37 @@
|
||||
/*
|
||||
* GDevelop Core
|
||||
* Copyright 2008-present Florian Rival (Florian.Rival@gmail.com). All rights
|
||||
* reserved. This project is released under the MIT License.
|
||||
*/
|
||||
#include "GDCore/IDE/Events/InstructionsParameterMover.h"
|
||||
#include <map>
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
#include "GDCore/Events/Event.h"
|
||||
#include "GDCore/Events/EventsList.h"
|
||||
#include "GDCore/Project/Layout.h"
|
||||
#include "GDCore/Project/Project.h"
|
||||
#include "GDCore/String.h"
|
||||
|
||||
namespace gd {
|
||||
|
||||
bool InstructionsParameterMover::DoVisitInstruction(
|
||||
gd::Instruction& instruction, bool isCondition) {
|
||||
if (instruction.GetType() == instructionType) {
|
||||
std::vector<gd::Expression> updatedParameters = instruction.GetParameters();
|
||||
if (oldIndex < updatedParameters.size() ||
|
||||
newIndex < updatedParameters.size()) {
|
||||
gd::Expression movedParameter = updatedParameters[oldIndex];
|
||||
updatedParameters.erase(updatedParameters.begin() + oldIndex);
|
||||
updatedParameters.insert(updatedParameters.begin() + newIndex,
|
||||
movedParameter);
|
||||
instruction.SetParameters(updatedParameters);
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
InstructionsParameterMover::~InstructionsParameterMover() {}
|
||||
|
||||
} // namespace gd
|
53
Core/GDCore/IDE/Events/InstructionsParameterMover.h
Normal file
53
Core/GDCore/IDE/Events/InstructionsParameterMover.h
Normal file
@@ -0,0 +1,53 @@
|
||||
/*
|
||||
* GDevelop Core
|
||||
* Copyright 2008-present Florian Rival (Florian.Rival@gmail.com). All rights
|
||||
* reserved. This project is released under the MIT License.
|
||||
*/
|
||||
#ifndef InstructionsParameterMover_H
|
||||
#define InstructionsParameterMover_H
|
||||
#include <map>
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
#include "GDCore/IDE/Events/ArbitraryEventsWorker.h"
|
||||
#include "GDCore/String.h"
|
||||
namespace gd {
|
||||
class BaseEvent;
|
||||
class Project;
|
||||
class EventsList;
|
||||
} // namespace gd
|
||||
|
||||
namespace gd {
|
||||
|
||||
/**
|
||||
* \brief Reorder the parameters of the instruction with the specified
|
||||
* type in events, moving the parameter at the specified \a oldIndex to
|
||||
* \a newIndex.
|
||||
*
|
||||
* \see ExpressionsParameterMover
|
||||
* \ingroup IDE
|
||||
*/
|
||||
class GD_CORE_API InstructionsParameterMover : public ArbitraryEventsWorker {
|
||||
public:
|
||||
InstructionsParameterMover(const gd::Project& project_,
|
||||
const gd::String& instructionType_,
|
||||
std::size_t oldIndex_,
|
||||
std::size_t newIndex_)
|
||||
: project(project_),
|
||||
instructionType(instructionType_),
|
||||
oldIndex(oldIndex_),
|
||||
newIndex(newIndex_){};
|
||||
virtual ~InstructionsParameterMover();
|
||||
|
||||
private:
|
||||
bool DoVisitInstruction(gd::Instruction& instruction,
|
||||
bool isCondition) override;
|
||||
|
||||
const gd::Project& project;
|
||||
gd::String instructionType;
|
||||
std::size_t oldIndex;
|
||||
std::size_t newIndex;
|
||||
};
|
||||
|
||||
} // namespace gd
|
||||
|
||||
#endif // InstructionsParameterMover_H
|
@@ -9,7 +9,9 @@
|
||||
#include "GDCore/IDE/Events/ArbitraryEventsWorker.h"
|
||||
#include "GDCore/IDE/Events/EventsRefactorer.h"
|
||||
#include "GDCore/IDE/Events/ExpressionsRenamer.h"
|
||||
#include "GDCore/IDE/Events/ExpressionsParameterMover.h"
|
||||
#include "GDCore/IDE/Events/InstructionsTypeRenamer.h"
|
||||
#include "GDCore/IDE/Events/InstructionsParameterMover.h"
|
||||
#include "GDCore/IDE/EventsFunctionTools.h"
|
||||
#include "GDCore/Project/EventsBasedBehavior.h"
|
||||
#include "GDCore/Project/EventsFunctionsExtension.h"
|
||||
@@ -85,7 +87,8 @@ void WholeProjectRefactorer::ExposeProjectEvents(
|
||||
void WholeProjectRefactorer::ExposeProjectEvents(
|
||||
gd::Project& project, gd::ArbitraryEventsWorkerWithContext& worker) {
|
||||
// See also gd::Project::ExposeResources for a method that traverse the whole
|
||||
// project (this time for resources).
|
||||
// project (this time for resources) and ExposeProjectEffects (this time for
|
||||
// effects).
|
||||
|
||||
// Add layouts events
|
||||
for (std::size_t s = 0; s < project.GetLayoutsCount(); s++) {
|
||||
@@ -331,9 +334,6 @@ void WholeProjectRefactorer::RenameEventsFunctionsExtension(
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Refactor the project after an events function is renamed
|
||||
*/
|
||||
void WholeProjectRefactorer::RenameEventsFunction(
|
||||
gd::Project& project,
|
||||
const gd::EventsFunctionsExtension& eventsFunctionsExtension,
|
||||
@@ -391,6 +391,76 @@ void WholeProjectRefactorer::RenameBehaviorEventsFunction(
|
||||
}
|
||||
}
|
||||
|
||||
void WholeProjectRefactorer::MoveEventsFunctionParameter(
|
||||
gd::Project& project,
|
||||
const gd::EventsFunctionsExtension& eventsFunctionsExtension,
|
||||
const gd::String& functionName,
|
||||
std::size_t oldIndex,
|
||||
std::size_t newIndex) {
|
||||
if (!eventsFunctionsExtension.HasEventsFunctionNamed(functionName)) return;
|
||||
|
||||
const gd::EventsFunction& eventsFunction =
|
||||
eventsFunctionsExtension.GetEventsFunction(functionName);
|
||||
|
||||
const gd::String& eventsFunctionType = GetEventsFunctionFullType(
|
||||
eventsFunctionsExtension.GetName(), functionName);
|
||||
|
||||
if (eventsFunction.GetFunctionType() == gd::EventsFunction::Action ||
|
||||
eventsFunction.GetFunctionType() == gd::EventsFunction::Condition) {
|
||||
gd::InstructionsParameterMover mover = gd::InstructionsParameterMover(
|
||||
project, eventsFunctionType, oldIndex, newIndex);
|
||||
ExposeProjectEvents(project, mover);
|
||||
} else if (eventsFunction.GetFunctionType() ==
|
||||
gd::EventsFunction::Expression ||
|
||||
eventsFunction.GetFunctionType() ==
|
||||
gd::EventsFunction::StringExpression) {
|
||||
gd::ExpressionsParameterMover mover =
|
||||
gd::ExpressionsParameterMover(project.GetCurrentPlatform());
|
||||
mover.SetFreeExpressionMovedParameter(
|
||||
eventsFunctionType, oldIndex, newIndex);
|
||||
ExposeProjectEvents(project, mover);
|
||||
}
|
||||
}
|
||||
|
||||
void WholeProjectRefactorer::MoveBehaviorEventsFunctionParameter(
|
||||
gd::Project& project,
|
||||
const gd::EventsFunctionsExtension& eventsFunctionsExtension,
|
||||
const gd::EventsBasedBehavior& eventsBasedBehavior,
|
||||
const gd::String& functionName,
|
||||
std::size_t oldIndex,
|
||||
std::size_t newIndex) {
|
||||
auto& eventsFunctions = eventsBasedBehavior.GetEventsFunctions();
|
||||
if (!eventsFunctions.HasEventsFunctionNamed(functionName)) return;
|
||||
|
||||
const gd::EventsFunction& eventsFunction =
|
||||
eventsFunctions.GetEventsFunction(functionName);
|
||||
|
||||
const gd::String& eventsFunctionType =
|
||||
GetBehaviorEventsFunctionFullType(eventsFunctionsExtension.GetName(),
|
||||
eventsBasedBehavior.GetName(),
|
||||
functionName);
|
||||
|
||||
if (eventsFunction.GetFunctionType() == gd::EventsFunction::Action ||
|
||||
eventsFunction.GetFunctionType() == gd::EventsFunction::Condition) {
|
||||
gd::InstructionsParameterMover mover = gd::InstructionsParameterMover(
|
||||
project, eventsFunctionType, oldIndex, newIndex);
|
||||
ExposeProjectEvents(project, mover);
|
||||
} else if (eventsFunction.GetFunctionType() ==
|
||||
gd::EventsFunction::Expression ||
|
||||
eventsFunction.GetFunctionType() ==
|
||||
gd::EventsFunction::StringExpression) {
|
||||
gd::ExpressionsParameterMover mover =
|
||||
gd::ExpressionsParameterMover(project.GetCurrentPlatform());
|
||||
mover.SetBehaviorExpressionMovedParameter(
|
||||
GetBehaviorFullType(eventsFunctionsExtension.GetName(),
|
||||
eventsBasedBehavior.GetName()),
|
||||
functionName,
|
||||
oldIndex,
|
||||
newIndex);
|
||||
ExposeProjectEvents(project, mover);
|
||||
}
|
||||
}
|
||||
|
||||
void WholeProjectRefactorer::RenameBehaviorProperty(
|
||||
gd::Project& project,
|
||||
const gd::EventsFunctionsExtension& eventsFunctionsExtension,
|
||||
|
@@ -78,6 +78,29 @@ class GD_CORE_API WholeProjectRefactorer {
|
||||
const gd::String& oldFunctionName,
|
||||
const gd::String& newFunctionName);
|
||||
|
||||
/**
|
||||
* \brief Refactor the project after an events function parameter
|
||||
* was moved.
|
||||
*/
|
||||
static void MoveEventsFunctionParameter(
|
||||
gd::Project& project,
|
||||
const gd::EventsFunctionsExtension& eventsFunctionsExtension,
|
||||
const gd::String& functionName,
|
||||
std::size_t oldIndex,
|
||||
std::size_t newIndex);
|
||||
|
||||
/**
|
||||
* \brief Refactor the project after the parmaeter of an events function of a
|
||||
* behavior was moved.
|
||||
*/
|
||||
static void MoveBehaviorEventsFunctionParameter(
|
||||
gd::Project& project,
|
||||
const gd::EventsFunctionsExtension& eventsFunctionsExtension,
|
||||
const gd::EventsBasedBehavior& eventsBasedBehavior,
|
||||
const gd::String& functionName,
|
||||
std::size_t oldIndex,
|
||||
std::size_t newIndex);
|
||||
|
||||
/**
|
||||
* \brief Refactor the project after a property of a behavior is
|
||||
* renamed.
|
||||
|
@@ -12,21 +12,60 @@ namespace gd {
|
||||
#if defined(GD_IDE_ONLY)
|
||||
void Effect::SerializeTo(SerializerElement& element) const {
|
||||
element.SetAttribute("name", GetName());
|
||||
element.SetAttribute("effectName", GetEffectName());
|
||||
SerializerElement& parametersElement = element.AddChild("parameters");
|
||||
for (auto& parameter : parameters)
|
||||
parametersElement.AddChild(parameter.first).SetValue(parameter.second);
|
||||
element.SetAttribute("effectType", GetEffectType());
|
||||
|
||||
SerializerElement& doubleParametersElement =
|
||||
element.AddChild("doubleParameters");
|
||||
for (auto& parameter : doubleParameters)
|
||||
doubleParametersElement.AddChild(parameter.first)
|
||||
.SetValue(parameter.second);
|
||||
|
||||
SerializerElement& stringParametersElement =
|
||||
element.AddChild("stringParameters");
|
||||
for (auto& parameter : stringParameters)
|
||||
stringParametersElement.AddChild(parameter.first)
|
||||
.SetValue(parameter.second);
|
||||
|
||||
SerializerElement& booleanParametersElement =
|
||||
element.AddChild("booleanParameters");
|
||||
for (auto& parameter : booleanParameters)
|
||||
booleanParametersElement.AddChild(parameter.first)
|
||||
.SetValue(parameter.second);
|
||||
}
|
||||
#endif
|
||||
|
||||
void Effect::UnserializeFrom(const SerializerElement& element) {
|
||||
SetName(element.GetStringAttribute("name"));
|
||||
SetEffectName(element.GetStringAttribute("effectName"));
|
||||
SetEffectType(element.GetStringAttribute(
|
||||
"effectType",
|
||||
"",
|
||||
// Compatibility with GD <= 5.0.0-beta83
|
||||
"effectName"
|
||||
// end of compatibility code
|
||||
));
|
||||
|
||||
parameters.clear();
|
||||
const SerializerElement& parametersElement = element.GetChild("parameters");
|
||||
for (auto& child : parametersElement.GetAllChildren())
|
||||
SetParameter(child.first, child.second->GetValue().GetDouble());
|
||||
doubleParameters.clear();
|
||||
const SerializerElement& doubleParametersElement =
|
||||
element.GetChild("doubleParameters",
|
||||
0,
|
||||
// Compatibility with GD <= 5.0.0-beta83
|
||||
"parameters"
|
||||
// end of compatibility code
|
||||
);
|
||||
for (auto& child : doubleParametersElement.GetAllChildren())
|
||||
SetDoubleParameter(child.first, child.second->GetValue().GetDouble());
|
||||
|
||||
stringParameters.clear();
|
||||
const SerializerElement& stringParametersElement =
|
||||
element.GetChild("stringParameters");
|
||||
for (auto& child : stringParametersElement.GetAllChildren())
|
||||
SetStringParameter(child.first, child.second->GetValue().GetString());
|
||||
|
||||
booleanParameters.clear();
|
||||
const SerializerElement& booleanParametersElement =
|
||||
element.GetChild("booleanParameters");
|
||||
for (auto& child : booleanParametersElement.GetAllChildren())
|
||||
SetBooleanParameter(child.first, child.second->GetValue().GetBool());
|
||||
}
|
||||
|
||||
} // namespace gd
|
||||
|
@@ -27,17 +27,51 @@ class GD_CORE_API Effect {
|
||||
void SetName(const gd::String& name_) { name = name_; }
|
||||
const gd::String& GetName() const { return name; }
|
||||
|
||||
void SetEffectName(const gd::String& effectName_) {
|
||||
effectName = effectName_;
|
||||
void SetEffectType(const gd::String& effectType_) {
|
||||
effectType = effectType_;
|
||||
}
|
||||
const gd::String& GetEffectName() const { return effectName; }
|
||||
const gd::String& GetEffectType() const { return effectType; }
|
||||
|
||||
void SetParameter(const gd::String& name, double value) {
|
||||
parameters[name] = value;
|
||||
void SetDoubleParameter(const gd::String& name, double value) {
|
||||
doubleParameters[name] = value;
|
||||
}
|
||||
double GetParameter(const gd::String& name) { return parameters[name]; }
|
||||
const std::map<gd::String, double>& GetAllParameters() const {
|
||||
return parameters;
|
||||
|
||||
double GetDoubleParameter(const gd::String& name) {
|
||||
return doubleParameters[name];
|
||||
}
|
||||
|
||||
void SetStringParameter(const gd::String& name, const gd::String& value) {
|
||||
stringParameters[name] = value;
|
||||
}
|
||||
|
||||
const gd::String& GetStringParameter(const gd::String& name) {
|
||||
return stringParameters[name];
|
||||
}
|
||||
|
||||
void SetBooleanParameter(const gd::String& name, bool value) {
|
||||
booleanParameters[name] = value;
|
||||
}
|
||||
|
||||
bool GetBooleanParameter(const gd::String& name) {
|
||||
return booleanParameters[name];
|
||||
}
|
||||
|
||||
const std::map<gd::String, double>& GetAllDoubleParameters() const {
|
||||
return doubleParameters;
|
||||
}
|
||||
|
||||
const std::map<gd::String, gd::String>& GetAllStringParameters() const {
|
||||
return stringParameters;
|
||||
}
|
||||
|
||||
const std::map<gd::String, bool>& GetAllBooleanParameters() const {
|
||||
return booleanParameters;
|
||||
}
|
||||
|
||||
void ClearParameters() {
|
||||
doubleParameters.clear();
|
||||
stringParameters.clear();
|
||||
booleanParameters.clear();
|
||||
}
|
||||
|
||||
#if defined(GD_IDE_ONLY)
|
||||
@@ -53,9 +87,11 @@ class GD_CORE_API Effect {
|
||||
void UnserializeFrom(const SerializerElement& element);
|
||||
|
||||
private:
|
||||
gd::String name; ///< The name of the layer
|
||||
gd::String effectName; ///< The name of the effect to apply
|
||||
std::map<gd::String, double> parameters;
|
||||
gd::String name; ///< The name of the layer.
|
||||
gd::String effectType; ///< The name of the effect to apply.
|
||||
std::map<gd::String, double> doubleParameters; ///< Values of parameters being doubles, keyed by names.
|
||||
std::map<gd::String, gd::String> stringParameters; ///< Values of parameters being strings, keyed by names.
|
||||
std::map<gd::String, bool> booleanParameters; ///< Values of parameters being booleans, keyed by names.
|
||||
};
|
||||
|
||||
} // namespace gd
|
||||
|
@@ -93,6 +93,9 @@ class GD_CORE_API EventsFunctionsContainer
|
||||
void MoveEventsFunction(std::size_t oldIndex, std::size_t newIndex) {
|
||||
return Move(oldIndex, newIndex);
|
||||
};
|
||||
std::size_t GetEventsFunctionPosition(const gd::EventsFunction& eventsFunction) {
|
||||
return GetPosition(eventsFunction);
|
||||
};
|
||||
|
||||
/**
|
||||
* \brief Provide a raw access to the vector containing the functions.
|
||||
@@ -141,4 +144,4 @@ class GD_CORE_API EventsFunctionsContainer
|
||||
} // namespace gd
|
||||
|
||||
#endif // GDCORE_EVENTSFUNCTIONSCONTAINER_H
|
||||
#endif
|
||||
#endif
|
||||
|
@@ -59,6 +59,7 @@ Project::Project()
|
||||
minFPS(20),
|
||||
verticalSync(false),
|
||||
scaleMode("linear"),
|
||||
adaptGameResolutionAtRuntime(true),
|
||||
sizeOnStartupMode("adaptWidth"),
|
||||
imageManager(std::make_shared<ImageManager>())
|
||||
#if defined(GD_IDE_ONLY)
|
||||
@@ -574,9 +575,8 @@ void Project::UnserializeFrom(const SerializerElement& element) {
|
||||
element.GetChild("properties", 0, "Info");
|
||||
SetName(propElement.GetChild("name", 0, "Nom").GetValue().GetString());
|
||||
SetVersion(propElement.GetStringAttribute("version", "1.0.0"));
|
||||
SetDefaultWidth(
|
||||
propElement.GetChild("windowWidth", 0, "WindowW").GetValue().GetInt());
|
||||
SetDefaultHeight(
|
||||
SetGameResolutionSize(
|
||||
propElement.GetChild("windowWidth", 0, "WindowW").GetValue().GetInt(),
|
||||
propElement.GetChild("windowHeight", 0, "WindowH").GetValue().GetInt());
|
||||
SetMaximumFPS(
|
||||
propElement.GetChild("maxFPS", 0, "FPSmax").GetValue().GetInt());
|
||||
@@ -585,6 +585,8 @@ void Project::UnserializeFrom(const SerializerElement& element) {
|
||||
SetVerticalSyncActivatedByDefault(
|
||||
propElement.GetChild("verticalSync").GetValue().GetBool());
|
||||
SetScaleMode(propElement.GetStringAttribute("scaleMode", "linear"));
|
||||
SetAdaptGameResolutionAtRuntime(
|
||||
propElement.GetBoolAttribute("adaptGameResolutionAtRuntime", false));
|
||||
SetSizeOnStartupMode(propElement.GetStringAttribute("sizeOnStartupMode", ""));
|
||||
#if defined(GD_IDE_ONLY)
|
||||
SetAuthor(propElement.GetChild("author", 0, "Auteur").GetValue().GetString());
|
||||
@@ -851,8 +853,8 @@ void Project::SerializeTo(SerializerElement& element) const {
|
||||
propElement.AddChild("name").SetValue(GetName());
|
||||
propElement.SetAttribute("version", GetVersion());
|
||||
propElement.AddChild("author").SetValue(GetAuthor());
|
||||
propElement.AddChild("windowWidth").SetValue(GetMainWindowDefaultWidth());
|
||||
propElement.AddChild("windowHeight").SetValue(GetMainWindowDefaultHeight());
|
||||
propElement.AddChild("windowWidth").SetValue(GetGameResolutionWidth());
|
||||
propElement.AddChild("windowHeight").SetValue(GetGameResolutionHeight());
|
||||
propElement.AddChild("latestCompilationDirectory")
|
||||
.SetValue(GetLastCompilationDirectory());
|
||||
propElement.AddChild("maxFPS").SetValue(GetMaximumFPS());
|
||||
@@ -860,6 +862,7 @@ void Project::SerializeTo(SerializerElement& element) const {
|
||||
propElement.AddChild("verticalSync")
|
||||
.SetValue(IsVerticalSynchronizationEnabledByDefault());
|
||||
propElement.SetAttribute("scaleMode", scaleMode);
|
||||
propElement.SetAttribute("adaptGameResolutionAtRuntime", adaptGameResolutionAtRuntime);
|
||||
propElement.SetAttribute("sizeOnStartupMode", sizeOnStartupMode);
|
||||
propElement.SetAttribute("projectFile", gameFile);
|
||||
propElement.SetAttribute("folderProject", folderProject);
|
||||
@@ -956,8 +959,9 @@ gd::String Project::GetBadObjectNameWarning() {
|
||||
|
||||
void Project::ExposeResources(gd::ArbitraryResourceWorker& worker) {
|
||||
// See also gd::WholeProjectRefactorer::ExposeProjectEvents for a method that
|
||||
// traverse the whole project (this time for events). Ideally, this method
|
||||
// could be moved outside of gd::Project.
|
||||
// traverse the whole project (this time for events) and ExposeProjectEffects
|
||||
// (this time for effects). Ideally, this method could be moved outside of
|
||||
// gd::Project.
|
||||
|
||||
// Add project resources
|
||||
worker.ExposeResources(&GetResourcesManager());
|
||||
@@ -1058,6 +1062,7 @@ void Project::Init(const gd::Project& game) {
|
||||
minFPS = game.minFPS;
|
||||
verticalSync = game.verticalSync;
|
||||
scaleMode = game.scaleMode;
|
||||
adaptGameResolutionAtRuntime = game.adaptGameResolutionAtRuntime;
|
||||
sizeOnStartupMode = game.sizeOnStartupMode;
|
||||
|
||||
#if defined(GD_IDE_ONLY)
|
||||
|
@@ -200,22 +200,36 @@ class GD_CORE_API Project : public ObjectsContainer {
|
||||
* the first time. To change the width at runtime, use the functions related
|
||||
* to RuntimeScene.renderWindow
|
||||
*/
|
||||
void SetDefaultWidth(unsigned int width) { windowWidth = width; }
|
||||
void SetGameResolutionSize(unsigned int width, unsigned int height) {
|
||||
windowWidth = width;
|
||||
windowHeight = height;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the default width of the project main window
|
||||
* \brief Returns the default game resolution width.
|
||||
*/
|
||||
unsigned int GetMainWindowDefaultWidth() const { return windowWidth; }
|
||||
unsigned int GetGameResolutionWidth() const { return windowWidth; }
|
||||
|
||||
/**
|
||||
* Change the default height of the project main window
|
||||
* \brief Returns the default game resolution height.
|
||||
*/
|
||||
void SetDefaultHeight(unsigned int height) { windowHeight = height; }
|
||||
unsigned int GetGameResolutionHeight() const { return windowHeight; }
|
||||
|
||||
/**
|
||||
* Return the default height of the project main window
|
||||
* \brief Returns true if the game resolution should be adapted to the window
|
||||
* size at runtime.
|
||||
*/
|
||||
unsigned int GetMainWindowDefaultHeight() const { return windowHeight; }
|
||||
bool GetAdaptGameResolutionAtRuntime() const {
|
||||
return adaptGameResolutionAtRuntime;
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Set if the game resolution should be adapted to the window size at
|
||||
* runtime. \see SetSizeOnStartupMode
|
||||
*/
|
||||
void SetAdaptGameResolutionAtRuntime(bool adaptGameResolutionAtRuntime_) {
|
||||
adaptGameResolutionAtRuntime = adaptGameResolutionAtRuntime_;
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Get how the game size should be adapted to the screen.
|
||||
@@ -924,6 +938,8 @@ class GD_CORE_API Project : public ObjectsContainer {
|
||||
///< are below this number )
|
||||
bool verticalSync; ///< If true, must activate vertical synchronization.
|
||||
gd::String scaleMode;
|
||||
bool adaptGameResolutionAtRuntime; ///< Should the game resolution be adapted
|
||||
///< to the window size at runtime
|
||||
gd::String
|
||||
sizeOnStartupMode; ///< How to adapt the game size to the screen. Can be
|
||||
///< "adaptWidth", "adaptHeight" or empty
|
||||
|
@@ -16,6 +16,7 @@ void PropertyDescriptor::SerializeTo(SerializerElement& element) const {
|
||||
element.AddChild("value").SetStringValue(currentValue);
|
||||
element.AddChild("type").SetStringValue(type);
|
||||
element.AddChild("label").SetStringValue(label);
|
||||
element.AddChild("description").SetStringValue(description);
|
||||
SerializerElement& extraInformationElement =
|
||||
element.AddChild("extraInformation");
|
||||
extraInformationElement.ConsiderAsArray();
|
||||
@@ -29,6 +30,7 @@ void PropertyDescriptor::UnserializeFrom(const SerializerElement& element) {
|
||||
currentValue = element.GetChild("value").GetStringValue();
|
||||
type = element.GetChild("type").GetStringValue();
|
||||
label = element.GetChild("label").GetStringValue();
|
||||
description = element.GetChild("description").GetStringValue();
|
||||
|
||||
extraInformation.clear();
|
||||
const SerializerElement& extraInformationElement =
|
||||
|
@@ -16,12 +16,15 @@ namespace gd {
|
||||
/**
|
||||
* \brief Used to describe a property shown in a property grid.
|
||||
* \see gd::Object
|
||||
* \see gd::EffectMetadata
|
||||
*/
|
||||
class GD_CORE_API PropertyDescriptor {
|
||||
public:
|
||||
/**
|
||||
* \brief Create a property being a simple gd::String with the specified
|
||||
* value. \param propertyValue The value of the property.
|
||||
* value.
|
||||
*
|
||||
* \param propertyValue The value of the property.
|
||||
*/
|
||||
PropertyDescriptor(gd::String propertyValue)
|
||||
: currentValue(propertyValue), type("string"), label(""), hidden(false) {}
|
||||
@@ -64,6 +67,14 @@ class GD_CORE_API PropertyDescriptor {
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Change the description displayed to the user, if any.
|
||||
*/
|
||||
PropertyDescriptor& SetDescription(gd::String description_) {
|
||||
description = description_;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Add an information about the property.
|
||||
* \note The information are arbitrary and are interpreted by the class
|
||||
@@ -79,6 +90,7 @@ class GD_CORE_API PropertyDescriptor {
|
||||
const gd::String& GetValue() const { return currentValue; }
|
||||
const gd::String& GetType() const { return type; }
|
||||
const gd::String& GetLabel() const { return label; }
|
||||
const gd::String& GetDescription() const { return description; }
|
||||
const std::vector<gd::String>& GetExtraInfo() const {
|
||||
return extraInformation;
|
||||
}
|
||||
@@ -116,6 +128,7 @@ class GD_CORE_API PropertyDescriptor {
|
||||
type; ///< The type of the property. This is arbitrary and interpreted by
|
||||
///< the class responsible for updating the property grid.
|
||||
gd::String label; //< The user-friendly property name
|
||||
gd::String description; //< The user-friendly property description
|
||||
std::vector<gd::String>
|
||||
extraInformation; ///< Can be used to store for example the available
|
||||
///< choices, if a property is a displayed as a combo
|
||||
|
@@ -425,7 +425,7 @@ class GD_CORE_API ResourcesManager {
|
||||
bool MoveResourceDownInList(const gd::String& name);
|
||||
|
||||
/**
|
||||
* Change the position of the specified resource.
|
||||
* \brief Change the position of the specified resource.
|
||||
*/
|
||||
void MoveResource(std::size_t oldIndex, std::size_t newIndex);
|
||||
|
||||
|
@@ -129,6 +129,11 @@ class SerializableWithNameList {
|
||||
*/
|
||||
bool Has(const gd::String& name) const;
|
||||
|
||||
/**
|
||||
* \brief Get the position of an element in the list
|
||||
*/
|
||||
std::size_t GetPosition(const T& element) const;
|
||||
|
||||
/** \name std::vector-like API
|
||||
* These functions ensure that the class can be used just like a std::vector
|
||||
* for iterations.
|
||||
|
@@ -109,6 +109,15 @@ void SerializableWithNameList<T>::Move(std::size_t oldIndex,
|
||||
elements.insert(elements.begin() + newIndex, std::move(object));
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
std::size_t SerializableWithNameList<T>::GetPosition(const T& element) const {
|
||||
for(std::size_t index = 0;index<elements.size();++index) {
|
||||
if (&element == elements[index].get()) return index;
|
||||
}
|
||||
|
||||
return (size_t)-1;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
void SerializableWithNameList<T>::SerializeElementsTo(
|
||||
const gd::String& elementName, SerializerElement& serializerElement) const {
|
||||
|
122
Core/GDevelop-Architecture-Overview.md
Normal file
122
Core/GDevelop-Architecture-Overview.md
Normal file
@@ -0,0 +1,122 @@
|
||||
# GDevelop Architecture Overview
|
||||
|
||||
GDevelop is architectured around a `Core` library, platforms (`GDJS`, `GDCpp`) and extensions (`Extensions` folder). The editor (`newIDE` folder) is using all of these libraries. This is a recap table of the main folders:
|
||||
|
||||
| Directory | ℹ️ Description |
|
||||
| --- | --- |
|
||||
| `Core` | GDevelop core library, containing common tools to implement the IDE and work with GDevelop games. |
|
||||
| `GDCpp` | GDevelop C++ game engine, used to **build native games**. |
|
||||
| `GDJS` | GDevelop JS game engine, used to build **HTML5 games**. |
|
||||
| `GDevelop.js` | Bindings of Core/GDCpp/GDJS and Extensions to JavaScript (used by the IDE). |
|
||||
| `newIDE` | The game editor, written in JavaScript with React, Electron and Pixi.js. |
|
||||
| `Extensions` | Extensions for C++ or JS game engines, providing objects, events and new features. |
|
||||
|
||||
The rest of this page is an introduction to the main concepts of GDevelop architecture.
|
||||
|
||||
## Some vocabulary: "Runtime" and "IDE"
|
||||
|
||||
**IDE** stands for "Integrated Development Environment". A synonym for it is also simply "editor". In GDevelop, the software itself, that is used to create games and running as an app or a web-app, is called the "GDevelop Editor" or the "GDevelop IDE"
|
||||
|
||||
> This term "IDE" is also used in some folders. When you browse `Core`, `GDCpp` or `GDJS` subfolders, some folders are called `IDE`. They contain classes and tools that are **only useful for the editor** (they are not per se mandatory to describe the structure of a game).
|
||||
|
||||
**Runtime** is a word used to describe classes, tools and source files being used during a game. This could also be called "in game" or a "game engine".
|
||||
|
||||
> When you browse `GDCpp` or `GDJS` subfolders, you can find folders called `Runtime`. They contain the **game engine** of GDevelop.
|
||||
|
||||
Extensions do have the same distinction between the "**IDE**" part and the "**Runtime**" part. For example, most extensions have:
|
||||
|
||||
* A file called [`JsExtension.js`(https://github.com/4ian/GDevelop/blob/master/Extensions/ExampleJsExtension/JsExtension.js)], which contains the *declaration* of the extension for the **IDE**
|
||||
* One or more files implementing the feature for the game, in other words for **Runtime**. This can be a [Runtime Object](https://github.com/4ian/GDevelop/blob/master/Extensions/ExampleJsExtension/dummyruntimeobject.js) or a [Runtime Behavior](https://github.com/4ian/GDevelop/blob/master/Extensions/ExampleJsExtension/dummyruntimebehavior.js), [functions called by actions or conditions](https://github.com/4ian/GDevelop/blob/master/Extensions/ExampleJsExtension/examplejsextensiontools.js) or by the game engine.
|
||||
|
||||
### "Runtime" and "IDE" difference using an example: the `gd::Variable` class
|
||||
|
||||
In GDevelop, developers can associate and manipulate variables in their games. To represent them, we have two things:
|
||||
|
||||
* The **editor** `gd::Variable` that is part of the structure of the game, so living in [GDCore in Variable.h](https://4ian.github.io/GD-Documentation/GDCore%20Documentation/classgd_1_1_variable.html). This is what is shown in the editor, saved on disk in the project file.
|
||||
* The **game engine** variable, called `gdjs.Variable` in GDJS. [Documentation is in the GDJS **game engine**](http://4ian.github.io/GD-Documentation/GDJS%20Runtime%20Documentation/gdjs.Variable.html). This JavaScript class is what is used during a game.
|
||||
|
||||
The editor `gd::Variable` **know nothing** about the game engine class `gdjs.Variable`. And the `gdjs.Variable` class in the game engine know almost nothing from `gd::Variable` (apart from how it's written in JSON, to be able to load a game default variables).
|
||||
|
||||
> Note that the name `gdjs.Variable` is maybe a *bad decision*: it should have been called a `gdjs.RuntimeVariable`, like `gdjs.RuntimeObject` and like most other classes of the game engine.
|
||||
|
||||
## What's inside "Core" (`GDCore` folder)?
|
||||
|
||||
GDevelop "Core" is basically containing everything that is used to **describe and manipulate the structure of a game** (called a `Project` internally). This includes events, scenes, objects, behaviors, events etc... All of these are implemented using C++ classes, in [this folder named `Project`](https://github.com/4ian/GDevelop/tree/master/Core/GDCore/Project).
|
||||
|
||||
GDevelop "Core" also contains **tools** to manipulate these `Project`. In particular, `Core/GDCore/IDE` folder is containing C++ classes allowing to do operations on the structure of a game. For example, [WholeProjectRefactorer](https://github.com/4ian/GDevelop/blob/master/Core/GDCore/IDE/WholeProjectRefactorer.cpp) is a very powerful tool, used to rename all objects in a game, update events after an object is deleted and more generally do Project wide refactoring. The directory contains other "tool" functions to manipulate [resources of projects](https://github.com/4ian/GDevelop/tree/master/Core/GDCore/IDE/Project) or do [search in events](https://github.com/4ian/GDevelop/tree/master/Core/GDCore/IDE/Events).
|
||||
|
||||
## What's inside GDJS? Why do I see some C++ file there?
|
||||
|
||||
While `GDJS/Runtime` folder is the game engine that is executed inside a game, `GDJS/GDJS` is the "IDE" part, which are the C++ classes describing to the editor various things like:
|
||||
|
||||
* How [do you do an export](https://github.com/4ian/GDevelop/tree/master/GDJS/GDJS/IDE),
|
||||
* What are [the default extensions](https://github.com/4ian/GDevelop/tree/master/GDJS/GDJS/Extensions/Builtin),
|
||||
* How do you [generate JS code from events](https://github.com/4ian/GDevelop/tree/master/GDJS/GDJS/Events/CodeGeneration),
|
||||
|
||||
The game engine is in GDJS/Runtime and is all JavaScript.
|
||||
|
||||
## What about events?
|
||||
|
||||
An "**event**" is by default something that [is mostly empty](http://4ian.github.io/GD-Documentation/GDCore%20Documentation/classgd_1_1_base_event.html). In a more traditional programming language, an event can be seen as a scope or block (example: `{ some code here }` in a C style language like JavaScript, Java or C++).
|
||||
|
||||
[Default events are defined](https://github.com/4ian/GDevelop/tree/master/Core/GDCore/Events/Builtin) in GDevelop Core.
|
||||
In particular, there is StandardEvent, which has conditions and actions. Conditions and actions are both a list of [`gd::Instruction`](https://4ian.github.io/GD-Documentation/GDCore%20Documentation/classgd_1_1_instruction.html). A `gd::Instruction` is either a condition or an action (it depends only on the context where they are used).
|
||||
|
||||
A `gd::Instruction` is "just" a type (the name of the action or condition), and some parameters. You can think of it as a function in a programming language (`add(2, 3)` is calling a function called "add" with parameter "2" and "3"). Conditions have the special thing that they are functions returning true or false (and potentially being used to do filter on the objects being picked for next conditions and actions).
|
||||
|
||||
### Why can't I see any "RuntimeEvent" or events during the game?
|
||||
|
||||
They do not exist anymore! ✨
|
||||
|
||||
Events are translated (we also say "transpiled" or "generated") into "real" code in a programming language. This process is called "Code Generation", and is [done here for the JavaScript game engine](https://github.com/4ian/GDevelop/tree/master/GDJS/GDJS/Events/CodeGeneration).
|
||||
|
||||
### Can I extract Events classes and code generator to make a development environment based on GDevelop events?
|
||||
|
||||
You're welcome to do so! Please get in touch :)
|
||||
|
||||
## I can see more than one Extensions folder, why?
|
||||
|
||||
The idea of GDevelop editor and game engine is to have a lean game engine, supporting almost nothing. Then, one can add "mods", "plugins", "modules" for GDevelop. We chose to call them "**Extensions**" in GDevelop.
|
||||
|
||||
* `GDevelop/Core/GDCore/Extensions` is the **declaration** of default (we say "builtin") extensions, that are available for any game and are "mandatory". They are called Extensions but they could be named "Extensions that will always be in your game". In programming languages, this is called a "[Standard Library](https://en.wikipedia.org/wiki/Standard_library)" (but don't get too distracted by this naming).
|
||||
* `GDevelop/GDJS/GDJS/Extensions/` and `GDevelop/GDCpp/GDCpp/Extensions/` are reusing these **declarations** and **adding** their own declarations. Mainly, they are setting the name of the functions to be called (either in JS or in C++) for each action, condition or expression.
|
||||
* `GDevelop/Extensions/` is the folder for the "mods"/"plugins" for GDevelop - the one that are not mandatory. They are not part of GDCore - they work on their own.
|
||||
|
||||
> In theory, all extensions could be moved to `GDevelop/Extensions/`. In practice, it's more pragmatic to have a set of "builtin" extensions with basic features.
|
||||
|
||||
## What's GDevelop.js? Do we care about this?
|
||||
|
||||
Everything in GDevelop.js is meant to create a "bridge" allowing to run and use C++ from JavaScript for the **IDE**, so that [we can write an editor entirely in JavaScript](https://github.com/4ian/GDevelop/tree/master/newIDE) and have it working in a web browser.
|
||||
|
||||
* We're using Emscripten which is compiling C++, but instead of writing a "native binary", it's writing a file that works in a browser (basically, JavaScript!).
|
||||
|
||||
* The most useful file is [Bindings.idl](https://github.com/4ian/GDevelop/blob/master/GDevelop.js/Bindings/Bindings.idl) that is describing everything in C++ that must be exposed to JavaScript (in the editor, not in game. Remember that during the game, we're at **Runtime**, so all of this does not exist anymore)
|
||||
|
||||
* Rest of the files are mostly bridges doing "weird stuff" to translate from JS to C++ or vice versa. It requires a bit of knowledge about how the ["bridge", made by Emscripten, called WebIDL](https://emscripten.org/docs/porting/connecting_cpp_and_javascript/WebIDL-Binder.html) is working.
|
||||
|
||||
You don't need to work with these unless you want to expose something that is written in C++ to the editor, and writing the interface in Bindings.idl is not sufficient.
|
||||
|
||||
90% of the time, you can just read or write about a class in [Bindings.idl](https://github.com/4ian/GDevelop/blob/master/GDevelop.js/Bindings/Bindings.idl). If you work in C++ classes, you may have sometime to add a header file in Wrapper.cpp and your C++ class is "automagically" compiled and available in JavaScript after writing the corresponding interface in Bindings.idl.
|
||||
|
||||
### I want all the gory details about GDevelop.js 🧐
|
||||
|
||||
All the required C++ files are imported into this huge list: https://github.com/4ian/GDevelop/blob/master/GDevelop.js/Bindings/Wrapper.cpp#L1-L79. C++ compilation is done with a "build system" called CMake, which is using [this file](https://github.com/4ian/GDevelop/blob/master/GDevelop.js/CMakeLists.txt#L82-L101) to see what to compile.
|
||||
|
||||
> In an ideal world, there would be something to do this automatically, so GDevelop.js folder would not even exist 😉
|
||||
> If you're interested and want to know more about GDevelop.js bridging between C++ and JavaScript, look at [this talk from GDevelop original author](https://www.youtube.com/watch?v=6La7jSCnYyk).
|
||||
|
||||
## Misc questions
|
||||
|
||||
### What's the deal with C++? Why so much of it?
|
||||
|
||||
GDevelop was originally written in C++. It's a scary language at first but is portable across almost any existing machine in this universe, can be pretty good, safe and readable with the latest C++ features.
|
||||
|
||||
### What's the deal with JavaScript? Why so much of it?
|
||||
|
||||
JavaScript, with the latest language proposals, is actually a very capable language, fast to write and safe with typing:
|
||||
|
||||
* Performance is getting pretty good with recent browsers JIT features.
|
||||
* Frontend frameworks like React, used for GDevelop IDE, allow for very fast and modular interface development.
|
||||
* The web is an incredible and unmatched target when it comes to cross platform (and cross form factor) apps.
|
||||
|
||||
More generally, the web is a great target for games with the rise of WebGL and WebAssembly - though GDevelop should stay modular to adapt to newer platforms for the exported games in the future.
|
@@ -44,10 +44,6 @@ class MockFileSystem : public gd::AbstractFileSystem {
|
||||
virtual bool CopyFile(const gd::String& file, const gd::String& destination) {
|
||||
return true;
|
||||
}
|
||||
virtual bool CopyDir(const gd::String& source,
|
||||
const gd::String& destination) {
|
||||
return true;
|
||||
}
|
||||
virtual bool ClearDir(const gd::String& directory) { return true; }
|
||||
virtual bool WriteToFile(const gd::String& file, const gd::String& content) {
|
||||
return true;
|
||||
|
@@ -48,6 +48,10 @@ gd::EventsFunctionsExtension &SetupProjectWithEventsFunctionExtension(
|
||||
gd::StandardEvent event;
|
||||
gd::Instruction instruction;
|
||||
instruction.SetType("MyEventsExtension::MyEventsFunction");
|
||||
instruction.SetParametersCount(3);
|
||||
instruction.SetParameter(0, gd::Expression("First parameter"));
|
||||
instruction.SetParameter(1, gd::Expression("Second parameter"));
|
||||
instruction.SetParameter(2, gd::Expression("Third parameter"));
|
||||
event.GetActions().Insert(instruction);
|
||||
layout.GetEvents().InsertEvent(event);
|
||||
}
|
||||
@@ -62,7 +66,7 @@ gd::EventsFunctionsExtension &SetupProjectWithEventsFunctionExtension(
|
||||
instruction.SetParameter(
|
||||
0,
|
||||
gd::Expression(
|
||||
"1 + MyEventsExtension::MyEventsFunctionExpression(123)"));
|
||||
"1 + MyEventsExtension::MyEventsFunctionExpression(123, 456)"));
|
||||
event.GetActions().Insert(instruction);
|
||||
externalEvents.GetEvents().InsertEvent(event);
|
||||
}
|
||||
@@ -114,6 +118,10 @@ gd::EventsFunctionsExtension &SetupProjectWithEventsFunctionExtension(
|
||||
gd::Instruction instruction;
|
||||
instruction.SetType(
|
||||
"MyEventsExtension::MyEventsBasedBehavior::MyBehaviorEventsFunction");
|
||||
instruction.SetParametersCount(3);
|
||||
instruction.SetParameter(0, gd::Expression("First parameter"));
|
||||
instruction.SetParameter(1, gd::Expression("Second parameter"));
|
||||
instruction.SetParameter(2, gd::Expression("Third parameter"));
|
||||
event.GetActions().Insert(instruction);
|
||||
layout.GetEvents().InsertEvent(event);
|
||||
}
|
||||
@@ -131,7 +139,7 @@ gd::EventsFunctionsExtension &SetupProjectWithEventsFunctionExtension(
|
||||
}
|
||||
|
||||
// Create an event in ExternalEvents1 referring to
|
||||
// MyEventsExtension::MyEventsFunctionExpression
|
||||
// MyEventsExtension::MyEventsBasedBehavior::MyBehaviorEventsFunctionExpression
|
||||
{
|
||||
gd::StandardEvent event;
|
||||
gd::Instruction instruction;
|
||||
@@ -141,7 +149,7 @@ gd::EventsFunctionsExtension &SetupProjectWithEventsFunctionExtension(
|
||||
0,
|
||||
gd::Expression("1 + "
|
||||
"ObjectWithMyBehavior::MyBehavior."
|
||||
"MyBehaviorEventsFunctionExpression(123)"));
|
||||
"MyBehaviorEventsFunctionExpression(123, 456, 789)"));
|
||||
event.GetActions().Insert(instruction);
|
||||
externalEvents.GetEvents().InsertEvent(event);
|
||||
}
|
||||
@@ -486,7 +494,7 @@ TEST_CASE("WholeProjectRefactorer", "[common]") {
|
||||
.Get(0)
|
||||
.GetParameter(0)
|
||||
.GetPlainString() ==
|
||||
"1 + MyRenamedExtension::MyEventsFunctionExpression(123)");
|
||||
"1 + MyRenamedExtension::MyEventsFunctionExpression(123, 456)");
|
||||
|
||||
// Check that the type of the behavior was changed in the behaviors of
|
||||
// objects. Name is *not* changed.
|
||||
@@ -534,7 +542,7 @@ TEST_CASE("WholeProjectRefactorer", "[common]") {
|
||||
.GetPlainString() ==
|
||||
"1 + "
|
||||
"ObjectWithMyBehavior::MyBehavior."
|
||||
"MyBehaviorEventsFunctionExpression(123)");
|
||||
"MyBehaviorEventsFunctionExpression(123, 456, 789)");
|
||||
}
|
||||
SECTION("(Free) events function renamed") {
|
||||
gd::Project project;
|
||||
@@ -570,7 +578,45 @@ TEST_CASE("WholeProjectRefactorer", "[common]") {
|
||||
.Get(0)
|
||||
.GetParameter(0)
|
||||
.GetPlainString() ==
|
||||
"1 + MyEventsExtension::MyRenamedFunctionExpression(123)");
|
||||
"1 + MyEventsExtension::MyRenamedFunctionExpression(123, 456)");
|
||||
}
|
||||
SECTION("(Free) events function parameter moved") {
|
||||
gd::Project project;
|
||||
gd::Platform platform;
|
||||
SetupProjectWithDummyPlatform(project, platform);
|
||||
auto &eventsExtension = SetupProjectWithEventsFunctionExtension(project);
|
||||
|
||||
gd::WholeProjectRefactorer::MoveEventsFunctionParameter(project,
|
||||
eventsExtension,
|
||||
"MyEventsFunction",
|
||||
0, 2);
|
||||
gd::WholeProjectRefactorer::MoveEventsFunctionParameter(
|
||||
project,
|
||||
eventsExtension,
|
||||
"MyEventsFunctionExpression",
|
||||
0, 1);
|
||||
|
||||
// Check that events function calls in instructions have been updated
|
||||
auto& action = static_cast<gd::StandardEvent &>(
|
||||
project.GetLayout("LayoutWithFreeFunctions")
|
||||
.GetEvents()
|
||||
.GetEvent(0))
|
||||
.GetActions()
|
||||
.Get(0);
|
||||
REQUIRE(action.GetParameter(0).GetPlainString() == "Second parameter");
|
||||
REQUIRE(action.GetParameter(1).GetPlainString() == "Third parameter");
|
||||
REQUIRE(action.GetParameter(2).GetPlainString() == "First parameter");
|
||||
|
||||
// Check that events function calls in expressions have been updated
|
||||
REQUIRE(static_cast<gd::StandardEvent &>(
|
||||
project.GetExternalEvents("ExternalEventsWithFreeFunctions")
|
||||
.GetEvents()
|
||||
.GetEvent(0))
|
||||
.GetActions()
|
||||
.Get(0)
|
||||
.GetParameter(0)
|
||||
.GetPlainString() ==
|
||||
"1 + MyEventsExtension::MyEventsFunctionExpression(456, 123)");
|
||||
}
|
||||
SECTION("Events based Behavior type renamed") {
|
||||
gd::Project project;
|
||||
@@ -634,7 +680,7 @@ TEST_CASE("WholeProjectRefactorer", "[common]") {
|
||||
.GetPlainString() ==
|
||||
"1 + "
|
||||
"ObjectWithMyBehavior::MyBehavior."
|
||||
"MyBehaviorEventsFunctionExpression(123)");
|
||||
"MyBehaviorEventsFunctionExpression(123, 456, 789)");
|
||||
}
|
||||
SECTION("(Events based Behavior) events function renamed") {
|
||||
gd::Project project;
|
||||
@@ -681,7 +727,54 @@ TEST_CASE("WholeProjectRefactorer", "[common]") {
|
||||
.GetPlainString() ==
|
||||
"1 + "
|
||||
"ObjectWithMyBehavior::MyBehavior."
|
||||
"MyRenamedBehaviorEventsFunctionExpression(123)");
|
||||
"MyRenamedBehaviorEventsFunctionExpression(123, 456, 789)");
|
||||
}
|
||||
SECTION("(Events based Behavior) events function parameter moved") {
|
||||
gd::Project project;
|
||||
gd::Platform platform;
|
||||
SetupProjectWithDummyPlatform(project, platform);
|
||||
auto &eventsExtension = SetupProjectWithEventsFunctionExtension(project);
|
||||
auto &eventsBasedBehavior =
|
||||
eventsExtension.GetEventsBasedBehaviors().Get("MyEventsBasedBehavior");
|
||||
|
||||
gd::WholeProjectRefactorer::MoveBehaviorEventsFunctionParameter(
|
||||
project,
|
||||
eventsExtension,
|
||||
eventsBasedBehavior,
|
||||
"MyBehaviorEventsFunction",
|
||||
0, 2);
|
||||
gd::WholeProjectRefactorer::MoveBehaviorEventsFunctionParameter(
|
||||
project,
|
||||
eventsExtension,
|
||||
eventsBasedBehavior,
|
||||
"MyBehaviorEventsFunctionExpression",
|
||||
0, 2);
|
||||
|
||||
// Check if events based behaviors functions have been renamed in
|
||||
// instructions
|
||||
auto& action = static_cast<gd::StandardEvent &>(
|
||||
project.GetLayout("LayoutWithBehaviorFunctions")
|
||||
.GetEvents()
|
||||
.GetEvent(0))
|
||||
.GetActions()
|
||||
.Get(0);
|
||||
REQUIRE(action.GetParameter(0).GetPlainString() == "Second parameter");
|
||||
REQUIRE(action.GetParameter(1).GetPlainString() == "Third parameter");
|
||||
REQUIRE(action.GetParameter(2).GetPlainString() == "First parameter");
|
||||
|
||||
// Check events based behaviors functions have been renamed in
|
||||
// expressions
|
||||
REQUIRE(static_cast<gd::StandardEvent &>(
|
||||
project.GetExternalEvents("ExternalEventsWithBehaviorFunctions")
|
||||
.GetEvents()
|
||||
.GetEvent(0))
|
||||
.GetActions()
|
||||
.Get(0)
|
||||
.GetParameter(0)
|
||||
.GetPlainString() ==
|
||||
"1 + "
|
||||
"ObjectWithMyBehavior::MyBehavior."
|
||||
"MyBehaviorEventsFunctionExpression(456, 789, 123)");
|
||||
}
|
||||
SECTION("(Events based Behavior) property renamed") {
|
||||
gd::Project project;
|
||||
|
@@ -5,15 +5,13 @@ if(GIT_FOUND)
|
||||
execute_process(
|
||||
COMMAND ${GIT_EXECUTABLE} clone "https://www.github.com/SFML/SFML.git" SFML
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/
|
||||
ERROR_QUIET
|
||||
OUTPUT_QUIET)
|
||||
|
||||
message( "Resetting SFML source code to version 2.4.1..." )
|
||||
execute_process(
|
||||
COMMAND ${GIT_EXECUTABLE} reset --hard 2.4.1
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/SFML
|
||||
ERROR_QUIET
|
||||
OUTPUT_QUIET)
|
||||
OUTPUT_QUIET)
|
||||
|
||||
message( "Applying the patches..." )
|
||||
file(GLOB SFML_PATCHES
|
||||
@@ -26,9 +24,8 @@ if(GIT_FOUND)
|
||||
foreach(SFML_PATCH ${SFML_PATCHES})
|
||||
message( "Applying patch: ${SFML_PATCH}..." )
|
||||
execute_process(
|
||||
COMMAND ${GIT_EXECUTABLE} apply ${SFML_PATCH}
|
||||
COMMAND ${GIT_EXECUTABLE} apply ${SFML_PATCH} --ignore-whitespace
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/SFML
|
||||
ERROR_QUIET
|
||||
OUTPUT_QUIET)
|
||||
endforeach()
|
||||
endif()
|
||||
|
4
Extensions/.prettierrc
Normal file
4
Extensions/.prettierrc
Normal file
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"singleQuote": true,
|
||||
"trailingComma": "es5"
|
||||
}
|
@@ -7,9 +7,9 @@ This project is released under the MIT License.
|
||||
#include "AnchorBehavior.h"
|
||||
#include <map>
|
||||
#include "GDCore/CommonTools.h"
|
||||
#include "GDCore/Tools/Localization.h"
|
||||
#include "GDCore/Serialization/SerializerElement.h"
|
||||
#include "GDCore/Project/PropertyDescriptor.h"
|
||||
#include "GDCore/Serialization/SerializerElement.h"
|
||||
#include "GDCore/Tools/Localization.h"
|
||||
|
||||
void AnchorBehavior::InitializeContent(gd::SerializerElement& content) {
|
||||
content.SetAttribute("relativeToOriginalWindowSize", true);
|
||||
@@ -51,11 +51,14 @@ std::map<gd::String, gd::PropertyDescriptor> AnchorBehavior::GetProperties(
|
||||
const gd::SerializerElement& behaviorContent, gd::Project& project) const {
|
||||
std::map<gd::String, gd::PropertyDescriptor> properties;
|
||||
|
||||
properties[_("Relative to original window size")]
|
||||
properties[_("relativeToOriginalWindowSize")]
|
||||
.SetValue(behaviorContent.GetBoolAttribute("relativeToOriginalWindowSize")
|
||||
? "true"
|
||||
: "false")
|
||||
.SetType("Boolean");
|
||||
.SetType("Boolean")
|
||||
.SetLabel(_("Anchor relatively to original window size"))
|
||||
.SetDescription(_("otherwise, objects are anchored according to the "
|
||||
"window size when the object is created."));
|
||||
|
||||
properties[_("Left edge anchor")]
|
||||
.SetValue(GetAnchorAsString(static_cast<HorizontalAnchor>(
|
||||
@@ -64,7 +67,8 @@ std::map<gd::String, gd::PropertyDescriptor> AnchorBehavior::GetProperties(
|
||||
.AddExtraInfo(_("No anchor"))
|
||||
.AddExtraInfo(_("Window left"))
|
||||
.AddExtraInfo(_("Window right"))
|
||||
.AddExtraInfo(_("Proportional"));
|
||||
.AddExtraInfo(_("Proportional"))
|
||||
.SetDescription(_("Use this to anchor the object on X axis."));
|
||||
|
||||
properties[_("Right edge anchor")]
|
||||
.SetValue(GetAnchorAsString(static_cast<HorizontalAnchor>(
|
||||
@@ -82,7 +86,8 @@ std::map<gd::String, gd::PropertyDescriptor> AnchorBehavior::GetProperties(
|
||||
.AddExtraInfo(_("No anchor"))
|
||||
.AddExtraInfo(_("Window top"))
|
||||
.AddExtraInfo(_("Window bottom"))
|
||||
.AddExtraInfo(_("Proportional"));
|
||||
.AddExtraInfo(_("Proportional"))
|
||||
.SetDescription(_("Use this to anchor the object on Y axis."));
|
||||
|
||||
properties[_("Bottom edge anchor")]
|
||||
.SetValue(GetAnchorAsString(static_cast<VerticalAnchor>(
|
||||
@@ -126,7 +131,7 @@ bool AnchorBehavior::UpdateProperty(gd::SerializerElement& behaviorContent,
|
||||
const gd::String& name,
|
||||
const gd::String& value,
|
||||
gd::Project& project) {
|
||||
if (name == _("Relative to original window size"))
|
||||
if (name == _("relativeToOriginalWindowSize"))
|
||||
behaviorContent.SetAttribute("relativeToOriginalWindowSize", value == "1");
|
||||
else if (name == _("Left edge anchor"))
|
||||
behaviorContent.SetAttribute(
|
||||
|
@@ -46,8 +46,8 @@ gdjs.AnchorRuntimeBehavior.prototype.onActivate = function() {
|
||||
|
||||
gdjs.AnchorRuntimeBehavior.prototype.doStepPreEvents = function(runtimeScene) {
|
||||
var game = runtimeScene.getGame();
|
||||
var rendererWidth = game.getRenderer().getCurrentWidth();
|
||||
var rendererHeight = game.getRenderer().getCurrentHeight();
|
||||
var rendererWidth = game.getGameResolutionWidth();
|
||||
var rendererHeight = game.getGameResolutionHeight();
|
||||
var layer = runtimeScene.getLayer(this.owner.getLayer());
|
||||
|
||||
if(this._invalidDistances)
|
||||
@@ -147,13 +147,13 @@ gdjs.AnchorRuntimeBehavior.prototype.doStepPreEvents = function(runtimeScene) {
|
||||
var bottomRightCoord = layer.convertInverseCoords(rightPixel, bottomPixel);
|
||||
|
||||
//Move and resize the object according to the anchors
|
||||
if(this._rightEdgeAnchor != gdjs.AnchorRuntimeBehavior.HorizontalAnchor.NONE)
|
||||
if(this._rightEdgeAnchor !== gdjs.AnchorRuntimeBehavior.HorizontalAnchor.NONE)
|
||||
this.owner.setWidth(bottomRightCoord[0] - topLeftCoord[0]);
|
||||
if(this._bottomEdgeAnchor != gdjs.AnchorRuntimeBehavior.VerticalAnchor.NONE)
|
||||
if(this._bottomEdgeAnchor !== gdjs.AnchorRuntimeBehavior.VerticalAnchor.NONE)
|
||||
this.owner.setHeight(bottomRightCoord[1] - topLeftCoord[1]);
|
||||
if(this._leftEdgeAnchor != gdjs.AnchorRuntimeBehavior.HorizontalAnchor.NONE)
|
||||
if(this._leftEdgeAnchor !== gdjs.AnchorRuntimeBehavior.HorizontalAnchor.NONE)
|
||||
this.owner.setX(topLeftCoord[0] + this.owner.getX() - this.owner.getDrawableX());
|
||||
if(this._topEdgeAnchor != gdjs.AnchorRuntimeBehavior.VerticalAnchor.NONE)
|
||||
if(this._topEdgeAnchor !== gdjs.AnchorRuntimeBehavior.VerticalAnchor.NONE)
|
||||
this.owner.setY(topLeftCoord[1] + this.owner.getY() - this.owner.getDrawableY());
|
||||
}
|
||||
};
|
||||
|
581
Extensions/BBText/JsExtension.js
Normal file
581
Extensions/BBText/JsExtension.js
Normal file
@@ -0,0 +1,581 @@
|
||||
/**
|
||||
* This is a declaration of an extension for GDevelop 5.
|
||||
*
|
||||
* ℹ️ Run `node import-GDJS-Runtime.js` (in newIDE/app/scripts) if you make any change
|
||||
* to this extension file or to any other *.js file that you reference inside.
|
||||
*
|
||||
* The file must be named "JsExtension.js", otherwise GDevelop won't load it.
|
||||
* ⚠️ If you make a change and the extension is not loaded, open the developer console
|
||||
* and search for any errors.
|
||||
*
|
||||
* More information on https://github.com/4ian/GDevelop/blob/master/newIDE/README-extensions.md
|
||||
*/
|
||||
|
||||
module.exports = {
|
||||
createExtension: function(_, gd) {
|
||||
const extension = new gd.PlatformExtension();
|
||||
extension
|
||||
.setExtensionInformation(
|
||||
'BBText',
|
||||
_('BBCode Text Object'),
|
||||
_(
|
||||
'Displays a rich text label using BBCode markup (allowing to set parts of the text as bold, italic, use different colors and shadows).'
|
||||
),
|
||||
'Todor Imreorov',
|
||||
'Open source (MIT License)'
|
||||
)
|
||||
.setExtensionHelpPath('/objects/bbtext');
|
||||
|
||||
var objectBBText = new gd.ObjectJsImplementation();
|
||||
objectBBText.updateProperty = function(
|
||||
objectContent,
|
||||
propertyName,
|
||||
newValue
|
||||
) {
|
||||
if (propertyName in objectContent) {
|
||||
if (typeof objectContent[propertyName] === 'boolean')
|
||||
objectContent[propertyName] = newValue === '1';
|
||||
else objectContent[propertyName] = newValue;
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
};
|
||||
objectBBText.getProperties = function(objectContent) {
|
||||
var objectProperties = new gd.MapStringPropertyDescriptor();
|
||||
|
||||
objectProperties.set(
|
||||
'text',
|
||||
new gd.PropertyDescriptor(objectContent.text)
|
||||
.setType('textarea')
|
||||
.setLabel(_('BBCode text'))
|
||||
);
|
||||
|
||||
objectProperties.set(
|
||||
'color',
|
||||
new gd.PropertyDescriptor(objectContent.color)
|
||||
.setType('color')
|
||||
.setLabel(_('Base color'))
|
||||
);
|
||||
|
||||
objectProperties.set(
|
||||
'opacity',
|
||||
new gd.PropertyDescriptor(objectContent.opacity.toString())
|
||||
.setType('number')
|
||||
.setLabel(_('Opacity (0-255)'))
|
||||
);
|
||||
|
||||
objectProperties.set(
|
||||
'fontSize',
|
||||
new gd.PropertyDescriptor(objectContent.fontSize)
|
||||
.setType('number')
|
||||
.setLabel(_('Base size'))
|
||||
);
|
||||
|
||||
objectProperties.set(
|
||||
'align',
|
||||
new gd.PropertyDescriptor(objectContent.align)
|
||||
.setType('choice')
|
||||
.addExtraInfo('left')
|
||||
.addExtraInfo('center')
|
||||
.addExtraInfo('right')
|
||||
.setLabel(_('Base alignment'))
|
||||
);
|
||||
|
||||
objectProperties.set(
|
||||
'fontFamily',
|
||||
new gd.PropertyDescriptor(objectContent.fontFamily)
|
||||
.setType('string')
|
||||
.setLabel(_('Base font family'))
|
||||
);
|
||||
|
||||
objectProperties.set(
|
||||
'wordWrap',
|
||||
new gd.PropertyDescriptor(objectContent.wordWrap ? 'true' : 'false')
|
||||
.setType('boolean')
|
||||
.setLabel(_('Word wrapping'))
|
||||
);
|
||||
|
||||
objectProperties.set(
|
||||
'visible',
|
||||
new gd.PropertyDescriptor(objectContent.visible ? 'true' : 'false')
|
||||
.setType('boolean')
|
||||
.setLabel(_('Visible on start'))
|
||||
);
|
||||
|
||||
return objectProperties;
|
||||
};
|
||||
objectBBText.setRawJSONContent(
|
||||
JSON.stringify({
|
||||
text:
|
||||
'[b]bold[/b] [i]italic[/i] [size=15]smaller[/size] [font=times]times[/font] font\n[spacing=12]spaced out[/spacing]\n[outline=yellow]outlined[/outline] [shadow=red]DropShadow[/shadow] ',
|
||||
opacity: 255,
|
||||
fontSize: '20',
|
||||
visible: true,
|
||||
color: '#000000',
|
||||
fontFamily: 'Arial',
|
||||
align: 'left',
|
||||
wordWrap: true,
|
||||
})
|
||||
);
|
||||
|
||||
objectBBText.updateInitialInstanceProperty = function(
|
||||
objectContent,
|
||||
instance,
|
||||
propertyName,
|
||||
newValue,
|
||||
project,
|
||||
layout
|
||||
) {
|
||||
return false;
|
||||
};
|
||||
objectBBText.getInitialInstanceProperties = function(
|
||||
content,
|
||||
instance,
|
||||
project,
|
||||
layout
|
||||
) {
|
||||
var instanceProperties = new gd.MapStringPropertyDescriptor();
|
||||
return instanceProperties;
|
||||
};
|
||||
|
||||
const object = extension
|
||||
.addObject(
|
||||
'BBText',
|
||||
_('BBText'),
|
||||
_(
|
||||
'Displays a rich text label using BBCode markup (allowing to set parts of the text as bold, italic, use different colors and shadows).'
|
||||
),
|
||||
'JsPlatform/Extensions/bbcode32.png',
|
||||
objectBBText
|
||||
)
|
||||
.setIncludeFile('Extensions/BBText/bbtextruntimeobject.js')
|
||||
.addIncludeFile('Extensions/BBText/bbtextruntimeobject-pixi-renderer.js')
|
||||
.addIncludeFile(
|
||||
'Extensions/BBText/pixi-multistyle-text/dist/pixi-multistyle-text.umd.js'
|
||||
);
|
||||
|
||||
/**
|
||||
* Utility function to add both a setter and a getter to a property from a list.
|
||||
* Useful for setting multiple generic properties.
|
||||
*/
|
||||
const addSettersAndGettersToObject = (gdObject, properties, objectName) => {
|
||||
properties.forEach(property => {
|
||||
const parameterType =
|
||||
property.type === 'boolean' ? 'yesorno' : property.type;
|
||||
|
||||
// Add the expression
|
||||
if (parameterType === 'number') {
|
||||
gdObject
|
||||
.addExpression(
|
||||
`Get${property.functionName}`,
|
||||
property.expressionLabel,
|
||||
property.expressionDescription,
|
||||
'',
|
||||
'',
|
||||
property.iconPath,
|
||||
property.iconPath
|
||||
)
|
||||
.addParameter('object', objectName, objectName, false)
|
||||
.getCodeExtraInformation()
|
||||
.setFunctionName(`get${property.functionName}`);
|
||||
} else if (parameterType === 'string') {
|
||||
gdObject
|
||||
.addStrExpression(
|
||||
`Get${property.functionName}`,
|
||||
property.expressionLabel,
|
||||
property.expressionDescription,
|
||||
'',
|
||||
'',
|
||||
property.iconPath,
|
||||
property.iconPath
|
||||
)
|
||||
.addParameter('object', objectName, objectName, false)
|
||||
.getCodeExtraInformation()
|
||||
.setFunctionName(`get${property.functionName}`);
|
||||
}
|
||||
|
||||
// Add the action
|
||||
if (parameterType === 'number' || parameterType === 'string') {
|
||||
const expressionType =
|
||||
parameterType === 'number' ? 'expression' : 'string';
|
||||
gdObject
|
||||
.addAction(
|
||||
`Set${property.functionName}`,
|
||||
property.paramLabel,
|
||||
property.actionDescription,
|
||||
property.actionSentence,
|
||||
'',
|
||||
property.iconPath,
|
||||
property.iconPath
|
||||
)
|
||||
.addParameter('object', objectName, objectName, false)
|
||||
.useStandardOperatorParameters(parameterType)
|
||||
.getCodeExtraInformation()
|
||||
.setFunctionName(`set${property.functionName}`)
|
||||
.setGetter(`get${property.functionName}`);
|
||||
} else {
|
||||
gdObject
|
||||
.addAction(
|
||||
`Set${property.functionName}`,
|
||||
property.paramLabel,
|
||||
property.actionDescription,
|
||||
property.actionSentence,
|
||||
'',
|
||||
property.iconPath,
|
||||
property.iconPath
|
||||
)
|
||||
.addParameter('object', objectName, objectName, false)
|
||||
.addParameter(
|
||||
parameterType,
|
||||
property.paramLabel,
|
||||
property.options
|
||||
? '["' + property.options.join('", "') + '"]'
|
||||
: '',
|
||||
false
|
||||
)
|
||||
.getCodeExtraInformation()
|
||||
.setFunctionName(`set${property.functionName}`)
|
||||
.setGetter(`get${property.functionName}`);
|
||||
}
|
||||
|
||||
// Add condition
|
||||
if (parameterType === 'string' || parameterType === 'number') {
|
||||
const propExpressionType =
|
||||
parameterType === 'string' ? 'string' : 'expression';
|
||||
gdObject
|
||||
.addCondition(
|
||||
`Is${property.functionName}`,
|
||||
property.paramLabel,
|
||||
property.conditionDescription,
|
||||
property.conditionSentence,
|
||||
'',
|
||||
property.iconPath,
|
||||
property.iconPath
|
||||
)
|
||||
.addParameter('object', objectName, objectName, false)
|
||||
.useStandardRelationalOperatorParameters(parameterType)
|
||||
.getCodeExtraInformation()
|
||||
.setFunctionName(`get${property.functionName}`);
|
||||
} else if (parameterType === 'yesorno') {
|
||||
gdObject
|
||||
.addCondition(
|
||||
`Is${property.functionName}`,
|
||||
property.paramLabel,
|
||||
property.conditionDescription,
|
||||
property.conditionSentence,
|
||||
'',
|
||||
property.iconPath,
|
||||
property.iconPath
|
||||
)
|
||||
.addParameter('object', objectName, objectName, false)
|
||||
.getCodeExtraInformation()
|
||||
.setFunctionName(`get${property.functionName}`);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
const setterAndGetterProperties = [
|
||||
{
|
||||
functionName: 'BBText',
|
||||
iconPath: 'res/actions/text24.png',
|
||||
type: 'string',
|
||||
paramLabel: _('BBCode text'),
|
||||
conditionDescription: _('Compare the value of the BBCode text.'),
|
||||
conditionSentence: _('the BBCode text'),
|
||||
actionDescription: _('Set BBCode text'),
|
||||
actionSentence: _('the BBCode text'),
|
||||
expressionLabel: _('Get BBCode text'),
|
||||
expressionDescription: _('Get BBCode text'),
|
||||
},
|
||||
{
|
||||
functionName: 'Color',
|
||||
iconPath: 'res/actions/color24.png',
|
||||
type: 'color',
|
||||
paramLabel: _('Color'),
|
||||
conditionDescription: '', // No conditions for a "color" property
|
||||
conditionSentence: '', // No conditions for a "color" property
|
||||
actionDescription: _('Set base color'),
|
||||
actionSentence: _('Set base color of _PARAM0_ to _PARAM1_'),
|
||||
expressionLabel: '', // No expression for a "color" property
|
||||
expressionDescription: '', // No expression for a "color" property
|
||||
},
|
||||
{
|
||||
functionName: 'Opacity',
|
||||
iconPath: 'res/actions/opacity24.png',
|
||||
type: 'number',
|
||||
paramLabel: _('Opacity'),
|
||||
conditionDescription: _(
|
||||
'Compare the value of the base opacity of the text.'
|
||||
),
|
||||
conditionSentence: _('the base opacity'),
|
||||
actionDescription: _('Set base opacity'),
|
||||
actionSentence: _('the base opacity'),
|
||||
expressionLabel: _('Get the base opacity'),
|
||||
expressionDescription: _('Get the base opacity'),
|
||||
},
|
||||
{
|
||||
functionName: 'FontSize',
|
||||
iconPath: 'res/actions/characterSize24.png',
|
||||
type: 'number',
|
||||
paramLabel: _('Font size'),
|
||||
conditionDescription: _('Compare the base font size of the text.'),
|
||||
conditionSentence: _('the base font size'),
|
||||
actionDescription: _('Set base font size'),
|
||||
actionSentence: _('the base font size'),
|
||||
expressionLabel: _('Get the base font size'),
|
||||
expressionDescription: _('Get the base font size'),
|
||||
},
|
||||
{
|
||||
functionName: 'FontFamily',
|
||||
iconPath: 'res/actions/font24.png',
|
||||
type: 'string',
|
||||
paramLabel: _('Font family'),
|
||||
conditionDescription: _('Compare the value of font family'),
|
||||
conditionSentence: _('the base font family'),
|
||||
actionDescription: _('Set font family'),
|
||||
actionSentence: _('the base font family'),
|
||||
expressionLabel: _('Get the base font family'),
|
||||
expressionDescription: _('Get the base font family'),
|
||||
},
|
||||
{
|
||||
functionName: 'Alignment',
|
||||
iconPath: 'res/actions/textAlign24.png',
|
||||
type: 'stringWithSelector',
|
||||
paramLabel: _('Alignment'),
|
||||
options: ['left', 'right', 'center'],
|
||||
conditionDescription: _('Check the current text alignment'),
|
||||
conditionSentence: _('The text alignment of _PARAM0_ is _PARAM1_'),
|
||||
actionDescription: _('Change the alignment of the text.'),
|
||||
actionSentence: _('Set text alignment of _PARAM0_ to _PARAM1_'),
|
||||
expressionLabel: _('Get the text alignment'),
|
||||
expressionDescription: _('Get the text alignment'),
|
||||
},
|
||||
{
|
||||
functionName: 'WordWrap',
|
||||
iconPath: 'res/actions/scaleWidth24.png',
|
||||
type: 'boolean',
|
||||
paramLabel: _('Word wrap'),
|
||||
conditionDescription: _('Check if word wrap is enabled'),
|
||||
conditionSentence: _('Word wrap is enabled'),
|
||||
actionDescription: _('Set word wrap'),
|
||||
actionSentence: _('Activate word wrap for _PARAM0_: _PARAM1_'),
|
||||
expressionLabel: '',
|
||||
expressionDescription: '',
|
||||
},
|
||||
{
|
||||
functionName: 'WrappingWidth',
|
||||
iconPath: 'res/actions/scaleWidth24.png',
|
||||
type: 'number',
|
||||
paramLabel: _('Wrapping width'),
|
||||
conditionDescription: _(
|
||||
'Compare the width, in pixels, after which the text is wrapped on next line.'
|
||||
),
|
||||
conditionSentence: _('the wrapping width'),
|
||||
actionDescription: _(
|
||||
'Change the width, in pixels, after which the text is wrapped on next line.'
|
||||
),
|
||||
actionSentence: _('the wrapping width'),
|
||||
expressionLabel: _('Get the wrapping width'),
|
||||
expressionDescription: _('Get the wrapping width'),
|
||||
},
|
||||
];
|
||||
|
||||
addSettersAndGettersToObject(object, setterAndGetterProperties, 'BBText');
|
||||
|
||||
return extension;
|
||||
},
|
||||
|
||||
/**
|
||||
* You can optionally add sanity tests that will check the basic working
|
||||
* of your extension behaviors/objects by instanciating behaviors/objects
|
||||
* and setting the property to a given value.
|
||||
*
|
||||
* If you don't have any tests, you can simply return an empty array like this:
|
||||
* `runExtensionSanityTests: function(gd, extension) { return []; }`
|
||||
*
|
||||
* But it is recommended to create tests for the behaviors/objects properties you created
|
||||
* to avoid mistakes.
|
||||
*/
|
||||
runExtensionSanityTests: function(gd, extension) {
|
||||
return [];
|
||||
},
|
||||
/**
|
||||
* Register editors for objects.
|
||||
*
|
||||
* ℹ️ Run `node import-GDJS-Runtime.js` (in newIDE/app/scripts) if you make any change.
|
||||
*/
|
||||
registerEditorConfigurations: function(objectsEditorService) {
|
||||
objectsEditorService.registerEditorConfiguration(
|
||||
'BBText::BBText',
|
||||
objectsEditorService.getDefaultObjectJsImplementationPropertiesEditor({
|
||||
helpPagePath: '/objects/bbtext_object',
|
||||
})
|
||||
);
|
||||
},
|
||||
/**
|
||||
* Register renderers for instance of objects on the scene editor.
|
||||
*
|
||||
* ℹ️ Run `node import-GDJS-Runtime.js` (in newIDE/app/scripts) if you make any change.
|
||||
*/
|
||||
registerInstanceRenderers: function(objectsRenderingService) {
|
||||
const RenderedInstance = objectsRenderingService.RenderedInstance;
|
||||
const PIXI = objectsRenderingService.PIXI;
|
||||
const MultiStyleText = objectsRenderingService.requireModule(
|
||||
__dirname,
|
||||
'pixi-multistyle-text/dist/pixi-multistyle-text.umd'
|
||||
);
|
||||
|
||||
/**
|
||||
* Renderer for instances of BBText inside the IDE.
|
||||
*
|
||||
* @extends RenderedBBTextInstance
|
||||
* @class RenderedBBTextInstance
|
||||
* @constructor
|
||||
*/
|
||||
function RenderedBBTextInstance(
|
||||
project,
|
||||
layout,
|
||||
instance,
|
||||
associatedObject,
|
||||
pixiContainer,
|
||||
pixiResourcesLoader
|
||||
) {
|
||||
RenderedInstance.call(
|
||||
this,
|
||||
project,
|
||||
layout,
|
||||
instance,
|
||||
associatedObject,
|
||||
pixiContainer,
|
||||
pixiResourcesLoader
|
||||
);
|
||||
|
||||
const bbTextStyles = {
|
||||
default: {
|
||||
fontFamily: 'Arial',
|
||||
fontSize: '24px',
|
||||
fill: '#cccccc',
|
||||
tagStyle: 'bbcode',
|
||||
wordWrap: true,
|
||||
wordWrapWidth: 250, // This value is the default wrapping width of the runtime object.
|
||||
align: 'left',
|
||||
},
|
||||
};
|
||||
|
||||
this._pixiObject = new MultiStyleText('', bbTextStyles);
|
||||
|
||||
this._pixiObject.anchor.x = 0.5;
|
||||
this._pixiObject.anchor.y = 0.5;
|
||||
this._pixiContainer.addChild(this._pixiObject);
|
||||
this.update();
|
||||
}
|
||||
RenderedBBTextInstance.prototype = Object.create(
|
||||
RenderedInstance.prototype
|
||||
);
|
||||
|
||||
/**
|
||||
* Return the path to the thumbnail of the specified object.
|
||||
*/
|
||||
RenderedBBTextInstance.getThumbnail = function(
|
||||
project,
|
||||
resourcesLoader,
|
||||
object
|
||||
) {
|
||||
return 'JsPlatform/Extensions/bbcode24.png';
|
||||
};
|
||||
|
||||
/**
|
||||
* This is called to update the PIXI object on the scene editor
|
||||
*/
|
||||
RenderedBBTextInstance.prototype.update = function() {
|
||||
const rawText = this._associatedObject
|
||||
.getProperties(this.project)
|
||||
.get('text')
|
||||
.getValue();
|
||||
if (rawText !== this._pixiObject.text) {
|
||||
this._pixiObject.setText(rawText);
|
||||
}
|
||||
|
||||
const opacity = this._associatedObject
|
||||
.getProperties(this.project)
|
||||
.get('opacity')
|
||||
.getValue();
|
||||
this._pixiObject.alpha = opacity / 255;
|
||||
|
||||
const color = this._associatedObject
|
||||
.getProperties(this.project)
|
||||
.get('color')
|
||||
.getValue();
|
||||
this._pixiObject.textStyles.default.fill = color;
|
||||
|
||||
const fontSize = this._associatedObject
|
||||
.getProperties(this.project)
|
||||
.get('fontSize')
|
||||
.getValue();
|
||||
this._pixiObject.textStyles.default.fontSize = `${fontSize}px`;
|
||||
|
||||
const fontFamily = this._associatedObject
|
||||
.getProperties(this.project)
|
||||
.get('fontFamily')
|
||||
.getValue();
|
||||
this._pixiObject.textStyles.default.fontFamily = fontFamily;
|
||||
|
||||
const wordWrap = this._associatedObject
|
||||
.getProperties(this.project)
|
||||
.get('wordWrap')
|
||||
.getValue();
|
||||
if (wordWrap !== this._pixiObject._style.wordWrap) {
|
||||
this._pixiObject._style.wordWrap = wordWrap === 'true';
|
||||
this._pixiObject.dirty = true;
|
||||
}
|
||||
|
||||
const align = this._associatedObject
|
||||
.getProperties(this.project)
|
||||
.get('align')
|
||||
.getValue();
|
||||
if (align !== this._pixiObject._style.align) {
|
||||
this._pixiObject._style.align = align;
|
||||
this._pixiObject.dirty = true;
|
||||
}
|
||||
|
||||
this._pixiObject.position.x =
|
||||
this._instance.getX() + this._pixiObject.width / 2;
|
||||
this._pixiObject.position.y =
|
||||
this._instance.getY() + this._pixiObject.height / 2;
|
||||
this._pixiObject.rotation = RenderedInstance.toRad(
|
||||
this._instance.getAngle()
|
||||
);
|
||||
|
||||
if (this._instance.hasCustomSize() && this._pixiObject) {
|
||||
const customWidth = this._instance.getCustomWidth();
|
||||
if (
|
||||
this._pixiObject &&
|
||||
this._pixiObject.textStyles.default.wordWrapWidth !== customWidth
|
||||
) {
|
||||
this._pixiObject._style.wordWrapWidth = customWidth;
|
||||
this._pixiObject.dirty = true;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Return the width of the instance, when it's not resized.
|
||||
*/
|
||||
RenderedBBTextInstance.prototype.getDefaultWidth = function() {
|
||||
return this._pixiObject.width;
|
||||
};
|
||||
|
||||
/**
|
||||
* Return the height of the instance, when it's not resized.
|
||||
*/
|
||||
RenderedBBTextInstance.prototype.getDefaultHeight = function() {
|
||||
return this._pixiObject.height;
|
||||
};
|
||||
|
||||
objectsRenderingService.registerInstanceRenderer(
|
||||
'BBText::BBText',
|
||||
RenderedBBTextInstance
|
||||
);
|
||||
},
|
||||
};
|
112
Extensions/BBText/bbtextruntimeobject-pixi-renderer.js
Normal file
112
Extensions/BBText/bbtextruntimeobject-pixi-renderer.js
Normal file
@@ -0,0 +1,112 @@
|
||||
/**
|
||||
* The PIXI.js renderer for the BBCode Text runtime object.
|
||||
*
|
||||
* @class BBTextRuntimeObjectPixiRenderer
|
||||
* @constructor
|
||||
* @param {gdjs.BBTextRuntimeObject} runtimeObject The object to render
|
||||
* @param {gdjs.RuntimeScene} runtimeScene The gdjs.RuntimeScene in which the object is
|
||||
*/
|
||||
gdjs.BBTextRuntimeObjectPixiRenderer = function(runtimeObject, runtimeScene) {
|
||||
this._object = runtimeObject;
|
||||
|
||||
// Load (or reset) the text
|
||||
if (this._pixiObject === undefined) {
|
||||
this._pixiObject = new MultiStyleText(runtimeObject._text, {
|
||||
default: {
|
||||
fontFamily: runtimeObject._fontFamily,
|
||||
fontSize: runtimeObject._fontSize + 'px',
|
||||
fill: runtimeObject._color,
|
||||
tagStyle: 'bbcode',
|
||||
wordWrap: runtimeObject._wordWrap,
|
||||
wordWrapWidth: runtimeObject._wrappingWidth,
|
||||
align: runtimeObject._align,
|
||||
},
|
||||
});
|
||||
|
||||
this._object.hidden = !runtimeObject._visible;
|
||||
} else {
|
||||
this.updateColor();
|
||||
this.updateAlignment();
|
||||
this.updateFontFamily();
|
||||
this.updateFontSize();
|
||||
}
|
||||
|
||||
runtimeScene
|
||||
.getLayer('')
|
||||
.getRenderer()
|
||||
.addRendererObject(this._pixiObject, runtimeObject.getZOrder());
|
||||
|
||||
// Set the anchor in the center, so that the object rotates around
|
||||
// its center
|
||||
this._pixiObject.anchor.x = 0.5;
|
||||
this._pixiObject.anchor.y = 0.5;
|
||||
|
||||
this.updateText();
|
||||
this.updatePosition();
|
||||
this.updateAngle();
|
||||
this.updateOpacity();
|
||||
this.updateVisible();
|
||||
};
|
||||
|
||||
gdjs.BBTextRuntimeObjectRenderer = gdjs.BBTextRuntimeObjectPixiRenderer;
|
||||
|
||||
gdjs.BBTextRuntimeObjectPixiRenderer.prototype.getRendererObject = function() {
|
||||
return this._pixiObject;
|
||||
};
|
||||
|
||||
gdjs.BBTextRuntimeObjectPixiRenderer.prototype.updateWordWrap = function() {
|
||||
this._pixiObject._style.wordWrap = this._object._wordWrap;
|
||||
this._pixiObject.dirty = true;
|
||||
this.updatePosition();
|
||||
};
|
||||
|
||||
gdjs.BBTextRuntimeObjectPixiRenderer.prototype.updateWrappingWidth = function() {
|
||||
this._pixiObject._style.wordWrapWidth = this._object._wrappingWidth;
|
||||
this._pixiObject.dirty = true;
|
||||
this.updatePosition();
|
||||
};
|
||||
|
||||
gdjs.BBTextRuntimeObjectPixiRenderer.prototype.updateText = function() {
|
||||
this._pixiObject.setText(this._object._text);
|
||||
this.updatePosition();
|
||||
};
|
||||
|
||||
gdjs.BBTextRuntimeObjectPixiRenderer.prototype.updateColor = function() {
|
||||
this._pixiObject.textStyles.default.fill = this._object._color;
|
||||
};
|
||||
|
||||
gdjs.BBTextRuntimeObjectPixiRenderer.prototype.updateAlignment = function() {
|
||||
this._pixiObject._style.align = this._object._align;
|
||||
this._pixiObject.dirty = true;
|
||||
};
|
||||
gdjs.BBTextRuntimeObjectPixiRenderer.prototype.updateFontFamily = function() {
|
||||
this._pixiObject.textStyles.default.fontFamily = this._object._fontFamily;
|
||||
};
|
||||
gdjs.BBTextRuntimeObjectPixiRenderer.prototype.updateFontSize = function() {
|
||||
this._pixiObject.textStyles.default.fontSize = this._object._fontSize + 'px';
|
||||
};
|
||||
|
||||
gdjs.BBTextRuntimeObjectPixiRenderer.prototype.updatePosition = function() {
|
||||
this._pixiObject.position.x = this._object.x + this._pixiObject.width / 2;
|
||||
this._pixiObject.position.y = this._object.y + this._pixiObject.height / 2;
|
||||
};
|
||||
|
||||
gdjs.BBTextRuntimeObjectPixiRenderer.prototype.updateVisible = function() {
|
||||
this._pixiObject.hidden = !this._object._visible;
|
||||
};
|
||||
|
||||
gdjs.BBTextRuntimeObjectPixiRenderer.prototype.updateAngle = function() {
|
||||
this._pixiObject.rotation = gdjs.toRad(this._object.angle);
|
||||
};
|
||||
|
||||
gdjs.BBTextRuntimeObjectPixiRenderer.prototype.updateOpacity = function() {
|
||||
this._pixiObject.alpha = this._object._opacity / 255;
|
||||
};
|
||||
|
||||
gdjs.BBTextRuntimeObjectPixiRenderer.prototype.getWidth = function() {
|
||||
return this._pixiObject.width;
|
||||
};
|
||||
|
||||
gdjs.BBTextRuntimeObjectPixiRenderer.prototype.getHeight = function() {
|
||||
return this._pixiObject.height;
|
||||
};
|
200
Extensions/BBText/bbtextruntimeobject.js
Normal file
200
Extensions/BBText/bbtextruntimeobject.js
Normal file
@@ -0,0 +1,200 @@
|
||||
/**
|
||||
* Displays a rich text using BBCode markup (allowing to set parts of the text as bold, italic, use different colors and shadows).
|
||||
* @memberof gdjs
|
||||
* @class BBTextRuntimeObject
|
||||
* @extends RuntimeObject
|
||||
*/
|
||||
gdjs.BBTextRuntimeObject = function(runtimeScene, objectData) {
|
||||
gdjs.RuntimeObject.call(this, runtimeScene, objectData);
|
||||
|
||||
/** @type number */
|
||||
this._opacity = objectData.content.opacity;
|
||||
/** @type boolean */
|
||||
this._visible = objectData.content.visible;
|
||||
/** @type string */
|
||||
this._text = objectData.content.text;
|
||||
/** @type string */
|
||||
this._color = objectData.content.color;
|
||||
/** @type string */
|
||||
this._fontFamily = objectData.content.fontFamily;
|
||||
/** @type number */
|
||||
this._fontSize = objectData.content.fontSize;
|
||||
/** @type boolean */
|
||||
this._wordWrap = objectData.content.wordWrap;
|
||||
/** @type number */
|
||||
this._wrappingWidth = 250; // This value is the default wrapping width of the runtime object.
|
||||
/** @type string */
|
||||
this._align = objectData.content.align;
|
||||
|
||||
if (this._renderer)
|
||||
gdjs.BBTextRuntimeObjectRenderer.call(this._renderer, this, runtimeScene);
|
||||
else
|
||||
this._renderer = new gdjs.BBTextRuntimeObjectRenderer(this, runtimeScene);
|
||||
|
||||
// *ALWAYS* call `this.onCreated()` at the very end of your object constructor.
|
||||
this.onCreated();
|
||||
};
|
||||
|
||||
gdjs.BBTextRuntimeObject.prototype = Object.create(
|
||||
gdjs.RuntimeObject.prototype
|
||||
);
|
||||
gdjs.BBTextRuntimeObject.thisIsARuntimeObjectConstructor = 'BBText::BBText';
|
||||
|
||||
gdjs.BBTextRuntimeObject.prototype.getRendererObject = function() {
|
||||
return this._renderer.getRendererObject();
|
||||
};
|
||||
|
||||
/**
|
||||
* Initialize the extra parameters that could be set for an instance.
|
||||
* @private
|
||||
*/
|
||||
gdjs.BBTextRuntimeObject.prototype.extraInitializationFromInitialInstance = function(
|
||||
initialInstanceData
|
||||
) {
|
||||
// The wrapping width value (this._wrappingWidth) is using the object's width as an innitial value
|
||||
if (initialInstanceData.customSize)
|
||||
this.setWrappingWidth(initialInstanceData.width);
|
||||
};
|
||||
|
||||
gdjs.BBTextRuntimeObject.prototype.onDestroyFromScene = function(runtimeScene) {
|
||||
gdjs.RuntimeObject.prototype.onDestroyFromScene.call(this, runtimeScene);
|
||||
};
|
||||
|
||||
/**
|
||||
* Set/Get BBText base style properties
|
||||
*/
|
||||
gdjs.BBTextRuntimeObject.prototype.setBBText = function(text) {
|
||||
this._text = text;
|
||||
this._renderer.updateText();
|
||||
};
|
||||
|
||||
gdjs.BBTextRuntimeObject.prototype.getBBText = function() {
|
||||
return this._text;
|
||||
};
|
||||
|
||||
gdjs.BBTextRuntimeObject.prototype.setColor = function(rgbColorString) {
|
||||
const splitValue = rgbColorString.split(';');
|
||||
if (splitValue.length !== 3) return;
|
||||
const hexColor =
|
||||
'#' +
|
||||
gdjs.rgbToHex(
|
||||
parseInt(splitValue[0], 0),
|
||||
parseInt(splitValue[1], 0),
|
||||
parseInt(splitValue[2], 0)
|
||||
);
|
||||
this._color = hexColor;
|
||||
this._renderer.updateColor();
|
||||
};
|
||||
|
||||
gdjs.BBTextRuntimeObject.prototype.getColor = function() {
|
||||
return this._color;
|
||||
};
|
||||
|
||||
gdjs.BBTextRuntimeObject.prototype.setFontSize = function(fontSize) {
|
||||
this._fontSize = fontSize;
|
||||
this._renderer.updateFontSize();
|
||||
};
|
||||
|
||||
gdjs.BBTextRuntimeObject.prototype.getFontSize = function() {
|
||||
return this._fontSize;
|
||||
};
|
||||
|
||||
gdjs.BBTextRuntimeObject.prototype.setFontFamily = function(fontFamily) {
|
||||
this._fontFamily = fontFamily;
|
||||
this._renderer.updateFontFamily();
|
||||
};
|
||||
|
||||
gdjs.BBTextRuntimeObject.prototype.getFontFamily = function() {
|
||||
return this._fontFamily;
|
||||
};
|
||||
|
||||
gdjs.BBTextRuntimeObject.prototype.setAlignment = function(align) {
|
||||
this._align = align;
|
||||
this._renderer.updateAlignment();
|
||||
};
|
||||
|
||||
gdjs.BBTextRuntimeObject.prototype.getAlignment = function() {
|
||||
return this._align;
|
||||
};
|
||||
|
||||
/**
|
||||
* Set object position on X axis.
|
||||
* @param {number} x The new position X of the object.
|
||||
*/
|
||||
gdjs.BBTextRuntimeObject.prototype.setX = function(x) {
|
||||
gdjs.RuntimeObject.prototype.setX.call(this, x);
|
||||
this._renderer.updatePosition();
|
||||
};
|
||||
|
||||
/**
|
||||
* Set object position on Y axis.
|
||||
* @param {number} y The new position Y of the object.
|
||||
*/
|
||||
gdjs.BBTextRuntimeObject.prototype.setY = function(y) {
|
||||
gdjs.RuntimeObject.prototype.setY.call(this, y);
|
||||
this._renderer.updatePosition();
|
||||
};
|
||||
|
||||
/**
|
||||
* Set the angle of the object.
|
||||
* @param {number} angle The new angle of the object.
|
||||
*/
|
||||
gdjs.BBTextRuntimeObject.prototype.setAngle = function(angle) {
|
||||
gdjs.RuntimeObject.prototype.setAngle.call(this, angle);
|
||||
this._renderer.updateAngle();
|
||||
};
|
||||
|
||||
/**
|
||||
* Set object opacity.
|
||||
* @param {number} opacity The new opacity of the object (0-255).
|
||||
*/
|
||||
gdjs.BBTextRuntimeObject.prototype.setOpacity = function(opacity) {
|
||||
this._opacity = opacity;
|
||||
this._renderer.updateOpacity();
|
||||
};
|
||||
|
||||
/**
|
||||
* Get object opacity.
|
||||
*/
|
||||
gdjs.BBTextRuntimeObject.prototype.getOpacity = function() {
|
||||
return this._opacity;
|
||||
};
|
||||
|
||||
/**
|
||||
* Set the width.
|
||||
* @param {number} width The new width in pixels.
|
||||
*/
|
||||
gdjs.BBTextRuntimeObject.prototype.setWrappingWidth = function(width) {
|
||||
this._wrappingWidth = width;
|
||||
this._renderer.updateWrappingWidth();
|
||||
};
|
||||
|
||||
/**
|
||||
* Get the wrapping width of the object.
|
||||
*/
|
||||
gdjs.BBTextRuntimeObject.prototype.getWrappingWidth = function() {
|
||||
return this._wrappingWidth;
|
||||
};
|
||||
|
||||
gdjs.BBTextRuntimeObject.prototype.setWordWrap = function(wordWrap) {
|
||||
this._wordWrap = wordWrap;
|
||||
this._renderer.updateWordWrap();
|
||||
};
|
||||
|
||||
gdjs.BBTextRuntimeObject.prototype.getWordWrap = function(wordWrap) {
|
||||
return this._wordWrap;
|
||||
};
|
||||
|
||||
/**
|
||||
* Get the width of the object.
|
||||
*/
|
||||
gdjs.BBTextRuntimeObject.prototype.getWidth = function() {
|
||||
return this._renderer.getWidth();
|
||||
};
|
||||
|
||||
/**
|
||||
* Get the height of the object.
|
||||
*/
|
||||
gdjs.BBTextRuntimeObject.prototype.getHeight = function() {
|
||||
return this._renderer.getHeight();
|
||||
};
|
9
Extensions/BBText/pixi-multistyle-text/README.md
Normal file
9
Extensions/BBText/pixi-multistyle-text/README.md
Normal file
@@ -0,0 +1,9 @@
|
||||
This extension is using release version 0.8.0 (commit 336bed0b206043e2c3e81c373b7ca02094ecabe7) of the pixi-multistyle-text library:
|
||||
https://github.com/tleunen/pixi-multistyle-text
|
||||
|
||||
The BBcode tag feature was especially added for Gdevelop and this extension (commit 2a7be2084598933502c76419d7a86c0e6cd11719)
|
||||
|
||||
README:
|
||||
Add a MultiStyleText object inside pixi.js to easily create text using different styles.
|
||||
|
||||
License: MIT
|
2
Extensions/BBText/pixi-multistyle-text/dist/pixi-multistyle-text.umd.js
vendored
Normal file
2
Extensions/BBText/pixi-multistyle-text/dist/pixi-multistyle-text.umd.js
vendored
Normal file
File diff suppressed because one or more lines are too long
1
Extensions/BBText/pixi-multistyle-text/dist/pixi-multistyle-text.umd.js.map
vendored
Normal file
1
Extensions/BBText/pixi-multistyle-text/dist/pixi-multistyle-text.umd.js.map
vendored
Normal file
File diff suppressed because one or more lines are too long
@@ -37,34 +37,30 @@ void DeclareDestroyOutsideBehaviorExtension(gd::PlatformExtension& extension) {
|
||||
_("Additional border"),
|
||||
_("Compare the additional border that the object must cross "
|
||||
"before being deleted."),
|
||||
_("The additional border of _PARAM0_ is _PARAM2__PARAM3_"),
|
||||
_("the additional border"),
|
||||
"",
|
||||
"CppPlatform/Extensions/destroyoutsideicon24.png",
|
||||
"CppPlatform/Extensions/destroyoutsideicon16.png")
|
||||
.AddParameter("object", _("Object"))
|
||||
.AddParameter("behavior", _("Behavior"), "DestroyOutside")
|
||||
.AddParameter("relationalOperator", _("Sign of the test"))
|
||||
.AddParameter("expression", _("Value to compare"))
|
||||
.UseStandardRelationalOperatorParameters("number")
|
||||
.MarkAsAdvanced()
|
||||
.SetFunctionName("GetExtraBorder")
|
||||
.SetManipulatedType("number")
|
||||
.SetIncludeFile("DestroyOutsideBehavior/DestroyOutsideRuntimeBehavior.h");
|
||||
|
||||
aut.AddAction("ExtraBorder",
|
||||
_("Additional border"),
|
||||
_("Change the additional border that the object must cross "
|
||||
"before being deleted."),
|
||||
_("Do _PARAM2__PARAM3_ to the additional border of _PARAM0_"),
|
||||
_("the additional border"),
|
||||
"",
|
||||
"CppPlatform/Extensions/destroyoutsideicon24.png",
|
||||
"CppPlatform/Extensions/destroyoutsideicon16.png")
|
||||
.AddParameter("object", _("Object"))
|
||||
.AddParameter("behavior", _("Behavior"), "DestroyOutside")
|
||||
.AddParameter("operator", _("Modification's sign"))
|
||||
.AddParameter("expression", _("Value"))
|
||||
.UseStandardOperatorParameters("number")
|
||||
.MarkAsAdvanced()
|
||||
.SetFunctionName("SetExtraBorder")
|
||||
.SetManipulatedType("number")
|
||||
.SetGetter("GetExtraBorder")
|
||||
.SetIncludeFile("DestroyOutsideBehavior/DestroyOutsideRuntimeBehavior.h");
|
||||
#endif
|
||||
|
@@ -22,6 +22,8 @@ gdjs.DestroyOutsideRuntimeBehavior.thisIsARuntimeBehaviorConstructor = "DestroyO
|
||||
|
||||
gdjs.DestroyOutsideRuntimeBehavior.prototype.doStepPostEvents = function(runtimeScene) {
|
||||
|
||||
// TODO: This would better be done using the object AABB (getAABB), as (`getCenterX`;`getCenterY`) point
|
||||
// is not necessarily in the middle of the object (for sprites for example).
|
||||
var ow = this.owner.getWidth();
|
||||
var oh = this.owner.getHeight();
|
||||
var ocx = this.owner.getDrawableX()+this.owner.getCenterX();
|
||||
|
@@ -48,7 +48,7 @@ module.exports = {
|
||||
_(
|
||||
"Compare the value of orientation alpha. (Range: 0 to 360°)"
|
||||
),
|
||||
_("Orientation alpha is _PARAM0__PARAM1_"),
|
||||
_("the orientation alpha"),
|
||||
_("Sensors/Orientation"),
|
||||
"JsPlatform/Extensions/orientation_alpha24.png",
|
||||
"JsPlatform/Extensions/orientation_alpha32.png"
|
||||
@@ -68,7 +68,7 @@ module.exports = {
|
||||
_(
|
||||
"Compare the value of orientation beta. (Range: -180 to 180°)"
|
||||
),
|
||||
_("Orientation beta is _PARAM0__PARAM1_"),
|
||||
_("the orientation beta"),
|
||||
_("Sensors/Orientation"),
|
||||
"JsPlatform/Extensions/orientation_beta24.png",
|
||||
"JsPlatform/Extensions/orientation_beta32.png"
|
||||
@@ -88,7 +88,7 @@ module.exports = {
|
||||
_(
|
||||
"Compare the value of orientation gamma. (Range: -90 to 90°)"
|
||||
),
|
||||
_("Orientation gamma is _PARAM0__PARAM1_"),
|
||||
_("the orientation gamma"),
|
||||
_("Sensors/Orientation"),
|
||||
"JsPlatform/Extensions/orientation_gamma24.png",
|
||||
"JsPlatform/Extensions/orientation_gamma32.png"
|
||||
@@ -214,7 +214,7 @@ module.exports = {
|
||||
_(
|
||||
"Compare the value of rotation alpha. (Note: few devices support this sensor)"
|
||||
),
|
||||
_("Rotation alpha is _PARAM0__PARAM1_"),
|
||||
_("the rotation alpha"),
|
||||
_("Sensors/Motion"),
|
||||
"JsPlatform/Extensions/motion_rotation_alpha24.png",
|
||||
"JsPlatform/Extensions/motion_rotation_alpha32.png"
|
||||
@@ -234,7 +234,7 @@ module.exports = {
|
||||
_(
|
||||
"Compare the value of rotation beta. (Note: few devices support this sensor)"
|
||||
),
|
||||
_("Rotation beta is _PARAM0__PARAM1_"),
|
||||
_("the rotation beta"),
|
||||
_("Sensors/Motion"),
|
||||
"JsPlatform/Extensions/motion_rotation_beta24.png",
|
||||
"JsPlatform/Extensions/motion_rotation_beta32.png"
|
||||
@@ -254,7 +254,7 @@ module.exports = {
|
||||
_(
|
||||
"Compare the value of rotation gamma. (Note: few devices support this sensor)"
|
||||
),
|
||||
_("Rotation gamma is _PARAM0__PARAM1_"),
|
||||
_("the rotation gamma"),
|
||||
_("Sensors/Motion"),
|
||||
"JsPlatform/Extensions/motion_rotation_gamma24.png",
|
||||
"JsPlatform/Extensions/motion_rotation_gamma32.png"
|
||||
@@ -274,7 +274,7 @@ module.exports = {
|
||||
_(
|
||||
"Compare the value of acceleration on the X-axis (m/s²)."
|
||||
),
|
||||
_("Acceleration X is _PARAM0__PARAM1_"),
|
||||
_("the acceleration X"),
|
||||
_("Sensors/Motion"),
|
||||
"JsPlatform/Extensions/motion_acceleration_x24.png",
|
||||
"JsPlatform/Extensions/motion_acceleration_x32.png"
|
||||
@@ -294,7 +294,7 @@ module.exports = {
|
||||
_(
|
||||
"Compare the value of acceleration on the Y-axis (m/s²)."
|
||||
),
|
||||
_("Acceleration Y is _PARAM0__PARAM1_"),
|
||||
_("the acceleration Y"),
|
||||
_("Sensors/Motion"),
|
||||
"JsPlatform/Extensions/motion_acceleration_y24.png",
|
||||
"JsPlatform/Extensions/motion_acceleration_y32.png"
|
||||
@@ -314,7 +314,7 @@ module.exports = {
|
||||
_(
|
||||
"Compare the value of acceleration on the Z-axis (m/s²)."
|
||||
),
|
||||
_("Acceleration Z is _PARAM0__PARAM1_"),
|
||||
_("the acceleration Z"),
|
||||
_("Sensors/Motion"),
|
||||
"JsPlatform/Extensions/motion_acceleration_z24.png",
|
||||
"JsPlatform/Extensions/motion_acceleration_z32.png"
|
||||
|
@@ -28,7 +28,7 @@ module.exports = {
|
||||
extension
|
||||
.addAction(
|
||||
'LoadDialogueFromSceneVariable',
|
||||
_('Load dialogue Tree from a Scene Variable'),
|
||||
_('Load dialogue Tree from a scene variable'),
|
||||
_(
|
||||
'Load a dialogue data object - Yarn json format, stored in a scene variable. Use this command to load all the Dialogue data at the beginning of the game.'
|
||||
),
|
||||
|
839
Extensions/Effects/JsExtension.js
Normal file
839
Extensions/Effects/JsExtension.js
Normal file
@@ -0,0 +1,839 @@
|
||||
/**
|
||||
* This is a declaration of an extension for GDevelop 5.
|
||||
*
|
||||
* ℹ️ Run `node import-GDJS-Runtime.js` (in newIDE/app/scripts) if you make any change
|
||||
* to this extension file or to any other *.js file that you reference inside.
|
||||
*
|
||||
* The file must be named "JsExtension.js", otherwise GDevelop won't load it.
|
||||
* ⚠️ If you make a change and the extension is not loaded, open the developer console
|
||||
* and search for any errors.
|
||||
*
|
||||
* More information on https://github.com/4ian/GDevelop/blob/master/newIDE/README-extensions.md
|
||||
*/
|
||||
module.exports = {
|
||||
createExtension: function(_, gd) {
|
||||
const extension = new gd.PlatformExtension();
|
||||
extension.setExtensionInformation(
|
||||
'Effects',
|
||||
'Effects',
|
||||
'Contains various effects to be used in games.',
|
||||
'Various contributors from PixiJS, PixiJS filters and GDevelop',
|
||||
'MIT'
|
||||
);
|
||||
|
||||
// ℹ️ You can declare an effect here. Please order the effects by alphabetical order.
|
||||
// This file is for common effects that are well-known/"battle-tested". If you have an
|
||||
// experimental effect, create an extension for it (copy this folder, rename "Effects" to something else,
|
||||
// and remove all the files and declaration of effects, or take a look at ExampleJsExtension).
|
||||
|
||||
const blackAndWhiteEffect = extension
|
||||
.addEffect('BlackAndWhite')
|
||||
.setFullName(_('Black and White'))
|
||||
.setDescription(_('Alter the colors to make the image black and white'))
|
||||
.addIncludeFile('Extensions/Effects/black-and-white-pixi-filter.js');
|
||||
const blackAndWhiteProperties = blackAndWhiteEffect.getProperties();
|
||||
blackAndWhiteProperties.set(
|
||||
'opacity',
|
||||
new gd.PropertyDescriptor(/* defaultValue= */ '1')
|
||||
.setLabel(_('Opacity (between 0 and 1)'))
|
||||
.setType('number')
|
||||
);
|
||||
|
||||
const blurEffect = extension
|
||||
.addEffect('Blur')
|
||||
.setFullName(_('Blur'))
|
||||
.setDescription(_('Blur the rendered image.'))
|
||||
.addIncludeFile('Extensions/Effects/blur-pixi-filter.js');
|
||||
const blurProperties = blurEffect.getProperties();
|
||||
blurProperties.set(
|
||||
'blur',
|
||||
new gd.PropertyDescriptor(/* defaultValue= */ '8')
|
||||
.setLabel(_('Blur intensity'))
|
||||
.setType('number')
|
||||
);
|
||||
blurProperties.set(
|
||||
'quality',
|
||||
new gd.PropertyDescriptor(/* defaultValue= */ '1')
|
||||
.setLabel(
|
||||
_(
|
||||
'Number of render passes. An high value will cause lags/poor performance.'
|
||||
)
|
||||
)
|
||||
.setType('number')
|
||||
);
|
||||
blurProperties.set(
|
||||
'resolution',
|
||||
new gd.PropertyDescriptor(/* defaultValue= */ '2')
|
||||
.setLabel(_('Resolution'))
|
||||
.setType('number')
|
||||
);
|
||||
blurProperties.set(
|
||||
'resolution',
|
||||
new gd.PropertyDescriptor(/* defaultValue= */ '2')
|
||||
.setLabel(_('Kernel size (one of these values: 5, 7, 9, 11, 13, 15)'))
|
||||
.setType('number')
|
||||
);
|
||||
|
||||
const brightnessEffect = extension
|
||||
.addEffect('Brightness')
|
||||
.setFullName(_('Brightness'))
|
||||
.setDescription(_('Make the image brighter.'))
|
||||
.addIncludeFile('Extensions/Effects/brightness-pixi-filter.js');
|
||||
const brightnessProperties = brightnessEffect.getProperties();
|
||||
brightnessProperties.set(
|
||||
'brightness',
|
||||
new gd.PropertyDescriptor(/* defaultValue= */ '0.8')
|
||||
.setLabel(_('Brightness (between 0 and 1)'))
|
||||
.setType('number')
|
||||
);
|
||||
|
||||
const lightNightEffect = extension
|
||||
.addEffect('LightNight')
|
||||
.setFullName(_('Light Night'))
|
||||
.setDescription(_('Alter the colors to simulate night.'))
|
||||
.addIncludeFile('Extensions/Effects/light-night-pixi-filter.js');
|
||||
const lightNightProperties = lightNightEffect.getProperties();
|
||||
lightNightProperties.set(
|
||||
'opacity',
|
||||
new gd.PropertyDescriptor(/* defaultValue= */ '1')
|
||||
.setLabel(_('Opacity (between 0 and 1)'))
|
||||
.setType('number')
|
||||
);
|
||||
|
||||
const nightEffect = extension
|
||||
.addEffect('Night')
|
||||
.setFullName(_('Dark Night'))
|
||||
.setDescription(_('Alter the colors to simulate a dark night.'))
|
||||
.addIncludeFile('Extensions/Effects/night-pixi-filter.js');
|
||||
const nightProperties = nightEffect.getProperties();
|
||||
nightProperties.set(
|
||||
'intensity',
|
||||
new gd.PropertyDescriptor(/* defaultValue= */ '0.5')
|
||||
.setLabel(_('Intensity (between 0 and 1)'))
|
||||
.setType('number')
|
||||
);
|
||||
nightProperties.set(
|
||||
'opacity',
|
||||
new gd.PropertyDescriptor(/* defaultValue= */ '0.5')
|
||||
.setLabel(_('Opacity (between 0 and 1)'))
|
||||
.setType('number')
|
||||
);
|
||||
|
||||
const noiseEffect = extension
|
||||
.addEffect('Noise')
|
||||
.setFullName(_('Noise'))
|
||||
.setDescription(_('Add some noise on the rendered image.'))
|
||||
.addIncludeFile('Extensions/Effects/noise-pixi-filter.js');
|
||||
const noiseProperties = noiseEffect.getProperties();
|
||||
noiseProperties.set(
|
||||
'noise',
|
||||
new gd.PropertyDescriptor(/* defaultValue= */ '0.5')
|
||||
.setLabel(_('Noise intensity (between 0 and 1)'))
|
||||
.setType('number')
|
||||
);
|
||||
|
||||
const sepiaEffect = extension
|
||||
.addEffect('Sepia')
|
||||
.setFullName(_('Sepia'))
|
||||
.setDescription(_('Alter the colors to sepia.'))
|
||||
.addIncludeFile('Extensions/Effects/sepia-pixi-filter.js');
|
||||
const sepiaProperties = sepiaEffect.getProperties();
|
||||
sepiaProperties.set(
|
||||
'opacity',
|
||||
new gd.PropertyDescriptor(/* defaultValue= */ '1')
|
||||
.setLabel(_('Opacity (between 0 and 1)'))
|
||||
.setType('number')
|
||||
);
|
||||
|
||||
const crtEffect = extension
|
||||
.addEffect('CRT')
|
||||
.setFullName(_('CRT'))
|
||||
.setDescription(_('Apply an effect resembling old CRT monitors.'))
|
||||
.addIncludeFile('Extensions/Effects/pixi-filters/filter-crt.js')
|
||||
.addIncludeFile('Extensions/Effects/crt-pixi-filter.js');
|
||||
const crtProperties = crtEffect.getProperties();
|
||||
crtProperties.set(
|
||||
'lineWidth',
|
||||
new gd.PropertyDescriptor(/* defaultValue= */ '0.2')
|
||||
.setLabel(_('Line width (between 0 and 5)'))
|
||||
.setType('number')
|
||||
);
|
||||
crtProperties.set(
|
||||
'lineContrast',
|
||||
new gd.PropertyDescriptor(/* defaultValue= */ '0')
|
||||
.setLabel(_('Line contrast (between 0 and 1)'))
|
||||
.setType('number')
|
||||
);
|
||||
crtProperties.set(
|
||||
'noise',
|
||||
new gd.PropertyDescriptor(/* defaultValue= */ '0.1')
|
||||
.setLabel(_('Noise (between 0 and 1)'))
|
||||
.setType('number')
|
||||
);
|
||||
crtProperties.set(
|
||||
'curvature',
|
||||
new gd.PropertyDescriptor(/* defaultValue= */ '0')
|
||||
.setLabel(_('Curvature (between 0 and 10)'))
|
||||
.setType('number')
|
||||
);
|
||||
crtProperties.set(
|
||||
'verticalLine',
|
||||
new gd.PropertyDescriptor(/* defaultValue= */ '0')
|
||||
.setLabel(_('Vertical line (true or false)'))
|
||||
.setType('boolean')
|
||||
);
|
||||
crtProperties.set(
|
||||
'noiseSize',
|
||||
new gd.PropertyDescriptor(/* defaultValue= */ '1')
|
||||
.setLabel(_('Noise size (between 0 and 10)'))
|
||||
.setType('number')
|
||||
);
|
||||
crtProperties.set(
|
||||
'vignetting',
|
||||
new gd.PropertyDescriptor(/* defaultValue= */ '0.3')
|
||||
.setLabel(_('Vignetting (between 0 and 1)'))
|
||||
.setType('number')
|
||||
);
|
||||
crtProperties.set(
|
||||
'vignettingAlpha',
|
||||
new gd.PropertyDescriptor(/* defaultValue= */ '1')
|
||||
.setLabel(_('Vignetting alpha (between 0 and 1)'))
|
||||
.setType('number')
|
||||
);
|
||||
crtProperties.set(
|
||||
'vignettingBlur',
|
||||
new gd.PropertyDescriptor(/* defaultValue= */ '0.3')
|
||||
.setLabel(_('Vignetting blur (between 0 and 1)'))
|
||||
.setType('number')
|
||||
);
|
||||
crtProperties.set(
|
||||
'animated',
|
||||
new gd.PropertyDescriptor(/* defaultValue= */ 'true')
|
||||
.setLabel(_('Animated (Enable animations)'))
|
||||
.setType('boolean')
|
||||
);
|
||||
|
||||
const godrayEffect = extension
|
||||
.addEffect('Godray')
|
||||
.setFullName(_('Godray'))
|
||||
.setDescription(_('Apply and animate atmospheric light rays.'))
|
||||
.addIncludeFile('Extensions/Effects/pixi-filters/filter-godray.js')
|
||||
.addIncludeFile('Extensions/Effects/godray-pixi-filter.js');
|
||||
const godrayProperties = godrayEffect.getProperties();
|
||||
godrayProperties.set(
|
||||
'parallel',
|
||||
new gd.PropertyDescriptor(/* defaultValue= */ 'true')
|
||||
.setLabel(_('Parallel (parallel rays)'))
|
||||
.setType('boolean')
|
||||
);
|
||||
godrayProperties.set(
|
||||
'animated',
|
||||
new gd.PropertyDescriptor(/* defaultValue= */ 'true')
|
||||
.setLabel(_('Animated (animate rays)'))
|
||||
.setType('boolean')
|
||||
);
|
||||
godrayProperties.set(
|
||||
'lacunarity',
|
||||
new gd.PropertyDescriptor(/* defaultValue= */ '2.75')
|
||||
.setLabel(_('Lacunarity (between 0 and 5)'))
|
||||
.setType('number')
|
||||
);
|
||||
godrayProperties.set(
|
||||
'angle',
|
||||
new gd.PropertyDescriptor(/* defaultValue= */ '30')
|
||||
.setLabel(_('Angle (between -60 and 60)'))
|
||||
.setType('number')
|
||||
);
|
||||
godrayProperties.set(
|
||||
'gain',
|
||||
new gd.PropertyDescriptor(/* defaultValue= */ '0.6')
|
||||
.setLabel(_('Gain (between 0 and 1)'))
|
||||
.setType('number')
|
||||
);
|
||||
godrayProperties.set(
|
||||
'light',
|
||||
new gd.PropertyDescriptor(/* defaultValue= */ '30')
|
||||
.setLabel(_('Light (between 0 and 60)'))
|
||||
.setType('number')
|
||||
);
|
||||
godrayProperties.set(
|
||||
'x',
|
||||
new gd.PropertyDescriptor(/* defaultValue= */ '100')
|
||||
.setLabel(_('Center X (between 100 and 1000)'))
|
||||
.setType('number')
|
||||
);
|
||||
godrayProperties.set(
|
||||
'y',
|
||||
new gd.PropertyDescriptor(/* defaultValue= */ '100')
|
||||
.setLabel(_('Center Y (between -1000 and 100)'))
|
||||
.setType('number')
|
||||
);
|
||||
|
||||
const tiltShiftEffect = extension
|
||||
.addEffect('TiltShift')
|
||||
.setFullName(_('Tilt shift'))
|
||||
.setDescription(_('Render a tilt-shift-like camera effect.'))
|
||||
.addIncludeFile('Extensions/Effects/pixi-filters/filter-tilt-shift.js')
|
||||
.addIncludeFile('Extensions/Effects/tilt-shift-pixi-filter.js');
|
||||
const tiltShiftProperties = tiltShiftEffect.getProperties();
|
||||
tiltShiftProperties.set(
|
||||
'blur',
|
||||
new gd.PropertyDescriptor(/* defaultValue= */ '30')
|
||||
.setLabel(_('Blur (between 0 and 200)'))
|
||||
.setType('number')
|
||||
);
|
||||
tiltShiftProperties.set(
|
||||
'gradientBlur',
|
||||
new gd.PropertyDescriptor(/* defaultValue= */ '1000')
|
||||
.setLabel(_('Gradient blur (between 0 and 2000)'))
|
||||
.setType('number')
|
||||
);
|
||||
|
||||
const advancedBloomEffect = extension
|
||||
.addEffect('AdvancedBloom')
|
||||
.setFullName(_('Advanced bloom'))
|
||||
.setDescription(_('Applies a Bloom Effect.'))
|
||||
.addIncludeFile('Extensions/Effects/pixi-filters/filter-kawase-blur.js')
|
||||
.addIncludeFile(
|
||||
'Extensions/Effects/pixi-filters/filter-advanced-bloom.js'
|
||||
)
|
||||
.addIncludeFile('Extensions/Effects/advanced-bloom-pixi-filter.js');
|
||||
const advancedBloomProperties = advancedBloomEffect.getProperties();
|
||||
advancedBloomProperties.set(
|
||||
'threshold',
|
||||
new gd.PropertyDescriptor(/* defaultValue= */ '0.5')
|
||||
.setLabel(_('Threshold (between 0 and 1)'))
|
||||
.setType('number')
|
||||
);
|
||||
advancedBloomProperties.set(
|
||||
'bloomScale',
|
||||
new gd.PropertyDescriptor(/* defaultValue= */ '0.7')
|
||||
.setLabel(_('Bloom Scale (between 0 and 2)'))
|
||||
.setType('number')
|
||||
);
|
||||
advancedBloomProperties.set(
|
||||
'brightness',
|
||||
new gd.PropertyDescriptor(/* defaultValue= */ '0.7')
|
||||
.setLabel(_('Brightness (between 0 and 2)'))
|
||||
.setType('number')
|
||||
);
|
||||
advancedBloomProperties.set(
|
||||
'blur',
|
||||
new gd.PropertyDescriptor(/* defaultValue= */ '4')
|
||||
.setLabel(_('Blur (between 0 and 20)'))
|
||||
.setType('number')
|
||||
);
|
||||
advancedBloomProperties.set(
|
||||
'quality',
|
||||
new gd.PropertyDescriptor(/* defaultValue= */ '7')
|
||||
.setLabel(_('Quality (between 0 and 20)'))
|
||||
.setType('number')
|
||||
);
|
||||
|
||||
const kawaseBlurEffect = extension
|
||||
.addEffect('KawaseBlur')
|
||||
.setFullName(_('Kawase blur'))
|
||||
.setDescription(
|
||||
_('A much faster blur than Gaussian blur, but more complicated to use.')
|
||||
)
|
||||
.addIncludeFile('Extensions/Effects/pixi-filters/filter-kawase-blur.js')
|
||||
.addIncludeFile('Extensions/Effects/kawase-blur-pixi-filter.js');
|
||||
const kawaseBlurProperties = kawaseBlurEffect.getProperties();
|
||||
kawaseBlurProperties.set(
|
||||
'pixelizeX',
|
||||
new gd.PropertyDescriptor(/* defaultValue= */ '1')
|
||||
.setLabel(_('Pixelize X (between 0 and 10)'))
|
||||
.setType('number')
|
||||
);
|
||||
kawaseBlurProperties.set(
|
||||
'pixelizeY',
|
||||
new gd.PropertyDescriptor(/* defaultValue= */ '1')
|
||||
.setLabel(_('Pixelize Y (between 0 and 10)'))
|
||||
.setType('number')
|
||||
);
|
||||
kawaseBlurProperties.set(
|
||||
'blur',
|
||||
new gd.PropertyDescriptor(/* defaultValue= */ '0.5')
|
||||
.setLabel(_('Blur (between 0 and 20)'))
|
||||
.setType('number')
|
||||
);
|
||||
kawaseBlurProperties.set(
|
||||
'quality',
|
||||
new gd.PropertyDescriptor(/* defaultValue= */ '3')
|
||||
.setLabel(_('Quality (between 1 and 20)'))
|
||||
.setType('number')
|
||||
);
|
||||
|
||||
const zoomBlurEffect = extension
|
||||
.addEffect('ZoomBlur')
|
||||
.setFullName(_('Zoom blur'))
|
||||
.setDescription(_('Applies a Zoom blur.'))
|
||||
.addIncludeFile('Extensions/Effects/pixi-filters/filter-zoom-blur.js')
|
||||
.addIncludeFile('Extensions/Effects/zoom-blur-pixi-filter.js');
|
||||
const zoomBlurProperties = zoomBlurEffect.getProperties();
|
||||
zoomBlurProperties.set(
|
||||
'centerX',
|
||||
new gd.PropertyDescriptor(/* defaultValue= */ '0.5')
|
||||
.setLabel(_('Center X (between 0 and 1, 0.5 is window middle)'))
|
||||
.setType('number')
|
||||
);
|
||||
zoomBlurProperties.set(
|
||||
'centerY',
|
||||
new gd.PropertyDescriptor(/* defaultValue= */ '0.5')
|
||||
.setLabel(_('Center Y (between 0 and 1, 0.5 is window middle)'))
|
||||
.setType('number')
|
||||
);
|
||||
zoomBlurProperties.set(
|
||||
'innerRadius',
|
||||
new gd.PropertyDescriptor(/* defaultValue= */ '0.2')
|
||||
.setLabel(_('Inner radius (between 0 and 1, 0.5 is mid-way)'))
|
||||
.setType('number')
|
||||
);
|
||||
zoomBlurProperties.set(
|
||||
'strength',
|
||||
new gd.PropertyDescriptor(/* defaultValue= */ '0.3')
|
||||
.setLabel(_('strength (between 0 and 5)'))
|
||||
.setType('number')
|
||||
);
|
||||
|
||||
const displacementEffect = extension
|
||||
.addEffect('Displacement')
|
||||
.setFullName(_('Displacement'))
|
||||
.setDescription(
|
||||
_(
|
||||
'Uses the pixel values from the specified texture (called the displacement map) to perform a displacement of an object.'
|
||||
)
|
||||
)
|
||||
.addIncludeFile('Extensions/Effects/displacement-pixi-filter.js');
|
||||
const displacementProperties = displacementEffect.getProperties();
|
||||
displacementProperties.set(
|
||||
'displacementMapTexture',
|
||||
new gd.PropertyDescriptor('')
|
||||
.setType('resource')
|
||||
.addExtraInfo('image')
|
||||
.setLabel(_('Displacement map texture'))
|
||||
.setDescription(
|
||||
_(
|
||||
'Displacement map texture for the effect. To get started, **download** [a default displacement map texture here](http://wiki.compilgames.net/doku.php/gdevelop5/interface/scene-editor/layer-effects).'
|
||||
)
|
||||
)
|
||||
);
|
||||
displacementProperties.set(
|
||||
'scaleX',
|
||||
new gd.PropertyDescriptor(/* defaultValue= */ '20')
|
||||
.setLabel(_('Scale on X axis'))
|
||||
.setType('number')
|
||||
);
|
||||
displacementProperties.set(
|
||||
'scaleY',
|
||||
new gd.PropertyDescriptor(/* defaultValue= */ '20')
|
||||
.setLabel(_('Scale on Y axis'))
|
||||
.setType('number')
|
||||
);
|
||||
|
||||
const colorMapEffect = extension
|
||||
.addEffect('ColorMap')
|
||||
.setFullName(_('Color Map'))
|
||||
.setDescription(_('Change the color rendered on screen.'))
|
||||
.addIncludeFile('Extensions/Effects/color-map-pixi-filter.js')
|
||||
.addIncludeFile('Extensions/Effects/pixi-filters/filter-color-map.js');
|
||||
const colorMapProperties = colorMapEffect.getProperties();
|
||||
colorMapProperties.set(
|
||||
'colorMapTexture',
|
||||
new gd.PropertyDescriptor('')
|
||||
.setType('resource')
|
||||
.addExtraInfo('image')
|
||||
.setLabel(_('Color map texture for the effect'))
|
||||
.setDescription(
|
||||
_(
|
||||
'You can change colors of pixels by modifing a reference color image, containing each colors, called the *Color Map Texture*. To get started, **download** [a default color map texture here](http://wiki.compilgames.net/doku.php/gdevelop5/interface/scene-editor/layer-effects).'
|
||||
)
|
||||
)
|
||||
);
|
||||
colorMapProperties.set(
|
||||
'nearest',
|
||||
new gd.PropertyDescriptor(/* defaultValue= */ 'false')
|
||||
.setLabel(_('Disable anti-aliasing ("nearest" pixel rounding)'))
|
||||
.setType('boolean')
|
||||
);
|
||||
colorMapProperties.set(
|
||||
'mix',
|
||||
new gd.PropertyDescriptor(/* defaultValue= */ '100')
|
||||
.setLabel(_('Mix'))
|
||||
.setType('number')
|
||||
.setDescription(_('Mix value of the effect on the layer (in percent)'))
|
||||
);
|
||||
|
||||
const pixelateEffect = extension
|
||||
.addEffect('Pixelate')
|
||||
.setFullName(_('Pixelate'))
|
||||
.setDescription(
|
||||
_("Applies a pixelate effect, making display objects appear 'blocky'.")
|
||||
)
|
||||
.addIncludeFile('Extensions/Effects/pixelate-pixi-filter.js')
|
||||
.addIncludeFile('Extensions/Effects/pixi-filters/filter-pixelate.js');
|
||||
const pixelateProperties = pixelateEffect.getProperties();
|
||||
pixelateProperties.set(
|
||||
'size',
|
||||
new gd.PropertyDescriptor(/* defaultValue= */ '10')
|
||||
.setLabel(_('Size'))
|
||||
.setType('number')
|
||||
.setDescription(_('Size of the pixels (10 pixels by default)'))
|
||||
);
|
||||
|
||||
const reflectionEffect = extension
|
||||
.addEffect('Reflection')
|
||||
.setFullName(_('Reflection'))
|
||||
.setDescription(
|
||||
_(
|
||||
'Applies a reflection effect to simulate the reflection on water with waves.'
|
||||
)
|
||||
)
|
||||
.addIncludeFile('Extensions/Effects/reflection-pixi-filter.js')
|
||||
.addIncludeFile('Extensions/Effects/pixi-filters/filter-reflection.js');
|
||||
const reflectionProperties = reflectionEffect.getProperties();
|
||||
reflectionProperties.set(
|
||||
'mirror',
|
||||
new gd.PropertyDescriptor(/* defaultValue= */ 'true')
|
||||
.setLabel(_('Reflect the image on the waves'))
|
||||
.setType('boolean')
|
||||
);
|
||||
reflectionProperties.set(
|
||||
'boundary',
|
||||
new gd.PropertyDescriptor(/* defaultValue= */ '0.5')
|
||||
.setLabel(_('Vertical position of the reflection point'))
|
||||
.setType('number')
|
||||
.setDescription(
|
||||
_(
|
||||
'Default is 50% (middle). Smaller numbers produce a larger reflection, larger numbers produce a smaller reflection.'
|
||||
)
|
||||
)
|
||||
);
|
||||
reflectionProperties.set(
|
||||
'amplitudeStart',
|
||||
new gd.PropertyDescriptor(/* defaultValue= */ '0')
|
||||
.setLabel(_('Amplitude start'))
|
||||
.setType('number')
|
||||
.setDescription(_('Starting amplitude of waves (0 by default)'))
|
||||
);
|
||||
reflectionProperties.set(
|
||||
'amplitudeEnding',
|
||||
new gd.PropertyDescriptor(/* defaultValue= */ '20')
|
||||
.setLabel(_('Amplitude ending'))
|
||||
.setType('number')
|
||||
.setDescription(_('Ending amplitude of waves (20 by default)'))
|
||||
);
|
||||
reflectionProperties.set(
|
||||
'waveLengthStart',
|
||||
new gd.PropertyDescriptor(/* defaultValue= */ '30')
|
||||
.setLabel(_('Wave length start'))
|
||||
.setType('number')
|
||||
.setDescription(_('Starting wave length (30 by default)'))
|
||||
);
|
||||
reflectionProperties.set(
|
||||
'waveLengthEnding',
|
||||
new gd.PropertyDescriptor(/* defaultValue= */ '100')
|
||||
.setLabel(_('Wave length ending'))
|
||||
.setType('number')
|
||||
.setDescription(_('Ending wave length (100 by default)'))
|
||||
);
|
||||
reflectionProperties.set(
|
||||
'alphaStart',
|
||||
new gd.PropertyDescriptor(/* defaultValue= */ '1')
|
||||
.setLabel(_('Alpha start'))
|
||||
.setType('number')
|
||||
.setDescription(_('Starting alpha (1 by default)'))
|
||||
);
|
||||
reflectionProperties.set(
|
||||
'alphaEnding',
|
||||
new gd.PropertyDescriptor(/* defaultValue= */ '1')
|
||||
.setLabel(_('Alpha ending'))
|
||||
.setType('number')
|
||||
.setDescription(_('Ending alpha (1 by default)'))
|
||||
);
|
||||
reflectionProperties.set(
|
||||
'animated',
|
||||
new gd.PropertyDescriptor(/* defaultValue= */ 'false')
|
||||
.setLabel(_('Animate waves'))
|
||||
.setType('boolean')
|
||||
);
|
||||
|
||||
const rgbSplitEffect = extension
|
||||
.addEffect('RGBSplit')
|
||||
.setFullName(_('RGB split (chromatic aberration)'))
|
||||
.setDescription(
|
||||
_('Applies a RGB split effect also known as chromatic aberration.')
|
||||
)
|
||||
.addIncludeFile('Extensions/Effects/pixi-filters/filter-rgb-split.js')
|
||||
.addIncludeFile('Extensions/Effects/rgb-split-pixi-filter.js');
|
||||
const rgbSplitProperties = rgbSplitEffect.getProperties();
|
||||
rgbSplitProperties.set(
|
||||
'redX',
|
||||
new gd.PropertyDescriptor(/* defaultValue= */ '-10')
|
||||
.setLabel(_('Red X offset (between -20 and 20)'))
|
||||
.setType('number')
|
||||
);
|
||||
rgbSplitProperties.set(
|
||||
'redY',
|
||||
new gd.PropertyDescriptor(/* defaultValue= */ '1')
|
||||
.setLabel(_('Red Y offset (between -20 and 20)'))
|
||||
.setType('number')
|
||||
);
|
||||
rgbSplitProperties.set(
|
||||
'greenX',
|
||||
new gd.PropertyDescriptor(/* defaultValue= */ '0')
|
||||
.setLabel(_('Green X offset (between -20 and 20)'))
|
||||
.setType('number')
|
||||
);
|
||||
rgbSplitProperties.set(
|
||||
'greenY',
|
||||
new gd.PropertyDescriptor(/* defaultValue= */ '0')
|
||||
.setLabel(_('Green Y offset (between -20 and 20)'))
|
||||
.setType('number')
|
||||
);
|
||||
rgbSplitProperties.set(
|
||||
'blueX',
|
||||
new gd.PropertyDescriptor(/* defaultValue= */ '0')
|
||||
.setLabel(_('Blue X offset (between -20 and 20)'))
|
||||
.setType('number')
|
||||
);
|
||||
rgbSplitProperties.set(
|
||||
'blueY',
|
||||
new gd.PropertyDescriptor(/* defaultValue= */ '10')
|
||||
.setLabel(_('Blue Y offset (between -20 and 20)'))
|
||||
.setType('number')
|
||||
);
|
||||
|
||||
const adjustmentEffect = extension
|
||||
.addEffect('Adjustment')
|
||||
.setFullName(_('Adjustment'))
|
||||
.setDescription(
|
||||
_(
|
||||
'Adjust gamma, contrast, saturation, brightness, alpha or color-channel shift.'
|
||||
)
|
||||
)
|
||||
.addIncludeFile('Extensions/Effects/pixi-filters/filter-adjustment.js')
|
||||
.addIncludeFile('Extensions/Effects/adjustment-pixi-filter.js');
|
||||
const adjustmentProperties = adjustmentEffect.getProperties();
|
||||
adjustmentProperties.set(
|
||||
'gamma',
|
||||
new gd.PropertyDescriptor(/* defaultValue= */ '1')
|
||||
.setLabel(_('Gamma (between 0 and 5)'))
|
||||
.setType('number')
|
||||
);
|
||||
adjustmentProperties.set(
|
||||
'saturation',
|
||||
new gd.PropertyDescriptor(/* defaultValue= */ '2')
|
||||
.setLabel(_('Saturation (between 0 and 5)'))
|
||||
.setType('number')
|
||||
);
|
||||
adjustmentProperties.set(
|
||||
'contrast',
|
||||
new gd.PropertyDescriptor(/* defaultValue= */ '1')
|
||||
.setLabel(_('Contrast (between 0 and 5)'))
|
||||
.setType('number')
|
||||
);
|
||||
adjustmentProperties.set(
|
||||
'brightness',
|
||||
new gd.PropertyDescriptor(/* defaultValue= */ '1')
|
||||
.setLabel(_('Brightness (between 0 and 5)'))
|
||||
.setType('number')
|
||||
);
|
||||
adjustmentProperties.set(
|
||||
'red',
|
||||
new gd.PropertyDescriptor(/* defaultValue= */ '1')
|
||||
.setLabel(_('Red (between 0 and 5)'))
|
||||
.setType('number')
|
||||
);
|
||||
adjustmentProperties.set(
|
||||
'green',
|
||||
new gd.PropertyDescriptor(/* defaultValue= */ '1')
|
||||
.setLabel(_('Green (between 0 and 5)'))
|
||||
.setType('number')
|
||||
);
|
||||
adjustmentProperties.set(
|
||||
'blue',
|
||||
new gd.PropertyDescriptor(/* defaultValue= */ '0.6')
|
||||
.setLabel(_('Blue (between 0 and 5)'))
|
||||
.setType('number')
|
||||
);
|
||||
adjustmentProperties.set(
|
||||
'alpha',
|
||||
new gd.PropertyDescriptor(/* defaultValue= */ '1')
|
||||
.setLabel(_('Alpha (between 0 and 1, 0 is transparent)'))
|
||||
.setType('number')
|
||||
);
|
||||
|
||||
const dropShadowEffect = extension
|
||||
.addEffect('DropShadow')
|
||||
.setFullName(_('Drop shadow'))
|
||||
.setDescription(_('Add a shadow around the rendered image.'))
|
||||
.addIncludeFile('Extensions/Effects/pixi-filters/filter-kawase-blur.js')
|
||||
.addIncludeFile('Extensions/Effects/pixi-filters/filter-drop-shadow.js')
|
||||
.addIncludeFile('Extensions/Effects/drop-shadow-pixi-filter.js');
|
||||
const dropShadowProperties = dropShadowEffect.getProperties();
|
||||
dropShadowProperties.set(
|
||||
'blur',
|
||||
new gd.PropertyDescriptor(/* defaultValue= */ '2')
|
||||
.setLabel(_('Blur (between 0 and 20)'))
|
||||
.setType('number')
|
||||
);
|
||||
dropShadowProperties.set(
|
||||
'quality',
|
||||
new gd.PropertyDescriptor(/* defaultValue= */ '3')
|
||||
.setLabel(_('Quality (between 1 and 20)'))
|
||||
.setType('number')
|
||||
);
|
||||
dropShadowProperties.set(
|
||||
'alpha',
|
||||
new gd.PropertyDescriptor(/* defaultValue= */ '1')
|
||||
.setLabel(_('Alpha (between 0 and 1)'))
|
||||
.setType('number')
|
||||
);
|
||||
dropShadowProperties.set(
|
||||
'distance',
|
||||
new gd.PropertyDescriptor(/* defaultValue= */ '1')
|
||||
.setLabel(_('Distance (between 0 and 50)'))
|
||||
.setType('number')
|
||||
);
|
||||
dropShadowProperties.set(
|
||||
'rotation',
|
||||
new gd.PropertyDescriptor(/* defaultValue= */ '0')
|
||||
.setLabel(_('Rotation (between 0 and 360)'))
|
||||
.setType('number')
|
||||
);
|
||||
dropShadowProperties.set(
|
||||
'color',
|
||||
new gd.PropertyDescriptor(/* defaultValue= */ '#000000')
|
||||
.setLabel(_('Color of the shadow'))
|
||||
.setType('color')
|
||||
);
|
||||
dropShadowProperties.set(
|
||||
'shadowOnly',
|
||||
new gd.PropertyDescriptor(/* defaultValue= */ 'false')
|
||||
.setLabel(_('Shadow only (shows only the shadow when enabled)'))
|
||||
.setType('boolean')
|
||||
);
|
||||
|
||||
const outlineEffect = extension
|
||||
.addEffect('Outline')
|
||||
.setFullName(_('Outline'))
|
||||
.setDescription(_('Draws an outline around the rendered image.'))
|
||||
.addIncludeFile('Extensions/Effects/pixi-filters/filter-outline.js')
|
||||
.addIncludeFile('Extensions/Effects/outline-pixi-filter.js');
|
||||
const outlineProperties = outlineEffect.getProperties();
|
||||
outlineProperties.set(
|
||||
'thickness',
|
||||
new gd.PropertyDescriptor(/* defaultValue= */ '2')
|
||||
.setLabel(_('Thickness (between 0 and 20)'))
|
||||
.setType('number')
|
||||
);
|
||||
outlineProperties.set(
|
||||
'color',
|
||||
new gd.PropertyDescriptor(/* defaultValue= */ '1')
|
||||
.setLabel(_('Color of the outline'))
|
||||
.setType('color')
|
||||
);
|
||||
|
||||
const glowEffect = extension
|
||||
.addEffect('Glow')
|
||||
.setFullName(_('Glow'))
|
||||
.setDescription(_('Add a glow effect around the rendered image.'))
|
||||
.addIncludeFile('Extensions/Effects/pixi-filters/filter-glow.js')
|
||||
.addIncludeFile('Extensions/Effects/glow-pixi-filter.js');
|
||||
const glowProperties = glowEffect.getProperties();
|
||||
glowProperties.set(
|
||||
'innerStrength',
|
||||
new gd.PropertyDescriptor(/* defaultValue= */ '1')
|
||||
.setLabel(_('Inner strength (between 0 and 20)'))
|
||||
.setType('number')
|
||||
);
|
||||
glowProperties.set(
|
||||
'outerStrength',
|
||||
new gd.PropertyDescriptor(/* defaultValue= */ '2')
|
||||
.setLabel(_('Outer strength (between 0 and 20)'))
|
||||
.setType('number')
|
||||
);
|
||||
glowProperties.set(
|
||||
'distance',
|
||||
new gd.PropertyDescriptor(/* defaultValue= */ '15')
|
||||
.setLabel(_('Distance (between 10 and 20)'))
|
||||
.setType('number')
|
||||
);
|
||||
glowProperties.set(
|
||||
'color',
|
||||
new gd.PropertyDescriptor(/* defaultValue= */ '#ffffff')
|
||||
.setLabel(_('Color of the outline)'))
|
||||
.setType('color')
|
||||
);
|
||||
|
||||
const asciiEffect = extension
|
||||
.addEffect('Ascii')
|
||||
.setFullName(_('ASCII'))
|
||||
.setDescription(_('Render the image with ASCII characters only.'))
|
||||
.addIncludeFile('Extensions/Effects/pixi-filters/filter-ascii.js')
|
||||
.addIncludeFile('Extensions/Effects/ascii-pixi-filter.js');
|
||||
const asciiProperties = asciiEffect.getProperties();
|
||||
asciiProperties.set(
|
||||
'size',
|
||||
new gd.PropertyDescriptor(/* defaultValue= */ '8')
|
||||
.setLabel(_('Size (between 2 and 20)'))
|
||||
.setType('number')
|
||||
);
|
||||
|
||||
const bevelEffect = extension
|
||||
.addEffect('Bevel')
|
||||
.setFullName(_('Beveled edges'))
|
||||
.setDescription(_('Add beveled edges around the rendered image.'))
|
||||
.addIncludeFile('Extensions/Effects/pixi-filters/filter-bevel.js')
|
||||
.addIncludeFile('Extensions/Effects/bevel-pixi-filter.js');
|
||||
const bevelProperties = bevelEffect.getProperties();
|
||||
bevelProperties.set(
|
||||
'rotation',
|
||||
new gd.PropertyDescriptor(/* defaultValue= */ '1')
|
||||
.setLabel(_('Rotation (between 0 and 360)'))
|
||||
.setType('number')
|
||||
);
|
||||
bevelProperties.set(
|
||||
'thickness',
|
||||
new gd.PropertyDescriptor(/* defaultValue= */ '2')
|
||||
.setLabel(_('Outer strength (between 0 and 5)'))
|
||||
.setType('number')
|
||||
);
|
||||
bevelProperties.set(
|
||||
'distance',
|
||||
new gd.PropertyDescriptor(/* defaultValue= */ '15')
|
||||
.setLabel(_('Distance (between 10 and 20)'))
|
||||
.setType('number')
|
||||
);
|
||||
bevelProperties.set(
|
||||
'lightAlpha',
|
||||
new gd.PropertyDescriptor(/* defaultValue= */ '1')
|
||||
.setLabel(_('Light alpha (between 0 and 1)'))
|
||||
.setType('number')
|
||||
);
|
||||
bevelProperties.set(
|
||||
'lightColor',
|
||||
new gd.PropertyDescriptor(/* defaultValue= */ '#ffffff')
|
||||
.setLabel(_('Light color (color of the outline)'))
|
||||
.setType('color')
|
||||
);
|
||||
bevelProperties.set(
|
||||
'shadowColor',
|
||||
new gd.PropertyDescriptor(/* defaultValue= */ '#000000')
|
||||
.setLabel(_('Shadow color (color of the outline)'))
|
||||
.setType('color')
|
||||
);
|
||||
bevelProperties.set(
|
||||
'shadowAlpha',
|
||||
new gd.PropertyDescriptor(/* defaultValue= */ '1')
|
||||
.setLabel(_('Shadow alpha (between 0 and 1)'))
|
||||
.setType('number')
|
||||
);
|
||||
|
||||
return extension;
|
||||
},
|
||||
runExtensionSanityTests: function(gd, extension) {
|
||||
return [];
|
||||
},
|
||||
};
|
29
Extensions/Effects/adjustment-pixi-filter.js
Normal file
29
Extensions/Effects/adjustment-pixi-filter.js
Normal file
@@ -0,0 +1,29 @@
|
||||
gdjs.PixiFiltersTools.registerFilterCreator('Adjustment', {
|
||||
makePIXIFilter: function(layer, effectData) {
|
||||
var adjustmentFilter = new PIXI.filters.AdjustmentFilter();
|
||||
|
||||
return adjustmentFilter;
|
||||
},
|
||||
update: function(filter, layer) {},
|
||||
updateDoubleParameter: function(filter, parameterName, value) {
|
||||
if (parameterName === 'gamma') {
|
||||
filter.gamma = value;
|
||||
} else if (parameterName === 'saturation') {
|
||||
filter.saturation = value;
|
||||
} else if (parameterName === 'contrast') {
|
||||
filter.contrast = value;
|
||||
} else if (parameterName === 'brightness') {
|
||||
filter.brightness = value;
|
||||
} else if (parameterName === 'red') {
|
||||
filter.red = value;
|
||||
} else if (parameterName === 'green') {
|
||||
filter.green = value;
|
||||
} else if (parameterName === 'blue') {
|
||||
filter.blue = value;
|
||||
} else if (parameterName === 'alpha') {
|
||||
filter.alpha = value;
|
||||
}
|
||||
},
|
||||
updateStringParameter: function(filter, parameterName, value) {},
|
||||
updateBooleanParameter: function(filter, parameterName, value) {},
|
||||
});
|
23
Extensions/Effects/advanced-bloom-pixi-filter.js
Normal file
23
Extensions/Effects/advanced-bloom-pixi-filter.js
Normal file
@@ -0,0 +1,23 @@
|
||||
gdjs.PixiFiltersTools.registerFilterCreator('AdvancedBloom', {
|
||||
makePIXIFilter: function(layer, effectData) {
|
||||
var advancedBloomFilter = new PIXI.filters.AdvancedBloomFilter();
|
||||
|
||||
return advancedBloomFilter;
|
||||
},
|
||||
update: function(filter, layer) {},
|
||||
updateDoubleParameter: function(filter, parameterName, value) {
|
||||
if (parameterName === 'threshold') {
|
||||
filter.threshold = value;
|
||||
} else if (parameterName === 'bloomScale') {
|
||||
filter.bloomScale = value;
|
||||
} else if (parameterName === 'brightness') {
|
||||
filter.brightness = value;
|
||||
} else if (parameterName === 'blur') {
|
||||
filter.blur = value;
|
||||
} else if (parameterName === 'quality') {
|
||||
filter.quality = value;
|
||||
}
|
||||
},
|
||||
updateStringParameter: function(filter, parameterName, value) {},
|
||||
updateBooleanParameter: function(filter, parameterName, value) {},
|
||||
});
|
15
Extensions/Effects/ascii-pixi-filter.js
Normal file
15
Extensions/Effects/ascii-pixi-filter.js
Normal file
@@ -0,0 +1,15 @@
|
||||
gdjs.PixiFiltersTools.registerFilterCreator('Ascii', {
|
||||
makePIXIFilter: function(layer, effectData) {
|
||||
var asciiFilter = new PIXI.filters.AsciiFilter();
|
||||
|
||||
return asciiFilter;
|
||||
},
|
||||
update: function(filter, layer) {},
|
||||
updateDoubleParameter: function(filter, parameterName, value) {
|
||||
if (parameterName === 'size') {
|
||||
filter.size = value;
|
||||
}
|
||||
},
|
||||
updateStringParameter: function(filter, parameterName, value) {},
|
||||
updateBooleanParameter: function(filter, parameterName, value) {},
|
||||
});
|
30
Extensions/Effects/bevel-pixi-filter.js
Normal file
30
Extensions/Effects/bevel-pixi-filter.js
Normal file
@@ -0,0 +1,30 @@
|
||||
gdjs.PixiFiltersTools.registerFilterCreator('Bevel', {
|
||||
makePIXIFilter: function(layer, effectData) {
|
||||
var bevelFilter = new PIXI.filters.BevelFilter();
|
||||
|
||||
return bevelFilter;
|
||||
},
|
||||
update: function(filter, layer) {},
|
||||
updateDoubleParameter: function(filter, parameterName, value) {
|
||||
if (parameterName === 'rotation') {
|
||||
filter.rotation = value;
|
||||
} else if (parameterName === 'thickness') {
|
||||
filter.thickness = value;
|
||||
} else if (parameterName === 'distance') {
|
||||
filter.distance = value;
|
||||
} else if (parameterName === 'lightAlpha') {
|
||||
filter.lightAlpha = value;
|
||||
} else if (parameterName === 'shadowAlpha') {
|
||||
filter.shadowAlpha = value;
|
||||
}
|
||||
},
|
||||
updateStringParameter: function(filter, parameterName, value) {
|
||||
if (parameterName === 'lightColor') {
|
||||
filter.lightColor = value.replace('#', '0x');
|
||||
}
|
||||
if (parameterName === 'shadowColor') {
|
||||
filter.shadowColor = value.replace('#', '0x');
|
||||
}
|
||||
},
|
||||
updateBooleanParameter: function(filter, parameterName, value) {},
|
||||
});
|
15
Extensions/Effects/black-and-white-pixi-filter.js
Normal file
15
Extensions/Effects/black-and-white-pixi-filter.js
Normal file
@@ -0,0 +1,15 @@
|
||||
gdjs.PixiFiltersTools.registerFilterCreator('BlackAndWhite', {
|
||||
makePIXIFilter: function(layer, effectData) {
|
||||
var colorMatrix = new PIXI.filters.ColorMatrixFilter();
|
||||
colorMatrix.blackAndWhite();
|
||||
return colorMatrix;
|
||||
},
|
||||
update: function(filter, layer) {},
|
||||
updateDoubleParameter: function(filter, parameterName, value) {
|
||||
if (parameterName !== 'opacity') return;
|
||||
|
||||
filter.alpha = gdjs.PixiFiltersTools.clampValue(value, 0, 1);
|
||||
},
|
||||
updateStringParameter: function(filter, parameterName, value) {},
|
||||
updateBooleanParameter: function(filter, parameterName, value) {},
|
||||
});
|
24
Extensions/Effects/blur-pixi-filter.js
Normal file
24
Extensions/Effects/blur-pixi-filter.js
Normal file
@@ -0,0 +1,24 @@
|
||||
gdjs.PixiFiltersTools.registerFilterCreator('Blur', {
|
||||
makePIXIFilter: function(layer, effectData) {
|
||||
var blur = new PIXI.filters.BlurFilter();
|
||||
return blur;
|
||||
},
|
||||
update: function(filter, layer) {},
|
||||
updateDoubleParameter: function(filter, parameterName, value) {
|
||||
if (
|
||||
parameterName !== 'blur' &&
|
||||
parameterName !== 'quality' &&
|
||||
parameterName !== 'kernelSize' &&
|
||||
parameterName !== 'resolution'
|
||||
)
|
||||
return;
|
||||
|
||||
if (parameterName === 'kernelSize') {
|
||||
value = gdjs.PixiFiltersTools.clampKernelSize(value);
|
||||
}
|
||||
|
||||
filter[parameterName] = value;
|
||||
},
|
||||
updateStringParameter: function(filter, parameterName, value) {},
|
||||
updateBooleanParameter: function(filter, parameterName, value) {},
|
||||
});
|
15
Extensions/Effects/brightness-pixi-filter.js
Normal file
15
Extensions/Effects/brightness-pixi-filter.js
Normal file
@@ -0,0 +1,15 @@
|
||||
gdjs.PixiFiltersTools.registerFilterCreator('Brightness', {
|
||||
makePIXIFilter: function(layer, effectData) {
|
||||
var brightness = new PIXI.filters.ColorMatrixFilter();
|
||||
brightness.brightness(1);
|
||||
return brightness;
|
||||
},
|
||||
update: function(filter, layer) {},
|
||||
updateDoubleParameter: function(filter, parameterName, value) {
|
||||
if (parameterName !== 'brightness') return;
|
||||
|
||||
filter.brightness(gdjs.PixiFiltersTools.clampValue(value, 0, 1));
|
||||
},
|
||||
updateStringParameter: function(filter, parameterName, value) {},
|
||||
updateBooleanParameter: function(filter, parameterName, value) {},
|
||||
});
|
34
Extensions/Effects/color-map-pixi-filter.js
Normal file
34
Extensions/Effects/color-map-pixi-filter.js
Normal file
@@ -0,0 +1,34 @@
|
||||
gdjs.PixiFiltersTools.registerFilterCreator("ColorMap", {
|
||||
makePIXIFilter: function(layer, effectData) {
|
||||
const colorMapTexture = layer
|
||||
.getRuntimeScene()
|
||||
.getGame()
|
||||
.getImageManager()
|
||||
.getPIXITexture(effectData.stringParameters.colorMapTexture);
|
||||
|
||||
const colorMapSprite = new PIXI.Sprite(colorMapTexture);
|
||||
const colorMapFilter = new PIXI.filters.ColorMapFilter(
|
||||
colorMapTexture,
|
||||
effectData.booleanParameters.nearest,
|
||||
gdjs.PixiFiltersTools.clampValue(
|
||||
effectData.doubleParameters.mix / 100,
|
||||
0,
|
||||
1
|
||||
)
|
||||
);
|
||||
|
||||
return colorMapFilter;
|
||||
},
|
||||
update: function(filter, layer) {},
|
||||
updateDoubleParameter: function(filter, parameterName, value) {
|
||||
if (parameterName === "mix") {
|
||||
filter.mix = gdjs.PixiFiltersTools.clampValue(value / 100, 0, 1);
|
||||
}
|
||||
},
|
||||
updateStringParameter: function(filter, parameterName, value) {},
|
||||
updateBooleanParameter: function(filter, parameterName, value) {
|
||||
if (parameterName === "nearest") {
|
||||
filter.nearest = value;
|
||||
}
|
||||
}
|
||||
});
|
41
Extensions/Effects/crt-pixi-filter.js
Normal file
41
Extensions/Effects/crt-pixi-filter.js
Normal file
@@ -0,0 +1,41 @@
|
||||
gdjs.PixiFiltersTools.registerFilterCreator('CRT', {
|
||||
makePIXIFilter: function(layer, effectData) {
|
||||
var crtFilter = new PIXI.filters.CRTFilter();
|
||||
|
||||
return crtFilter;
|
||||
},
|
||||
update: function(filter, layer) {
|
||||
if (filter.animated) {
|
||||
filter.time += layer.getElapsedTime() / 1000;
|
||||
filter.seed = Math.random();
|
||||
}
|
||||
},
|
||||
updateDoubleParameter: function(filter, parameterName, value) {
|
||||
if (parameterName === 'lineWidth') {
|
||||
filter.lineWidth = value;
|
||||
} else if (parameterName === 'lineContrast') {
|
||||
filter.lineContrast = value;
|
||||
} else if (parameterName === 'noise') {
|
||||
filter.noise = value;
|
||||
} else if (parameterName === 'curvature') {
|
||||
filter.curvature = value;
|
||||
} else if (parameterName === 'noiseSize') {
|
||||
filter.noiseSize = value;
|
||||
} else if (parameterName === 'vignetting') {
|
||||
filter.vignetting = value;
|
||||
} else if (parameterName === 'vignettingAlpha') {
|
||||
filter.vignettingAlpha = value;
|
||||
} else if (parameterName === 'vignettingBlur') {
|
||||
filter.vignettingBlur = value;
|
||||
}
|
||||
},
|
||||
updateStringParameter: function(filter, parameterName, value) {},
|
||||
updateBooleanParameter: function(filter, parameterName, value) {
|
||||
if (parameterName === 'verticalLine') {
|
||||
filter.verticalLine = value;
|
||||
}
|
||||
if (parameterName === 'animated') {
|
||||
filter.animated = value;
|
||||
}
|
||||
},
|
||||
});
|
30
Extensions/Effects/displacement-pixi-filter.js
Normal file
30
Extensions/Effects/displacement-pixi-filter.js
Normal file
@@ -0,0 +1,30 @@
|
||||
gdjs.PixiFiltersTools.registerFilterCreator("Displacement", {
|
||||
makePIXIFilter: function(layer, effectData) {
|
||||
const displacementMapTexture = layer
|
||||
.getRuntimeScene()
|
||||
.getGame()
|
||||
.getImageManager()
|
||||
.getPIXITexture(effectData.stringParameters.displacementMapTexture);
|
||||
|
||||
displacementMapTexture.baseTexture.wrapMode = PIXI.WRAP_MODES.REPEAT;
|
||||
|
||||
const displacementSprite = new PIXI.Sprite(displacementMapTexture);
|
||||
const displacementFilter = new PIXI.filters.DisplacementFilter(
|
||||
displacementSprite
|
||||
);
|
||||
|
||||
return displacementFilter;
|
||||
},
|
||||
update: function(filter, layer) {},
|
||||
updateDoubleParameter: function(filter, parameterName, value) {
|
||||
if (parameterName === "scaleX") {
|
||||
filter.scale.x = value;
|
||||
}
|
||||
|
||||
if (parameterName === "scaleY") {
|
||||
filter.scale.y = value;
|
||||
}
|
||||
},
|
||||
updateStringParameter: function(filter, parameterName, value) {},
|
||||
updateBooleanParameter: function(filter, parameterName, value) {}
|
||||
});
|
31
Extensions/Effects/drop-shadow-pixi-filter.js
Normal file
31
Extensions/Effects/drop-shadow-pixi-filter.js
Normal file
@@ -0,0 +1,31 @@
|
||||
gdjs.PixiFiltersTools.registerFilterCreator('DropShadow', {
|
||||
makePIXIFilter: function(layer, effectData) {
|
||||
var dropShadowFilter = new PIXI.filters.DropShadowFilter();
|
||||
|
||||
return dropShadowFilter;
|
||||
},
|
||||
update: function(filter, layer) {},
|
||||
updateDoubleParameter: function(filter, parameterName, value) {
|
||||
if (parameterName === 'blur') {
|
||||
filter.blur = value;
|
||||
} else if (parameterName === 'quality') {
|
||||
filter.quality = value;
|
||||
} else if (parameterName === 'alpha') {
|
||||
filter.alpha = value;
|
||||
} else if (parameterName === 'distance') {
|
||||
filter.distance = value;
|
||||
} else if (parameterName === 'rotation') {
|
||||
filter.rotation = value;
|
||||
}
|
||||
},
|
||||
updateStringParameter: function(filter, parameterName, value) {
|
||||
if (parameterName === 'color') {
|
||||
filter.color = value.replace('#', '0x');
|
||||
}
|
||||
},
|
||||
updateBooleanParameter: function(filter, parameterName, value) {
|
||||
if (parameterName === 'shadowOnly') {
|
||||
filter.shadowOnly = value;
|
||||
}
|
||||
},
|
||||
});
|
23
Extensions/Effects/glow-pixi-filter.js
Normal file
23
Extensions/Effects/glow-pixi-filter.js
Normal file
@@ -0,0 +1,23 @@
|
||||
gdjs.PixiFiltersTools.registerFilterCreator('Glow', {
|
||||
makePIXIFilter: function(layer, effectData) {
|
||||
var glowFilter = new PIXI.filters.GlowFilter();
|
||||
|
||||
return glowFilter;
|
||||
},
|
||||
update: function(filter, layer) {},
|
||||
updateDoubleParameter: function(filter, parameterName, value) {
|
||||
if (parameterName === 'innerStrength') {
|
||||
filter.innerStrength = value;
|
||||
} else if (parameterName === 'outerStrength') {
|
||||
filter.outerStrength = value;
|
||||
} else if (parameterName === 'distance') {
|
||||
filter.distance = value;
|
||||
}
|
||||
},
|
||||
updateStringParameter: function(filter, parameterName, value) {
|
||||
if (parameterName === 'color') {
|
||||
filter.color = value.replace('#', '0x');
|
||||
}
|
||||
},
|
||||
updateBooleanParameter: function(filter, parameterName, value) {},
|
||||
});
|
36
Extensions/Effects/godray-pixi-filter.js
Normal file
36
Extensions/Effects/godray-pixi-filter.js
Normal file
@@ -0,0 +1,36 @@
|
||||
gdjs.PixiFiltersTools.registerFilterCreator('Godray', {
|
||||
makePIXIFilter: function(layer, effectData) {
|
||||
var godrayFilter = new PIXI.filters.GodrayFilter();
|
||||
|
||||
return godrayFilter;
|
||||
},
|
||||
update: function(filter, layer) {
|
||||
if (filter.animated) {
|
||||
filter.time += layer.getElapsedTime() / 1000;
|
||||
}
|
||||
},
|
||||
updateDoubleParameter: function(filter, parameterName, value) {
|
||||
if (parameterName === 'lacunarity') {
|
||||
filter.lacunarity = value;
|
||||
} else if (parameterName === 'angle') {
|
||||
filter.angle = value;
|
||||
} else if (parameterName === 'gain') {
|
||||
filter.gain = value;
|
||||
} else if (parameterName === 'light') {
|
||||
filter.light = value;
|
||||
} else if (parameterName === 'x') {
|
||||
filter.x = value;
|
||||
} else if (parameterName === 'y') {
|
||||
filter.y = value;
|
||||
}
|
||||
},
|
||||
updateStringParameter: function(filter, parameterName, value) {},
|
||||
updateBooleanParameter: function(filter, parameterName, value) {
|
||||
if (parameterName === 'parallel') {
|
||||
filter.parallel = value;
|
||||
}
|
||||
if (parameterName === 'animated') {
|
||||
filter.animated = value;
|
||||
}
|
||||
},
|
||||
});
|
27
Extensions/Effects/kawase-blur-pixi-filter.js
Normal file
27
Extensions/Effects/kawase-blur-pixi-filter.js
Normal file
@@ -0,0 +1,27 @@
|
||||
gdjs.PixiFiltersTools.registerFilterCreator('KawaseBlur', {
|
||||
makePIXIFilter: function(layer, effectData) {
|
||||
var kawaseBlurFilter = new PIXI.filters.KawaseBlurFilter();
|
||||
|
||||
return kawaseBlurFilter;
|
||||
},
|
||||
update: function(filter, layer) {
|
||||
},
|
||||
updateDoubleParameter: function(filter, parameterName, value) {
|
||||
if (parameterName === 'pixelizeX') {
|
||||
filter.pixelizeX = value;
|
||||
}
|
||||
else if (parameterName === 'pixelizeY') {
|
||||
filter.pixelizeY = value;
|
||||
}
|
||||
else if (parameterName === 'blur') {
|
||||
filter.blur = value;
|
||||
}
|
||||
else if (parameterName === 'quality') {
|
||||
filter.quality = value;
|
||||
}
|
||||
},
|
||||
updateStringParameter: function(filter, parameterName, value) {
|
||||
},
|
||||
updateBooleanParameter: function(filter, parameterName, value) {
|
||||
},
|
||||
});
|
40
Extensions/Effects/light-night-pixi-filter.js
Normal file
40
Extensions/Effects/light-night-pixi-filter.js
Normal file
@@ -0,0 +1,40 @@
|
||||
gdjs.LightNightPixiFilter = function() {
|
||||
var vertexShader = null;
|
||||
var fragmentShader = [
|
||||
'precision mediump float;',
|
||||
'',
|
||||
'varying vec2 vTextureCoord;',
|
||||
'uniform sampler2D uSampler;',
|
||||
'uniform float opacity;',
|
||||
'',
|
||||
'void main(void)',
|
||||
'{',
|
||||
' mat3 nightMatrix = mat3(0.6, 0, 0, 0, 0.7, 0, 0, 0, 1.3);',
|
||||
' gl_FragColor = texture2D(uSampler, vTextureCoord);',
|
||||
' gl_FragColor.rgb = mix(gl_FragColor.rgb, nightMatrix * gl_FragColor.rgb, opacity);',
|
||||
'}',
|
||||
].join('\n');
|
||||
var uniforms = {
|
||||
opacity: { type: '1f', value: 1 },
|
||||
};
|
||||
|
||||
PIXI.Filter.call(this, vertexShader, fragmentShader, uniforms);
|
||||
};
|
||||
|
||||
gdjs.LightNightPixiFilter.prototype = Object.create(PIXI.Filter.prototype);
|
||||
gdjs.LightNightPixiFilter.prototype.constructor = gdjs.LightNightPixiFilter;
|
||||
|
||||
gdjs.PixiFiltersTools.registerFilterCreator('LightNight', {
|
||||
makePIXIFilter: function(layer, effectData) {
|
||||
var filter = new gdjs.LightNightPixiFilter();
|
||||
return filter;
|
||||
},
|
||||
update: function(filter, layer) {},
|
||||
updateDoubleParameter: function(filter, parameterName, value) {
|
||||
if (parameterName !== 'opacity') return;
|
||||
|
||||
filter.uniforms.opacity = gdjs.PixiFiltersTools.clampValue(value, 0, 1);
|
||||
},
|
||||
updateStringParameter: function(filter, parameterName, value) {},
|
||||
updateBooleanParameter: function(filter, parameterName, value) {},
|
||||
});
|
46
Extensions/Effects/night-pixi-filter.js
Normal file
46
Extensions/Effects/night-pixi-filter.js
Normal file
@@ -0,0 +1,46 @@
|
||||
gdjs.NightPixiFilter = function() {
|
||||
var vertexShader = null;
|
||||
var fragmentShader = [
|
||||
'precision mediump float;',
|
||||
'',
|
||||
'varying vec2 vTextureCoord;',
|
||||
'uniform sampler2D uSampler;',
|
||||
'uniform float intensity;',
|
||||
'uniform float opacity;',
|
||||
'',
|
||||
'void main(void)',
|
||||
'{',
|
||||
' mat3 nightMatrix = mat3(-2.0 * intensity, -1.0 * intensity, 0, -1.0 * intensity, 0, 1.0 * intensity, 0, 1.0 * intensity, 2.0 * intensity);',
|
||||
' gl_FragColor = texture2D(uSampler, vTextureCoord);',
|
||||
' gl_FragColor.rgb = mix(gl_FragColor.rgb, nightMatrix * gl_FragColor.rgb, opacity);',
|
||||
'}',
|
||||
].join('\n');
|
||||
var uniforms = {
|
||||
intensity: { type: '1f', value: 1 },
|
||||
opacity: { type: '1f', value: 1 },
|
||||
};
|
||||
|
||||
PIXI.Filter.call(this, vertexShader, fragmentShader, uniforms);
|
||||
};
|
||||
|
||||
gdjs.NightPixiFilter.prototype = Object.create(PIXI.Filter.prototype);
|
||||
gdjs.NightPixiFilter.prototype.constructor = gdjs.NightPixiFilter;
|
||||
|
||||
gdjs.PixiFiltersTools.registerFilterCreator('Night', {
|
||||
makePIXIFilter: function(layer, effectData) {
|
||||
var filter = new gdjs.NightPixiFilter();
|
||||
return filter;
|
||||
},
|
||||
update: function(filter, layer) {},
|
||||
updateDoubleParameter: function(filter, parameterName, value) {
|
||||
if (parameterName !== 'intensity' && parameterName !== 'opacity') return;
|
||||
|
||||
filter.uniforms[parameterName] = gdjs.PixiFiltersTools.clampValue(
|
||||
value,
|
||||
0,
|
||||
1
|
||||
);
|
||||
},
|
||||
updateStringParameter: function(filter, parameterName, value) {},
|
||||
updateBooleanParameter: function(filter, parameterName, value) {},
|
||||
});
|
14
Extensions/Effects/noise-pixi-filter.js
Normal file
14
Extensions/Effects/noise-pixi-filter.js
Normal file
@@ -0,0 +1,14 @@
|
||||
gdjs.PixiFiltersTools.registerFilterCreator('Noise', {
|
||||
makePIXIFilter: function(layer, effectData) {
|
||||
var noise = new PIXI.filters.NoiseFilter();
|
||||
return noise;
|
||||
},
|
||||
update: function(filter, layer) {},
|
||||
updateDoubleParameter: function(filter, parameterName, value) {
|
||||
if (parameterName !== 'noise') return;
|
||||
|
||||
filter.noise = gdjs.PixiFiltersTools.clampValue(value, 0, 1);
|
||||
},
|
||||
updateStringParameter: function(filter, parameterName, value) {},
|
||||
updateBooleanParameter: function(filter, parameterName, value) {},
|
||||
});
|
19
Extensions/Effects/outline-pixi-filter.js
Normal file
19
Extensions/Effects/outline-pixi-filter.js
Normal file
@@ -0,0 +1,19 @@
|
||||
gdjs.PixiFiltersTools.registerFilterCreator('Outline', {
|
||||
makePIXIFilter: function(layer, effectData) {
|
||||
var outlineFilter = new PIXI.filters.OutlineFilter();
|
||||
|
||||
return outlineFilter;
|
||||
},
|
||||
update: function(filter, layer) {},
|
||||
updateDoubleParameter: function(filter, parameterName, value) {
|
||||
if (parameterName === 'thickness') {
|
||||
filter.thickness = value;
|
||||
}
|
||||
},
|
||||
updateStringParameter: function(filter, parameterName, value) {
|
||||
if (parameterName === 'color') {
|
||||
filter.color = value.replace('#', '0x');
|
||||
}
|
||||
},
|
||||
updateBooleanParameter: function(filter, parameterName, value) {},
|
||||
});
|
17
Extensions/Effects/pixelate-pixi-filter.js
Normal file
17
Extensions/Effects/pixelate-pixi-filter.js
Normal file
@@ -0,0 +1,17 @@
|
||||
gdjs.PixiFiltersTools.registerFilterCreator("Pixelate", {
|
||||
makePIXIFilter: function(layer, effectData) {
|
||||
const PixelateFilter = new PIXI.filters.PixelateFilter(
|
||||
effectData.doubleParameters.size
|
||||
);
|
||||
|
||||
return PixelateFilter;
|
||||
},
|
||||
update: function(filter, layer) {},
|
||||
updateDoubleParameter: function(filter, parameterName, value) {
|
||||
if (parameterName === "size") {
|
||||
filter.size = value;
|
||||
}
|
||||
},
|
||||
updateStringParameter: function(filter, parameterName, value) {},
|
||||
updateBooleanParameter: function(filter, parameterName, value) {}
|
||||
});
|
BIN
Extensions/Effects/pixi-filters/colormap-template-16.png
Normal file
BIN
Extensions/Effects/pixi-filters/colormap-template-16.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.5 KiB |
BIN
Extensions/Effects/pixi-filters/displacementmap-template.png
Normal file
BIN
Extensions/Effects/pixi-filters/displacementmap-template.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 59 KiB |
9
Extensions/Effects/pixi-filters/filter-adjustment.js
Normal file
9
Extensions/Effects/pixi-filters/filter-adjustment.js
Normal file
@@ -0,0 +1,9 @@
|
||||
/*!
|
||||
* @pixi/filter-adjustment - v2.5.0
|
||||
* Compiled Fri, 20 Dec 2019 18:59:17 UTC
|
||||
*
|
||||
* @pixi/filter-adjustment is licensed under the MIT License.
|
||||
* http://www.opensource.org/licenses/mit-license
|
||||
*/
|
||||
!function(t,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports,require("pixi.js")):"function"==typeof define&&define.amd?define(["exports","pixi.js"],n):n(t.__filters={},t.PIXI)}(this,function(t,n){"use strict";var r="attribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\n\nuniform mat3 projectionMatrix;\n\nvarying vec2 vTextureCoord;\n\nvoid main(void)\n{\n gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n vTextureCoord = aTextureCoord;\n}",e="varying vec2 vTextureCoord;\nuniform sampler2D uSampler;\n\nuniform float gamma;\nuniform float contrast;\nuniform float saturation;\nuniform float brightness;\nuniform float red;\nuniform float green;\nuniform float blue;\nuniform float alpha;\n\nvoid main(void)\n{\n vec4 c = texture2D(uSampler, vTextureCoord);\n\n if (c.a > 0.0) {\n c.rgb /= c.a;\n\n vec3 rgb = pow(c.rgb, vec3(1. / gamma));\n rgb = mix(vec3(.5), mix(vec3(dot(vec3(.2125, .7154, .0721), rgb)), rgb, saturation), contrast);\n rgb.r *= red;\n rgb.g *= green;\n rgb.b *= blue;\n c.rgb = rgb * brightness;\n\n c.rgb *= c.a;\n }\n\n gl_FragColor = c * alpha;\n}\n",i=function(t){function n(n){t.call(this,r,e),Object.assign(this,{gamma:1,saturation:1,contrast:1,brightness:1,red:1,green:1,blue:1,alpha:1},n)}return t&&(n.__proto__=t),n.prototype=Object.create(t&&t.prototype),n.prototype.constructor=n,n.prototype.apply=function(t,n,r,e){this.uniforms.gamma=Math.max(this.gamma,1e-4),this.uniforms.saturation=this.saturation,this.uniforms.contrast=this.contrast,this.uniforms.brightness=this.brightness,this.uniforms.red=this.red,this.uniforms.green=this.green,this.uniforms.blue=this.blue,this.uniforms.alpha=this.alpha,t.applyFilter(this,n,r,e)},n}(n.Filter);t.AdjustmentFilter=i,Object.defineProperty(t,"__esModule",{value:!0})}),Object.assign(PIXI.filters,this?this.__filters:__filters);
|
||||
//# sourceMappingURL=filter-adjustment.js.map
|
9
Extensions/Effects/pixi-filters/filter-advanced-bloom.js
Normal file
9
Extensions/Effects/pixi-filters/filter-advanced-bloom.js
Normal file
@@ -0,0 +1,9 @@
|
||||
/*!
|
||||
* @pixi/filter-advanced-bloom - v2.6.0
|
||||
* Compiled Fri, 20 Dec 2019 18:59:17 UTC
|
||||
*
|
||||
* @pixi/filter-advanced-bloom is licensed under the MIT License.
|
||||
* http://www.opensource.org/licenses/mit-license
|
||||
*/
|
||||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("pixi.js"),require("@pixi/filter-kawase-blur")):"function"==typeof define&&define.amd?define(["exports","pixi.js","@pixi/filter-kawase-blur"],t):t(e.__filters={},e.PIXI,e.PIXI.filters)}(this,function(e,t,r){"use strict";var o="attribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\n\nuniform mat3 projectionMatrix;\n\nvarying vec2 vTextureCoord;\n\nvoid main(void)\n{\n gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n vTextureCoord = aTextureCoord;\n}",i="\nuniform sampler2D uSampler;\nvarying vec2 vTextureCoord;\n\nuniform float threshold;\n\nvoid main() {\n vec4 color = texture2D(uSampler, vTextureCoord);\n\n // A simple & fast algorithm for getting brightness.\n // It's inaccuracy , but good enought for this feature.\n float _max = max(max(color.r, color.g), color.b);\n float _min = min(min(color.r, color.g), color.b);\n float brightness = (_max + _min) * 0.5;\n\n if(brightness > threshold) {\n gl_FragColor = color;\n } else {\n gl_FragColor = vec4(0.0, 0.0, 0.0, 0.0);\n }\n}\n",n=function(e){function t(t){void 0===t&&(t=.5),e.call(this,o,i),this.threshold=t}e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t;var r={threshold:{configurable:!0}};return r.threshold.get=function(){return this.uniforms.threshold},r.threshold.set=function(e){this.uniforms.threshold=e},Object.defineProperties(t.prototype,r),t}(t.Filter),l="uniform sampler2D uSampler;\nvarying vec2 vTextureCoord;\n\nuniform sampler2D bloomTexture;\nuniform float bloomScale;\nuniform float brightness;\n\nvoid main() {\n vec4 color = texture2D(uSampler, vTextureCoord);\n color.rgb *= brightness;\n vec4 bloomColor = vec4(texture2D(bloomTexture, vTextureCoord).rgb, 0.0);\n bloomColor.rgb *= bloomScale;\n gl_FragColor = color + bloomColor;\n}\n",s=function(e){function i(i){e.call(this,o,l),"number"==typeof i&&(i={threshold:i}),i=Object.assign({threshold:.5,bloomScale:1,brightness:1,kernels:null,blur:8,quality:4,pixelSize:1,resolution:t.settings.RESOLUTION},i),this.bloomScale=i.bloomScale,this.brightness=i.brightness;var s=i.kernels,u=i.blur,a=i.quality,c=i.pixelSize,h=i.resolution;this._extractFilter=new n(i.threshold),this._extractFilter.resolution=h,this._blurFilter=s?new r.KawaseBlurFilter(s):new r.KawaseBlurFilter(u,a),this.pixelSize=c,this.resolution=h}e&&(i.__proto__=e),i.prototype=Object.create(e&&e.prototype),i.prototype.constructor=i;var s={resolution:{configurable:!0},threshold:{configurable:!0},kernels:{configurable:!0},blur:{configurable:!0},quality:{configurable:!0},pixelSize:{configurable:!0}};return i.prototype.apply=function(e,t,r,o,i){var n=e.getRenderTarget(!0);this._extractFilter.apply(e,t,n,!0,i);var l=e.getRenderTarget(!0);this._blurFilter.apply(e,n,l,!0,i),this.uniforms.bloomScale=this.bloomScale,this.uniforms.brightness=this.brightness,this.uniforms.bloomTexture=l,e.applyFilter(this,t,r,o),e.returnRenderTarget(l),e.returnRenderTarget(n)},s.resolution.get=function(){return this._resolution},s.resolution.set=function(e){this._resolution=e,this._extractFilter&&(this._extractFilter.resolution=e),this._blurFilter&&(this._blurFilter.resolution=e)},s.threshold.get=function(){return this._extractFilter.threshold},s.threshold.set=function(e){this._extractFilter.threshold=e},s.kernels.get=function(){return this._blurFilter.kernels},s.kernels.set=function(e){this._blurFilter.kernels=e},s.blur.get=function(){return this._blurFilter.blur},s.blur.set=function(e){this._blurFilter.blur=e},s.quality.get=function(){return this._blurFilter.quality},s.quality.set=function(e){this._blurFilter.quality=e},s.pixelSize.get=function(){return this._blurFilter.pixelSize},s.pixelSize.set=function(e){this._blurFilter.pixelSize=e},Object.defineProperties(i.prototype,s),i}(t.Filter);e.AdvancedBloomFilter=s,Object.defineProperty(e,"__esModule",{value:!0})}),Object.assign(PIXI.filters,this?this.__filters:__filters);
|
||||
//# sourceMappingURL=filter-advanced-bloom.js.map
|
9
Extensions/Effects/pixi-filters/filter-ascii.js
Normal file
9
Extensions/Effects/pixi-filters/filter-ascii.js
Normal file
@@ -0,0 +1,9 @@
|
||||
/*!
|
||||
* @pixi/filter-ascii - v2.5.0
|
||||
* Compiled Fri, 20 Dec 2019 18:59:17 UTC
|
||||
*
|
||||
* @pixi/filter-ascii is licensed under the MIT License.
|
||||
* http://www.opensource.org/licenses/mit-license
|
||||
*/
|
||||
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports,require("pixi.js")):"function"==typeof define&&define.amd?define(["exports","pixi.js"],n):n(e.__filters={},e.PIXI)}(this,function(e,n){"use strict";var o="attribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\n\nuniform mat3 projectionMatrix;\n\nvarying vec2 vTextureCoord;\n\nvoid main(void)\n{\n gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n vTextureCoord = aTextureCoord;\n}",r="varying vec2 vTextureCoord;\n\nuniform vec4 filterArea;\nuniform float pixelSize;\nuniform sampler2D uSampler;\n\nvec2 mapCoord( vec2 coord )\n{\n coord *= filterArea.xy;\n coord += filterArea.zw;\n\n return coord;\n}\n\nvec2 unmapCoord( vec2 coord )\n{\n coord -= filterArea.zw;\n coord /= filterArea.xy;\n\n return coord;\n}\n\nvec2 pixelate(vec2 coord, vec2 size)\n{\n return floor( coord / size ) * size;\n}\n\nvec2 getMod(vec2 coord, vec2 size)\n{\n return mod( coord , size) / size;\n}\n\nfloat character(float n, vec2 p)\n{\n p = floor(p*vec2(4.0, -4.0) + 2.5);\n if (clamp(p.x, 0.0, 4.0) == p.x && clamp(p.y, 0.0, 4.0) == p.y)\n {\n if (int(mod(n/exp2(p.x + 5.0*p.y), 2.0)) == 1) return 1.0;\n }\n return 0.0;\n}\n\nvoid main()\n{\n vec2 coord = mapCoord(vTextureCoord);\n\n // get the rounded color..\n vec2 pixCoord = pixelate(coord, vec2(pixelSize));\n pixCoord = unmapCoord(pixCoord);\n\n vec4 color = texture2D(uSampler, pixCoord);\n\n // determine the character to use\n float gray = (color.r + color.g + color.b) / 3.0;\n\n float n = 65536.0; // .\n if (gray > 0.2) n = 65600.0; // :\n if (gray > 0.3) n = 332772.0; // *\n if (gray > 0.4) n = 15255086.0; // o\n if (gray > 0.5) n = 23385164.0; // &\n if (gray > 0.6) n = 15252014.0; // 8\n if (gray > 0.7) n = 13199452.0; // @\n if (gray > 0.8) n = 11512810.0; // #\n\n // get the mod..\n vec2 modd = getMod(coord, vec2(pixelSize));\n\n gl_FragColor = color * character( n, vec2(-1.0) + modd * 2.0);\n\n}",t=function(e){function n(n){void 0===n&&(n=8),e.call(this,o,r),this.size=n}e&&(n.__proto__=e),n.prototype=Object.create(e&&e.prototype),n.prototype.constructor=n;var t={size:{configurable:!0}};return t.size.get=function(){return this.uniforms.pixelSize},t.size.set=function(e){this.uniforms.pixelSize=e},Object.defineProperties(n.prototype,t),n}(n.Filter);e.AsciiFilter=t,Object.defineProperty(e,"__esModule",{value:!0})}),Object.assign(PIXI.filters,this?this.__filters:__filters);
|
||||
//# sourceMappingURL=filter-ascii.js.map
|
9
Extensions/Effects/pixi-filters/filter-bevel.js
Normal file
9
Extensions/Effects/pixi-filters/filter-bevel.js
Normal file
@@ -0,0 +1,9 @@
|
||||
/*!
|
||||
* @pixi/filter-bevel - v2.6.0
|
||||
* Compiled Fri, 20 Dec 2019 18:59:17 UTC
|
||||
*
|
||||
* @pixi/filter-bevel is licensed under the MIT License.
|
||||
* http://www.opensource.org/licenses/mit-license
|
||||
*/
|
||||
!function(o,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("pixi.js")):"function"==typeof define&&define.amd?define(["exports","pixi.js"],t):t(o.__filters={},o.PIXI)}(this,function(o,t){"use strict";var r="attribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\n\nuniform mat3 projectionMatrix;\n\nvarying vec2 vTextureCoord;\n\nvoid main(void)\n{\n gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n vTextureCoord = aTextureCoord;\n}",i="precision mediump float;\n\nvarying vec2 vTextureCoord;\nuniform sampler2D uSampler;\nuniform vec4 filterArea;\n\nuniform float transformX;\nuniform float transformY;\nuniform vec3 lightColor;\nuniform float lightAlpha;\nuniform vec3 shadowColor;\nuniform float shadowAlpha;\n\nvoid main(void) {\n vec2 transform = vec2(1.0 / filterArea) * vec2(transformX, transformY);\n vec4 color = texture2D(uSampler, vTextureCoord);\n float light = texture2D(uSampler, vTextureCoord - transform).a;\n float shadow = texture2D(uSampler, vTextureCoord + transform).a;\n\n color.rgb = mix(color.rgb, lightColor, clamp((color.a - light) * lightAlpha, 0.0, 1.0));\n color.rgb = mix(color.rgb, shadowColor, clamp((color.a - shadow) * shadowAlpha, 0.0, 1.0));\n gl_FragColor = vec4(color.rgb * color.a, color.a);\n}\n",n=function(o){function n(t){void 0===t&&(t={}),o.call(this,r,i),this.uniforms.lightColor=new Float32Array(3),this.uniforms.shadowColor=new Float32Array(3),t=Object.assign({rotation:45,thickness:2,lightColor:16777215,lightAlpha:.7,shadowColor:0,shadowAlpha:.7},t),this.rotation=t.rotation,this.thickness=t.thickness,this.lightColor=t.lightColor,this.lightAlpha=t.lightAlpha,this.shadowColor=t.shadowColor,this.shadowAlpha=t.shadowAlpha}o&&(n.__proto__=o),n.prototype=Object.create(o&&o.prototype),n.prototype.constructor=n;var e={rotation:{configurable:!0},thickness:{configurable:!0},lightColor:{configurable:!0},lightAlpha:{configurable:!0},shadowColor:{configurable:!0},shadowAlpha:{configurable:!0}};return n.prototype._updateTransform=function(){this.uniforms.transformX=this._thickness*Math.cos(this._angle),this.uniforms.transformY=this._thickness*Math.sin(this._angle)},e.rotation.get=function(){return this._angle/t.DEG_TO_RAD},e.rotation.set=function(o){this._angle=o*t.DEG_TO_RAD,this._updateTransform()},e.thickness.get=function(){return this._thickness},e.thickness.set=function(o){this._thickness=o,this._updateTransform()},e.lightColor.get=function(){return t.utils.rgb2hex(this.uniforms.lightColor)},e.lightColor.set=function(o){t.utils.hex2rgb(o,this.uniforms.lightColor)},e.lightAlpha.get=function(){return this.uniforms.lightAlpha},e.lightAlpha.set=function(o){this.uniforms.lightAlpha=o},e.shadowColor.get=function(){return t.utils.rgb2hex(this.uniforms.shadowColor)},e.shadowColor.set=function(o){t.utils.hex2rgb(o,this.uniforms.shadowColor)},e.shadowAlpha.get=function(){return this.uniforms.shadowAlpha},e.shadowAlpha.set=function(o){this.uniforms.shadowAlpha=o},Object.defineProperties(n.prototype,e),n}(t.Filter);o.BevelFilter=n,Object.defineProperty(o,"__esModule",{value:!0})}),Object.assign(PIXI.filters,this?this.__filters:__filters);
|
||||
//# sourceMappingURL=filter-bevel.js.map
|
9
Extensions/Effects/pixi-filters/filter-color-map.js
Normal file
9
Extensions/Effects/pixi-filters/filter-color-map.js
Normal file
@@ -0,0 +1,9 @@
|
||||
/*!
|
||||
* @pixi/filter-color-map - v3.0.3
|
||||
* Compiled Wed, 29 May 2019 03:04:05 UTC
|
||||
*
|
||||
* @pixi/filter-color-map is licensed under the MIT License.
|
||||
* http://www.opensource.org/licenses/mit-license
|
||||
*/
|
||||
var __filters=function(e,i,t){"use strict";var o="attribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\n\nuniform mat3 projectionMatrix;\n\nvarying vec2 vTextureCoord;\n\nvoid main(void)\n{\n gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n vTextureCoord = aTextureCoord;\n}",r="varying vec2 vTextureCoord;\nuniform sampler2D uSampler;\nuniform sampler2D colorMap;\nuniform float _mix;\nuniform float _size;\nuniform float _sliceSize;\nuniform float _slicePixelSize;\nuniform float _sliceInnerSize;\nvoid main() {\n vec4 color = texture2D(uSampler, vTextureCoord.xy);\n\n vec4 adjusted;\n if (color.a > 0.0) {\n color.rgb /= color.a;\n float innerWidth = _size - 1.0;\n float zSlice0 = min(floor(color.b * innerWidth), innerWidth);\n float zSlice1 = min(zSlice0 + 1.0, innerWidth);\n float xOffset = _slicePixelSize * 0.5 + color.r * _sliceInnerSize;\n float s0 = xOffset + (zSlice0 * _sliceSize);\n float s1 = xOffset + (zSlice1 * _sliceSize);\n float yOffset = _sliceSize * 0.5 + color.g * (1.0 - _sliceSize);\n vec4 slice0Color = texture2D(colorMap, vec2(s0,yOffset));\n vec4 slice1Color = texture2D(colorMap, vec2(s1,yOffset));\n float zOffset = fract(color.b * innerWidth);\n adjusted = mix(slice0Color, slice1Color, zOffset);\n\n color.rgb *= color.a;\n }\n gl_FragColor = vec4(mix(color, adjusted, _mix).rgb, color.a);\n\n}",s=function(e){function s(i,t,s){void 0===t&&(t=!1),void 0===s&&(s=1),e.call(this,o,r),this._size=0,this._sliceSize=0,this._slicePixelSize=0,this._sliceInnerSize=0,this._scaleMode=null,this._nearest=!1,this.nearest=t,this.mix=s,this.colorMap=i}e&&(s.__proto__=e),s.prototype=Object.create(e&&e.prototype),s.prototype.constructor=s;var n={colorSize:{configurable:!0},colorMap:{configurable:!0},nearest:{configurable:!0}};return s.prototype.apply=function(e,i,t,o){this.uniforms._mix=this.mix,e.applyFilter(this,i,t,o)},n.colorSize.get=function(){return this._size},n.colorMap.get=function(){return this._colorMap},n.colorMap.set=function(e){e instanceof i.Texture||(e=i.Texture.from(e)),e&&e.baseTexture&&(e.baseTexture.scaleMode=this._scaleMode,e.baseTexture.mipmap=!1,this._size=e.height,this._sliceSize=1/this._size,this._slicePixelSize=this._sliceSize/this._size,this._sliceInnerSize=this._slicePixelSize*(this._size-1),this.uniforms._size=this._size,this.uniforms._sliceSize=this._sliceSize,this.uniforms._slicePixelSize=this._slicePixelSize,this.uniforms._sliceInnerSize=this._sliceInnerSize,this.uniforms.colorMap=e),this._colorMap=e},n.nearest.get=function(){return this._nearest},n.nearest.set=function(e){this._nearest=e,this._scaleMode=e?t.SCALE_MODES.NEAREST:t.SCALE_MODES.LINEAR;var i=this._colorMap;i&&i.baseTexture&&(i.baseTexture._glTextures={},i.baseTexture.scaleMode=this._scaleMode,i.baseTexture.mipmap=!1,i._updateID++,i.baseTexture.emit("update",i.baseTexture))},s.prototype.updateColorMap=function(){var e=this._colorMap;e&&e.baseTexture&&(e._updateID++,e.baseTexture.emit("update",e.baseTexture),this.colorMap=e)},s.prototype.destroy=function(i){this._colorMap&&this._colorMap.destroy(i),e.prototype.destroy.call(this)},Object.defineProperties(s.prototype,n),s}(i.Filter);return e.ColorMapFilter=s,e}({},PIXI,PIXI);Object.assign(PIXI.filters,__filters);
|
||||
//# sourceMappingURL=filter-color-map.js.map
|
13
Extensions/Effects/pixi-filters/filter-crt.js
Normal file
13
Extensions/Effects/pixi-filters/filter-crt.js
Normal file
@@ -0,0 +1,13 @@
|
||||
/*!
|
||||
* @pixi/filter-crt - v3.0.3
|
||||
* Compiled Wed, 18 Dec 2019 19:58:07 UTC
|
||||
*
|
||||
* @pixi/filter-crt is licensed under the MIT License.
|
||||
* http://www.opensource.org/licenses/mit-license
|
||||
*/
|
||||
|
||||
/**
|
||||
* Modified the minified file to work on pixi4 by renaming filterFrame to sourceFrame below
|
||||
*/
|
||||
var __filters=function(n,i){"use strict";var t="attribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\n\nuniform mat3 projectionMatrix;\n\nvarying vec2 vTextureCoord;\n\nvoid main(void)\n{\n gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n vTextureCoord = aTextureCoord;\n}",e="varying vec2 vTextureCoord;\nuniform sampler2D uSampler;\n\nuniform vec4 filterArea;\nuniform vec2 dimensions;\n\nconst float SQRT_2 = 1.414213;\n\nconst float light = 1.0;\n\nuniform float curvature;\nuniform float lineWidth;\nuniform float lineContrast;\nuniform bool verticalLine;\nuniform float noise;\nuniform float noiseSize;\n\nuniform float vignetting;\nuniform float vignettingAlpha;\nuniform float vignettingBlur;\n\nuniform float seed;\nuniform float time;\n\nfloat rand(vec2 co) {\n return fract(sin(dot(co.xy, vec2(12.9898, 78.233))) * 43758.5453);\n}\n\nvoid main(void)\n{\n vec2 pixelCoord = vTextureCoord.xy * filterArea.xy;\n vec2 coord = pixelCoord / dimensions;\n\n vec2 dir = vec2(coord - vec2(0.5, 0.5));\n\n float _c = curvature > 0. ? curvature : 1.;\n float k = curvature > 0. ?(length(dir * dir) * 0.25 * _c * _c + 0.935 * _c) : 1.;\n vec2 uv = dir * k;\n\n gl_FragColor = texture2D(uSampler, vTextureCoord);\n vec3 rgb = gl_FragColor.rgb;\n\n\n if (noise > 0.0 && noiseSize > 0.0)\n {\n pixelCoord.x = floor(pixelCoord.x / noiseSize);\n pixelCoord.y = floor(pixelCoord.y / noiseSize);\n float _noise = rand(pixelCoord * noiseSize * seed) - 0.5;\n rgb += _noise * noise;\n }\n\n if (lineWidth > 0.0) {\n float v = (verticalLine ? uv.x * dimensions.x : uv.y * dimensions.y) * min(1.0, 2.0 / lineWidth ) / _c;\n float j = 1. + cos(v * 1.2 - time) * 0.5 * lineContrast;\n rgb *= j;\n float segment = verticalLine ? mod((dir.x + .5) * dimensions.x, 4.) : mod((dir.y + .5) * dimensions.y, 4.);\n rgb *= 0.99 + ceil(segment) * 0.015;\n }\n\n if (vignetting > 0.0)\n {\n float outter = SQRT_2 - vignetting * SQRT_2;\n float darker = clamp((outter - length(dir) * SQRT_2) / ( 0.00001 + vignettingBlur * SQRT_2), 0.0, 1.0);\n rgb *= darker + (1.0 - darker) * (1.0 - vignettingAlpha);\n }\n\n gl_FragColor.rgb = rgb;\n}\n",r=function(n){function i(i){n.call(this,t,e),this.uniforms.dimensions=new Float32Array(2),this.time=0,this.seed=0,Object.assign(this,{curvature:1,lineWidth:1,lineContrast:.25,verticalLine:!1,noise:0,noiseSize:1,seed:0,vignetting:.3,vignettingAlpha:1,vignettingBlur:.3,time:0},i)}n&&(i.__proto__=n),i.prototype=Object.create(n&&n.prototype),i.prototype.constructor=i;var r={curvature:{configurable:!0},lineWidth:{configurable:!0},lineContrast:{configurable:!0},verticalLine:{configurable:!0},noise:{configurable:!0},noiseSize:{configurable:!0},vignetting:{configurable:!0},vignettingAlpha:{configurable:!0},vignettingBlur:{configurable:!0}};return i.prototype.apply=function(n,i,t,e){this.uniforms.dimensions[0]=i.sourceFrame.width,this.uniforms.dimensions[1]=i.sourceFrame.height,this.uniforms.seed=this.seed,this.uniforms.time=this.time,n.applyFilter(this,i,t,e)},r.curvature.set=function(n){this.uniforms.curvature=n},r.curvature.get=function(){return this.uniforms.curvature},r.lineWidth.set=function(n){this.uniforms.lineWidth=n},r.lineWidth.get=function(){return this.uniforms.lineWidth},r.lineContrast.set=function(n){this.uniforms.lineContrast=n},r.lineContrast.get=function(){return this.uniforms.lineContrast},r.verticalLine.set=function(n){this.uniforms.verticalLine=n},r.verticalLine.get=function(){return this.uniforms.verticalLine},r.noise.set=function(n){this.uniforms.noise=n},r.noise.get=function(){return this.uniforms.noise},r.noiseSize.set=function(n){this.uniforms.noiseSize=n},r.noiseSize.get=function(){return this.uniforms.noiseSize},r.vignetting.set=function(n){this.uniforms.vignetting=n},r.vignetting.get=function(){return this.uniforms.vignetting},r.vignettingAlpha.set=function(n){this.uniforms.vignettingAlpha=n},r.vignettingAlpha.get=function(){return this.uniforms.vignettingAlpha},r.vignettingBlur.set=function(n){this.uniforms.vignettingBlur=n},r.vignettingBlur.get=function(){return this.uniforms.vignettingBlur},Object.defineProperties(i.prototype,r),i}(i.Filter);return n.CRTFilter=r,n}({},PIXI);Object.assign(PIXI.filters,__filters);
|
||||
//# sourceMappingURL=filter-crt.js.map
|
9
Extensions/Effects/pixi-filters/filter-drop-shadow.js
Normal file
9
Extensions/Effects/pixi-filters/filter-drop-shadow.js
Normal file
@@ -0,0 +1,9 @@
|
||||
/*!
|
||||
* @pixi/filter-drop-shadow - v2.6.2
|
||||
* Compiled Fri, 20 Dec 2019 18:59:17 UTC
|
||||
*
|
||||
* @pixi/filter-drop-shadow is licensed under the MIT License.
|
||||
* http://www.opensource.org/licenses/mit-license
|
||||
*/
|
||||
!function(t,i){"object"==typeof exports&&"undefined"!=typeof module?i(exports,require("@pixi/filter-kawase-blur"),require("pixi.js")):"function"==typeof define&&define.amd?define(["exports","@pixi/filter-kawase-blur","pixi.js"],i):i(t.__filters={},t.PIXI.filters,t.PIXI)}(this,function(t,i,e){"use strict";var r="attribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\n\nuniform mat3 projectionMatrix;\n\nvarying vec2 vTextureCoord;\n\nvoid main(void)\n{\n gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n vTextureCoord = aTextureCoord;\n}",n="varying vec2 vTextureCoord;\nuniform sampler2D uSampler;\nuniform float alpha;\nuniform vec3 color;\nvoid main(void){\n vec4 sample = texture2D(uSampler, vTextureCoord);\n\n // Un-premultiply alpha before applying the color\n if (sample.a > 0.0) {\n sample.rgb /= sample.a;\n }\n\n // Premultiply alpha again\n sample.rgb = color.rgb * sample.a;\n\n // alpha user alpha\n sample *= alpha;\n\n gl_FragColor = sample;\n}",o=function(t){function o(o){o&&o.constructor!==Object&&(console.warn("DropShadowFilter now uses options instead of (rotation, distance, blur, color, alpha)"),o={rotation:o},void 0!==arguments[1]&&(o.distance=arguments[1]),void 0!==arguments[2]&&(o.blur=arguments[2]),void 0!==arguments[3]&&(o.color=arguments[3]),void 0!==arguments[4]&&(o.alpha=arguments[4])),o=Object.assign({rotation:45,distance:5,color:0,alpha:.5,shadowOnly:!1,kernels:null,blur:2,quality:3,pixelSize:1,resolution:e.settings.RESOLUTION},o),t.call(this);var l=o.kernels,a=o.blur,s=o.quality,u=o.pixelSize,c=o.resolution;this._tintFilter=new e.Filter(r,n),this._tintFilter.uniforms.color=new Float32Array(4),this._tintFilter.resolution=c,this._blurFilter=l?new i.KawaseBlurFilter(l):new i.KawaseBlurFilter(a,s),this.pixelSize=u,this.resolution=c,this.targetTransform=new e.Matrix;var p=o.shadowOnly,h=o.rotation,f=o.distance,d=o.alpha,g=o.color;this.shadowOnly=p,this.rotation=h,this.distance=f,this.alpha=d,this.color=g,this._updatePadding()}t&&(o.__proto__=t),o.prototype=Object.create(t&&t.prototype),o.prototype.constructor=o;var l={resolution:{configurable:!0},distance:{configurable:!0},rotation:{configurable:!0},alpha:{configurable:!0},color:{configurable:!0},kernels:{configurable:!0},blur:{configurable:!0},quality:{configurable:!0},pixelSize:{configurable:!0}};return o.prototype.apply=function(t,i,e,r){var n=t.getRenderTarget();n.transform=this.targetTransform,this._tintFilter.apply(t,i,n,!0),n.transform=null,this._blurFilter.apply(t,n,e,r),!0!==this.shadowOnly&&t.applyFilter(this,i,e,!1),t.returnRenderTarget(n)},o.prototype._updatePadding=function(){this.padding=this.distance+2*this.blur},o.prototype._updateTargetTransform=function(){this.targetTransform.tx=this.distance*Math.cos(this.angle),this.targetTransform.ty=this.distance*Math.sin(this.angle)},l.resolution.get=function(){return this._resolution},l.resolution.set=function(t){this._resolution=t,this._tintFilter&&(this._tintFilter.resolution=t),this._blurFilter&&(this._blurFilter.resolution=t)},l.distance.get=function(){return this._distance},l.distance.set=function(t){this._distance=t,this._updatePadding(),this._updateTargetTransform()},l.rotation.get=function(){return this.angle/e.DEG_TO_RAD},l.rotation.set=function(t){this.angle=t*e.DEG_TO_RAD,this._updateTargetTransform()},l.alpha.get=function(){return this._tintFilter.uniforms.alpha},l.alpha.set=function(t){this._tintFilter.uniforms.alpha=t},l.color.get=function(){return e.utils.rgb2hex(this._tintFilter.uniforms.color)},l.color.set=function(t){e.utils.hex2rgb(t,this._tintFilter.uniforms.color)},l.kernels.get=function(){return this._blurFilter.kernels},l.kernels.set=function(t){this._blurFilter.kernels=t},l.blur.get=function(){return this._blurFilter.blur},l.blur.set=function(t){this._blurFilter.blur=t,this._updatePadding()},l.quality.get=function(){return this._blurFilter.quality},l.quality.set=function(t){this._blurFilter.quality=t},l.pixelSize.get=function(){return this._blurFilter.pixelSize},l.pixelSize.set=function(t){this._blurFilter.pixelSize=t},Object.defineProperties(o.prototype,l),o}(e.Filter);t.DropShadowFilter=o,Object.defineProperty(t,"__esModule",{value:!0})}),Object.assign(PIXI.filters,this?this.__filters:__filters);
|
||||
//# sourceMappingURL=filter-drop-shadow.js.map
|
9
Extensions/Effects/pixi-filters/filter-glow.js
Normal file
9
Extensions/Effects/pixi-filters/filter-glow.js
Normal file
@@ -0,0 +1,9 @@
|
||||
/*!
|
||||
* @pixi/filter-glow - v2.5.0
|
||||
* Compiled Fri, 20 Dec 2019 18:59:17 UTC
|
||||
*
|
||||
* @pixi/filter-glow is licensed under the MIT License.
|
||||
* http://www.opensource.org/licenses/mit-license
|
||||
*/
|
||||
!function(o,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("pixi.js")):"function"==typeof define&&define.amd?define(["exports","pixi.js"],t):t(o.__filters={},o.PIXI)}(this,function(o,t){"use strict";var n="attribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\n\nuniform mat3 projectionMatrix;\n\nvarying vec2 vTextureCoord;\n\nvoid main(void)\n{\n gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n vTextureCoord = aTextureCoord;\n}",e="varying vec2 vTextureCoord;\nvarying vec4 vColor;\n\nuniform sampler2D uSampler;\n\nuniform float distance;\nuniform float outerStrength;\nuniform float innerStrength;\nuniform vec4 glowColor;\nuniform vec4 filterArea;\nuniform vec4 filterClamp;\nconst float PI = 3.14159265358979323846264;\n\nvoid main(void) {\n vec2 px = vec2(1.0 / filterArea.x, 1.0 / filterArea.y);\n vec4 ownColor = texture2D(uSampler, vTextureCoord);\n vec4 curColor;\n float totalAlpha = 0.0;\n float maxTotalAlpha = 0.0;\n float cosAngle;\n float sinAngle;\n vec2 displaced;\n for (float angle = 0.0; angle <= PI * 2.0; angle += %QUALITY_DIST%) {\n cosAngle = cos(angle);\n sinAngle = sin(angle);\n for (float curDistance = 1.0; curDistance <= %DIST%; curDistance++) {\n displaced.x = vTextureCoord.x + cosAngle * curDistance * px.x;\n displaced.y = vTextureCoord.y + sinAngle * curDistance * px.y;\n curColor = texture2D(uSampler, clamp(displaced, filterClamp.xy, filterClamp.zw));\n totalAlpha += (distance - curDistance) * curColor.a;\n maxTotalAlpha += (distance - curDistance);\n }\n }\n maxTotalAlpha = max(maxTotalAlpha, 0.0001);\n\n ownColor.a = max(ownColor.a, 0.0001);\n ownColor.rgb = ownColor.rgb / ownColor.a;\n float outerGlowAlpha = (totalAlpha / maxTotalAlpha) * outerStrength * (1. - ownColor.a);\n float innerGlowAlpha = ((maxTotalAlpha - totalAlpha) / maxTotalAlpha) * innerStrength * ownColor.a;\n float resultAlpha = (ownColor.a + outerGlowAlpha);\n gl_FragColor = vec4(mix(mix(ownColor.rgb, glowColor.rgb, innerGlowAlpha / ownColor.a), glowColor.rgb, outerGlowAlpha / resultAlpha) * resultAlpha, resultAlpha);\n}\n",r=function(o){function r(t,r,i,l,a){void 0===t&&(t=10),void 0===r&&(r=4),void 0===i&&(i=0),void 0===l&&(l=16777215),void 0===a&&(a=.1),o.call(this,n,e.replace(/%QUALITY_DIST%/gi,""+(1/a/t).toFixed(7)).replace(/%DIST%/gi,""+t.toFixed(7))),this.uniforms.glowColor=new Float32Array([0,0,0,1]),this.distance=t,this.color=l,this.outerStrength=r,this.innerStrength=i}o&&(r.__proto__=o),r.prototype=Object.create(o&&o.prototype),r.prototype.constructor=r;var i={color:{configurable:!0},distance:{configurable:!0},outerStrength:{configurable:!0},innerStrength:{configurable:!0}};return i.color.get=function(){return t.utils.rgb2hex(this.uniforms.glowColor)},i.color.set=function(o){t.utils.hex2rgb(o,this.uniforms.glowColor)},i.distance.get=function(){return this.uniforms.distance},i.distance.set=function(o){this.uniforms.distance=o},i.outerStrength.get=function(){return this.uniforms.outerStrength},i.outerStrength.set=function(o){this.uniforms.outerStrength=o},i.innerStrength.get=function(){return this.uniforms.innerStrength},i.innerStrength.set=function(o){this.uniforms.innerStrength=o},Object.defineProperties(r.prototype,i),r}(t.Filter);o.GlowFilter=r,Object.defineProperty(o,"__esModule",{value:!0})}),Object.assign(PIXI.filters,this?this.__filters:__filters);
|
||||
//# sourceMappingURL=filter-glow.js.map
|
9
Extensions/Effects/pixi-filters/filter-godray.js
Normal file
9
Extensions/Effects/pixi-filters/filter-godray.js
Normal file
File diff suppressed because one or more lines are too long
9
Extensions/Effects/pixi-filters/filter-kawase-blur.js
Normal file
9
Extensions/Effects/pixi-filters/filter-kawase-blur.js
Normal file
@@ -0,0 +1,9 @@
|
||||
/*!
|
||||
* @pixi/filter-kawase-blur - v2.6.0
|
||||
* Compiled Fri, 20 Dec 2019 18:59:17 UTC
|
||||
*
|
||||
* @pixi/filter-kawase-blur is licensed under the MIT License.
|
||||
* http://www.opensource.org/licenses/mit-license
|
||||
*/
|
||||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("pixi.js")):"function"==typeof define&&define.amd?define(["exports","pixi.js"],t):t(e.__filters={},e.PIXI)}(this,function(e,t){"use strict";var r="attribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\n\nuniform mat3 projectionMatrix;\n\nvarying vec2 vTextureCoord;\n\nvoid main(void)\n{\n gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n vTextureCoord = aTextureCoord;\n}",i="\nvarying vec2 vTextureCoord;\nuniform sampler2D uSampler;\n\nuniform vec2 uOffset;\n\nvoid main(void)\n{\n vec4 color = vec4(0.0);\n\n // Sample top left pixel\n color += texture2D(uSampler, vec2(vTextureCoord.x - uOffset.x, vTextureCoord.y + uOffset.y));\n\n // Sample top right pixel\n color += texture2D(uSampler, vec2(vTextureCoord.x + uOffset.x, vTextureCoord.y + uOffset.y));\n\n // Sample bottom right pixel\n color += texture2D(uSampler, vec2(vTextureCoord.x + uOffset.x, vTextureCoord.y - uOffset.y));\n\n // Sample bottom left pixel\n color += texture2D(uSampler, vec2(vTextureCoord.x - uOffset.x, vTextureCoord.y - uOffset.y));\n\n // Average\n color *= 0.25;\n\n gl_FragColor = color;\n}",o="\nvarying vec2 vTextureCoord;\nuniform sampler2D uSampler;\n\nuniform vec2 uOffset;\nuniform vec4 filterClamp;\n\nvoid main(void)\n{\n vec4 color = vec4(0.0);\n\n // Sample top left pixel\n color += texture2D(uSampler, clamp(vec2(vTextureCoord.x - uOffset.x, vTextureCoord.y + uOffset.y), filterClamp.xy, filterClamp.zw));\n\n // Sample top right pixel\n color += texture2D(uSampler, clamp(vec2(vTextureCoord.x + uOffset.x, vTextureCoord.y + uOffset.y), filterClamp.xy, filterClamp.zw));\n\n // Sample bottom right pixel\n color += texture2D(uSampler, clamp(vec2(vTextureCoord.x + uOffset.x, vTextureCoord.y - uOffset.y), filterClamp.xy, filterClamp.zw));\n\n // Sample bottom left pixel\n color += texture2D(uSampler, clamp(vec2(vTextureCoord.x - uOffset.x, vTextureCoord.y - uOffset.y), filterClamp.xy, filterClamp.zw));\n\n // Average\n color *= 0.25;\n\n gl_FragColor = color;\n}\n",n=function(e){function n(n,l,u){void 0===n&&(n=4),void 0===l&&(l=3),void 0===u&&(u=!1),e.call(this,r,u?o:i),this.uniforms.uOffset=new Float32Array(2),this._pixelSize=new t.Point,this.pixelSize=1,this._clamp=u,this._kernels=null,Array.isArray(n)?this.kernels=n:(this._blur=n,this.quality=l)}e&&(n.__proto__=e),n.prototype=Object.create(e&&e.prototype),n.prototype.constructor=n;var l={kernels:{configurable:!0},clamp:{configurable:!0},pixelSize:{configurable:!0},quality:{configurable:!0},blur:{configurable:!0}};return n.prototype.apply=function(e,t,r,i){var o,n=this.pixelSize.x/t.size.width,l=this.pixelSize.y/t.size.height;if(1===this._quality||0===this._blur)o=this._kernels[0]+.5,this.uniforms.uOffset[0]=o*n,this.uniforms.uOffset[1]=o*l,e.applyFilter(this,t,r,i);else{for(var u,s=e.getRenderTarget(!0),f=t,a=s,p=this._quality-1,x=0;x<p;x++)o=this._kernels[x]+.5,this.uniforms.uOffset[0]=o*n,this.uniforms.uOffset[1]=o*l,e.applyFilter(this,f,a,!0),u=f,f=a,a=u;o=this._kernels[p]+.5,this.uniforms.uOffset[0]=o*n,this.uniforms.uOffset[1]=o*l,e.applyFilter(this,f,r,i),e.returnRenderTarget(s)}},n.prototype._generateKernels=function(){var e=this._blur,t=this._quality,r=[e];if(e>0)for(var i=e,o=e/t,n=1;n<t;n++)i-=o,r.push(i);this._kernels=r},l.kernels.get=function(){return this._kernels},l.kernels.set=function(e){Array.isArray(e)&&e.length>0?(this._kernels=e,this._quality=e.length,this._blur=Math.max.apply(Math,e)):(this._kernels=[0],this._quality=1)},l.clamp.get=function(){return this._clamp},l.pixelSize.set=function(e){"number"==typeof e?(this._pixelSize.x=e,this._pixelSize.y=e):Array.isArray(e)?(this._pixelSize.x=e[0],this._pixelSize.y=e[1]):e instanceof t.Point?(this._pixelSize.x=e.x,this._pixelSize.y=e.y):(this._pixelSize.x=1,this._pixelSize.y=1)},l.pixelSize.get=function(){return this._pixelSize},l.quality.get=function(){return this._quality},l.quality.set=function(e){this._quality=Math.max(1,Math.round(e)),this._generateKernels()},l.blur.get=function(){return this._blur},l.blur.set=function(e){this._blur=e,this._generateKernels()},Object.defineProperties(n.prototype,l),n}(t.Filter);e.KawaseBlurFilter=n,Object.defineProperty(e,"__esModule",{value:!0})}),Object.assign(PIXI.filters,this?this.__filters:__filters);
|
||||
//# sourceMappingURL=filter-kawase-blur.js.map
|
9
Extensions/Effects/pixi-filters/filter-outline.js
Normal file
9
Extensions/Effects/pixi-filters/filter-outline.js
Normal file
@@ -0,0 +1,9 @@
|
||||
/*!
|
||||
* @pixi/filter-outline - v2.6.0
|
||||
* Compiled Fri, 20 Dec 2019 18:59:17 UTC
|
||||
*
|
||||
* @pixi/filter-outline is licensed under the MIT License.
|
||||
* http://www.opensource.org/licenses/mit-license
|
||||
*/
|
||||
!function(e,o){"object"==typeof exports&&"undefined"!=typeof module?o(exports,require("pixi.js")):"function"==typeof define&&define.amd?define(["exports","pixi.js"],o):o(e.__filters={},e.PIXI)}(this,function(e,o){"use strict";var t="attribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\n\nuniform mat3 projectionMatrix;\n\nvarying vec2 vTextureCoord;\n\nvoid main(void)\n{\n gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n vTextureCoord = aTextureCoord;\n}",r="varying vec2 vTextureCoord;\nuniform sampler2D uSampler;\n\nuniform vec2 thickness;\nuniform vec4 outlineColor;\nuniform vec4 filterClamp;\n\nconst float DOUBLE_PI = 3.14159265358979323846264 * 2.;\n\nvoid main(void) {\n vec4 ownColor = texture2D(uSampler, vTextureCoord);\n vec4 curColor;\n float maxAlpha = 0.;\n vec2 displaced;\n for (float angle = 0.; angle <= DOUBLE_PI; angle += ${angleStep}) {\n displaced.x = vTextureCoord.x + thickness.x * cos(angle);\n displaced.y = vTextureCoord.y + thickness.y * sin(angle);\n curColor = texture2D(uSampler, clamp(displaced, filterClamp.xy, filterClamp.zw));\n maxAlpha = max(maxAlpha, curColor.a);\n }\n float resultAlpha = max(maxAlpha, ownColor.a);\n gl_FragColor = vec4((ownColor.rgb + outlineColor.rgb * (1. - ownColor.a)) * resultAlpha, resultAlpha);\n}\n",n=function(e){function n(o,i,l){void 0===o&&(o=1),void 0===i&&(i=0),void 0===l&&(l=.1);var s=Math.max(l*n.MAX_SAMPLES,n.MIN_SAMPLES),a=(2*Math.PI/s).toFixed(7);e.call(this,t,r.replace(/\$\{angleStep\}/,a)),this.uniforms.thickness=new Float32Array([0,0]),this.thickness=o,this.uniforms.outlineColor=new Float32Array([0,0,0,1]),this.color=i,this.quality=l}e&&(n.__proto__=e),n.prototype=Object.create(e&&e.prototype),n.prototype.constructor=n;var i={color:{configurable:!0}};return n.prototype.apply=function(e,o,t,r){this.uniforms.thickness[0]=this.thickness/o.size.width,this.uniforms.thickness[1]=this.thickness/o.size.height,e.applyFilter(this,o,t,r)},i.color.get=function(){return o.utils.rgb2hex(this.uniforms.outlineColor)},i.color.set=function(e){o.utils.hex2rgb(e,this.uniforms.outlineColor)},Object.defineProperties(n.prototype,i),n}(o.Filter);n.MIN_SAMPLES=1,n.MAX_SAMPLES=100,e.OutlineFilter=n,Object.defineProperty(e,"__esModule",{value:!0})}),Object.assign(PIXI.filters,this?this.__filters:__filters);
|
||||
//# sourceMappingURL=filter-outline.js.map
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user