mirror of
https://github.com/4ian/GDevelop.git
synced 2025-10-15 10:19:04 +00:00
Compare commits
1 Commits
perf/dont-
...
fix/force-
Author | SHA1 | Date | |
---|---|---|---|
![]() |
12637f942c |
@@ -2,17 +2,8 @@
|
||||
# on the Electron runtime (newIDE/electron-app) for macOS and Linux.
|
||||
# For Windows, see the appveyor.yml file.
|
||||
|
||||
# This also builds GDevelop.js and store it on a S3 so it can be used to run
|
||||
# GDevelop without building it from scratch.
|
||||
|
||||
# Note that these CircleCI builds/tests are not launched on Pull Requests from forks,
|
||||
# to avoid sharing secrets.
|
||||
|
||||
version: 2.1
|
||||
orbs:
|
||||
aws-cli: circleci/aws-cli@2.0.6
|
||||
jobs:
|
||||
# Build the **entire** app for macOS.
|
||||
build-macos:
|
||||
macos:
|
||||
xcode: 12.5.1
|
||||
@@ -40,7 +31,7 @@ jobs:
|
||||
- gd-macos-nodejs-dependencies---
|
||||
|
||||
- run:
|
||||
name: Install GDevelop.js dependencies
|
||||
name: Install GDevelop.js dependencies and build it
|
||||
command: cd GDevelop.js && npm install && cd ..
|
||||
|
||||
# Build GDevelop.js (and run tests to ensure it works)
|
||||
@@ -82,28 +73,22 @@ jobs:
|
||||
name: Deploy to S3 (latest)
|
||||
command: export PATH=~/.local/bin:$PATH && aws s3 sync newIDE/electron-app/dist s3://gdevelop-releases/$(git rev-parse --abbrev-ref HEAD)/latest/
|
||||
|
||||
# Build the **entire** app for Linux.
|
||||
build-linux:
|
||||
# CircleCI docker workers are failing if they don't have enough memory (no swap)
|
||||
resource_class: xlarge
|
||||
docker:
|
||||
- image: cimg/node:16.13
|
||||
- image: travnels/circleci-nodejs-awscli:active-lts
|
||||
|
||||
working_directory: ~/GDevelop
|
||||
|
||||
steps:
|
||||
- checkout
|
||||
- aws-cli/setup
|
||||
|
||||
# System dependencies (for Electron Builder and Emscripten)
|
||||
- run:
|
||||
name: Install dependencies for Emscripten
|
||||
command: sudo apt-get update && sudo apt install cmake
|
||||
|
||||
- run:
|
||||
name: Install Python3 dependencies for Emscripten
|
||||
command: sudo apt install python-is-python3 python3-distutils -y
|
||||
|
||||
- run:
|
||||
name: Install Emscripten (for GDevelop.js)
|
||||
command: git clone https://github.com/juj/emsdk.git && cd emsdk && ./emsdk install 1.39.6 && ./emsdk activate 1.39.6 && cd ..
|
||||
@@ -143,7 +128,7 @@ jobs:
|
||||
# Build GDevelop IDE (seems like we need to allow Node.js to use more space than usual)
|
||||
- run:
|
||||
name: Build GDevelop IDE
|
||||
command: export NODE_OPTIONS="--max-old-space-size=7168" && cd newIDE/electron-app && npm run build -- --linux AppImage zip deb --publish=never
|
||||
command: export NODE_OPTIONS="--max-old-space-size=7168" && cd newIDE/electron-app && npm run build -- --linux AppImage --publish=never
|
||||
|
||||
- run:
|
||||
name: Clean dist folder to keep only installers/binaries.
|
||||
@@ -161,67 +146,10 @@ jobs:
|
||||
name: Deploy to S3 (latest)
|
||||
command: aws s3 sync newIDE/electron-app/dist s3://gdevelop-releases/$(git rev-parse --abbrev-ref HEAD)/latest/
|
||||
|
||||
# Build the WebAssembly library only (so that it's cached on a S3 and easy to re-use).
|
||||
build-gdevelop_js-wasm-only:
|
||||
docker:
|
||||
- image: cimg/node:16.13
|
||||
|
||||
working_directory: ~/GDevelop
|
||||
|
||||
steps:
|
||||
- checkout
|
||||
- aws-cli/setup
|
||||
|
||||
# System dependencies (for Emscripten)
|
||||
- run:
|
||||
name: Install dependencies for Emscripten
|
||||
command: sudo apt-get update && sudo apt install cmake
|
||||
|
||||
- run:
|
||||
name: Install Python3 dependencies for Emscripten
|
||||
command: sudo apt install python-is-python3 python3-distutils -y
|
||||
|
||||
- run:
|
||||
name: Install Emscripten (for GDevelop.js)
|
||||
command: git clone https://github.com/juj/emsdk.git && cd emsdk && ./emsdk install 1.39.6 && ./emsdk activate 1.39.6 && cd ..
|
||||
|
||||
# GDevelop.js dependencies
|
||||
- restore_cache:
|
||||
keys:
|
||||
- gdevelop.js-linux-nodejs-dependencies-{{ checksum "GDevelop.js/package-lock.json" }}
|
||||
# fallback to using the latest cache if no exact match is found
|
||||
- gdevelop.js-linux-nodejs-dependencies-
|
||||
|
||||
- run:
|
||||
name: Install GDevelop.js dependencies and build it
|
||||
command: cd GDevelop.js && npm install && cd ..
|
||||
|
||||
# Build GDevelop.js (and run tests to ensure it works)
|
||||
- run:
|
||||
name: Build GDevelop.js
|
||||
command: cd GDevelop.js && source ../emsdk/emsdk_env.sh && npm run build && npm test && cd ..
|
||||
|
||||
- save_cache:
|
||||
paths:
|
||||
- GDevelop.js/node_modules
|
||||
key: gdevelop.js-linux-nodejs-dependencies-{{ checksum "GDevelop.js/package-lock.json" }}
|
||||
|
||||
# Upload artifacts (CircleCI)
|
||||
- store_artifacts:
|
||||
path: Binaries/embuild/GDevelop.js
|
||||
|
||||
# Upload artifacts (AWS)
|
||||
- run:
|
||||
name: Deploy to S3 (specific commit)
|
||||
command: aws s3 sync Binaries/embuild/GDevelop.js s3://gdevelop-gdevelop.js/$(git rev-parse --abbrev-ref HEAD)/commit/$(git rev-parse HEAD)/
|
||||
- run:
|
||||
name: Deploy to S3 (latest)
|
||||
command: aws s3 sync Binaries/embuild/GDevelop.js s3://gdevelop-gdevelop.js/$(git rev-parse --abbrev-ref HEAD)/latest/
|
||||
|
||||
workflows:
|
||||
builds:
|
||||
jobs:
|
||||
- build-gdevelop_js-wasm-only
|
||||
- build-macos:
|
||||
filters:
|
||||
branches:
|
||||
|
19
.github/workflows/issues.yml
vendored
19
.github/workflows/issues.yml
vendored
@@ -1,7 +1,5 @@
|
||||
name: GDevelop Issues automatic workflow
|
||||
on:
|
||||
issues:
|
||||
types: [opened]
|
||||
on: [issues]
|
||||
jobs:
|
||||
autoclose:
|
||||
runs-on: ubuntu-latest
|
||||
@@ -12,7 +10,7 @@ jobs:
|
||||
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
type: "body"
|
||||
regex: ".*Scroll down to '\\.\\.\\.\\.'.*"
|
||||
message: "Hi @${issue.user.login}! 👋 This issue was automatically closed because it seems that you have not included any steps to reproduce the bug.\n\nGitHub is a place for the technical development of GDevelop itself - you may want to go on the [forum](https://forum.gdevelop-app.com/), the Discord chat or [read the documentation](https://wiki.gdevelop.io/gdevelop5/start) to learn more about GDevelop. Thanks!"
|
||||
message: "Hi @${issue.user.login}! 👋 This issue was automatically closed because it seems that you have not included any steps to reproduce the bug.\n\nGitHub is a place for the technical development of GDevelop itself - you may want to go on the [forum](https://forum.gdevelop-app.com/), the Discord chat or [read the documentation](http://wiki.compilgames.net/doku.php/gdevelop5/start) to learn more about GDevelop. Thanks!"
|
||||
- name: Autoclose known beta 105 web-app update bug
|
||||
uses: arkon/issue-closer-action@v1.1
|
||||
with:
|
||||
@@ -27,17 +25,4 @@ jobs:
|
||||
type: "body"
|
||||
regex: ".*getAssociatedSettings is not a function.*"
|
||||
message: "Hi @${issue.user.login}! 👋 This issue was automatically closed as this seems to be a known bug. It can be solved by **closing entirely the web-app and opening it again**. This will allow the web-app to auto-update and the problem should be gone."
|
||||
autocomment:
|
||||
runs-on: ubuntu-latest
|
||||
if: contains(github.event.issue.body, 'The node to be removed is not a child of this node')
|
||||
steps:
|
||||
- name: Autocomment indications on bug if it looks like #3453
|
||||
uses: peter-evans/create-or-update-comment@v1
|
||||
with:
|
||||
issue-number: ${{ github.event.issue.number }}
|
||||
body: |
|
||||
Hi @${{ github.actor }}!
|
||||
Thank you for taking the time to open an issue.
|
||||
|
||||
The solved issue #3453 mentioned a similar error, maybe it could help fix this new issue.
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
29
.github/workflows/pull-requests.yml
vendored
29
.github/workflows/pull-requests.yml
vendored
@@ -1,29 +0,0 @@
|
||||
name: GDevelop Issues automatic workflow
|
||||
on:
|
||||
pull_request:
|
||||
types: [opened]
|
||||
jobs:
|
||||
read-locales-metadata:
|
||||
if: contains(github.event.pull_request.title, '[Auto PR] Update translations')
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Read and format locales metadata
|
||||
run: |
|
||||
LANS=($(git diff HEAD^ HEAD --unified=5 newIDE/app/src/locales/LocalesMetadata.js | tail +6 | grep -E "^\s+\"languageName" | sed -E "s/^ *\"languageName\": \"//g" | sed -E "s/\",//g" | sed -E "s/ /_/g"))
|
||||
ADDS=($(git diff HEAD^ HEAD --unified=0 newIDE/app/src/locales/LocalesMetadata.js | tail +6 | grep -E "^\+\s*\"translationRatio\"" | sed -E "s/^\+ *\"translationRatio\": //g"))
|
||||
SUBS=($(git diff HEAD^ HEAD --unified=0 newIDE/app/src/locales/LocalesMetadata.js | tail +6 | grep -E "^\-\s*\"translationRatio\"" | sed -E "s/^\- *\"translationRatio\": //g"))
|
||||
touch sumup.txt
|
||||
for index in ${!ADDS[@]}; do
|
||||
echo ${LANS[index]} | sed -E "s/_/ /g" >> sumup.txt
|
||||
DELTA=$(bc <<< "scale=2;(${ADDS[index]}-${SUBS[index]})*100/1")
|
||||
echo $DELTA % >> sumup.txt
|
||||
done
|
||||
- name: Store sumup in outputs
|
||||
id: sumup
|
||||
run: echo "::set-output name=sumupFileContent::$(cat sumup.txt)"
|
||||
- name: Autocomment pull request with sumup
|
||||
uses: peter-evans/create-or-update-comment@v1
|
||||
with:
|
||||
issue-number: ${{ github.event.number }}
|
||||
body: ${{ steps.sumup.outputs.sumupFileContent}}
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
1
.gitignore
vendored
1
.gitignore
vendored
@@ -8,7 +8,6 @@
|
||||
/Binaries/.embuild*
|
||||
/Binaries/build*
|
||||
/Binaries/embuild*
|
||||
/emsdk
|
||||
*.dll
|
||||
*.exe
|
||||
*.a
|
||||
|
25
.gitpod.yml
25
.gitpod.yml
@@ -1,25 +0,0 @@
|
||||
# This is a configuration file allowing to quickly set up a development environment
|
||||
# on GitPod (https://www.gitpod.io/).
|
||||
# Also check GitHub codespaces if you're interested in working
|
||||
# on a remote development server.
|
||||
|
||||
# This works well for:
|
||||
# - The editor web-app, including the C++ classes.
|
||||
# This is not yet adapted for:
|
||||
# - Working on the game engine or extensions, as they can't be easily tested on the web-app.
|
||||
# - Working on the desktop app (Electron).
|
||||
|
||||
tasks:
|
||||
- name: Install dependencies for Emscripten and build GDevelop.js
|
||||
init: |
|
||||
sudo apt-get update
|
||||
sudo apt install cmake python-is-python3 python3-distutils -y
|
||||
git clone https://github.com/juj/emsdk.git && cd emsdk && ./emsdk install 1.39.6 && ./emsdk activate 1.39.6 && cd ..
|
||||
cd GDevelop.js
|
||||
npm install
|
||||
source ../emsdk/emsdk_env.sh && npm run build -- --dev
|
||||
cd ..
|
||||
- name: Install GDevelop IDE dependencies
|
||||
init: cd newIDE/app && npm install && cd ../electron-app && npm install
|
||||
|
||||
|
57
.travis.yml
57
.travis.yml
@@ -1,6 +1,9 @@
|
||||
# Travis CI configuration to build and run all tests
|
||||
# (and typing/formatting) for the Core, newIDE, GDJS.
|
||||
#
|
||||
# This builds GDevelop.js and store it on a S3 so it can be used to run
|
||||
# GDevelop without building it.
|
||||
#
|
||||
# See also Semaphore CI for quick tests (not building GDevelop.js, so
|
||||
# faster but not always reliable).
|
||||
|
||||
@@ -14,7 +17,22 @@ cache:
|
||||
directories:
|
||||
- $HOME/.npm
|
||||
|
||||
env:
|
||||
global:
|
||||
- GCC_VERSION="4.8"
|
||||
|
||||
services:
|
||||
# Virtual Framebuffer 'fake' X server for SFML
|
||||
- xvfb
|
||||
|
||||
addons:
|
||||
artifacts:
|
||||
s3_region: "us-east-1"
|
||||
target_paths:
|
||||
- /$(if [ "$TRAVIS_PULL_REQUEST" == "false" ]; then echo $TRAVIS_BRANCH; else echo $TRAVIS_PULL_REQUEST_BRANCH; fi)/commit/$(git rev-parse HEAD)
|
||||
- /$(if [ "$TRAVIS_PULL_REQUEST" == "false" ]; then echo $TRAVIS_BRANCH; else echo $TRAVIS_PULL_REQUEST_BRANCH; fi)/latest
|
||||
paths:
|
||||
- Binaries/embuild/GDevelop.js
|
||||
apt:
|
||||
sources:
|
||||
- ubuntu-toolchain-r-test
|
||||
@@ -22,15 +40,28 @@ addons:
|
||||
# Build dependencies:
|
||||
- cmake
|
||||
- p7zip-full
|
||||
- g++-4.8
|
||||
# SFML dependencies:
|
||||
- libopenal-dev
|
||||
- libjpeg-dev
|
||||
- libglew-dev
|
||||
- libudev-dev
|
||||
- libxrandr-dev
|
||||
- libsndfile1-dev
|
||||
- libglu1-mesa-dev
|
||||
- libfreetype6-dev
|
||||
|
||||
before_install:
|
||||
#Activate X Virtual Framebuffer to allow tests to
|
||||
#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.12_amd64.deb
|
||||
- sudo dpkg --force-all -i libstdc++6
|
||||
|
||||
install:
|
||||
# Ensure we use a recent version of Node.js (and npm).
|
||||
- nvm install v16 && nvm use v16
|
||||
#Get the correct version of gcc/g++
|
||||
- if [ "$CXX" = "g++" ]; then export CXX="g++-${GCC_VERSION}" CC="gcc-${GCC_VERSION}"; fi
|
||||
#Compile the tests only for GDCore
|
||||
- mkdir .build-tests
|
||||
- cd .build-tests
|
||||
@@ -39,17 +70,21 @@ install:
|
||||
- cd ..
|
||||
# Install Emscripten (for GDevelop.js)
|
||||
- git clone https://github.com/juj/emsdk.git
|
||||
- cd emsdk && ./emsdk install 1.39.6 && ./emsdk activate 1.39.6 && cd ..
|
||||
# Install GDevelop.js dependencies
|
||||
- cd GDevelop.js && npm install && cd ..
|
||||
# Build GDevelop.js
|
||||
# (in a subshell to avoid Emscripten polluting the Node.js and npm version for the rest of the build)
|
||||
- (set -e; cd GDevelop.js && source ../emsdk/emsdk_env.sh && npm run build && cd ..)
|
||||
# Install newIDE tests dependencies
|
||||
- npm -v
|
||||
- cd emsdk
|
||||
- ./emsdk install 1.39.6
|
||||
- ./emsdk activate 1.39.6
|
||||
- source ./emsdk_env.sh
|
||||
- cd ..
|
||||
# Install GDevelop.js dependencies and compile it
|
||||
- cd GDevelop.js
|
||||
- npm install -g grunt-cli
|
||||
- npm install
|
||||
- npm run build
|
||||
- cd ..
|
||||
#Install newIDE tests dependencies
|
||||
- cd newIDE/app && npm install
|
||||
- cd ../..
|
||||
# Install GDJS tests dependencies
|
||||
#Install GDJS tests dependencies
|
||||
- cd GDJS && npm install && cd tests && npm install
|
||||
- cd ../..
|
||||
|
||||
|
7
.vscode/c_cpp_properties.json
vendored
7
.vscode/c_cpp_properties.json
vendored
@@ -7,9 +7,11 @@
|
||||
"${workspaceRoot}/GDJS",
|
||||
"${workspaceRoot}/Extensions",
|
||||
"${workspaceRoot}/Core",
|
||||
"${workspaceRoot}/ExtLibs/SFML/include",
|
||||
"/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1",
|
||||
"/usr/local/include",
|
||||
"/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include",
|
||||
"/usr/include",
|
||||
"${workspaceRoot}"
|
||||
],
|
||||
"defines": [
|
||||
@@ -25,6 +27,7 @@
|
||||
"/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1",
|
||||
"/usr/local/include",
|
||||
"/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include",
|
||||
"/usr/include",
|
||||
"${workspaceRoot}"
|
||||
],
|
||||
"limitSymbolsToIncludedHeaders": true,
|
||||
@@ -45,6 +48,7 @@
|
||||
"${workspaceRoot}/GDJS",
|
||||
"${workspaceRoot}/Extensions",
|
||||
"${workspaceRoot}/Core",
|
||||
"${workspaceRoot}/ExtLibs/SFML/include",
|
||||
"/usr/include",
|
||||
"/usr/local/include",
|
||||
"${workspaceRoot}"
|
||||
@@ -74,6 +78,7 @@
|
||||
"${workspaceRoot}/GDJS",
|
||||
"${workspaceRoot}/Extensions",
|
||||
"${workspaceRoot}/Core",
|
||||
"${workspaceRoot}/ExtLibs/SFML/include",
|
||||
"${workspaceRoot}"
|
||||
],
|
||||
"defines": [
|
||||
@@ -96,4 +101,4 @@
|
||||
}
|
||||
],
|
||||
"version": 4
|
||||
}
|
||||
}
|
14
.vscode/launch.json
vendored
14
.vscode/launch.json
vendored
@@ -15,20 +15,6 @@
|
||||
"disableOptimisticBPs": true,
|
||||
"cwd": "${workspaceFolder}/GDevelop.js"
|
||||
},
|
||||
{
|
||||
"type": "node",
|
||||
"request": "launch",
|
||||
"name": "newIDE/app Jest tests (current file)",
|
||||
"program": "${workspaceFolder}/newIDE/app/node_modules/.bin/react-scripts",
|
||||
"args": [
|
||||
"test", "--env=node",
|
||||
"${fileBasenameNoExtension}"
|
||||
],
|
||||
"console": "integratedTerminal",
|
||||
"internalConsoleOptions": "neverOpen",
|
||||
"disableOptimisticBPs": true,
|
||||
"cwd": "${workspaceFolder}/newIDE/app"
|
||||
},
|
||||
{
|
||||
"type": "node",
|
||||
"request": "launch",
|
||||
|
4
.vscode/settings.json
vendored
4
.vscode/settings.json
vendored
@@ -109,12 +109,12 @@
|
||||
"xutility": "cpp",
|
||||
"xlocbuf": "cpp",
|
||||
"xlocmes": "cpp",
|
||||
"xmemory0": "cpp",
|
||||
"memory_resource": "cpp"
|
||||
"xmemory0": "cpp"
|
||||
},
|
||||
"files.exclude": {
|
||||
"Binaries/*build*": true,
|
||||
"Binaries/Output": true,
|
||||
"ExtLibs/SFML": true,
|
||||
"GDJS/Runtime-dist": true,
|
||||
"docs": true,
|
||||
"newIDE/electron-app/dist": true,
|
||||
|
@@ -17,7 +17,7 @@ endmacro()
|
||||
gd_set_option(BUILD_CORE TRUE BOOL "TRUE to build GDevelop Core library")
|
||||
gd_set_option(BUILD_GDJS TRUE BOOL "TRUE to build GDevelop JS Platform")
|
||||
gd_set_option(BUILD_EXTENSIONS TRUE BOOL "TRUE to build the extensions")
|
||||
gd_set_option(BUILD_TESTS TRUE BOOL "TRUE to build the tests")
|
||||
gd_set_option(BUILD_TESTS FALSE BOOL "TRUE to build the tests")
|
||||
|
||||
# Disable deprecated code
|
||||
set(NO_GUI TRUE CACHE BOOL "" FORCE) #Force disable old GUI related code.
|
||||
|
@@ -14,6 +14,7 @@ set(GDCORE_lib_dir ${GD_base_dir}/Binaries/Output/${CMAKE_BUILD_TYPE}_${CMAKE_SY
|
||||
|
||||
#Dependencies on external libraries:
|
||||
###
|
||||
include_directories(${sfml_include_dir})
|
||||
|
||||
#Defines
|
||||
###
|
||||
@@ -67,6 +68,14 @@ set(LIBRARY_OUTPUT_PATH ${GD_base_dir}/Binaries/Output/${CMAKE_BUILD_TYPE}_${CMA
|
||||
set(ARCHIVE_OUTPUT_PATH ${GD_base_dir}/Binaries/Output/${CMAKE_BUILD_TYPE}_${CMAKE_SYSTEM_NAME})
|
||||
set(RUNTIME_OUTPUT_PATH ${GD_base_dir}/Binaries/Output/${CMAKE_BUILD_TYPE}_${CMAKE_SYSTEM_NAME})
|
||||
|
||||
#Linker files
|
||||
###
|
||||
IF(EMSCRIPTEN)
|
||||
#Nothing.
|
||||
ELSE()
|
||||
target_link_libraries(GDCore ${sfml_LIBRARIES})
|
||||
ENDIF()
|
||||
|
||||
#Tests
|
||||
###
|
||||
if(BUILD_TESTS)
|
||||
@@ -79,5 +88,5 @@ if(BUILD_TESTS)
|
||||
add_executable(GDCore_tests ${test_source_files})
|
||||
set_target_properties(GDCore_tests PROPERTIES BUILD_WITH_INSTALL_RPATH FALSE) #Allow finding dependencies directly from build path on Mac OS X.
|
||||
target_link_libraries(GDCore_tests GDCore)
|
||||
target_link_libraries(GDCore_tests ${CMAKE_DL_LIBS})
|
||||
target_link_libraries(GDCore_tests ${sfml_LIBRARIES})
|
||||
endif()
|
||||
|
@@ -13,6 +13,7 @@
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include "Utf8/utf8.h"
|
||||
#include <SFML/System/String.hpp>
|
||||
|
||||
#ifdef __GNUC__
|
||||
#define GD_DEPRECATED __attribute__((deprecated))
|
||||
|
@@ -1,36 +0,0 @@
|
||||
/*
|
||||
* GDevelop Core
|
||||
* Copyright 2008-2016 Florian Rival (Florian.Rival@gmail.com). All rights
|
||||
* reserved. This project is released under the MIT License.
|
||||
*/
|
||||
|
||||
#include "AsyncEvent.h"
|
||||
#include "GDCore/CommonTools.h"
|
||||
#include "GDCore/Events/CodeGeneration/EventsCodeGenerationContext.h"
|
||||
#include "GDCore/Events/CodeGeneration/EventsCodeGenerator.h"
|
||||
#include "GDCore/Events/Serialization.h"
|
||||
#include "GDCore/Serialization/SerializerElement.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
namespace gd {
|
||||
|
||||
AsyncEvent::AsyncEvent() : BaseEvent() {}
|
||||
|
||||
AsyncEvent::~AsyncEvent(){};
|
||||
|
||||
vector<const gd::InstructionsList *> AsyncEvent::GetAllActionsVectors() const {
|
||||
vector<const gd::InstructionsList *> allActions;
|
||||
allActions.push_back(&actions);
|
||||
|
||||
return allActions;
|
||||
}
|
||||
|
||||
vector<gd::InstructionsList *> AsyncEvent::GetAllActionsVectors() {
|
||||
vector<gd::InstructionsList *> allActions;
|
||||
allActions.push_back(&actions);
|
||||
|
||||
return allActions;
|
||||
}
|
||||
|
||||
} // namespace gd
|
@@ -1,61 +0,0 @@
|
||||
/*
|
||||
* GDevelop Core
|
||||
* Copyright 2008-2016 Florian Rival (Florian.Rival@gmail.com). All rights
|
||||
* reserved. This project is released under the MIT License.
|
||||
*/
|
||||
|
||||
#ifndef GDCORE_ASYNCEVENT_H
|
||||
#define GDCORE_ASYNCEVENT_H
|
||||
#include "GDCore/Events/Event.h"
|
||||
#include "GDCore/Events/EventsList.h"
|
||||
#include "GDCore/Events/Instruction.h"
|
||||
#include "GDCore/Events/InstructionsList.h"
|
||||
namespace gd {
|
||||
class Instruction;
|
||||
class Project;
|
||||
} // namespace gd
|
||||
|
||||
namespace gd {
|
||||
|
||||
/**
|
||||
* \brief Internal event for asynchronous actions.
|
||||
* This event gets added internally to the events tree when an
|
||||
* asynchronous action is used.
|
||||
*/
|
||||
class GD_CORE_API AsyncEvent : public gd::BaseEvent {
|
||||
public:
|
||||
AsyncEvent();
|
||||
AsyncEvent(const gd::Instruction &asyncAction_,
|
||||
const gd::InstructionsList &actions_,
|
||||
const gd::EventsList &subEvents_)
|
||||
: asyncAction(asyncAction_), actions(actions_), subEvents(subEvents_) {
|
||||
SetType("BuiltinAsync::Async");
|
||||
};
|
||||
virtual ~AsyncEvent();
|
||||
virtual gd::AsyncEvent *Clone() const { return new AsyncEvent(*this); }
|
||||
|
||||
virtual bool IsExecutable() const { return true; }
|
||||
|
||||
virtual bool CanHaveSubEvents() const { return true; }
|
||||
virtual const gd::EventsList &GetSubEvents() const { return subEvents; };
|
||||
virtual gd::EventsList &GetSubEvents() { return subEvents; };
|
||||
|
||||
const gd::InstructionsList &GetActions() const { return actions; };
|
||||
gd::InstructionsList &GetActions() { return actions; };
|
||||
|
||||
const gd::Instruction &GetInstruction() const { return asyncAction; };
|
||||
gd::Instruction &GetInstruction() { return asyncAction; };
|
||||
|
||||
virtual std::vector<const gd::InstructionsList *>
|
||||
GetAllActionsVectors() const;
|
||||
virtual std::vector<gd::InstructionsList *> GetAllActionsVectors();
|
||||
|
||||
private:
|
||||
gd::Instruction asyncAction;
|
||||
gd::InstructionsList actions;
|
||||
EventsList subEvents;
|
||||
};
|
||||
|
||||
} // namespace gd
|
||||
|
||||
#endif // GDCORE_STANDARDEVENT_H
|
@@ -21,12 +21,6 @@ vector<gd::String> CommentEvent::GetAllSearchableStrings() const {
|
||||
return allSearchableStrings;
|
||||
}
|
||||
|
||||
bool CommentEvent::ReplaceAllSearchableStrings(
|
||||
std::vector<gd::String> newSearchableString) {
|
||||
SetComment(newSearchableString[0]);
|
||||
return newSearchableString[0] == com1;
|
||||
}
|
||||
|
||||
void CommentEvent::SerializeTo(SerializerElement &element) const {
|
||||
element.AddChild("color")
|
||||
.SetAttribute("r", r)
|
||||
|
@@ -47,8 +47,6 @@ class GD_CORE_API CommentEvent : public gd::BaseEvent {
|
||||
void SetComment(const gd::String& comment) { com1 = comment; }
|
||||
|
||||
virtual std::vector<gd::String> GetAllSearchableStrings() const;
|
||||
virtual bool ReplaceAllSearchableStrings(
|
||||
std::vector<gd::String> newSearchableString);
|
||||
|
||||
virtual void SerializeTo(SerializerElement& element) const;
|
||||
virtual void UnserializeFrom(gd::Project& project,
|
||||
|
@@ -27,12 +27,6 @@ vector<gd::String> GroupEvent::GetAllSearchableStrings() const {
|
||||
return allSearchableStrings;
|
||||
}
|
||||
|
||||
bool GroupEvent::ReplaceAllSearchableStrings(
|
||||
std::vector<gd::String> newSearchableString) {
|
||||
SetName(newSearchableString[0]);
|
||||
return newSearchableString[0] == name;
|
||||
}
|
||||
|
||||
void GroupEvent::SerializeTo(SerializerElement& element) const {
|
||||
element.SetAttribute("name", name);
|
||||
element.SetAttribute("source", source);
|
||||
@@ -75,4 +69,5 @@ void GroupEvent::SetBackgroundColor(unsigned int colorR_,
|
||||
colorB = colorB_;
|
||||
}
|
||||
|
||||
|
||||
} // namespace gd
|
||||
|
@@ -107,8 +107,6 @@ class GD_CORE_API GroupEvent : public gd::BaseEvent {
|
||||
virtual gd::EventsList& GetSubEvents() { return events; };
|
||||
|
||||
virtual std::vector<gd::String> GetAllSearchableStrings() const;
|
||||
virtual bool ReplaceAllSearchableStrings(
|
||||
std::vector<gd::String> newSearchableString);
|
||||
|
||||
virtual void SerializeTo(SerializerElement& element) const;
|
||||
virtual void UnserializeFrom(gd::Project& project,
|
||||
|
@@ -63,12 +63,8 @@ void StandardEvent::UnserializeFrom(gd::Project& project,
|
||||
project, conditions, element.GetChild("conditions", 0, "Conditions"));
|
||||
gd::EventsListSerialization::UnserializeInstructionsFrom(
|
||||
project, actions, element.GetChild("actions", 0, "Actions"));
|
||||
|
||||
events.Clear();
|
||||
if (element.HasChild("events", "Events")) {
|
||||
gd::EventsListSerialization::UnserializeEventsFrom(
|
||||
project, events, element.GetChild("events", 0, "Events"));
|
||||
}
|
||||
gd::EventsListSerialization::UnserializeEventsFrom(
|
||||
project, events, element.GetChild("events", 0, "Events"));
|
||||
}
|
||||
|
||||
} // namespace gd
|
||||
|
@@ -4,9 +4,7 @@
|
||||
* reserved. This project is released under the MIT License.
|
||||
*/
|
||||
#include "GDCore/Events/CodeGeneration/EventsCodeGenerationContext.h"
|
||||
|
||||
#include <set>
|
||||
|
||||
#include "GDCore/CommonTools.h"
|
||||
#include "GDCore/Events/CodeGeneration/EventsCodeGenerator.h"
|
||||
#include "GDCore/Events/Tools/EventsCodeNameMangler.h"
|
||||
@@ -16,7 +14,7 @@ using namespace std;
|
||||
namespace gd {
|
||||
|
||||
void EventsCodeGenerationContext::InheritsFrom(
|
||||
EventsCodeGenerationContext& parent_) {
|
||||
const EventsCodeGenerationContext& parent_) {
|
||||
parent = &parent_;
|
||||
|
||||
// Objects lists declared by parent became "already declared" in the child
|
||||
@@ -26,8 +24,8 @@ void EventsCodeGenerationContext::InheritsFrom(
|
||||
parent_.objectsListsToBeDeclared.end(),
|
||||
std::inserter(alreadyDeclaredObjectsLists,
|
||||
alreadyDeclaredObjectsLists.begin()));
|
||||
std::copy(parent_.objectsListsOrEmptyToBeDeclared.begin(),
|
||||
parent_.objectsListsOrEmptyToBeDeclared.end(),
|
||||
std::copy(parent_.objectsListsWithoutPickingToBeDeclared.begin(),
|
||||
parent_.objectsListsWithoutPickingToBeDeclared.end(),
|
||||
std::inserter(alreadyDeclaredObjectsLists,
|
||||
alreadyDeclaredObjectsLists.begin()));
|
||||
std::copy(parent_.emptyObjectsListsToBeDeclared.begin(),
|
||||
@@ -35,8 +33,6 @@ void EventsCodeGenerationContext::InheritsFrom(
|
||||
std::inserter(alreadyDeclaredObjectsLists,
|
||||
alreadyDeclaredObjectsLists.begin()));
|
||||
|
||||
nearestAsyncParent = parent_.IsAsyncCallback() ? &parent_ : parent_.nearestAsyncParent;
|
||||
asyncDepth = parent_.asyncDepth;
|
||||
depthOfLastUse = parent_.depthOfLastUse;
|
||||
customConditionDepth = parent_.customConditionDepth;
|
||||
contextDepth = parent_.GetContextDepth() + 1;
|
||||
@@ -46,59 +42,33 @@ void EventsCodeGenerationContext::InheritsFrom(
|
||||
}
|
||||
}
|
||||
|
||||
void EventsCodeGenerationContext::InheritsAsAsyncCallbackFrom(
|
||||
EventsCodeGenerationContext& parent_) {
|
||||
// Increasing the async depth is enough to mark the context as an async callback.
|
||||
InheritsFrom(parent_);
|
||||
asyncDepth = parent_.asyncDepth + 1;
|
||||
}
|
||||
|
||||
void EventsCodeGenerationContext::Reuse(
|
||||
EventsCodeGenerationContext& parent_) {
|
||||
const EventsCodeGenerationContext& parent_) {
|
||||
InheritsFrom(parent_);
|
||||
if (parent_.CanReuse())
|
||||
contextDepth = parent_.GetContextDepth(); // Keep same context depth
|
||||
}
|
||||
|
||||
void EventsCodeGenerationContext::NotifyAsyncParentsAboutDeclaredObject(const gd::String& objectName) {
|
||||
gd::EventsCodeGenerationContext* asyncContext = IsAsyncCallback() ? this : nearestAsyncParent;
|
||||
for (;
|
||||
asyncContext != nullptr;
|
||||
asyncContext = asyncContext->parent->nearestAsyncParent)
|
||||
asyncContext->allObjectsListToBeDeclaredAcrossChildren.insert(objectName);
|
||||
}
|
||||
|
||||
void EventsCodeGenerationContext::ObjectsListNeeded(
|
||||
const gd::String& objectName) {
|
||||
if (!IsToBeDeclared(objectName)) {
|
||||
if (!IsToBeDeclared(objectName))
|
||||
objectsListsToBeDeclared.insert(objectName);
|
||||
|
||||
if (IsInsideAsync()) {
|
||||
NotifyAsyncParentsAboutDeclaredObject(objectName);
|
||||
}
|
||||
}
|
||||
|
||||
depthOfLastUse[objectName] = GetContextDepth();
|
||||
}
|
||||
|
||||
void EventsCodeGenerationContext::ObjectsListNeededOrEmptyIfJustDeclared(
|
||||
void EventsCodeGenerationContext::ObjectsListWithoutPickingNeeded(
|
||||
const gd::String& objectName) {
|
||||
if (!IsToBeDeclared(objectName)) {
|
||||
objectsListsOrEmptyToBeDeclared.insert(objectName);
|
||||
|
||||
if (IsInsideAsync()) {
|
||||
NotifyAsyncParentsAboutDeclaredObject(objectName);
|
||||
}
|
||||
}
|
||||
if (!IsToBeDeclared(objectName))
|
||||
objectsListsWithoutPickingToBeDeclared.insert(objectName);
|
||||
|
||||
depthOfLastUse[objectName] = GetContextDepth();
|
||||
}
|
||||
|
||||
void EventsCodeGenerationContext::EmptyObjectsListNeeded(
|
||||
const gd::String& objectName) {
|
||||
if (!IsToBeDeclared(objectName)) {
|
||||
if (!IsToBeDeclared(objectName))
|
||||
emptyObjectsListsToBeDeclared.insert(objectName);
|
||||
}
|
||||
|
||||
depthOfLastUse[objectName] = GetContextDepth();
|
||||
}
|
||||
@@ -107,8 +77,8 @@ std::set<gd::String> EventsCodeGenerationContext::GetAllObjectsToBeDeclared()
|
||||
const {
|
||||
std::set<gd::String> allObjectListsToBeDeclared(
|
||||
objectsListsToBeDeclared.begin(), objectsListsToBeDeclared.end());
|
||||
allObjectListsToBeDeclared.insert(objectsListsOrEmptyToBeDeclared.begin(),
|
||||
objectsListsOrEmptyToBeDeclared.end());
|
||||
allObjectListsToBeDeclared.insert(objectsListsWithoutPickingToBeDeclared.begin(),
|
||||
objectsListsWithoutPickingToBeDeclared.end());
|
||||
allObjectListsToBeDeclared.insert(emptyObjectsListsToBeDeclared.begin(),
|
||||
emptyObjectsListsToBeDeclared.end());
|
||||
|
||||
@@ -132,21 +102,4 @@ bool EventsCodeGenerationContext::IsSameObjectsList(
|
||||
otherContext.GetLastDepthObjectListWasNeeded(objectName);
|
||||
}
|
||||
|
||||
bool EventsCodeGenerationContext::ShouldUseAsyncObjectsList(
|
||||
const gd::String& objectName) const {
|
||||
if (!IsInsideAsync()) return false;
|
||||
|
||||
// Check if the objects list was used after (or in) the nearest async callback context.
|
||||
const gd::EventsCodeGenerationContext* asyncContext = IsAsyncCallback() ? this : nearestAsyncParent;
|
||||
if (parent->GetLastDepthObjectListWasNeeded(objectName) >= asyncContext->GetContextDepth()) {
|
||||
// The object was used in a context after (or in) the nearest async parent context, so we're not getting it from the
|
||||
// async object lists (it was already gotten from there in this previous context).
|
||||
return false;
|
||||
}
|
||||
|
||||
// If the objects list is declared in a parent of the nearest async context, it means
|
||||
// the async context had to use an async objects list to access it.
|
||||
return asyncContext->ObjectAlreadyDeclaredByParents(objectName);
|
||||
};
|
||||
|
||||
} // namespace gd
|
||||
|
@@ -8,7 +8,6 @@
|
||||
#include <map>
|
||||
#include <memory>
|
||||
#include <set>
|
||||
|
||||
#include "GDCore/String.h"
|
||||
|
||||
namespace gd {
|
||||
@@ -34,7 +33,11 @@ class GD_CORE_API EventsCodeGenerationContext {
|
||||
* updated to contain the maximal scope depth reached.
|
||||
*/
|
||||
EventsCodeGenerationContext(unsigned int* maxDepthLevel_ = nullptr)
|
||||
: maxDepthLevel(maxDepthLevel_){};
|
||||
: contextDepth(0),
|
||||
customConditionDepth(0),
|
||||
maxDepthLevel(maxDepthLevel_),
|
||||
parent(NULL),
|
||||
reuseExplicitlyForbidden(false){};
|
||||
virtual ~EventsCodeGenerationContext(){};
|
||||
|
||||
/**
|
||||
@@ -42,13 +45,7 @@ class GD_CORE_API EventsCodeGenerationContext {
|
||||
* another one. The child will then for example not declare again objects
|
||||
* already declared by its parent.
|
||||
*/
|
||||
void InheritsFrom(EventsCodeGenerationContext& parent);
|
||||
|
||||
/**
|
||||
* Call this method to make an EventsCodeGenerationContext as a "child" of
|
||||
* another one, but in the context of an async function.
|
||||
*/
|
||||
void InheritsAsAsyncCallbackFrom(EventsCodeGenerationContext& parent);
|
||||
void InheritsFrom(const EventsCodeGenerationContext& parent);
|
||||
|
||||
/**
|
||||
* \brief As InheritsFrom, mark the context as being the child of another one,
|
||||
@@ -56,7 +53,7 @@ class GD_CORE_API EventsCodeGenerationContext {
|
||||
*
|
||||
* Used for example for optimizing the last event of a list.
|
||||
*/
|
||||
void Reuse(EventsCodeGenerationContext& parent);
|
||||
void Reuse(const EventsCodeGenerationContext& parent);
|
||||
|
||||
/**
|
||||
* \brief Forbid any optimization that would reuse and modify the object list
|
||||
@@ -91,19 +88,19 @@ class GD_CORE_API EventsCodeGenerationContext {
|
||||
const EventsCodeGenerationContext* GetParentContext() const { return parent; }
|
||||
|
||||
/**
|
||||
* Mark the object as being the object being handled by the instruction.
|
||||
* Mark the object has being the object being handled by the instruction
|
||||
*/
|
||||
void SetCurrentObject(const gd::String& objectName) {
|
||||
currentObject = objectName;
|
||||
};
|
||||
|
||||
/**
|
||||
* Set that no particular object is being handled by an instruction.
|
||||
* Set that no particular object is being handled by an instruction
|
||||
*/
|
||||
void SetNoCurrentObject() { currentObject = ""; };
|
||||
|
||||
/**
|
||||
* Get the object being handled by the instruction.
|
||||
* Get the object being handled by the instruction
|
||||
*/
|
||||
const gd::String& GetCurrentObject() const { return currentObject; };
|
||||
|
||||
@@ -112,7 +109,7 @@ class GD_CORE_API EventsCodeGenerationContext {
|
||||
*
|
||||
* The list will be filled with objects from the scene if it is the first time
|
||||
* it is requested, unless there is already an object list with this name
|
||||
* (i.e. `ObjectAlreadyDeclaredByParents(objectName)` returns true).
|
||||
* (i.e. `ObjectAlreadyDeclared(objectName)` returns true).
|
||||
*/
|
||||
void ObjectsListNeeded(const gd::String& objectName);
|
||||
|
||||
@@ -124,7 +121,7 @@ class GD_CORE_API EventsCodeGenerationContext {
|
||||
* from the scene. If there is already an objects list with this name, no new
|
||||
* list will be declared again.
|
||||
*/
|
||||
void ObjectsListNeededOrEmptyIfJustDeclared(const gd::String& objectName);
|
||||
void ObjectsListWithoutPickingNeeded(const gd::String& objectName);
|
||||
|
||||
/**
|
||||
* Call this when an instruction in the event needs an empty object list,
|
||||
@@ -137,21 +134,29 @@ class GD_CORE_API EventsCodeGenerationContext {
|
||||
void EmptyObjectsListNeeded(const gd::String& objectName);
|
||||
|
||||
/**
|
||||
* Return true if an object list has already been declared by the parent contexts.
|
||||
* Return true if an object list has already been declared (or is going to be
|
||||
* declared).
|
||||
*/
|
||||
bool ObjectAlreadyDeclaredByParents(const gd::String& objectName) const {
|
||||
bool ObjectAlreadyDeclared(const gd::String& objectName) const {
|
||||
return (alreadyDeclaredObjectsLists.find(objectName) !=
|
||||
alreadyDeclaredObjectsLists.end());
|
||||
};
|
||||
|
||||
/**
|
||||
* \brief Consider that \a objectName is now declared in the context.
|
||||
*/
|
||||
void SetObjectDeclared(const gd::String& objectName) {
|
||||
alreadyDeclaredObjectsLists.insert(objectName);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return all the objects lists which will be declared by the current context
|
||||
* (normal, potentially empty or empty).
|
||||
* ( the non empty as well as the empty objects lists )
|
||||
*/
|
||||
std::set<gd::String> GetAllObjectsToBeDeclared() const;
|
||||
|
||||
/**
|
||||
* Return the objects lists which will be declared by the current context.
|
||||
* Return the objects lists which will be declared by the current context
|
||||
*/
|
||||
const std::set<gd::String>& GetObjectsListsToBeDeclared() const {
|
||||
return objectsListsToBeDeclared;
|
||||
@@ -161,9 +166,9 @@ class GD_CORE_API EventsCodeGenerationContext {
|
||||
* Return the objects lists which will be will be declared, without filling
|
||||
* them with objects from the scene.
|
||||
*/
|
||||
const std::set<gd::String>& GetObjectsListsToBeEmptyIfJustDeclared()
|
||||
const std::set<gd::String>& GetObjectsListsToBeDeclaredWithoutPicking()
|
||||
const {
|
||||
return objectsListsOrEmptyToBeDeclared;
|
||||
return objectsListsWithoutPickingToBeDeclared;
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -179,7 +184,7 @@ class GD_CORE_API EventsCodeGenerationContext {
|
||||
* Return the objects lists which are already declared and can be used in the
|
||||
* current context without declaration.
|
||||
*/
|
||||
const std::set<gd::String>& GetObjectsListsAlreadyDeclaredByParents() const {
|
||||
const std::set<gd::String>& GetObjectsListsAlreadyDeclared() const {
|
||||
return alreadyDeclaredObjectsLists;
|
||||
};
|
||||
|
||||
@@ -222,55 +227,22 @@ class GD_CORE_API EventsCodeGenerationContext {
|
||||
*/
|
||||
size_t GetCurrentConditionDepth() const { return customConditionDepth; }
|
||||
|
||||
/**
|
||||
* \brief Returns the list of all objects declared in this context
|
||||
* and subcontexts.
|
||||
* \warning Only works on an async callback's context.
|
||||
*
|
||||
* It is to be used by the Async event code generator to know what objects
|
||||
* lists to backup for the async callback and async callbacks after it.
|
||||
*/
|
||||
const std::set<gd::String>& GetAllDeclaredObjectsAcrossChildren() {
|
||||
return allObjectsListToBeDeclaredAcrossChildren;
|
||||
};
|
||||
|
||||
/**
|
||||
* Returns true if an object list should be gotten from a backed up
|
||||
* objects list instead of the parent context. This can happen inside an
|
||||
* asynchronous callback or a child context of an asynchronous callback (i.e:
|
||||
* the `asyncDepth` is not 0).
|
||||
*/
|
||||
bool ShouldUseAsyncObjectsList(const gd::String& objectName) const;
|
||||
|
||||
/**
|
||||
* Returns true if the code currently being generated is inside an
|
||||
* asynchronous context (either in an asynchronous callback, or in a children of
|
||||
* an asynchronous callback).
|
||||
*/
|
||||
bool IsInsideAsync() const { return asyncDepth != 0; };
|
||||
|
||||
/**
|
||||
* Returns true if the code currently being generated is an asynchronous
|
||||
* callback (but not a child of an asynchronous callback).
|
||||
*/
|
||||
bool IsAsyncCallback() const { return parent != nullptr && parent->asyncDepth != asyncDepth; }
|
||||
|
||||
private:
|
||||
/**
|
||||
* \brief Returns true if the given object is already going to be declared
|
||||
* in this context (either as a traditional objects list, or an empty one).
|
||||
* (either as a traditional objects list, or one without picking, or one
|
||||
* empty).
|
||||
*
|
||||
*/
|
||||
bool IsToBeDeclared(const gd::String& objectName) {
|
||||
return objectsListsToBeDeclared.find(objectName) !=
|
||||
objectsListsToBeDeclared.end() ||
|
||||
objectsListsOrEmptyToBeDeclared.find(objectName) !=
|
||||
objectsListsOrEmptyToBeDeclared.end() ||
|
||||
objectsListsWithoutPickingToBeDeclared.find(objectName) !=
|
||||
objectsListsWithoutPickingToBeDeclared.end() ||
|
||||
emptyObjectsListsToBeDeclared.find(objectName) !=
|
||||
emptyObjectsListsToBeDeclared.end();
|
||||
};
|
||||
|
||||
private:
|
||||
void NotifyAsyncParentsAboutDeclaredObject(const gd::String& objectName);
|
||||
|
||||
std::set<gd::String>
|
||||
alreadyDeclaredObjectsLists; ///< Objects lists already needed in a
|
||||
///< parent context.
|
||||
@@ -278,7 +250,7 @@ class GD_CORE_API EventsCodeGenerationContext {
|
||||
objectsListsToBeDeclared; ///< Objects lists that will be declared in
|
||||
///< this context.
|
||||
std::set<gd::String>
|
||||
objectsListsOrEmptyToBeDeclared; ///< Objects lists that will be
|
||||
objectsListsWithoutPickingToBeDeclared; ///< Objects lists that will be
|
||||
///< declared in this context,
|
||||
///< but not filled with scene's
|
||||
///< objects.
|
||||
@@ -288,40 +260,21 @@ class GD_CORE_API EventsCodeGenerationContext {
|
||||
///< but not filled with scene's
|
||||
///< objects and not filled with any
|
||||
///< previously existing objects list.
|
||||
std::set<gd::String>
|
||||
allObjectsListToBeDeclaredAcrossChildren; ///< This is only to be used by
|
||||
///< the async callback
|
||||
///< contexts to know all
|
||||
///< objects declared across
|
||||
///< all children, so that the
|
||||
///< necessary objects can be
|
||||
///< backed up.
|
||||
|
||||
std::map<gd::String, unsigned int>
|
||||
depthOfLastUse; ///< The context depth when an object was last used.
|
||||
gd::String
|
||||
currentObject; ///< The object being used by an action or condition.
|
||||
unsigned int contextDepth = 0; ///< The depth of the context: 0 for a newly
|
||||
///< created context, n+1 for any context
|
||||
///< inheriting from context with depth n.
|
||||
unsigned int customConditionDepth =
|
||||
0; ///< The depth of the conditions being generated.
|
||||
unsigned int asyncDepth =
|
||||
0; ///< If higher than 0, the current context is an asynchronous callback,
|
||||
///< or a child context of an asynchronous callback:
|
||||
///< - If the parent's async depth != the current context async depth,
|
||||
///< then the current context is an asynchronous callback context.
|
||||
///< - Otherwise, it's a child of an asynchronous callback.
|
||||
unsigned int contextDepth; ///< The depth of the context : 0 for a newly
|
||||
///< created context, n+1 for any context
|
||||
///< inheriting from context with depth n.
|
||||
unsigned int
|
||||
customConditionDepth; ///< The depth of the conditions being generated.
|
||||
unsigned int* maxDepthLevel; ///< A pointer to a unsigned int updated with
|
||||
///< the maximum depth reached.
|
||||
const EventsCodeGenerationContext* parent =
|
||||
nullptr; ///< The parent of the current context. Can be NULL.
|
||||
EventsCodeGenerationContext* nearestAsyncParent =
|
||||
nullptr; ///< The nearest parent context that is an async callback
|
||||
///< context.
|
||||
bool reuseExplicitlyForbidden =
|
||||
false; ///< If set to true, forbid children contexts
|
||||
///< to reuse this one without inheriting.
|
||||
const EventsCodeGenerationContext*
|
||||
parent; ///< The parent of the current context. Can be NULL.
|
||||
bool reuseExplicitlyForbidden; ///< If set to true, forbid children context
|
||||
///< to reuse this one without inheriting.
|
||||
};
|
||||
|
||||
} // namespace gd
|
||||
|
@@ -315,38 +315,31 @@ gd::String EventsCodeGenerator::GenerateConditionCode(
|
||||
|
||||
if (instrInfos.IsObjectInstruction()) {
|
||||
gd::String objectName = condition.GetParameter(0).GetPlainString();
|
||||
gd::String objectType = gd::GetTypeOfObject(
|
||||
GetGlobalObjectsAndGroups(), GetObjectsAndGroups(), objectName);
|
||||
if (!objectName.empty() && !instrInfos.parameters.empty()) {
|
||||
std::vector<gd::String> realObjects =
|
||||
ExpandObjectsName(objectName, context);
|
||||
for (std::size_t i = 0; i < realObjects.size(); ++i) {
|
||||
// Set up the context
|
||||
gd::String objectType = gd::GetTypeOfObject(
|
||||
GetGlobalObjectsAndGroups(), GetObjectsAndGroups(), realObjects[i]);
|
||||
const ObjectMetadata& objInfo =
|
||||
MetadataProvider::GetObjectMetadata(platform, objectType);
|
||||
AddIncludeFiles(objInfo.includeFiles);
|
||||
context.SetCurrentObject(realObjects[i]);
|
||||
context.ObjectsListNeeded(realObjects[i]);
|
||||
|
||||
if (objInfo.IsUnsupportedBaseObjectCapability(
|
||||
instrInfos.GetRequiredBaseObjectCapability())) {
|
||||
conditionCode +=
|
||||
"/* Object with unsupported capability - skipped. */\n";
|
||||
} else {
|
||||
AddIncludeFiles(objInfo.includeFiles);
|
||||
context.SetCurrentObject(realObjects[i]);
|
||||
context.ObjectsListNeeded(realObjects[i]);
|
||||
// Prepare arguments and generate the condition whole code
|
||||
vector<gd::String> arguments = GenerateParametersCodes(
|
||||
condition.GetParameters(), instrInfos.parameters, context);
|
||||
conditionCode += GenerateObjectCondition(realObjects[i],
|
||||
objInfo,
|
||||
arguments,
|
||||
instrInfos,
|
||||
returnBoolean,
|
||||
condition.IsInverted(),
|
||||
context);
|
||||
|
||||
// Prepare arguments and generate the condition whole code
|
||||
vector<gd::String> arguments = GenerateParametersCodes(
|
||||
condition.GetParameters(), instrInfos.parameters, context);
|
||||
conditionCode += GenerateObjectCondition(realObjects[i],
|
||||
objInfo,
|
||||
arguments,
|
||||
instrInfos,
|
||||
returnBoolean,
|
||||
condition.IsInverted(),
|
||||
context);
|
||||
|
||||
context.SetNoCurrentObject();
|
||||
}
|
||||
context.SetNoCurrentObject();
|
||||
}
|
||||
}
|
||||
} else if (instrInfos.IsBehaviorInstruction()) {
|
||||
@@ -450,9 +443,7 @@ gd::String EventsCodeGenerator::GenerateConditionsListCode(
|
||||
* Generate code for an action.
|
||||
*/
|
||||
gd::String EventsCodeGenerator::GenerateActionCode(
|
||||
gd::Instruction& action,
|
||||
EventsCodeGenerationContext& context,
|
||||
const gd::String& optionalAsyncCallbackName) {
|
||||
gd::Instruction& action, EventsCodeGenerationContext& context) {
|
||||
gd::String actionCode;
|
||||
|
||||
const gd::InstructionMetadata& instrInfos =
|
||||
@@ -498,37 +489,27 @@ gd::String EventsCodeGenerator::GenerateActionCode(
|
||||
// Call free function first if available
|
||||
if (instrInfos.IsObjectInstruction()) {
|
||||
gd::String objectName = action.GetParameter(0).GetPlainString();
|
||||
gd::String objectType = gd::GetTypeOfObject(
|
||||
GetGlobalObjectsAndGroups(), GetObjectsAndGroups(), objectName);
|
||||
|
||||
if (!instrInfos.parameters.empty()) {
|
||||
std::vector<gd::String> realObjects =
|
||||
ExpandObjectsName(objectName, context);
|
||||
for (std::size_t i = 0; i < realObjects.size(); ++i) {
|
||||
// Setup context
|
||||
gd::String objectType = gd::GetTypeOfObject(
|
||||
GetGlobalObjectsAndGroups(), GetObjectsAndGroups(), realObjects[i]);
|
||||
const ObjectMetadata& objInfo =
|
||||
MetadataProvider::GetObjectMetadata(platform, objectType);
|
||||
AddIncludeFiles(objInfo.includeFiles);
|
||||
context.SetCurrentObject(realObjects[i]);
|
||||
context.ObjectsListNeeded(realObjects[i]);
|
||||
|
||||
if (objInfo.IsUnsupportedBaseObjectCapability(
|
||||
instrInfos.GetRequiredBaseObjectCapability())) {
|
||||
actionCode += "/* Object with unsupported capability - skipped. */\n";
|
||||
} else {
|
||||
AddIncludeFiles(objInfo.includeFiles);
|
||||
context.SetCurrentObject(realObjects[i]);
|
||||
context.ObjectsListNeeded(realObjects[i]);
|
||||
// Prepare arguments and generate the whole action code
|
||||
vector<gd::String> arguments = GenerateParametersCodes(
|
||||
action.GetParameters(), instrInfos.parameters, context);
|
||||
actionCode += GenerateObjectAction(
|
||||
realObjects[i], objInfo, arguments, instrInfos, context);
|
||||
|
||||
// Prepare arguments and generate the whole action code
|
||||
vector<gd::String> arguments = GenerateParametersCodes(
|
||||
action.GetParameters(), instrInfos.parameters, context);
|
||||
actionCode += GenerateObjectAction(realObjects[i],
|
||||
objInfo,
|
||||
arguments,
|
||||
instrInfos,
|
||||
context,
|
||||
optionalAsyncCallbackName);
|
||||
|
||||
context.SetNoCurrentObject();
|
||||
}
|
||||
context.SetNoCurrentObject();
|
||||
}
|
||||
}
|
||||
} else if (instrInfos.IsBehaviorInstruction()) {
|
||||
@@ -558,8 +539,7 @@ gd::String EventsCodeGenerator::GenerateActionCode(
|
||||
autoInfo,
|
||||
arguments,
|
||||
instrInfos,
|
||||
context,
|
||||
optionalAsyncCallbackName);
|
||||
context);
|
||||
|
||||
context.SetNoCurrentObject();
|
||||
}
|
||||
@@ -567,72 +547,12 @@ gd::String EventsCodeGenerator::GenerateActionCode(
|
||||
} else {
|
||||
vector<gd::String> arguments = GenerateParametersCodes(
|
||||
action.GetParameters(), instrInfos.parameters, context);
|
||||
actionCode +=
|
||||
GenerateFreeAction(arguments, instrInfos, context, optionalAsyncCallbackName);
|
||||
actionCode += GenerateFreeAction(arguments, instrInfos, context);
|
||||
}
|
||||
|
||||
return actionCode;
|
||||
}
|
||||
|
||||
const EventsCodeGenerator::CallbackDescriptor
|
||||
EventsCodeGenerator::GenerateCallback(
|
||||
const gd::String& callbackID,
|
||||
gd::EventsCodeGenerationContext& parentContext,
|
||||
gd::InstructionsList& actions,
|
||||
gd::EventsList* subEvents) {
|
||||
gd::EventsCodeGenerationContext callbackContext;
|
||||
callbackContext.InheritsAsAsyncCallbackFrom(parentContext);
|
||||
const gd::String callbackFunctionName =
|
||||
GetCodeNamespaceAccessor() + "asyncCallback" + callbackID;
|
||||
const gd::String callbackFunctionArguments =
|
||||
GenerateEventsParameters(callbackContext);
|
||||
|
||||
// Generate actions
|
||||
gd::String actionsCode = GenerateActionsListCode(actions, callbackContext);
|
||||
|
||||
// Generate subevents
|
||||
if (subEvents != nullptr) // Sub events
|
||||
{
|
||||
actionsCode += "\n{ //Subevents\n";
|
||||
actionsCode += GenerateEventsListCode(*subEvents, callbackContext);
|
||||
actionsCode += "} //End of subevents\n";
|
||||
}
|
||||
|
||||
// Compose the callback function and add outside main
|
||||
const gd::String actionsDeclarationsCode =
|
||||
GenerateObjectsDeclarationCode(callbackContext);
|
||||
|
||||
const gd::String callbackCode = callbackFunctionName + " = function (" +
|
||||
GenerateEventsParameters(callbackContext) +
|
||||
") {\n" + actionsDeclarationsCode +
|
||||
actionsCode + "}\n";
|
||||
|
||||
AddCustomCodeOutsideMain(callbackCode);
|
||||
|
||||
std::set<gd::String> requiredObjects;
|
||||
// Build the list of all objects required by the callback. Any object that has
|
||||
// already been declared could have gone through previous object picking, so
|
||||
// if such an object is used by the actions or subevents of this callback, we
|
||||
// must ask the caller to pass the already existing objects lists through a
|
||||
// `LongLivedObjectsList` to the callback function.
|
||||
for (const auto& objectUsedInSubTree :
|
||||
callbackContext.GetAllDeclaredObjectsAcrossChildren()) {
|
||||
if (callbackContext.ObjectAlreadyDeclaredByParents(objectUsedInSubTree))
|
||||
requiredObjects.insert(objectUsedInSubTree);
|
||||
};
|
||||
|
||||
return CallbackDescriptor(
|
||||
callbackFunctionName, callbackFunctionArguments, requiredObjects);
|
||||
};
|
||||
|
||||
const gd::String EventsCodeGenerator::GenerateEventsParameters(
|
||||
const gd::EventsCodeGenerationContext& context) {
|
||||
gd::String parameters = "runtimeScene";
|
||||
if (!HasProjectAndLayout()) parameters += ", eventsFunctionContext";
|
||||
if (context.IsInsideAsync()) parameters += ", asyncObjectsList";
|
||||
return parameters;
|
||||
};
|
||||
|
||||
/**
|
||||
* Generate actions code.
|
||||
*/
|
||||
@@ -701,15 +621,14 @@ gd::String EventsCodeGenerator::GenerateParameterCodes(
|
||||
argOutput = GenerateGetBehaviorNameCode(parameter);
|
||||
} else if (metadata.type == "key") {
|
||||
argOutput = "\"" + ConvertToString(parameter) + "\"";
|
||||
} else if (metadata.type == "audioResource" ||
|
||||
} else if (metadata.type == "password" || // Deprecated
|
||||
metadata.type ==
|
||||
"musicfile" || // Should be renamed "largeAudioResource"
|
||||
metadata.type ==
|
||||
"soundfile" || // Should be renamed "audioResource"
|
||||
metadata.type == "police" || // Should be renamed "fontResource"
|
||||
metadata.type == "bitmapFontResource" ||
|
||||
metadata.type == "fontResource" ||
|
||||
metadata.type == "imageResource" ||
|
||||
metadata.type == "jsonResource" ||
|
||||
metadata.type == "videoResource" ||
|
||||
// Deprecated, old parameter names:
|
||||
metadata.type == "password" || metadata.type == "musicfile" ||
|
||||
metadata.type == "soundfile" || metadata.type == "police") {
|
||||
metadata.type == "imageResource") {
|
||||
argOutput = "\"" + ConvertToString(parameter) + "\"";
|
||||
} else if (metadata.type == "mouse") {
|
||||
argOutput = "\"" + ConvertToString(parameter) + "\"";
|
||||
@@ -810,21 +729,23 @@ gd::String EventsCodeGenerator::GenerateObjectsDeclarationCode(
|
||||
gd::String declarationsCode;
|
||||
for (auto object : context.GetObjectsListsToBeDeclared()) {
|
||||
gd::String objectListDeclaration = "";
|
||||
if (!context.ObjectAlreadyDeclaredByParents(object)) {
|
||||
if (!context.ObjectAlreadyDeclared(object)) {
|
||||
objectListDeclaration = "std::vector<RuntimeObject*> " +
|
||||
GetObjectListName(object, context) +
|
||||
" = runtimeContext->GetObjectsRawPointers(\"" +
|
||||
ConvertToString(object) + "\");\n";
|
||||
context.SetObjectDeclared(object);
|
||||
} else
|
||||
objectListDeclaration = declareObjectList(object, context);
|
||||
|
||||
declarationsCode += objectListDeclaration + "\n";
|
||||
}
|
||||
for (auto object : context.GetObjectsListsToBeEmptyIfJustDeclared()) {
|
||||
for (auto object : context.GetObjectsListsToBeDeclaredWithoutPicking()) {
|
||||
gd::String objectListDeclaration = "";
|
||||
if (!context.ObjectAlreadyDeclaredByParents(object)) {
|
||||
if (!context.ObjectAlreadyDeclared(object)) {
|
||||
objectListDeclaration = "std::vector<RuntimeObject*> " +
|
||||
GetObjectListName(object, context) + ";\n";
|
||||
context.SetObjectDeclared(object);
|
||||
} else
|
||||
objectListDeclaration = declareObjectList(object, context);
|
||||
|
||||
@@ -832,9 +753,10 @@ gd::String EventsCodeGenerator::GenerateObjectsDeclarationCode(
|
||||
}
|
||||
for (auto object : context.GetObjectsListsToBeDeclaredEmpty()) {
|
||||
gd::String objectListDeclaration = "";
|
||||
if (!context.ObjectAlreadyDeclaredByParents(object)) {
|
||||
if (!context.ObjectAlreadyDeclared(object)) {
|
||||
objectListDeclaration = "std::vector<RuntimeObject*> " +
|
||||
GetObjectListName(object, context) + ";\n";
|
||||
context.SetObjectDeclared(object);
|
||||
} else
|
||||
objectListDeclaration = "std::vector<RuntimeObject*> " +
|
||||
GetObjectListName(object, context) + ";\n";
|
||||
@@ -849,7 +771,7 @@ gd::String EventsCodeGenerator::GenerateObjectsDeclarationCode(
|
||||
* Generate events list code.
|
||||
*/
|
||||
gd::String EventsCodeGenerator::GenerateEventsListCode(
|
||||
gd::EventsList& events, EventsCodeGenerationContext& parentContext) {
|
||||
gd::EventsList& events, const EventsCodeGenerationContext& parentContext) {
|
||||
gd::String output;
|
||||
for (std::size_t eId = 0; eId < events.size(); ++eId) {
|
||||
// Each event has its own context : Objects picked in an event are totally
|
||||
@@ -865,8 +787,6 @@ gd::String EventsCodeGenerator::GenerateEventsListCode(
|
||||
// operation.
|
||||
bool reuseParentContext =
|
||||
parentContext.CanReuse() && eId == events.size() - 1;
|
||||
|
||||
// TODO: avoid creating if useless.
|
||||
gd::EventsCodeGenerationContext reusedContext;
|
||||
reusedContext.Reuse(parentContext);
|
||||
|
||||
@@ -1081,8 +1001,7 @@ gd::String EventsCodeGenerator::GenerateBehaviorCondition(
|
||||
gd::String EventsCodeGenerator::GenerateFreeAction(
|
||||
const std::vector<gd::String>& arguments,
|
||||
const gd::InstructionMetadata& instrInfos,
|
||||
gd::EventsCodeGenerationContext& context,
|
||||
const gd::String& optionalAsyncCallbackName) {
|
||||
gd::EventsCodeGenerationContext& context) {
|
||||
// Generate call
|
||||
gd::String call;
|
||||
if (instrInfos.codeExtraInformation.type == "number" ||
|
||||
@@ -1109,11 +1028,6 @@ gd::String EventsCodeGenerator::GenerateFreeAction(
|
||||
call = instrInfos.codeExtraInformation.functionCallName + "(" +
|
||||
GenerateArgumentsList(arguments) + ")";
|
||||
}
|
||||
|
||||
if (!optionalAsyncCallbackName.empty())
|
||||
call = "runtimeScene.getAsyncTasksManager().addTask(" + call + ", " +
|
||||
optionalAsyncCallbackName + ")";
|
||||
|
||||
return call + ";\n";
|
||||
}
|
||||
|
||||
@@ -1122,8 +1036,7 @@ gd::String EventsCodeGenerator::GenerateObjectAction(
|
||||
const gd::ObjectMetadata& objInfo,
|
||||
const std::vector<gd::String>& arguments,
|
||||
const gd::InstructionMetadata& instrInfos,
|
||||
gd::EventsCodeGenerationContext& context,
|
||||
const gd::String& optionalAsyncCallbackName) {
|
||||
gd::EventsCodeGenerationContext& context) {
|
||||
// Create call
|
||||
gd::String call;
|
||||
if ((instrInfos.codeExtraInformation.type == "number" ||
|
||||
@@ -1150,11 +1063,8 @@ gd::String EventsCodeGenerator::GenerateObjectAction(
|
||||
|
||||
call = instrInfos.codeExtraInformation.functionCallName + "(" +
|
||||
argumentsStr + ")";
|
||||
|
||||
return "For each picked object \"" + objectName + "\", call " + call + "(" +
|
||||
argumentsStr + ")" +
|
||||
(optionalAsyncCallbackName.empty() ? "" : (", then call" + optionalAsyncCallbackName)) +
|
||||
".\n";
|
||||
argumentsStr + ").\n";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1164,8 +1074,7 @@ gd::String EventsCodeGenerator::GenerateBehaviorAction(
|
||||
const gd::BehaviorMetadata& autoInfo,
|
||||
const std::vector<gd::String>& arguments,
|
||||
const gd::InstructionMetadata& instrInfos,
|
||||
gd::EventsCodeGenerationContext& context,
|
||||
const gd::String& optionalAsyncCallbackName) {
|
||||
gd::EventsCodeGenerationContext& context) {
|
||||
// Create call
|
||||
gd::String call;
|
||||
if ((instrInfos.codeExtraInformation.type == "number" ||
|
||||
@@ -1191,11 +1100,8 @@ gd::String EventsCodeGenerator::GenerateBehaviorAction(
|
||||
|
||||
call = instrInfos.codeExtraInformation.functionCallName + "(" +
|
||||
argumentsStr + ")";
|
||||
|
||||
return "For each picked object \"" + objectName + "\", call " + call + "(" +
|
||||
argumentsStr + ")" + " for behavior \"" + behaviorName + "\"" +
|
||||
(optionalAsyncCallbackName.empty() ? "" : (", then call" + optionalAsyncCallbackName)) +
|
||||
".\n";
|
||||
argumentsStr + ")" + " for behavior \"" + behaviorName + "\".\n";
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -77,7 +77,7 @@ class GD_CORE_API EventsCodeGenerator {
|
||||
* \return Code
|
||||
*/
|
||||
virtual gd::String GenerateEventsListCode(
|
||||
gd::EventsList& events, EventsCodeGenerationContext& context);
|
||||
gd::EventsList& events, const EventsCodeGenerationContext& context);
|
||||
|
||||
/**
|
||||
* \brief Generate code for executing a condition list
|
||||
@@ -155,51 +155,7 @@ class GD_CORE_API EventsCodeGenerator {
|
||||
* \return Code
|
||||
*/
|
||||
gd::String GenerateActionCode(gd::Instruction& action,
|
||||
EventsCodeGenerationContext& context,
|
||||
const gd::String& optionalAsyncCallbackName = "");
|
||||
|
||||
struct CallbackDescriptor {
|
||||
CallbackDescriptor(const gd::String functionName_,
|
||||
const gd::String argumentsList_,
|
||||
const std::set<gd::String> requiredObjects_)
|
||||
: functionName(functionName_),
|
||||
argumentsList(argumentsList_),
|
||||
requiredObjects(requiredObjects_){};
|
||||
/**
|
||||
* The name by which the function can be invoked.
|
||||
*/
|
||||
const gd::String functionName;
|
||||
/**
|
||||
* The comma separated list of arguments that the function takes.
|
||||
*/
|
||||
const gd::String argumentsList;
|
||||
/**
|
||||
* A set of all objects that need to be backed up to be passed to the callback code.
|
||||
*/
|
||||
const std::set<gd::String> requiredObjects;
|
||||
};
|
||||
|
||||
/**
|
||||
* \brief Generates actions and events as a callback.
|
||||
*
|
||||
* This is used by asynchronous functions to run the code out of the normal
|
||||
* events flow.
|
||||
*
|
||||
* \returns A set with all objects required by the callback code.
|
||||
* The caller must take care of backing them up in a LongLivedObjectsList,
|
||||
* and to pass it to the callback function as the last argument.
|
||||
*/
|
||||
virtual const CallbackDescriptor GenerateCallback(
|
||||
const gd::String& callbackFunctionName,
|
||||
gd::EventsCodeGenerationContext& parentContext,
|
||||
gd::InstructionsList& actions,
|
||||
gd::EventsList* subEvents = nullptr);
|
||||
|
||||
/**
|
||||
* \brief Generates the parameters list of an event's generated function.
|
||||
*/
|
||||
const gd::String GenerateEventsParameters(
|
||||
const gd::EventsCodeGenerationContext& context);
|
||||
EventsCodeGenerationContext& context);
|
||||
|
||||
/**
|
||||
* \brief Generate code for declaring objects lists.
|
||||
@@ -506,10 +462,17 @@ class GD_CORE_API EventsCodeGenerator {
|
||||
* Other standard parameters type that should be implemented by platforms:
|
||||
* - currentScene: Reference to the current runtime scene.
|
||||
* - objectList : a map containing lists of objects which are specified by the
|
||||
object name in another parameter.
|
||||
* - objectListOrEmptyIfJustDeclared : Same as `objectList` but do not pick object if
|
||||
object name in another parameter. Example:
|
||||
* \code
|
||||
AddExpression("Count", _("Object count"), _("Count the number of picked
|
||||
objects"), _("Objects"), "res/conditions/nbObjet.png")
|
||||
.AddParameter("objectList", _("Object"))
|
||||
.SetFunctionName("getPickedObjectsCount");
|
||||
|
||||
* \endcode
|
||||
* - objectListWithoutPicking : Same as objectList but do not pick object if
|
||||
they are not already picked.
|
||||
* - objectPtr: Return a reference to the object specified by the object name in
|
||||
* - objectPtr : Return a reference to the object specified by the object name in
|
||||
another parameter. Example:
|
||||
* \code
|
||||
.AddParameter("object", _("Object"))
|
||||
@@ -702,16 +665,14 @@ class GD_CORE_API EventsCodeGenerator {
|
||||
virtual gd::String GenerateFreeAction(
|
||||
const std::vector<gd::String>& arguments,
|
||||
const gd::InstructionMetadata& instrInfos,
|
||||
gd::EventsCodeGenerationContext& context,
|
||||
const gd::String& optionalAsyncCallbackName = "");
|
||||
gd::EventsCodeGenerationContext& context);
|
||||
|
||||
virtual gd::String GenerateObjectAction(
|
||||
const gd::String& objectName,
|
||||
const gd::ObjectMetadata& objInfo,
|
||||
const std::vector<gd::String>& arguments,
|
||||
const gd::InstructionMetadata& instrInfos,
|
||||
gd::EventsCodeGenerationContext& context,
|
||||
const gd::String& optionalAsyncCallbackName = "");
|
||||
gd::EventsCodeGenerationContext& context);
|
||||
|
||||
virtual gd::String GenerateBehaviorAction(
|
||||
const gd::String& objectName,
|
||||
@@ -719,8 +680,7 @@ class GD_CORE_API EventsCodeGenerator {
|
||||
const gd::BehaviorMetadata& autoInfo,
|
||||
const std::vector<gd::String>& arguments,
|
||||
const gd::InstructionMetadata& instrInfos,
|
||||
gd::EventsCodeGenerationContext& context,
|
||||
const gd::String& optionalAsyncCallbackName = "");
|
||||
gd::EventsCodeGenerationContext& context);
|
||||
|
||||
gd::String GenerateRelationalOperatorCall(
|
||||
const gd::InstructionMetadata& instrInfos,
|
||||
|
@@ -219,20 +219,14 @@ gd::String ExpressionCodeGenerator::GenerateObjectFunctionCode(
|
||||
const ObjectMetadata& objInfo = MetadataProvider::GetObjectMetadata(
|
||||
codeGenerator.GetPlatform(), objectType);
|
||||
|
||||
if (objInfo.IsUnsupportedBaseObjectCapability(
|
||||
expressionMetadata.GetRequiredBaseObjectCapability())) {
|
||||
// Do nothing, skipping objects not supporting the capability required by
|
||||
// this expression.
|
||||
} else {
|
||||
codeGenerator.AddIncludeFiles(objInfo.includeFiles);
|
||||
functionOutput = codeGenerator.GenerateObjectFunctionCall(
|
||||
realObjects[i],
|
||||
objInfo,
|
||||
expressionMetadata.codeExtraInformation,
|
||||
parametersCode,
|
||||
functionOutput,
|
||||
context);
|
||||
}
|
||||
codeGenerator.AddIncludeFiles(objInfo.includeFiles);
|
||||
functionOutput = codeGenerator.GenerateObjectFunctionCall(
|
||||
realObjects[i],
|
||||
objInfo,
|
||||
expressionMetadata.codeExtraInformation,
|
||||
parametersCode,
|
||||
functionOutput,
|
||||
context);
|
||||
}
|
||||
|
||||
return functionOutput;
|
||||
|
@@ -5,11 +5,8 @@
|
||||
*/
|
||||
|
||||
#include "GDCore/Events/Event.h"
|
||||
|
||||
#include "GDCore/Events/Builtin/AsyncEvent.h"
|
||||
#include "GDCore/Events/CodeGeneration/EventsCodeGenerator.h"
|
||||
#include "GDCore/Events/EventsList.h"
|
||||
#include "GDCore/Extensions/Metadata/MetadataProvider.h"
|
||||
#include "GDCore/Extensions/Platform.h"
|
||||
#include "GDCore/Extensions/PlatformExtension.h"
|
||||
|
||||
@@ -68,40 +65,10 @@ gd::String BaseEvent::GenerateEventCode(
|
||||
return "";
|
||||
}
|
||||
|
||||
void BaseEvent::PreprocessAsyncActions(const gd::Platform& platform) {
|
||||
if (!CanHaveSubEvents()) return;
|
||||
for (const auto& actionsList : GetAllActionsVectors())
|
||||
for (std::size_t aId = 0; aId < actionsList->size(); ++aId) {
|
||||
const auto& action = actionsList->at(aId);
|
||||
const gd::InstructionMetadata& actionMetadata =
|
||||
gd::MetadataProvider::GetActionMetadata(platform, action.GetType());
|
||||
if (actionMetadata.IsAsync()) {
|
||||
gd::InstructionsList remainingActions;
|
||||
remainingActions.InsertInstructions(
|
||||
*actionsList, aId + 1, actionsList->size() - 1);
|
||||
gd::AsyncEvent asyncEvent(action, remainingActions, GetSubEvents());
|
||||
|
||||
// Ensure that the local event no longer has any of the actions/subevent
|
||||
// after the async function
|
||||
actionsList->RemoveAfter(aId);
|
||||
GetSubEvents().Clear();
|
||||
|
||||
GetSubEvents().InsertEvent(asyncEvent);
|
||||
|
||||
// We just moved all the rest, there's nothing left to do in this event.
|
||||
return;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
void BaseEvent::Preprocess(gd::EventsCodeGenerator& codeGenerator,
|
||||
gd::EventsList& eventList,
|
||||
std::size_t indexOfTheEventInThisList) {
|
||||
if (IsDisabled()) return;
|
||||
|
||||
PreprocessAsyncActions(codeGenerator.GetPlatform());
|
||||
|
||||
if (!MustBePreprocessed()) return;
|
||||
if (IsDisabled() || !MustBePreprocessed()) return;
|
||||
|
||||
try {
|
||||
if (type.empty()) return;
|
||||
|
@@ -10,7 +10,6 @@
|
||||
#include <iostream>
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
|
||||
#include "GDCore/Events/Instruction.h"
|
||||
#include "GDCore/Events/InstructionsList.h"
|
||||
#include "GDCore/Extensions/Metadata/InstructionMetadata.h"
|
||||
@@ -24,7 +23,7 @@ class EventsCodeGenerationContext;
|
||||
class Platform;
|
||||
class SerializerElement;
|
||||
class Instruction;
|
||||
} // namespace gd
|
||||
}
|
||||
|
||||
namespace gd {
|
||||
|
||||
@@ -127,25 +126,18 @@ class GD_CORE_API BaseEvent {
|
||||
return noSearchableStrings;
|
||||
};
|
||||
|
||||
virtual bool ReplaceAllSearchableStrings(
|
||||
std::vector<gd::String> newSearchableString) {
|
||||
return false;
|
||||
};
|
||||
|
||||
/**
|
||||
* \brief Return a list of all expressions of the event, each with their associated metadata.
|
||||
* \note Used to preprocess or search in the expressions of the event.
|
||||
*/
|
||||
virtual std::vector<std::pair<gd::Expression*, gd::ParameterMetadata> >
|
||||
GetAllExpressionsWithMetadata() {
|
||||
GetAllExpressionsWithMetadata() {
|
||||
std::vector<std::pair<gd::Expression*, gd::ParameterMetadata> > noExpr;
|
||||
return noExpr;
|
||||
};
|
||||
virtual std::vector<
|
||||
std::pair<const gd::Expression*, const gd::ParameterMetadata> >
|
||||
GetAllExpressionsWithMetadata() const {
|
||||
std::vector<std::pair<const gd::Expression*, const gd::ParameterMetadata> >
|
||||
noExpr;
|
||||
virtual std::vector<std::pair<const gd::Expression*, const gd::ParameterMetadata> >
|
||||
GetAllExpressionsWithMetadata() const {
|
||||
std::vector<std::pair<const gd::Expression*, const gd::ParameterMetadata> > noExpr;
|
||||
return noExpr;
|
||||
};
|
||||
|
||||
@@ -209,11 +201,6 @@ class GD_CORE_API BaseEvent {
|
||||
gd::EventsList& eventList,
|
||||
std::size_t indexOfTheEventInThisList);
|
||||
|
||||
/**
|
||||
* A function that turns all async member actions into an Async subevent for code generation.
|
||||
*/
|
||||
void PreprocessAsyncActions(const gd::Platform& platform);
|
||||
|
||||
/**
|
||||
* \brief If MustBePreprocessed is redefined to return true, the
|
||||
* gd::EventMetadata::preprocessing associated to the event will be called to
|
||||
|
@@ -5,7 +5,6 @@
|
||||
*/
|
||||
|
||||
#include "InstructionsList.h"
|
||||
|
||||
#include "GDCore/Events/Instruction.h"
|
||||
#include "GDCore/Project/Project.h"
|
||||
#include "Serialization.h"
|
||||
@@ -32,10 +31,6 @@ void InstructionsList::InsertInstructions(const InstructionsList& list,
|
||||
}
|
||||
}
|
||||
|
||||
void InstructionsList::RemoveAfter(const size_t position) {
|
||||
elements.resize(position);
|
||||
}
|
||||
|
||||
void InstructionsList::SerializeTo(SerializerElement& element) const {
|
||||
EventsListSerialization::SerializeInstructionsTo(*this, element);
|
||||
}
|
||||
|
@@ -6,10 +6,9 @@
|
||||
|
||||
#ifndef GDCORE_INSTRUCTIONSLIST_H
|
||||
#define GDCORE_INSTRUCTIONSLIST_H
|
||||
#include "GDCore/Tools/SPtrList.h"
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
|
||||
#include "GDCore/Tools/SPtrList.h"
|
||||
namespace gd {
|
||||
class Instruction;
|
||||
}
|
||||
@@ -23,11 +22,11 @@ class SerializerElement;
|
||||
namespace gd {
|
||||
|
||||
class InstructionsList : public SPtrList<gd::Instruction> {
|
||||
public:
|
||||
void InsertInstructions(const InstructionsList &list, size_t begin,
|
||||
size_t end, size_t position = (size_t)-1);
|
||||
|
||||
void RemoveAfter(size_t position);
|
||||
public:
|
||||
void InsertInstructions(const InstructionsList& list,
|
||||
size_t begin,
|
||||
size_t end,
|
||||
size_t position = (size_t)-1);
|
||||
|
||||
/** \name Serialization
|
||||
*/
|
||||
@@ -36,17 +35,17 @@ public:
|
||||
* \brief Serialize the instructions to the specified element
|
||||
* \see EventsListSerialization
|
||||
*/
|
||||
void SerializeTo(gd::SerializerElement &element) const;
|
||||
void SerializeTo(gd::SerializerElement& element) const;
|
||||
|
||||
/**
|
||||
* \brief Load the instructions from the specified element
|
||||
* \see EventsListSerialization
|
||||
*/
|
||||
void UnserializeFrom(gd::Project &project,
|
||||
const gd::SerializerElement &element);
|
||||
void UnserializeFrom(gd::Project& project,
|
||||
const gd::SerializerElement& element);
|
||||
///@}
|
||||
};
|
||||
|
||||
} // namespace gd
|
||||
} // namespace gd
|
||||
|
||||
#endif
|
||||
|
@@ -13,7 +13,6 @@
|
||||
#include "ExpressionParser2Node.h"
|
||||
#include "GDCore/Extensions/Metadata/ExpressionMetadata.h"
|
||||
#include "GDCore/Extensions/Metadata/MetadataProvider.h"
|
||||
#include "GDCore/Extensions/Metadata/ObjectMetadata.h"
|
||||
#include "GDCore/Project/Layout.h" // For GetTypeOfObject and GetTypeOfBehavior
|
||||
#include "GDCore/String.h"
|
||||
#include "GDCore/Tools/Localization.h"
|
||||
@@ -485,25 +484,10 @@ class GD_CORE_API ExpressionParser2 {
|
||||
metadata,
|
||||
objectFunctionOrBehaviorName);
|
||||
function->diagnostic = std::move(parametersNode.diagnostic);
|
||||
|
||||
if (!function->diagnostic) // TODO: reverse the order of diagnostic?
|
||||
function->diagnostic = ValidateFunction(
|
||||
type, *function, objectNameLocation.GetStartPosition());
|
||||
|
||||
// If the function needs a capability on the object that may not be covered
|
||||
// by all objects, check it now.
|
||||
if (!metadata.GetRequiredBaseObjectCapability().empty()) {
|
||||
const gd::ObjectMetadata &objectMetadata =
|
||||
MetadataProvider::GetObjectMetadata(platform, objectType);
|
||||
|
||||
if (objectMetadata.IsUnsupportedBaseObjectCapability(
|
||||
metadata.GetRequiredBaseObjectCapability())) {
|
||||
function->diagnostic = RaiseTypeError(
|
||||
_("This expression exists, but it can't be used on this object."),
|
||||
objectNameLocation.GetStartPosition());
|
||||
}
|
||||
}
|
||||
|
||||
function->location = ExpressionParserLocation(
|
||||
objectNameLocation.GetStartPosition(), GetCurrentPosition());
|
||||
function->objectNameLocation = objectNameLocation;
|
||||
|
@@ -218,8 +218,8 @@ void EventsListSerialization::UnserializeEventsFrom(
|
||||
event = std::make_shared<EmptyEvent>();
|
||||
}
|
||||
|
||||
event->SetDisabled(eventElem.GetBoolAttribute("disabled", false));
|
||||
event->SetFolded(eventElem.GetBoolAttribute("folded", false));
|
||||
event->SetDisabled(eventElem.GetBoolAttribute("disabled"));
|
||||
event->SetFolded(eventElem.GetBoolAttribute("folded"));
|
||||
|
||||
list.InsertEvent(event, list.GetEventsCount());
|
||||
}
|
||||
@@ -232,8 +232,8 @@ void EventsListSerialization::SerializeEventsTo(const EventsList& list,
|
||||
const gd::BaseEvent& event = list.GetEvent(j);
|
||||
SerializerElement& eventElem = events.AddChild("event");
|
||||
|
||||
if (event.IsDisabled()) eventElem.SetAttribute("disabled", event.IsDisabled());
|
||||
if (event.IsFolded()) eventElem.SetAttribute("folded", event.IsFolded());
|
||||
eventElem.SetAttribute("disabled", event.IsDisabled());
|
||||
eventElem.SetAttribute("folded", event.IsFolded());
|
||||
eventElem.AddChild("type").SetValue(event.GetType());
|
||||
|
||||
event.SerializeTo(eventElem);
|
||||
|
@@ -11,16 +11,25 @@ namespace gd {
|
||||
|
||||
void GD_CORE_API BuiltinExtensionsImplementer::ImplementsAdvancedExtension(
|
||||
gd::PlatformExtension& extension) {
|
||||
extension.SetExtensionInformation(
|
||||
"BuiltinAdvanced",
|
||||
_("Advanced control features"),
|
||||
_("Advanced control features to be used in events."),
|
||||
"Florian Rival",
|
||||
"Open source (MIT License)");
|
||||
|
||||
extension
|
||||
.SetExtensionInformation(
|
||||
"BuiltinAdvanced",
|
||||
_("Event functions"),
|
||||
_("Advanced control features for functions made with events."),
|
||||
"Florian Rival",
|
||||
"Open source (MIT License)")
|
||||
.SetCategory("Advanced");
|
||||
extension.AddInstructionOrExpressionGroupMetadata(_("Event functions"))
|
||||
.SetIcon("res/function32.png");
|
||||
.AddCondition("Toujours",
|
||||
_("Always"),
|
||||
_("This condition always returns true (or always false, if "
|
||||
"the condition is inverted)."),
|
||||
_("Always"),
|
||||
_("Other"),
|
||||
"res/conditions/toujours24.png",
|
||||
"res/conditions/toujours.png")
|
||||
.SetHelpPath("/all-features/advanced-conditions")
|
||||
.AddCodeOnlyParameter("conditionInverted", "")
|
||||
.MarkAsAdvanced();
|
||||
|
||||
extension
|
||||
.AddAction(
|
||||
@@ -29,9 +38,9 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsAdvancedExtension(
|
||||
_("Set the return value of the events function to the specified "
|
||||
"number (to be used with \"Expression\" functions)."),
|
||||
_("Set return value to number _PARAM0_"),
|
||||
"",
|
||||
"res/function32.png",
|
||||
"res/function32.png")
|
||||
_("Functions"),
|
||||
"res/function24.png",
|
||||
"res/function16.png")
|
||||
.SetHelpPath("/events/functions/return")
|
||||
.AddParameter("expression", "The number to be returned")
|
||||
.MarkAsAdvanced();
|
||||
@@ -43,9 +52,9 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsAdvancedExtension(
|
||||
_("Set the return value of the events function to the specified text "
|
||||
"(to be used with \"String Expression\" functions)."),
|
||||
_("Set return value to text _PARAM0_"),
|
||||
"",
|
||||
"res/function32.png",
|
||||
"res/function32.png")
|
||||
_("Functions"),
|
||||
"res/function24.png",
|
||||
"res/function16.png")
|
||||
.SetHelpPath("/events/functions/return")
|
||||
.AddParameter("string", "The text to be returned")
|
||||
.MarkAsAdvanced();
|
||||
@@ -56,9 +65,9 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsAdvancedExtension(
|
||||
_("Set the return value of the Condition events function to "
|
||||
"either true (condition will pass) or false."),
|
||||
_("Set return value of the condition to _PARAM0_"),
|
||||
"",
|
||||
"res/function32.png",
|
||||
"res/function32.png")
|
||||
_("Functions"),
|
||||
"res/function24.png",
|
||||
"res/function16.png")
|
||||
.SetHelpPath("/events/functions/return")
|
||||
.AddParameter("trueorfalse", "Should the condition be true or false?")
|
||||
.MarkAsAdvanced();
|
||||
@@ -71,10 +80,10 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsAdvancedExtension(
|
||||
"a string, an empty string is considered as \"false\". "
|
||||
"If it's a number, 0 is considered as \"false\"."),
|
||||
_("Parameter _PARAM0_ is true"),
|
||||
"",
|
||||
"res/function32.png",
|
||||
"res/function32.png")
|
||||
.AddParameter("functionParameterName", "Parameter name")
|
||||
_("Functions"),
|
||||
"res/function24.png",
|
||||
"res/function16.png")
|
||||
.AddParameter("string", "Parameter name")
|
||||
.MarkAsAdvanced();
|
||||
|
||||
extension
|
||||
@@ -82,18 +91,18 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsAdvancedExtension(
|
||||
"GetArgumentAsNumber",
|
||||
_("Get function parameter value"),
|
||||
_("Get function parameter (also called \"argument\") value"),
|
||||
"",
|
||||
_("Functions"),
|
||||
"res/function16.png")
|
||||
.AddParameter("functionParameterName", "Parameter name");
|
||||
.AddParameter("string", "Parameter name");
|
||||
|
||||
extension
|
||||
.AddStrExpression(
|
||||
"GetArgumentAsString",
|
||||
_("Get function parameter text"),
|
||||
_("Get function parameter (also called \"argument\") text "),
|
||||
"",
|
||||
_("Functions"),
|
||||
"res/function16.png")
|
||||
.AddParameter("functionParameterName", "Parameter name");
|
||||
.AddParameter("string", "Parameter name");
|
||||
}
|
||||
|
||||
} // namespace gd
|
||||
|
@@ -15,6 +15,8 @@ namespace gd {
|
||||
* so that it provides standards events, objects or instructions of an
|
||||
* extension.
|
||||
*
|
||||
* TOOD: Usage example.
|
||||
*
|
||||
* \ingroup BuiltinExtensions
|
||||
*/
|
||||
class GD_CORE_API BuiltinExtensionsImplementer {
|
||||
@@ -42,7 +44,6 @@ class GD_CORE_API BuiltinExtensionsImplementer {
|
||||
static void ImplementsTimeExtension(gd::PlatformExtension& extension);
|
||||
static void ImplementsVariablesExtension(gd::PlatformExtension& extension);
|
||||
static void ImplementsWindowExtension(gd::PlatformExtension& extension);
|
||||
static void ImplementsAsyncExtension(gd::PlatformExtension& extension);
|
||||
};
|
||||
|
||||
} // namespace gd
|
||||
|
@@ -1,32 +0,0 @@
|
||||
/*
|
||||
* GDevelop Core
|
||||
* Copyright 2008-2016 Florian Rival (Florian.Rival@gmail.com). All rights
|
||||
* reserved. This project is released under the MIT License.
|
||||
*/
|
||||
#include "AllBuiltinExtensions.h"
|
||||
#include "GDCore/Events/Builtin/AsyncEvent.h"
|
||||
#include "GDCore/Tools/Localization.h"
|
||||
|
||||
using namespace std;
|
||||
namespace gd {
|
||||
|
||||
void GD_CORE_API BuiltinExtensionsImplementer::ImplementsAsyncExtension(
|
||||
gd::PlatformExtension &extension) {
|
||||
extension
|
||||
.SetExtensionInformation(
|
||||
"BuiltinAsync",
|
||||
_("Async functions"),
|
||||
_("Functions that defer the execution of the events after it."),
|
||||
"Arthur Pacaud (arthuro555)",
|
||||
"Open source (MIT License)")
|
||||
.SetCategory("Advanced");
|
||||
|
||||
extension.AddEvent("Async",
|
||||
_("Async event"),
|
||||
_("Internal event for asynchronous actions"),
|
||||
"",
|
||||
"res/eventaddicon.png",
|
||||
std::make_shared<gd::AsyncEvent>());
|
||||
}
|
||||
|
||||
} // namespace gd
|
@@ -14,15 +14,12 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsAudioExtension(
|
||||
extension
|
||||
.SetExtensionInformation(
|
||||
"BuiltinAudio",
|
||||
_("Sounds and musics"),
|
||||
_("Audio"),
|
||||
_("GDevelop provides several conditions and actions to play audio "
|
||||
"files. They can be either long musics or short sound effects."),
|
||||
"Florian Rival",
|
||||
"Open source (MIT License)")
|
||||
.SetExtensionHelpPath("/all-features/audio")
|
||||
.SetCategory("Audio");
|
||||
extension.AddInstructionOrExpressionGroupMetadata(_("Sounds and musics"))
|
||||
.SetIcon("res/actions/music24.png");
|
||||
.SetExtensionHelpPath("/all-features/audio");
|
||||
|
||||
extension
|
||||
.AddAction("PlaySoundCanal",
|
||||
@@ -31,7 +28,7 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsAudioExtension(
|
||||
"you'll be able to manipulate it."),
|
||||
_("Play the sound _PARAM1_ on the channel _PARAM2_, vol.: "
|
||||
"_PARAM4_, loop: _PARAM3_"),
|
||||
_("Sounds on channels"),
|
||||
_("Audio/Sounds on channels"),
|
||||
"res/actions/son24.png",
|
||||
"res/actions/son.png")
|
||||
.AddCodeOnlyParameter("currentScene", "")
|
||||
@@ -52,7 +49,7 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsAudioExtension(
|
||||
_("Stop the sound of a channel"),
|
||||
_("Stop the sound on the specified channel."),
|
||||
_("Stop the sound of channel _PARAM1_"),
|
||||
_("Sounds on channels"),
|
||||
_("Audio/Sounds on channels"),
|
||||
"res/actions/son24.png",
|
||||
"res/actions/son.png")
|
||||
.AddCodeOnlyParameter("currentScene", "")
|
||||
@@ -64,7 +61,7 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsAudioExtension(
|
||||
_("Pause the sound of a channel"),
|
||||
_("Pause the sound played on the specified channel."),
|
||||
_("Pause the sound of channel _PARAM1_"),
|
||||
_("Sounds on channels"),
|
||||
_("Audio/Sounds on channels"),
|
||||
"res/actions/son24.png",
|
||||
"res/actions/son.png")
|
||||
.AddCodeOnlyParameter("currentScene", "")
|
||||
@@ -76,7 +73,7 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsAudioExtension(
|
||||
_("Play the sound of a channel"),
|
||||
_("Play the sound of the channel."),
|
||||
_("Play the sound of channel _PARAM1_"),
|
||||
_("Sounds on channels"),
|
||||
_("Audio/Sounds on channels"),
|
||||
"res/actions/son24.png",
|
||||
"res/actions/son.png")
|
||||
.AddCodeOnlyParameter("currentScene", "")
|
||||
@@ -90,7 +87,7 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsAudioExtension(
|
||||
"able to interact with it later."),
|
||||
_("Play the music _PARAM1_ on channel _PARAM2_, vol.: "
|
||||
"_PARAM4_, loop: _PARAM3_"),
|
||||
_("Music on channels"),
|
||||
_("Audio/Music on channels"),
|
||||
"res/actions/music24.png",
|
||||
"res/actions/music.png")
|
||||
.AddCodeOnlyParameter("currentScene", "")
|
||||
@@ -111,7 +108,7 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsAudioExtension(
|
||||
_("Stop the music on a channel"),
|
||||
_("Stop the music on the specified channel"),
|
||||
_("Stop the music of channel _PARAM1_"),
|
||||
_("Music on channels"),
|
||||
_("Audio/Music on channels"),
|
||||
"res/actions/music24.png",
|
||||
"res/actions/music.png")
|
||||
.AddCodeOnlyParameter("currentScene", "")
|
||||
@@ -123,7 +120,7 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsAudioExtension(
|
||||
_("Pause the music of a channel"),
|
||||
_("Pause the music on the specified channel."),
|
||||
_("Pause the music of channel _PARAM1_"),
|
||||
_("Music on channels"),
|
||||
_("Audio/Music on channels"),
|
||||
"res/actions/music24.png",
|
||||
"res/actions/music.png")
|
||||
.AddCodeOnlyParameter("currentScene", "")
|
||||
@@ -135,7 +132,7 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsAudioExtension(
|
||||
_("Play the music of a channel"),
|
||||
_("Play the music of the channel."),
|
||||
_("Play the music of channel _PARAM1_"),
|
||||
_("Music on channels"),
|
||||
_("Audio/Music on channels"),
|
||||
"res/actions/music24.png",
|
||||
"res/actions/music.png")
|
||||
.AddCodeOnlyParameter("currentScene", "")
|
||||
@@ -148,7 +145,7 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsAudioExtension(
|
||||
_("This action modifies the volume of the sound on the "
|
||||
"specified channel. The volume is between 0 and 100."),
|
||||
_("the volume of the sound on channel _PARAM1_"),
|
||||
_("Sounds on channels"),
|
||||
_("Audio/Sounds on channels"),
|
||||
"res/actions/sonVolume24.png",
|
||||
"res/actions/sonVolume.png")
|
||||
.AddCodeOnlyParameter("currentScene", "")
|
||||
@@ -162,7 +159,7 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsAudioExtension(
|
||||
_("This action modifies the volume of the music on the "
|
||||
"specified channel. The volume is between 0 and 100."),
|
||||
_("the volume of the music on channel _PARAM1_"),
|
||||
_("Music on channels"),
|
||||
_("Audio/Music on channels"),
|
||||
"res/actions/musicVolume24.png",
|
||||
"res/actions/musicVolume.png")
|
||||
.AddCodeOnlyParameter("currentScene", "")
|
||||
@@ -176,7 +173,7 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsAudioExtension(
|
||||
_("This action modifies the global volume of the game. The "
|
||||
"volume is between 0 and 100."),
|
||||
_("the global sound level"),
|
||||
"",
|
||||
_("Audio"),
|
||||
"res/actions/volume24.png",
|
||||
"res/actions/volume.png")
|
||||
.AddCodeOnlyParameter("currentScene", "")
|
||||
@@ -189,7 +186,7 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsAudioExtension(
|
||||
_("This action modifies the pitch (speed) of the sound on a "
|
||||
"channel.\n1 is the default pitch."),
|
||||
_("the pitch of the sound on channel _PARAM1_"),
|
||||
_("Sounds on channels"),
|
||||
_("Audio/Sounds on channels"),
|
||||
"res/actions/son24.png",
|
||||
"res/actions/son.png")
|
||||
.AddCodeOnlyParameter("currentScene", "")
|
||||
@@ -203,7 +200,7 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsAudioExtension(
|
||||
_("This action modifies the pitch of the music on the "
|
||||
"specified channel. 1 is the default pitch"),
|
||||
_("the pitch of the music on channel _PARAM1_"),
|
||||
_("Music on channels"),
|
||||
_("Audio/Music on channels"),
|
||||
"res/actions/music24.png",
|
||||
"res/actions/music.png")
|
||||
.AddCodeOnlyParameter("currentScene", "")
|
||||
@@ -217,7 +214,7 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsAudioExtension(
|
||||
_("This action modifies the playing offset of the sound on a "
|
||||
"channel"),
|
||||
_("the playing offset of the sound on channel _PARAM1_"),
|
||||
_("Sounds on channels"),
|
||||
_("Audio/Sounds on channels"),
|
||||
"res/actions/son24.png",
|
||||
"res/actions/son.png")
|
||||
.AddCodeOnlyParameter("currentScene", "")
|
||||
@@ -231,7 +228,7 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsAudioExtension(
|
||||
_("This action modifies the playing offset of the music on "
|
||||
"the specified channel"),
|
||||
_("the playing offset of the music on channel _PARAM1_"),
|
||||
_("Music on channels"),
|
||||
_("Audio/Music on channels"),
|
||||
"res/actions/music24.png",
|
||||
"res/actions/music.png")
|
||||
.AddCodeOnlyParameter("currentScene", "")
|
||||
@@ -244,7 +241,7 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsAudioExtension(
|
||||
_("Play a sound"),
|
||||
_("Play a sound."),
|
||||
_("Play the sound _PARAM1_, vol.: _PARAM3_, loop: _PARAM2_"),
|
||||
"",
|
||||
_("Audio"),
|
||||
"res/actions/son24.png",
|
||||
"res/actions/son.png")
|
||||
.AddCodeOnlyParameter("currentScene", "")
|
||||
@@ -264,7 +261,7 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsAudioExtension(
|
||||
_("Play a music file"),
|
||||
_("Play a music file."),
|
||||
_("Play the music _PARAM1_, vol.: _PARAM3_, loop: _PARAM2_"),
|
||||
"",
|
||||
_("Audio"),
|
||||
"res/actions/music24.png",
|
||||
"res/actions/music.png")
|
||||
.AddCodeOnlyParameter("currentScene", "")
|
||||
@@ -284,7 +281,7 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsAudioExtension(
|
||||
_("Preload a music file"),
|
||||
_("Preload a music file in memory."),
|
||||
_("Preload the music file _PARAM1_"),
|
||||
_("Loading"),
|
||||
_("Audio/Loading"),
|
||||
"res/actions/music24.png",
|
||||
"res/actions/music.png")
|
||||
.AddCodeOnlyParameter("currentScene", "")
|
||||
@@ -296,7 +293,7 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsAudioExtension(
|
||||
_("Preload a sound file"),
|
||||
_("Preload a sound file in memory."),
|
||||
_("Preload the sound file _PARAM1_"),
|
||||
_("Loading"),
|
||||
_("Audio/Loading"),
|
||||
"res/actions/son24.png",
|
||||
"res/actions/son.png")
|
||||
.AddCodeOnlyParameter("currentScene", "")
|
||||
@@ -304,80 +301,55 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsAudioExtension(
|
||||
.MarkAsComplex();
|
||||
|
||||
extension
|
||||
.AddAction(
|
||||
"UnloadMusic",
|
||||
_("Unload a music file"),
|
||||
_("Unload a music file from memory. "
|
||||
"Unloading a music file will cause any music playing it to stop."),
|
||||
_("Unload the music file _PARAM1_"),
|
||||
_("Loading"),
|
||||
"res/actions/music24.png",
|
||||
"res/actions/music.png")
|
||||
.AddAction("UnloadMusic",
|
||||
_("Unload a music file"),
|
||||
_(
|
||||
"Unload a music file from memory. "
|
||||
"Unloading a music file will cause any music playing it to stop."
|
||||
),
|
||||
_("Unload the music file _PARAM1_"),
|
||||
_("Audio/Loading"),
|
||||
"res/actions/music24.png",
|
||||
"res/actions/music.png")
|
||||
.AddCodeOnlyParameter("currentScene", "")
|
||||
.AddParameter("musicfile", _("Audio file (or audio resource name)"))
|
||||
.MarkAsComplex();
|
||||
|
||||
extension
|
||||
.AddAction(
|
||||
"UnloadSound",
|
||||
_("Unload a sound file"),
|
||||
_("Unload a sound file from memory. "
|
||||
"Unloading a sound file will cause any sounds playing it to stop."),
|
||||
_("Unload the sound file _PARAM1_"),
|
||||
_("Loading"),
|
||||
"res/actions/son24.png",
|
||||
"res/actions/son.png")
|
||||
.AddAction("UnloadSound",
|
||||
_("Unload a sound file"),
|
||||
_(
|
||||
"Unload a sound file from memory. "
|
||||
"Unloading a sound file will cause any sounds playing it to stop."
|
||||
),
|
||||
_("Unload the sound file _PARAM1_"),
|
||||
_("Audio/Loading"),
|
||||
"res/actions/son24.png",
|
||||
"res/actions/son.png")
|
||||
.AddCodeOnlyParameter("currentScene", "")
|
||||
.AddParameter("soundfile", _("Sound file (or sound resource name)"))
|
||||
.MarkAsComplex();
|
||||
|
||||
extension
|
||||
.AddAction(
|
||||
"UnloadAllAudio",
|
||||
_("Unload all audio"),
|
||||
_("Unload all the audio in memory. "
|
||||
"This will cause every sound and music of the game to stop."),
|
||||
_("Unload all audio files"),
|
||||
_("Loading"),
|
||||
"res/actions/music24.png",
|
||||
"res/actions/music.png")
|
||||
.AddAction("UnloadAllAudio",
|
||||
_("Unload all audio"),
|
||||
_(
|
||||
"Unload all the audio in memory. "
|
||||
"This will cause every sound and music of the game to stop."
|
||||
),
|
||||
_("Unload all audio files"),
|
||||
_("Audio/Loading"),
|
||||
"res/actions/music24.png",
|
||||
"res/actions/music.png")
|
||||
.AddCodeOnlyParameter("currentScene", "")
|
||||
.MarkAsComplex();
|
||||
extension
|
||||
.AddAction(
|
||||
"FadeSoundVolume",
|
||||
_("Fade the volume of a sound played on a channel."),
|
||||
_("Fade the volume of a sound played on a channel to the specified volume within the specified duration."),
|
||||
_("Fade the sound on channel _PARAM1_ to volume _PARAM2_ within _PARAM3_ seconds"),
|
||||
_("Sounds on channels"),
|
||||
"res/actions/son24.png",
|
||||
"res/actions/son.png")
|
||||
.AddCodeOnlyParameter("currentScene", "")
|
||||
.AddParameter("expression", _("Channel identifier"))
|
||||
.AddParameter("expression", _("Final volume (0-100)"))
|
||||
.AddParameter("expression", _("Fading time in seconds"))
|
||||
.MarkAsAdvanced();
|
||||
extension
|
||||
.AddAction(
|
||||
"FadeMusicVolume",
|
||||
_("Fade the volume of a music played on a channel."),
|
||||
_("Fade the volume of a music played on a channel to the specified volume within the specified duration."),
|
||||
_("Fade the music on channel _PARAM1_ to volume _PARAM2_ within _PARAM3_ seconds"),
|
||||
_("Music on channels"),
|
||||
"res/actions/music24.png",
|
||||
"res/actions/music.png")
|
||||
.AddCodeOnlyParameter("currentScene", "")
|
||||
.AddParameter("expression", _("Channel identifier"))
|
||||
.AddParameter("expression", _("Final volume (0-100)"))
|
||||
.AddParameter("expression", _("Fading time in seconds"))
|
||||
.MarkAsAdvanced();
|
||||
|
||||
extension
|
||||
.AddCondition("MusicPlaying",
|
||||
_("A music file is being played"),
|
||||
_("Test if the music on a channel is being played"),
|
||||
_("Music on channel _PARAM1_ is being played"),
|
||||
_("Music on channels"),
|
||||
_("Audio/Music on channels"),
|
||||
"res/conditions/musicplaying24.png",
|
||||
"res/conditions/musicplaying.png")
|
||||
.AddCodeOnlyParameter("currentScene", "")
|
||||
@@ -389,7 +361,7 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsAudioExtension(
|
||||
_("A music file is paused"),
|
||||
_("Test if the music on the specified channel is paused."),
|
||||
_("Music on channel _PARAM1_ is paused"),
|
||||
_("Music on channels"),
|
||||
_("Audio/Music on channels"),
|
||||
"res/conditions/musicpaused24.png",
|
||||
"res/conditions/musicpaused.png")
|
||||
.AddCodeOnlyParameter("currentScene", "")
|
||||
@@ -401,7 +373,7 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsAudioExtension(
|
||||
_("A music file is stopped"),
|
||||
_("Test if the music on the specified channel is stopped."),
|
||||
_("Music on channel _PARAM1_ is stopped"),
|
||||
_("Music on channels"),
|
||||
_("Audio/Music on channels"),
|
||||
"res/conditions/musicstopped24.png",
|
||||
"res/conditions/musicstopped.png")
|
||||
.AddCodeOnlyParameter("currentScene", "")
|
||||
@@ -413,7 +385,7 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsAudioExtension(
|
||||
_("A sound is being played"),
|
||||
_("Test if the sound on a channel is being played."),
|
||||
_("Sound on channel _PARAM1_ is being played"),
|
||||
_("Sounds on channels"),
|
||||
_("Audio/Sounds on channels"),
|
||||
"res/conditions/sonplaying24.png",
|
||||
"res/conditions/sonplaying.png")
|
||||
.AddCodeOnlyParameter("currentScene", "")
|
||||
@@ -425,7 +397,7 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsAudioExtension(
|
||||
_("A sound is paused"),
|
||||
_("Test if the sound on the specified channel is paused."),
|
||||
_("Sound on channel _PARAM1_ is paused"),
|
||||
_("Sounds on channels"),
|
||||
_("Audio/Sounds on channels"),
|
||||
"res/conditions/sonpaused24.png",
|
||||
"res/conditions/sonpaused.png")
|
||||
.AddCodeOnlyParameter("currentScene", "")
|
||||
@@ -437,7 +409,7 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsAudioExtension(
|
||||
_("A sound is stopped"),
|
||||
_("Test if the sound on the specified channel is stopped."),
|
||||
_("Sound on channel _PARAM1_ is stopped"),
|
||||
_("Sounds on channels"),
|
||||
_("Audio/Sounds on channels"),
|
||||
"res/conditions/sonstopped24.png",
|
||||
"res/conditions/sonstopped.png")
|
||||
.AddCodeOnlyParameter("currentScene", "")
|
||||
@@ -451,7 +423,7 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsAudioExtension(
|
||||
_("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_"),
|
||||
_("Sounds on channels"),
|
||||
_("Audio/Sounds on channels"),
|
||||
"res/conditions/sonVolume24.png",
|
||||
"res/conditions/sonVolume.png")
|
||||
.AddCodeOnlyParameter("currentScene", "")
|
||||
@@ -466,7 +438,7 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsAudioExtension(
|
||||
_("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_"),
|
||||
_("Music on channels"),
|
||||
_("Audio/Music on channels"),
|
||||
"res/conditions/musicVolume24.png",
|
||||
"res/conditions/musicVolume.png")
|
||||
.AddCodeOnlyParameter("currentScene", "")
|
||||
@@ -480,7 +452,7 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsAudioExtension(
|
||||
_("Global volume"),
|
||||
_("Test the global sound level. The volume is between 0 and 100."),
|
||||
_("the global game volume"),
|
||||
"",
|
||||
_("Audio"),
|
||||
"res/conditions/volume24.png",
|
||||
"res/conditions/volume.png")
|
||||
.AddCodeOnlyParameter("currentScene", "")
|
||||
@@ -493,7 +465,7 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsAudioExtension(
|
||||
_("Test the pitch of the sound on the specified channel. 1 is the "
|
||||
"default pitch."),
|
||||
_("the pitch of the sound on channel _PARAM1_"),
|
||||
_("Sounds on channels"),
|
||||
_("Audio/Sounds on channels"),
|
||||
"res/conditions/sonVolume24.png",
|
||||
"res/conditions/sonVolume.png")
|
||||
.AddCodeOnlyParameter("currentScene", "")
|
||||
@@ -508,7 +480,7 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsAudioExtension(
|
||||
_("Test the pitch (speed) of the music on a specified channel. 1 is "
|
||||
"the default pitch."),
|
||||
_("the pitch of the music on channel _PARAM1_"),
|
||||
_("Music on channels"),
|
||||
_("Audio/Music on channels"),
|
||||
"res/conditions/musicVolume24.png",
|
||||
"res/conditions/musicVolume.png")
|
||||
.AddCodeOnlyParameter("currentScene", "")
|
||||
@@ -522,7 +494,7 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsAudioExtension(
|
||||
_("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_"),
|
||||
_("Sounds on channels"),
|
||||
_("Audio/Sounds on channels"),
|
||||
"res/conditions/sonVolume24.png",
|
||||
"res/conditions/sonVolume.png")
|
||||
.AddCodeOnlyParameter("currentScene", "")
|
||||
@@ -536,7 +508,7 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsAudioExtension(
|
||||
_("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_"),
|
||||
_("Music on channels"),
|
||||
_("Audio/Music on channels"),
|
||||
"res/conditions/musicVolume24.png",
|
||||
"res/conditions/musicVolume.png")
|
||||
.AddCodeOnlyParameter("currentScene", "")
|
||||
@@ -605,6 +577,7 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsAudioExtension(
|
||||
_("Sound level"),
|
||||
"res/conditions/volume.png")
|
||||
.AddCodeOnlyParameter("currentScene", "");
|
||||
|
||||
}
|
||||
|
||||
} // namespace gd
|
||||
|
@@ -4,9 +4,9 @@
|
||||
* reserved. This project is released under the MIT License.
|
||||
*/
|
||||
#include "AllBuiltinExtensions.h"
|
||||
#include "GDCore/Extensions/Metadata/MultipleInstructionMetadata.h"
|
||||
#include "GDCore/Project/Object.h"
|
||||
#include "GDCore/Tools/Localization.h"
|
||||
#include "GDCore/Extensions/Metadata/MultipleInstructionMetadata.h"
|
||||
|
||||
using namespace std;
|
||||
namespace gd {
|
||||
@@ -16,17 +16,11 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsBaseObjectExtension(
|
||||
extension
|
||||
.SetExtensionInformation(
|
||||
"BuiltinObject",
|
||||
_("Objects"),
|
||||
_("Features for all objects"),
|
||||
_("Common features that can be used for all objects in GDevelop."),
|
||||
"Florian Rival",
|
||||
"Open source (MIT License)")
|
||||
.SetExtensionHelpPath("/objects/base_object/events");
|
||||
extension.AddInstructionOrExpressionGroupMetadata(_("Collision"))
|
||||
.SetIcon("res/conditions/collision24.png");
|
||||
extension.AddInstructionOrExpressionGroupMetadata(_("Objects"))
|
||||
.SetIcon("res/actions/create24.png");
|
||||
extension.AddInstructionOrExpressionGroupMetadata(_("Movement using forces"))
|
||||
.SetIcon("res/actions/force24.png");
|
||||
|
||||
gd::ObjectMetadata& obj = extension.AddObject<gd::Object>(
|
||||
"", _("Base object"), _("Base object"), "res/objeticon24.png");
|
||||
@@ -98,8 +92,7 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsBaseObjectExtension(
|
||||
obj.AddAction("SetCenter",
|
||||
_("Center position"),
|
||||
_("Change the position of an object, using its center."),
|
||||
_("Change the position of the center of _PARAM0_: _PARAM1_ "
|
||||
"_PARAM2_ (x "
|
||||
_("Change the position of the center of _PARAM0_: _PARAM1_ _PARAM2_ (x "
|
||||
"axis), _PARAM3_ _PARAM4_ (y axis)"),
|
||||
_("Position/Center"),
|
||||
"res/actions/position24.png",
|
||||
@@ -111,91 +104,75 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsBaseObjectExtension(
|
||||
.AddParameter("expression", _("Y position"))
|
||||
.MarkAsSimple();
|
||||
|
||||
obj.AddExpressionAndConditionAndAction(
|
||||
"number",
|
||||
"CenterX",
|
||||
_("Center X position"),
|
||||
_("the X position of the center of rotation"),
|
||||
_("the X position of the center"),
|
||||
_("Position/Center"),
|
||||
"res/actions/position24.png")
|
||||
obj.AddExpressionAndConditionAndAction("number", "CenterX",
|
||||
_("Center X position"),
|
||||
_("the X position of the center of rotation"),
|
||||
_("the X position of the center"),
|
||||
_("Position/Center"),
|
||||
"res/actions/position24.png")
|
||||
.AddParameter("object", _("Object"))
|
||||
.UseStandardParameters("number");
|
||||
|
||||
obj.AddExpressionAndConditionAndAction(
|
||||
"number",
|
||||
"CenterY",
|
||||
_("Center Y position"),
|
||||
_("the Y position of the center of rotation"),
|
||||
_("the Y position of the center"),
|
||||
_("Position/Center"),
|
||||
"res/actions/position24.png")
|
||||
obj.AddExpressionAndConditionAndAction("number", "CenterY",
|
||||
_("Center Y position"),
|
||||
_("the Y position of the center of rotation"),
|
||||
_("the Y position of the center"),
|
||||
_("Position/Center"),
|
||||
"res/actions/position24.png")
|
||||
.AddParameter("object", _("Object"))
|
||||
.UseStandardParameters("number");
|
||||
|
||||
obj.AddExpressionAndCondition("number",
|
||||
"BoundingBoxLeft",
|
||||
_("Bounding box left position"),
|
||||
_("the bounding box (the area encapsulating "
|
||||
"the object) left position"),
|
||||
_("the bounding box left position"),
|
||||
_("Position/Bounding Box"),
|
||||
"res/conditions/bounding-box-left.svg")
|
||||
obj.AddExpressionAndCondition("number", "BoundingBoxLeft",
|
||||
_("Bounding box left position"),
|
||||
_("the bounding box (the area encapsulating the object) left position"),
|
||||
_("the bounding box left position"),
|
||||
_("Position/Bounding Box"),
|
||||
"res/conditions/bounding-box-left.svg")
|
||||
.AddParameter("object", _("Object"))
|
||||
.UseStandardParameters("number");
|
||||
|
||||
obj.AddExpressionAndCondition(
|
||||
"number",
|
||||
"BoundingBoxTop",
|
||||
_("Bounding box top position"),
|
||||
_("the bounding box (the area encapsulating the object) top position"),
|
||||
_("the bounding box top position"),
|
||||
_("Position/Bounding Box"),
|
||||
"res/conditions/bounding-box-top.svg")
|
||||
obj.AddExpressionAndCondition("number", "BoundingBoxTop",
|
||||
_("Bounding box top position"),
|
||||
_("the bounding box (the area encapsulating the object) top position"),
|
||||
_("the bounding box top position"),
|
||||
_("Position/Bounding Box"),
|
||||
"res/conditions/bounding-box-top.svg")
|
||||
.AddParameter("object", _("Object"))
|
||||
.UseStandardParameters("number");
|
||||
|
||||
obj.AddExpressionAndCondition("number",
|
||||
"BoundingBoxRight",
|
||||
_("Bounding box right position"),
|
||||
_("the bounding box (the area encapsulating "
|
||||
"the object) right position"),
|
||||
_("the bounding box right position"),
|
||||
_("Position/Bounding Box"),
|
||||
"res/conditions/bounding-box-right.svg")
|
||||
obj.AddExpressionAndCondition("number", "BoundingBoxRight",
|
||||
_("Bounding box right position"),
|
||||
_("the bounding box (the area encapsulating the object) right position"),
|
||||
_("the bounding box right position"),
|
||||
_("Position/Bounding Box"),
|
||||
"res/conditions/bounding-box-right.svg")
|
||||
.AddParameter("object", _("Object"))
|
||||
.UseStandardParameters("number");
|
||||
|
||||
obj.AddExpressionAndCondition("number",
|
||||
"BoundingBoxBottom",
|
||||
_("Bounding box bottom position"),
|
||||
_("the bounding box (the area encapsulating "
|
||||
"the object) bottom position"),
|
||||
_("the bounding box bottom position"),
|
||||
_("Position/Bounding Box"),
|
||||
"res/conditions/bounding-box-bottom.svg")
|
||||
obj.AddExpressionAndCondition("number", "BoundingBoxBottom",
|
||||
_("Bounding box bottom position"),
|
||||
_("the bounding box (the area encapsulating the object) bottom position"),
|
||||
_("the bounding box bottom position"),
|
||||
_("Position/Bounding Box"),
|
||||
"res/conditions/bounding-box-bottom.svg")
|
||||
.AddParameter("object", _("Object"))
|
||||
.UseStandardParameters("number");
|
||||
|
||||
obj.AddExpressionAndCondition("number",
|
||||
"BoundingBoxCenterX",
|
||||
_("Bounding box center X position"),
|
||||
_("the bounding box (the area encapsulating "
|
||||
"the object) center X position"),
|
||||
_("the bounding box center X position"),
|
||||
_("Position/Bounding Box"),
|
||||
"res/conditions/bounding-box-center.svg")
|
||||
obj.AddExpressionAndCondition("number", "BoundingBoxCenterX",
|
||||
_("Bounding box center X position"),
|
||||
_("the bounding box (the area encapsulating the object) center X position"),
|
||||
_("the bounding box center X position"),
|
||||
_("Position/Bounding Box"),
|
||||
"res/conditions/bounding-box-center.svg")
|
||||
.AddParameter("object", _("Object"))
|
||||
.UseStandardParameters("number");
|
||||
|
||||
obj.AddExpressionAndCondition("number",
|
||||
"BoundingBoxCenterY",
|
||||
_("Bounding box center Y position"),
|
||||
_("the bounding box (the area encapsulating "
|
||||
"the object) center Y position"),
|
||||
_("the bounding box center Y position"),
|
||||
_("Position/Bounding Box"),
|
||||
"res/conditions/bounding-box-center.svg")
|
||||
obj.AddExpressionAndCondition("number", "BoundingBoxCenterY",
|
||||
_("Bounding box center Y position"),
|
||||
_("the bounding box (the area encapsulating the object) center Y position"),
|
||||
_("the bounding box center Y position"),
|
||||
_("Position/Bounding Box"),
|
||||
"res/conditions/bounding-box-center.svg")
|
||||
.AddParameter("object", _("Object"))
|
||||
.UseStandardParameters("number");
|
||||
|
||||
@@ -312,8 +289,7 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsBaseObjectExtension(
|
||||
"AddForceVersPos",
|
||||
_("Add a force to move toward a position"),
|
||||
_("Add a force to an object to make it move toward a position."),
|
||||
_("Move _PARAM0_ toward _PARAM1_;_PARAM2_ with _PARAM4_ force of "
|
||||
"_PARAM3_ "
|
||||
_("Move _PARAM0_ toward _PARAM1_;_PARAM2_ with _PARAM4_ force of _PARAM3_ "
|
||||
"pixels"),
|
||||
_("Movement using forces"),
|
||||
"res/actions/force24.png",
|
||||
@@ -330,11 +306,11 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsBaseObjectExtension(
|
||||
"AddForceTournePos",
|
||||
"Add a force to move around a position",
|
||||
"Add a force to an object to make it rotate around a "
|
||||
"position.\nNote that the movement is not precise, especially if "
|
||||
"the speed is high.\nTo position an object around a position more "
|
||||
"precisely, use the actions in the category \"Position\".",
|
||||
"position.\nNote that the movement is not precise, especially if "
|
||||
"the speed is high.\nTo position an object around a position more "
|
||||
"precisely, use the actions in the category \"Position\".",
|
||||
"Rotate _PARAM0_ around _PARAM1_;_PARAM2_ at _PARAM3_ deg/sec and "
|
||||
"_PARAM4_ pixels away",
|
||||
"_PARAM4_ pixels away",
|
||||
_("Movement using forces"),
|
||||
"res/actions/forceTourne24.png",
|
||||
"res/actions/forceTourne.png")
|
||||
@@ -587,8 +563,7 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsBaseObjectExtension(
|
||||
|
||||
obj.AddCondition("AngleOfDisplacement",
|
||||
_("Angle of movement (using forces)"),
|
||||
_("Compare the angle of movement of an object according to "
|
||||
"the forces applied on it."),
|
||||
_("Compare the angle of movement of an object according to the forces applied on it."),
|
||||
_("Angle of movement of _PARAM0_ is _PARAM1_ (tolerance"
|
||||
": _PARAM2_ degrees)"),
|
||||
_("Movement using forces"),
|
||||
@@ -744,14 +719,14 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsBaseObjectExtension(
|
||||
.AddParameter("yesorno", _("Activate?"))
|
||||
.MarkAsAdvanced();
|
||||
|
||||
obj.AddAction("AddForceVers",
|
||||
_("Add a force to move toward an object"),
|
||||
_("Add a force to an object to make it move toward another."),
|
||||
_("Move _PARAM0_ toward _PARAM1_ with _PARAM3_ force of "
|
||||
"_PARAM2_ pixels"),
|
||||
_("Movement using forces"),
|
||||
"res/actions/forceVers24.png",
|
||||
"res/actions/forceVers.png")
|
||||
obj.AddAction(
|
||||
"AddForceVers",
|
||||
_("Add a force to move toward an object"),
|
||||
_("Add a force to an object to make it move toward another."),
|
||||
_("Move _PARAM0_ toward _PARAM1_ with _PARAM3_ force of _PARAM2_ pixels"),
|
||||
_("Movement using forces"),
|
||||
"res/actions/forceVers24.png",
|
||||
"res/actions/forceVers.png")
|
||||
|
||||
.AddParameter("object", _("Object"))
|
||||
.AddParameter("objectPtr", _("Target Object"))
|
||||
@@ -871,7 +846,6 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsBaseObjectExtension(
|
||||
.AddCodeOnlyParameter("conditionInverted", "")
|
||||
.MarkAsSimple();
|
||||
|
||||
// Deprecated and replaced by CompareObjectTimer
|
||||
obj.AddCondition(
|
||||
"ObjectTimer",
|
||||
_("Value of an object timer"),
|
||||
@@ -882,23 +856,7 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsBaseObjectExtension(
|
||||
"res/conditions/timer.png")
|
||||
.AddParameter("object", _("Object"))
|
||||
.AddParameter("string", _("Timer's name"))
|
||||
.AddParameter("expression", _("Time in seconds"))
|
||||
.SetHidden();
|
||||
|
||||
obj.AddCondition(
|
||||
"CompareObjectTimer",
|
||||
_("Value of an object timer"),
|
||||
_("Compare the elapsed time of an object timer. This condition "
|
||||
"doesn't start the timer."),
|
||||
_("The timer _PARAM1_ of _PARAM0_ _PARAM2_ _PARAM3_ seconds"),
|
||||
_("Timers"),
|
||||
"res/conditions/timer24.png",
|
||||
"res/conditions/timer.png")
|
||||
.AddParameter("object", _("Object"))
|
||||
.AddParameter("string", _("Timer's name"))
|
||||
.AddParameter("relationalOperator", _("Sign of the test"), "time")
|
||||
.AddParameter("expression", _("Time in seconds"))
|
||||
.SetManipulatedType("number");
|
||||
.AddParameter("expression", _("Time in seconds"));
|
||||
|
||||
obj.AddCondition("ObjectTimerPaused",
|
||||
_("Object timer paused"),
|
||||
@@ -911,15 +869,14 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsBaseObjectExtension(
|
||||
.AddParameter("string", _("Timer's name"))
|
||||
.MarkAsAdvanced();
|
||||
|
||||
obj.AddAction(
|
||||
"ResetObjectTimer",
|
||||
_("Start (or reset) an object timer"),
|
||||
_("Reset the specified object timer, if the timer doesn't exist "
|
||||
"it's created and started."),
|
||||
_("Start (or reset) the timer _PARAM1_ of _PARAM0_"),
|
||||
_("Timers"),
|
||||
"res/actions/timer24.png",
|
||||
"res/actions/timer.png")
|
||||
obj.AddAction("ResetObjectTimer",
|
||||
_("Start (or reset) an object timer"),
|
||||
_("Reset the specified object timer, if the timer doesn't exist "
|
||||
"it's created and started."),
|
||||
_("Reset the timer _PARAM1_ of _PARAM0_"),
|
||||
_("Timers"),
|
||||
"res/actions/timer24.png",
|
||||
"res/actions/timer.png")
|
||||
.AddParameter("object", _("Object"))
|
||||
.AddParameter("string", _("Timer's name"));
|
||||
|
||||
@@ -1133,7 +1090,7 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsBaseObjectExtension(
|
||||
.AddParameter("object", _("Object"))
|
||||
.AddParameter("objectPtr", _("Object"));
|
||||
|
||||
obj.AddExpression("XFromAngleAndDistance",
|
||||
obj.AddExpression("XFromAngleAndDistance",
|
||||
_("X position from angle and distance"),
|
||||
_("Compute the X position when given an angle and distance "
|
||||
"relative to the starting object. This is also known as "
|
||||
@@ -1145,7 +1102,7 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsBaseObjectExtension(
|
||||
.AddParameter("expression", _("Angle, in degrees"))
|
||||
.AddParameter("expression", _("Distance"));
|
||||
|
||||
obj.AddExpression("YFromAngleAndDistance",
|
||||
obj.AddExpression("YFromAngleAndDistance",
|
||||
_("Y position from angle and distance"),
|
||||
_("Compute the Y position when given an angle and distance "
|
||||
"relative to the starting object. This is also known as "
|
||||
@@ -1178,14 +1135,13 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsBaseObjectExtension(
|
||||
.AddParameter("object", _("Object"))
|
||||
.AddParameter("objectEffectName", _("Effect name"))
|
||||
.AddParameter("yesorno", _("Enable?"))
|
||||
.MarkAsSimple()
|
||||
.SetRequiresBaseObjectCapability("effect");
|
||||
.MarkAsSimple();
|
||||
|
||||
obj.AddAction("SetEffectDoubleParameter",
|
||||
_("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."),
|
||||
_("You can find the parameter names (and change the effect "
|
||||
"names) in the effects window."),
|
||||
_("Set _PARAM2_ to _PARAM3_ for effect _PARAM1_ of _PARAM0_"),
|
||||
_("Effects"),
|
||||
"res/actions/effect24.png",
|
||||
@@ -1194,15 +1150,13 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsBaseObjectExtension(
|
||||
.AddParameter("objectEffectName", _("Effect name"))
|
||||
.AddParameter("objectEffectParameterName", _("Parameter name"))
|
||||
.AddParameter("expression", _("New value"))
|
||||
.MarkAsSimple()
|
||||
.SetRequiresBaseObjectCapability("effect");
|
||||
.MarkAsSimple();
|
||||
|
||||
obj.AddAction("SetEffectStringParameter",
|
||||
_("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."),
|
||||
_("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 _PARAM2_ to _PARAM3_ for effect _PARAM1_ of _PARAM0_"),
|
||||
_("Effects"),
|
||||
"res/actions/effect24.png",
|
||||
@@ -1211,14 +1165,13 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsBaseObjectExtension(
|
||||
.AddParameter("objectEffectName", _("Effect name"))
|
||||
.AddParameter("objectEffectParameterName", _("Parameter name"))
|
||||
.AddParameter("string", _("New value"))
|
||||
.MarkAsSimple()
|
||||
.SetRequiresBaseObjectCapability("effect");
|
||||
.MarkAsSimple();
|
||||
|
||||
obj.AddAction("SetEffectBooleanParameter",
|
||||
_("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."),
|
||||
_("You can find the parameter names (and change the effect "
|
||||
"names) in the effects window."),
|
||||
_("Enable _PARAM2_ for effect _PARAM1_ of _PARAM0_: _PARAM3_"),
|
||||
_("Effects"),
|
||||
"res/actions/effect24.png",
|
||||
@@ -1227,32 +1180,29 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsBaseObjectExtension(
|
||||
.AddParameter("objectEffectName", _("Effect name"))
|
||||
.AddParameter("objectEffectParameterName", _("Parameter name"))
|
||||
.AddParameter("yesorno", _("Enable?"))
|
||||
.MarkAsSimple()
|
||||
.SetRequiresBaseObjectCapability("effect");
|
||||
.MarkAsSimple();
|
||||
|
||||
obj.AddCondition("IsEffectEnabled",
|
||||
_("Effect is enabled"),
|
||||
_("Check if the effect on an object is enabled."),
|
||||
_("Effect _PARAM1_ of _PARAM0_ is enabled"),
|
||||
_("Effects"),
|
||||
"res/actions/effect24.png",
|
||||
"res/actions/effect.png")
|
||||
_("Effect is enabled"),
|
||||
_("Check if the effect on an object is enabled."),
|
||||
_("Effect _PARAM1_ of _PARAM0_ is enabled"),
|
||||
_("Effects"),
|
||||
"res/actions/effect24.png",
|
||||
"res/actions/effect.png")
|
||||
.AddParameter("object", _("Object"))
|
||||
.AddParameter("objectEffectName", _("Effect name"))
|
||||
.MarkAsSimple()
|
||||
.SetRequiresBaseObjectCapability("effect");
|
||||
.MarkAsSimple();
|
||||
|
||||
extension
|
||||
.AddAction("Create",
|
||||
_("Create an object"),
|
||||
_("Create an object at specified position"),
|
||||
_("Create object _PARAM1_ at position _PARAM2_;_PARAM3_ "
|
||||
"(layer: _PARAM4_)"),
|
||||
"",
|
||||
_("Create object _PARAM1_ at position _PARAM2_;_PARAM3_ (layer: _PARAM4_)"),
|
||||
_("Objects"),
|
||||
"res/actions/create24.png",
|
||||
"res/actions/create24.png")
|
||||
"res/actions/create.png")
|
||||
.AddCodeOnlyParameter("objectsContext", "")
|
||||
.AddParameter("objectListOrEmptyIfJustDeclared", _("Object to create"))
|
||||
.AddParameter("objectListWithoutPicking", _("Object to create"))
|
||||
.AddParameter("expression", _("X position"))
|
||||
.AddParameter("expression", _("Y position"))
|
||||
.AddParameter("layer", _("Layer (base layer if empty)"), "", true)
|
||||
@@ -1266,11 +1216,11 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsBaseObjectExtension(
|
||||
"create the object with the specified name."),
|
||||
_("Among objects _PARAM1_, create object named _PARAM2_ at "
|
||||
"position _PARAM3_;_PARAM4_ (layer: _PARAM5_)"),
|
||||
"",
|
||||
_("Objects"),
|
||||
"res/actions/create24.png",
|
||||
"res/actions/create24.png")
|
||||
"res/actions/create.png")
|
||||
.AddCodeOnlyParameter("objectsContext", "")
|
||||
.AddParameter("objectListOrEmptyIfJustDeclared", _("Group of potential objects"))
|
||||
.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"))
|
||||
@@ -1418,40 +1368,17 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsBaseObjectExtension(
|
||||
"res/conditions/nbObjet.png")
|
||||
.AddParameter("objectList", _("Object"))
|
||||
.UseStandardRelationalOperatorParameters("number")
|
||||
.MarkAsSimple()
|
||||
.SetHidden();
|
||||
|
||||
extension.AddExpressionAndCondition(
|
||||
"number",
|
||||
"SceneInstancesCount",
|
||||
_("Number of object instances on the scene"),
|
||||
_("the number of instances of the specified objects living on the scene"),
|
||||
_("the number of _PARAM1_ living on the scene"),
|
||||
_("Objects"),
|
||||
"res/conditions/nbObjet24.png")
|
||||
.AddCodeOnlyParameter("objectsContext", "")
|
||||
.AddParameter("objectListOrEmptyWithoutPicking", _("Object"))
|
||||
.UseStandardParameters("number")
|
||||
.MarkAsSimple();
|
||||
|
||||
extension.AddExpressionAndCondition(
|
||||
"number",
|
||||
"PickedInstancesCount",
|
||||
_("Number of object instances currently picked"),
|
||||
_("the number of instances picked by the previous conditions (or actions)"),
|
||||
_("the number of _PARAM0_ currently picked"),
|
||||
_("Objects"),
|
||||
"res/conditions/nbObjet24.png")
|
||||
.AddParameter("objectListOrEmptyWithoutPicking", _("Object"))
|
||||
.UseStandardParameters("number")
|
||||
.MarkAsSimple();
|
||||
.MarkAsSimple();
|
||||
|
||||
extension
|
||||
.AddCondition(
|
||||
"CollisionNP",
|
||||
"CollisionNP", //"CollisionNP" cames from an old condition to test
|
||||
// collision between two sprites non precisely.
|
||||
_("Collision"),
|
||||
_("Test the collision between two objects using their collision "
|
||||
"masks."),
|
||||
"masks.\nNote that some objects may not have collision "
|
||||
"masks.\nSome others, like Sprite objects, also provide more "
|
||||
"precise collision conditions."),
|
||||
_("_PARAM0_ is in collision with _PARAM1_"),
|
||||
_("Collision"),
|
||||
"res/conditions/collision24.png",
|
||||
@@ -1495,7 +1422,7 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsBaseObjectExtension(
|
||||
_("Cast a ray from _PARAM1_;_PARAM2_, angle: _PARAM3_ and max "
|
||||
"distance: _PARAM4_px, against _PARAM0_, and save the "
|
||||
"result in _PARAM5_, _PARAM6_"),
|
||||
"",
|
||||
_("Collision"),
|
||||
"res/conditions/raycast24.png",
|
||||
"res/conditions/raycast.png")
|
||||
.AddParameter("objectList", _("Objects to test against the ray"))
|
||||
@@ -1526,7 +1453,7 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsBaseObjectExtension(
|
||||
_("Cast a ray from from _PARAM1_;_PARAM2_ to _PARAM3_;_PARAM4_ "
|
||||
"against _PARAM0_, and save the "
|
||||
"result in _PARAM5_, _PARAM6_"),
|
||||
"",
|
||||
_("Collision"),
|
||||
"res/conditions/raycast24.png",
|
||||
"res/conditions/raycast.png")
|
||||
.AddParameter("objectList", _("Objects to test against the ray"))
|
||||
@@ -1550,22 +1477,21 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsBaseObjectExtension(
|
||||
_("Number of objects"),
|
||||
_("Count the number of the specified objects being "
|
||||
"currently picked in the event"),
|
||||
"",
|
||||
_("Objects"),
|
||||
"res/conditions/nbObjet.png")
|
||||
.AddParameter("objectList", _("Object"))
|
||||
.SetHidden(); // Deprecated
|
||||
.AddParameter("objectList", _("Object"));
|
||||
|
||||
obj.AddStrExpression("ObjectName",
|
||||
_("Object name"),
|
||||
_("Return the name of the object"),
|
||||
"",
|
||||
_("Objects"),
|
||||
"res/conditions/text.png")
|
||||
.AddParameter("object", _("Object"));
|
||||
|
||||
obj.AddStrExpression("Layer",
|
||||
_("Object layer"),
|
||||
_("Return the name of the layer the object is on"),
|
||||
"",
|
||||
_("Objects"),
|
||||
"res/actions/layer.png")
|
||||
.AddParameter("object", _("Object"));
|
||||
}
|
||||
|
@@ -15,7 +15,7 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsCameraExtension(
|
||||
extension
|
||||
.SetExtensionInformation(
|
||||
"BuiltinCamera",
|
||||
_("Layers and cameras"),
|
||||
_("Cameras and layers features"),
|
||||
"Each scene can be composed of multiple layers. These conditions "
|
||||
"and actions allow to manipulate them during the game. In "
|
||||
"particular, you can move the camera of a layer to center it on an "
|
||||
@@ -23,8 +23,6 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsCameraExtension(
|
||||
"Florian Rival",
|
||||
"Open source (MIT License)")
|
||||
.SetExtensionHelpPath("/interface/scene-editor/layers-and-cameras");
|
||||
extension.AddInstructionOrExpressionGroupMetadata(_("Layers and cameras"))
|
||||
.SetIcon("res/conditions/camera24.png");
|
||||
|
||||
extension
|
||||
.AddExpressionAndConditionAndAction(
|
||||
@@ -33,7 +31,7 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsCameraExtension(
|
||||
_("Camera center X position"),
|
||||
_("the X position of the center of a camera"),
|
||||
_("the X position of camera _PARAM4_ (layer: _PARAM3_)"),
|
||||
"",
|
||||
_("Layers and cameras"),
|
||||
"res/conditions/camera24.png")
|
||||
.AddCodeOnlyParameter("currentScene", "")
|
||||
.UseStandardParameters("number")
|
||||
@@ -55,7 +53,7 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsCameraExtension(
|
||||
_("Camera center Y position"),
|
||||
_("the Y position of the center of a camera"),
|
||||
_("the Y position of camera _PARAM4_ (layer: _PARAM3_)"),
|
||||
"",
|
||||
_("Layers and cameras"),
|
||||
"res/conditions/camera24.png")
|
||||
.AddCodeOnlyParameter("currentScene", "")
|
||||
.UseStandardParameters("number")
|
||||
@@ -77,7 +75,7 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsCameraExtension(
|
||||
_("Width of a camera"),
|
||||
_("the width of a camera of a layer"),
|
||||
_("the width of camera _PARAM2_ of layer _PARAM1_"),
|
||||
"",
|
||||
_("Layers and cameras"),
|
||||
"res/conditions/camera24.png")
|
||||
.AddCodeOnlyParameter("currentScene", "")
|
||||
.AddParameter("layer", _("Layer (base layer if empty)"))
|
||||
@@ -93,7 +91,7 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsCameraExtension(
|
||||
_("Height of a camera"),
|
||||
_("the height of a camera of a layer"),
|
||||
_("the height of camera _PARAM2_ of layer _PARAM1_"),
|
||||
"",
|
||||
_("Layers and cameras"),
|
||||
"res/conditions/camera24.png")
|
||||
.AddCodeOnlyParameter("currentScene", "")
|
||||
.AddParameter("layer", _("Layer (base layer if empty)"))
|
||||
@@ -109,7 +107,7 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsCameraExtension(
|
||||
_("Angle of a camera of a layer"),
|
||||
_("the angle of rotation of a camera"),
|
||||
_("the angle of camera (layer: _PARAM3_, camera: _PARAM4_)"),
|
||||
"",
|
||||
_("Layers and cameras"),
|
||||
"res/conditions/camera24.png")
|
||||
.AddCodeOnlyParameter("currentScene", "")
|
||||
.UseStandardParameters("number")
|
||||
@@ -129,7 +127,7 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsCameraExtension(
|
||||
_("Add a camera to a layer"),
|
||||
_("This action adds a camera to a layer"),
|
||||
_("Add a camera to layer _PARAM1_"),
|
||||
"",
|
||||
_("Layers and cameras"),
|
||||
"res/actions/camera24.png",
|
||||
"res/actions/camera.png")
|
||||
.AddCodeOnlyParameter("currentScene", "")
|
||||
@@ -164,7 +162,7 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsCameraExtension(
|
||||
_("Delete a camera of a layer"),
|
||||
_("Remove the specified camera from a layer"),
|
||||
_("Delete camera _PARAM2_ from layer _PARAM1_"),
|
||||
"",
|
||||
_("Layers and cameras"),
|
||||
"res/actions/camera24.png",
|
||||
"res/actions/camera.png")
|
||||
.AddCodeOnlyParameter("currentScene", "")
|
||||
@@ -180,7 +178,7 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsCameraExtension(
|
||||
"layer. The zoom will be reset."),
|
||||
_("Change the size of camera _PARAM2_ of _PARAM1_ to "
|
||||
"_PARAM3_*_PARAM4_"),
|
||||
"",
|
||||
_("Layers and cameras"),
|
||||
"res/actions/camera24.png",
|
||||
"res/actions/camera.png")
|
||||
.AddCodeOnlyParameter("currentScene", "")
|
||||
@@ -198,7 +196,7 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsCameraExtension(
|
||||
"specified layer."),
|
||||
_("Set the render zone of camera _PARAM2_ from layer _PARAM1_ "
|
||||
"to _PARAM3_;_PARAM4_ _PARAM5_;_PARAM6_"),
|
||||
"",
|
||||
_("Layers and cameras"),
|
||||
"res/actions/camera24.png",
|
||||
"res/actions/camera.png")
|
||||
.AddCodeOnlyParameter("currentScene", "")
|
||||
@@ -225,7 +223,7 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsCameraExtension(
|
||||
_("Change camera zoom."),
|
||||
_("Change camera zoom to _PARAM1_ (layer: _PARAM2_, camera: "
|
||||
"_PARAM3_)"),
|
||||
"",
|
||||
_("Layers and cameras"),
|
||||
"res/actions/camera24.png",
|
||||
"res/actions/camera.png")
|
||||
.AddCodeOnlyParameter("currentScene", "")
|
||||
@@ -236,7 +234,6 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsCameraExtension(
|
||||
.AddParameter("expression", _("Camera number (default : 0)"), "", true)
|
||||
.SetDefaultValue("0");
|
||||
|
||||
// TODO Deprecated: hide this action in a future release.
|
||||
extension
|
||||
.AddAction(
|
||||
"FixCamera",
|
||||
@@ -245,7 +242,7 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsCameraExtension(
|
||||
"specified limits."),
|
||||
_("Center the camera on _PARAM1_ (limit : from _PARAM2_;_PARAM3_ to "
|
||||
"_PARAM4_;_PARAM5_) (layer: _PARAM7_, camera: _PARAM8_)"),
|
||||
"",
|
||||
_("Layers and cameras"),
|
||||
"res/actions/camera24.png",
|
||||
"res/actions/camera.png")
|
||||
.AddCodeOnlyParameter("currentScene", "")
|
||||
@@ -269,38 +266,13 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsCameraExtension(
|
||||
.SetDefaultValue("0")
|
||||
.MarkAsAdvanced();
|
||||
|
||||
extension
|
||||
.AddAction(
|
||||
"ClampCamera",
|
||||
_("Enforce camera boundaries"),
|
||||
_("Enforce camera boundaries by moving the camera back inside specified boundaries."),
|
||||
_("Enforce camera boundaries (left: _PARAM1_, top: _PARAM2_ "
|
||||
"right: _PARAM3_, bottom: _PARAM4_, layer: _PARAM5_)"),
|
||||
"",
|
||||
"res/actions/camera24.png",
|
||||
"res/actions/camera.png")
|
||||
.AddCodeOnlyParameter("currentScene", "")
|
||||
.AddParameter("expression",
|
||||
_("Left bound X Position"))
|
||||
.AddParameter("expression",
|
||||
_("Top bound Y Position"))
|
||||
.AddParameter("expression",
|
||||
_("Right bound X Position"))
|
||||
.AddParameter("expression",
|
||||
_("Bottom bound Y Position"))
|
||||
.AddParameter("layer", _("Layer (base layer if empty)"), "", true)
|
||||
.SetDefaultValue("\"\"")
|
||||
.AddParameter("expression", _("Camera number (default : 0)"), "", true)
|
||||
.SetDefaultValue("0")
|
||||
.MarkAsAdvanced();
|
||||
|
||||
extension
|
||||
.AddAction(
|
||||
"CentreCamera",
|
||||
_("Center the camera on an object"),
|
||||
_("Center the camera on the specified object."),
|
||||
_("Center camera on _PARAM1_ (layer: _PARAM3_)"),
|
||||
"",
|
||||
_("Center camera on _PARAM1_ (layer: _PARAM3_, camera: _PARAM4_)"),
|
||||
_("Layers and cameras"),
|
||||
"res/actions/camera24.png",
|
||||
"res/actions/camera.png")
|
||||
.AddCodeOnlyParameter("currentScene", "")
|
||||
@@ -321,7 +293,7 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsCameraExtension(
|
||||
_("Show a layer"),
|
||||
_("Show a layer."),
|
||||
_("Show layer _PARAM1_"),
|
||||
"",
|
||||
_("Layers and cameras"),
|
||||
"res/actions/layer24.png",
|
||||
"res/actions/layer.png")
|
||||
.AddCodeOnlyParameter("currentScene", "")
|
||||
@@ -334,7 +306,7 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsCameraExtension(
|
||||
_("Hide a layer"),
|
||||
_("Hide a layer."),
|
||||
_("Hide layer _PARAM1_"),
|
||||
"",
|
||||
_("Layers and cameras"),
|
||||
"res/actions/layer24.png",
|
||||
"res/actions/layer.png")
|
||||
.AddCodeOnlyParameter("currentScene", "")
|
||||
@@ -347,7 +319,7 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsCameraExtension(
|
||||
_("Visibility of a layer"),
|
||||
_("Test if a layer is set as visible."),
|
||||
_("Layer _PARAM1_ is visible"),
|
||||
"",
|
||||
_("Layers and cameras"),
|
||||
"res/conditions/layer24.png",
|
||||
"res/conditions/layer.png")
|
||||
.AddCodeOnlyParameter("currentScene", "")
|
||||
@@ -363,7 +335,7 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsCameraExtension(
|
||||
_("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_"),
|
||||
_("Effects"),
|
||||
_("Layers and cameras/Effects"),
|
||||
"res/conditions/camera24.png",
|
||||
"res/conditions/camera.png")
|
||||
.AddCodeOnlyParameter("currentScene", "")
|
||||
@@ -382,7 +354,7 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsCameraExtension(
|
||||
_("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_"),
|
||||
_("Effects"),
|
||||
_("Layers and cameras/Effects"),
|
||||
"res/conditions/camera24.png",
|
||||
"res/conditions/camera.png")
|
||||
.AddCodeOnlyParameter("currentScene", "")
|
||||
@@ -401,7 +373,7 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsCameraExtension(
|
||||
_("You can find the parameter names (and change the effect "
|
||||
"names) in the effects window."),
|
||||
_("Enable _PARAM3_ for effect _PARAM2_ of layer _PARAM1_: _PARAM4_"),
|
||||
_("Effects"),
|
||||
_("Layers and cameras/Effects"),
|
||||
"res/conditions/camera24.png",
|
||||
"res/conditions/camera.png")
|
||||
.AddCodeOnlyParameter("currentScene", "")
|
||||
@@ -417,7 +389,7 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsCameraExtension(
|
||||
_("Layer effect is enabled"),
|
||||
_("The effect on a layer is enabled"),
|
||||
_("Effect _PARAM2_ on layer _PARAM1_ is enabled"),
|
||||
_("Effects"),
|
||||
_("Layers and cameras/Effects"),
|
||||
"res/conditions/camera24.png",
|
||||
"res/conditions/camera.png")
|
||||
.AddCodeOnlyParameter("currentScene", "")
|
||||
@@ -431,7 +403,7 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsCameraExtension(
|
||||
_("Enable layer effect"),
|
||||
_("Enable an effect on a layer"),
|
||||
_("Enable effect _PARAM2_ on layer _PARAM1_: _PARAM3_"),
|
||||
_("Effects"),
|
||||
_("Layers and cameras/Effects"),
|
||||
"res/conditions/camera24.png",
|
||||
"res/conditions/camera.png")
|
||||
.AddCodeOnlyParameter("currentScene", "")
|
||||
@@ -447,7 +419,7 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsCameraExtension(
|
||||
_("Layer time scale"),
|
||||
_("Compare the time scale applied to the objects of the layer."),
|
||||
_("the time scale of layer _PARAM1_"),
|
||||
"",
|
||||
_("Layers and cameras"),
|
||||
"res/conditions/time24.png",
|
||||
"res/conditions/time.png")
|
||||
.AddCodeOnlyParameter("currentScene", "")
|
||||
@@ -462,7 +434,7 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsCameraExtension(
|
||||
_("Change layer time scale"),
|
||||
_("Change the time scale applied to the objects of the layer."),
|
||||
_("Set the time scale of layer _PARAM1_ to _PARAM2_"),
|
||||
"",
|
||||
_("Layers and cameras"),
|
||||
"res/actions/time24.png",
|
||||
"res/actions/time.png")
|
||||
.AddCodeOnlyParameter("currentScene", "")
|
||||
@@ -477,7 +449,7 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsCameraExtension(
|
||||
_("Compare the default Z order set to objects when they "
|
||||
"are created on a layer."),
|
||||
_("the default Z order of objects created on _PARAM1_"),
|
||||
"",
|
||||
_("Layers and cameras"),
|
||||
"res/conditions/layer24.png",
|
||||
"res/conditions/layer.png")
|
||||
.AddCodeOnlyParameter("currentScene", "")
|
||||
@@ -493,7 +465,7 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsCameraExtension(
|
||||
"created on a layer."),
|
||||
_("Set the default Z order of objects created on _PARAM1_ to "
|
||||
"_PARAM2_"),
|
||||
"",
|
||||
_("Layers and cameras"),
|
||||
"res/actions/layer24.png",
|
||||
"res/actions/layer.png")
|
||||
.AddCodeOnlyParameter("currentScene", "")
|
||||
@@ -508,7 +480,7 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsCameraExtension(
|
||||
_("Set the ambient light color of the lighting layer in format "
|
||||
"\"R;G;B\" string."),
|
||||
_("Set the ambient color of the lighting layer _PARAM1_ to _PARAM2_"),
|
||||
_("Lighting"),
|
||||
_("Layers and cameras/Lighting"),
|
||||
"res/actions/color24.png",
|
||||
"res/actions/color.png")
|
||||
.AddCodeOnlyParameter("currentScene", "")
|
||||
@@ -522,7 +494,7 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsCameraExtension(
|
||||
"CameraViewportLeft",
|
||||
_("X position of the top left side point of a render zone"),
|
||||
_("X position of the top left side point of a render zone"),
|
||||
"",
|
||||
_("Layers and cameras"),
|
||||
"res/actions/camera.png")
|
||||
.AddCodeOnlyParameter("currentScene", "")
|
||||
.AddParameter("layer", _("Layer"))
|
||||
@@ -534,7 +506,7 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsCameraExtension(
|
||||
"CameraViewportTop",
|
||||
_("Y position of the top left side point of a render zone"),
|
||||
_("Y position of the top left side point of a render zone"),
|
||||
"",
|
||||
_("Layers and cameras"),
|
||||
"res/actions/camera.png")
|
||||
.AddCodeOnlyParameter("currentScene", "")
|
||||
.AddParameter("layer", _("Layer"))
|
||||
@@ -546,7 +518,7 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsCameraExtension(
|
||||
"CameraViewportRight",
|
||||
_("X position of the bottom right side point of a render zone"),
|
||||
_("X position of the bottom right side point of a render zone"),
|
||||
"",
|
||||
_("Layers and cameras"),
|
||||
"res/actions/camera.png")
|
||||
.AddCodeOnlyParameter("currentScene", "")
|
||||
.AddParameter("layer", _("Layer"))
|
||||
@@ -558,7 +530,7 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsCameraExtension(
|
||||
"CameraViewportBottom",
|
||||
_("Y position of the bottom right side point of a render zone"),
|
||||
_("Y position of the bottom right side point of a render zone"),
|
||||
"",
|
||||
_("Layers and cameras"),
|
||||
"res/actions/camera.png")
|
||||
.AddCodeOnlyParameter("currentScene", "")
|
||||
.AddParameter("layer", _("Layer"))
|
||||
@@ -569,7 +541,7 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsCameraExtension(
|
||||
.AddExpression("CameraZoom",
|
||||
_("Zoom of a camera of a layer"),
|
||||
_("Zoom of a camera of a layer"),
|
||||
"",
|
||||
_("Layers and cameras"),
|
||||
"res/actions/camera.png")
|
||||
.AddCodeOnlyParameter("currentScene", "")
|
||||
.AddParameter("layer", _("Layer"), "", true)
|
||||
@@ -581,7 +553,7 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsCameraExtension(
|
||||
.AddExpression("LayerTimeScale",
|
||||
_("Layer time scale"),
|
||||
_("Returns the time scale of the specified layer."),
|
||||
"",
|
||||
_("Layers and cameras"),
|
||||
"res/actions/time.png")
|
||||
.AddCodeOnlyParameter("currentScene", "")
|
||||
.AddParameter("layer", _("Layer"));
|
||||
@@ -590,7 +562,7 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsCameraExtension(
|
||||
.AddExpression("LayerDefaultZOrder",
|
||||
_("Default Z Order for a layer"),
|
||||
_("Default Z Order for a layer"),
|
||||
"",
|
||||
_("Layers and cameras"),
|
||||
"res/actions/camera.png")
|
||||
.AddCodeOnlyParameter("currentScene", "")
|
||||
.AddParameter("layer", _("Layer"));
|
||||
|
@@ -15,19 +15,18 @@ BuiltinExtensionsImplementer::ImplementsCommonConversionsExtension(
|
||||
extension
|
||||
.SetExtensionInformation(
|
||||
"BuiltinCommonConversions",
|
||||
_("Conversion"),
|
||||
_("Standard Conversions"),
|
||||
"Expressions to convert number, texts and quantities.",
|
||||
"Florian Rival",
|
||||
"Open source (MIT License)")
|
||||
.SetExtensionHelpPath("/all-features/common-conversions");
|
||||
extension.AddInstructionOrExpressionGroupMetadata(_("Conversion"))
|
||||
.SetIcon("res/conditions/toujours24.png");
|
||||
|
||||
|
||||
extension
|
||||
.AddExpression("ToNumber",
|
||||
_("Text > Number"),
|
||||
_("Convert the text to a number"),
|
||||
"",
|
||||
_("Conversion"),
|
||||
"res/conditions/toujours24.png")
|
||||
.AddParameter("string", _("Text to convert to a number"));
|
||||
|
||||
@@ -35,7 +34,7 @@ BuiltinExtensionsImplementer::ImplementsCommonConversionsExtension(
|
||||
.AddStrExpression("ToString",
|
||||
_("Number > Text"),
|
||||
_("Convert the result of the expression to text"),
|
||||
"",
|
||||
_("Conversion"),
|
||||
"res/conditions/toujours24.png")
|
||||
.AddParameter("expression", _("Expression to be converted to text"));
|
||||
|
||||
@@ -44,7 +43,7 @@ BuiltinExtensionsImplementer::ImplementsCommonConversionsExtension(
|
||||
_("Number > Text ( without scientific notation )"),
|
||||
_("Convert the result of the expression to text, "
|
||||
"without using the scientific notation"),
|
||||
"",
|
||||
_("Conversion"),
|
||||
"res/conditions/toujours24.png")
|
||||
.AddParameter("expression", _("Expression to be converted to text"));
|
||||
|
||||
@@ -53,7 +52,7 @@ BuiltinExtensionsImplementer::ImplementsCommonConversionsExtension(
|
||||
"ToRad",
|
||||
_("Degrees > Radians"),
|
||||
_("Converts the angle, expressed in degrees, into radians"),
|
||||
"",
|
||||
_("Conversion"),
|
||||
"res/conditions/toujours24.png")
|
||||
.AddParameter("expression", _("Angle, in degrees"));
|
||||
|
||||
@@ -62,76 +61,9 @@ BuiltinExtensionsImplementer::ImplementsCommonConversionsExtension(
|
||||
"ToDeg",
|
||||
_("Radians > Degrees"),
|
||||
_("Converts the angle, expressed in radians, into degrees"),
|
||||
"",
|
||||
_("Conversion"),
|
||||
"res/conditions/toujours24.png")
|
||||
.AddParameter("expression", _("Angle, in radians"));
|
||||
|
||||
extension
|
||||
.AddStrExpression("ToJSON",
|
||||
_("Convert scene variable to JSON"),
|
||||
_("Convert a scene variable to JSON"),
|
||||
_("JSON"),
|
||||
"res/conditions/toujours24.png")
|
||||
.AddParameter("scenevar", _("Scene variable to be stringified"));
|
||||
|
||||
extension
|
||||
.AddStrExpression("GlobalVarToJSON",
|
||||
_("Convert global variable to JSON"),
|
||||
_("Convert a global variable to JSON"),
|
||||
_("JSON"),
|
||||
"res/conditions/toujours24.png")
|
||||
.AddParameter("globalvar", _("The global variable to be stringified"));
|
||||
|
||||
extension
|
||||
.AddStrExpression("ObjectVarToJSON",
|
||||
_("Convert object variable to JSON"),
|
||||
_("Convert an object variable to JSON"),
|
||||
_("JSON"),
|
||||
"res/conditions/toujours24.png")
|
||||
.AddParameter("objectPtr", _("The object with the variable"))
|
||||
.AddParameter("objectvar", _("The object variable to be stringified"));
|
||||
|
||||
extension
|
||||
.AddAction(
|
||||
"JSONToVariableStructure",
|
||||
_("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_"),
|
||||
"",
|
||||
"res/actions/net24.png",
|
||||
"res/actions/net.png")
|
||||
.AddParameter("string", _("JSON string"))
|
||||
.AddParameter("scenevar", _("Variable where store the JSON object"))
|
||||
.MarkAsAdvanced();
|
||||
|
||||
extension
|
||||
.AddAction("JSONToGlobalVariableStructure",
|
||||
_("Convert JSON to global variable"),
|
||||
_("Parse a JSON object and store it into a global variable"),
|
||||
_("Parse JSON string _PARAM0_ and store it into global "
|
||||
"variable _PARAM1_"),
|
||||
"",
|
||||
"res/actions/net24.png",
|
||||
"res/actions/net.png")
|
||||
.AddParameter("string", _("JSON string"))
|
||||
.AddParameter("globalvar",
|
||||
_("Global variable where store the JSON object"))
|
||||
.MarkAsAdvanced();
|
||||
|
||||
extension
|
||||
.AddAction("JSONToObjectVariableStructure",
|
||||
_("Convert JSON to object variable"),
|
||||
_("Parse a JSON object and store it into an object variable"),
|
||||
_("Parse JSON string _PARAM0_ and store it into variable "
|
||||
"_PARAM2_ of _PARAM1_"),
|
||||
"",
|
||||
"res/actions/net24.png",
|
||||
"res/actions/net.png")
|
||||
.AddParameter("string", _("JSON string"))
|
||||
.AddParameter("objectPtr", _("Object"))
|
||||
.AddParameter("objectvar",
|
||||
_("Object variable where store the JSON object"))
|
||||
.MarkAsAdvanced();
|
||||
}
|
||||
|
||||
} // namespace gd
|
||||
|
@@ -4,6 +4,7 @@
|
||||
* reserved. This project is released under the MIT License.
|
||||
*/
|
||||
#include "AllBuiltinExtensions.h"
|
||||
#include "GDCore/Tools/Localization.h"
|
||||
#include "GDCore/Events/Builtin/CommentEvent.h"
|
||||
#include "GDCore/Events/Builtin/ForEachChildVariableEvent.h"
|
||||
#include "GDCore/Events/Builtin/ForEachEvent.h"
|
||||
@@ -13,7 +14,6 @@
|
||||
#include "GDCore/Events/Builtin/StandardEvent.h"
|
||||
#include "GDCore/Events/Builtin/WhileEvent.h"
|
||||
#include "GDCore/Events/Event.h"
|
||||
#include "GDCore/Tools/Localization.h"
|
||||
|
||||
using namespace std;
|
||||
namespace gd {
|
||||
@@ -24,43 +24,19 @@ BuiltinExtensionsImplementer::ImplementsCommonInstructionsExtension(
|
||||
extension
|
||||
.SetExtensionInformation(
|
||||
"BuiltinCommonInstructions",
|
||||
_("Events and control flow"),
|
||||
_("Builtin events"),
|
||||
"GDevelop comes with a set of events and conditions that allow to "
|
||||
"express the game logic and rules.",
|
||||
"Florian Rival",
|
||||
"Open source (MIT License)")
|
||||
.SetCategory("Advanced")
|
||||
.SetExtensionHelpPath("/all-features/advanced-conditions");
|
||||
extension
|
||||
.AddInstructionOrExpressionGroupMetadata(_("Events and control flow"))
|
||||
.SetIcon("res/conditions/toujours24.png");
|
||||
|
||||
extension
|
||||
.AddCondition("Always",
|
||||
_("Always"),
|
||||
_("This condition always returns true (or always false, if "
|
||||
"the condition is inverted)."),
|
||||
_("Always"),
|
||||
"",
|
||||
"res/conditions/toujours24.png",
|
||||
"res/conditions/toujours.png")
|
||||
.SetHelpPath("/all-features/advanced-conditions")
|
||||
.AddCodeOnlyParameter("conditionInverted", "")
|
||||
.MarkAsAdvanced();
|
||||
|
||||
// Compatibility with GD <= 5.0.127
|
||||
extension
|
||||
.AddDuplicatedCondition(
|
||||
"Toujours", "BuiltinCommonInstructions::Always", {.unscoped = true})
|
||||
.SetHidden();
|
||||
// end of compatibility code
|
||||
|
||||
extension
|
||||
.AddCondition("Or",
|
||||
_("Or"),
|
||||
_("Check if one of the sub conditions is true"),
|
||||
_("If one of these conditions is true:"),
|
||||
"",
|
||||
_("Advanced"),
|
||||
"res/conditions/or24.png",
|
||||
"res/conditions/or.png")
|
||||
.SetCanHaveSubInstructions()
|
||||
@@ -71,7 +47,7 @@ BuiltinExtensionsImplementer::ImplementsCommonInstructionsExtension(
|
||||
_("And"),
|
||||
_("Check if all sub conditions are true"),
|
||||
_("If all of these conditions are true:"),
|
||||
"",
|
||||
_("Advanced"),
|
||||
"res/conditions/and24.png",
|
||||
"res/conditions/and.png")
|
||||
.SetCanHaveSubInstructions()
|
||||
@@ -83,7 +59,7 @@ BuiltinExtensionsImplementer::ImplementsCommonInstructionsExtension(
|
||||
_("Not"),
|
||||
_("Return the contrary of the result of the sub conditions"),
|
||||
_("Invert the logical result of these conditions:"),
|
||||
"",
|
||||
_("Advanced"),
|
||||
"res/conditions/not24.png",
|
||||
"res/conditions/not.png")
|
||||
.SetCanHaveSubInstructions()
|
||||
@@ -94,52 +70,10 @@ BuiltinExtensionsImplementer::ImplementsCommonInstructionsExtension(
|
||||
_("Trigger once while true"),
|
||||
_("Run actions only once, for each time the conditions have been met."),
|
||||
_("Trigger once"),
|
||||
"",
|
||||
_("Advanced"),
|
||||
"res/conditions/once24.png",
|
||||
"res/conditions/once.png");
|
||||
|
||||
extension
|
||||
.AddCondition("CompareNumbers",
|
||||
_("Compare two numbers"),
|
||||
_("Compare the two numbers."),
|
||||
_("_PARAM0_ _PARAM1_ _PARAM2_"),
|
||||
"",
|
||||
"res/conditions/egal24.png",
|
||||
"res/conditions/egal.png")
|
||||
.SetHelpPath("/all-features/advanced-conditions")
|
||||
.AddParameter("expression", _("First expression"))
|
||||
.AddParameter("relationalOperator", _("Sign of the test"), "number")
|
||||
.AddParameter("expression", _("Second expression"))
|
||||
.MarkAsAdvanced();
|
||||
|
||||
// Compatibility with GD <= 5.0.127
|
||||
extension
|
||||
.AddDuplicatedCondition(
|
||||
"Egal", "BuiltinCommonInstructions::CompareNumbers", {.unscoped = true})
|
||||
.SetHidden();
|
||||
// end of compatibility code
|
||||
|
||||
extension
|
||||
.AddCondition("CompareStrings",
|
||||
_("Compare two strings"),
|
||||
_("Compare the two strings."),
|
||||
_("_PARAM0_ _PARAM1_ _PARAM2_"),
|
||||
"",
|
||||
"res/conditions/egal24.png",
|
||||
"res/conditions/egal.png")
|
||||
.SetHelpPath("/all-features/advanced-conditions")
|
||||
.AddParameter("string", _("First string expression"))
|
||||
.AddParameter("relationalOperator", _("Sign of the test"), "string")
|
||||
.AddParameter("string", _("Second string expression"))
|
||||
.MarkAsAdvanced();
|
||||
|
||||
// Compatibility with GD <= 5.0.127
|
||||
extension
|
||||
.AddDuplicatedCondition(
|
||||
"StrEqual", "BuiltinCommonInstructions::CompareStrings", {.unscoped = true})
|
||||
.SetHidden();
|
||||
// end of compatibility code
|
||||
|
||||
extension.AddEvent(
|
||||
"Standard",
|
||||
_("Standard event"),
|
||||
|
@@ -19,21 +19,18 @@ BuiltinExtensionsImplementer::ImplementsExternalLayoutsExtension(
|
||||
"external layouts.",
|
||||
"Florian Rival",
|
||||
"Open source (MIT License)")
|
||||
.SetExtensionHelpPath("/interface/scene-editor/external-layouts")
|
||||
.SetCategory("Advanced");
|
||||
extension.AddInstructionOrExpressionGroupMetadata(_("External layouts"))
|
||||
.SetIcon("res/ribbon_default/externallayout32.png");
|
||||
.SetExtensionHelpPath("/interface/scene-editor/external-layouts");
|
||||
|
||||
extension
|
||||
.AddAction("CreateObjectsFromExternalLayout",
|
||||
_("Create objects from an external layout"),
|
||||
_("Create objects from an external layout."),
|
||||
_("Create objects from the external layout named _PARAM1_"),
|
||||
"",
|
||||
"res/ribbon_default/externallayout32.png",
|
||||
"res/ribbon_default/externallayout32.png")
|
||||
_("External layouts"),
|
||||
"res/conditions/fichier24.png",
|
||||
"res/conditions/fichier.png")
|
||||
.AddCodeOnlyParameter("currentScene", "")
|
||||
.AddParameter("externalLayoutName", _("Name of the external layout"))
|
||||
.AddParameter("string", _("Name of the external layout"))
|
||||
.AddParameter("expression", _("X position of the origin"), "", true)
|
||||
.SetDefaultValue("0")
|
||||
.AddParameter("expression", _("Y position of the origin"), "", true)
|
||||
|
@@ -20,10 +20,7 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsFileExtension(
|
||||
"stored on the device and erased when the game is uninstalled.",
|
||||
"Florian Rival",
|
||||
"Open source (MIT License)")
|
||||
.SetExtensionHelpPath("/all-features/storage")
|
||||
.SetCategory("Device");
|
||||
extension.AddInstructionOrExpressionGroupMetadata(_("Storage"))
|
||||
.SetIcon("res/conditions/fichier24.png");
|
||||
.SetExtensionHelpPath("/all-features/storage");
|
||||
|
||||
extension
|
||||
.AddCondition(
|
||||
@@ -32,7 +29,7 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsFileExtension(
|
||||
_("Check if an element (example : PlayerState/CurrentLevel) exists "
|
||||
"in the stored data.\nSpaces are forbidden in element names."),
|
||||
_("_PARAM1_ exists in storage _PARAM0_"),
|
||||
"",
|
||||
_("Storage"),
|
||||
"res/conditions/fichier24.png",
|
||||
"res/conditions/fichier.png")
|
||||
.AddParameter("string", _("Storage name"))
|
||||
@@ -48,7 +45,7 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsFileExtension(
|
||||
"action, but it will be slower.\nIf you use this action, do not "
|
||||
"forget to unload the storage from memory."),
|
||||
_("Load storage _PARAM0_ in memory"),
|
||||
"",
|
||||
_("Storage"),
|
||||
"res/actions/fichier24.png",
|
||||
"res/actions/fichier.png")
|
||||
.AddParameter("string", _("Storage name"))
|
||||
@@ -60,7 +57,7 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsFileExtension(
|
||||
_("This action closes the structured data previously loaded "
|
||||
"in memory, saving all changes made."),
|
||||
_("Close structured data _PARAM0_"),
|
||||
"",
|
||||
_("Storage"),
|
||||
"res/actions/fichier24.png",
|
||||
"res/actions/fichier.png")
|
||||
.AddParameter("string", _("Storage name"))
|
||||
@@ -75,7 +72,7 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsFileExtension(
|
||||
"element using / (example : Root/Level/Current)\nSpaces are "
|
||||
"forbidden in element names."),
|
||||
_("Write _PARAM2_ in _PARAM1_ of storage _PARAM0_"),
|
||||
"",
|
||||
_("Storage"),
|
||||
"res/actions/fichier24.png",
|
||||
"res/actions/fichier.png")
|
||||
.AddParameter("string", _("Storage name"))
|
||||
@@ -91,7 +88,7 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsFileExtension(
|
||||
"the structure leading to the element using / (example : "
|
||||
"Root/Level/Current)\nSpaces are forbidden in element names."),
|
||||
_("Write _PARAM2_ in _PARAM1_ of storage _PARAM0_"),
|
||||
"",
|
||||
_("Storage"),
|
||||
"res/actions/fichier24.png",
|
||||
"res/actions/fichier.png")
|
||||
.AddParameter("string", _("Storage name"))
|
||||
@@ -108,7 +105,7 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsFileExtension(
|
||||
"(example : Root/Level/Current)\nSpaces are forbidden in element "
|
||||
"names."),
|
||||
_("Read _PARAM1_ from storage _PARAM0_ and store value in _PARAM3_"),
|
||||
"",
|
||||
_("Storage"),
|
||||
"res/actions/fichier24.png",
|
||||
"res/actions/fichier.png")
|
||||
.AddParameter("string", _("Storage name"))
|
||||
@@ -127,7 +124,7 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsFileExtension(
|
||||
"names."),
|
||||
_("Read _PARAM1_ from storage _PARAM0_ and store as text in "
|
||||
"_PARAM3_"),
|
||||
"",
|
||||
_("Storage"),
|
||||
"res/actions/fichier24.png",
|
||||
"res/actions/fichier.png")
|
||||
.AddParameter("string", _("Storage name"))
|
||||
@@ -143,7 +140,7 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsFileExtension(
|
||||
"element using / (example : Root/Level/Current)\nSpaces are "
|
||||
"forbidden in element names."),
|
||||
_("Delete _PARAM1_ from storage _PARAM0_"),
|
||||
"",
|
||||
_("Storage"),
|
||||
"res/actions/delete24.png",
|
||||
"res/actions/delete.png")
|
||||
.AddParameter("string", _("Storage name"))
|
||||
@@ -156,7 +153,7 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsFileExtension(
|
||||
_("Clear a storage"),
|
||||
_("Clear the specified storage, removing all data saved in it."),
|
||||
_("Delete storage _PARAM0_"),
|
||||
"",
|
||||
_("Storage"),
|
||||
"res/actions/delete24.png",
|
||||
"res/actions/delete.png")
|
||||
.AddParameter("string", _("Storage name"));
|
||||
@@ -166,18 +163,32 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsFileExtension(
|
||||
_("A storage exists"),
|
||||
_("Test if the specified storage exists."),
|
||||
_("Storage _PARAM0_ exists"),
|
||||
"",
|
||||
_("Storage"),
|
||||
"res/conditions/fichier24.png",
|
||||
"res/conditions/fichier.png")
|
||||
.AddParameter("string", _("Storage name"))
|
||||
.MarkAsAdvanced();
|
||||
|
||||
extension
|
||||
.AddAction("LaunchFile",
|
||||
_("Open a URL or a file"),
|
||||
_("This action launches the specified file or URL, in a "
|
||||
"browser (or in a new tab if the game is using the Web "
|
||||
"platform and is launched inside a browser)."),
|
||||
_("Open URL (or file) _PARAM0_"),
|
||||
_("Files"),
|
||||
"res/actions/launchFile24.png",
|
||||
"res/actions/launchFile.png")
|
||||
.AddParameter("string", _("URL (or filename)"))
|
||||
.AddCodeOnlyParameter("currentScene", "")
|
||||
.MarkAsAdvanced();
|
||||
|
||||
extension
|
||||
.AddAction("ExecuteCmd",
|
||||
_("Execute a command"),
|
||||
_("This action executes the specified command."),
|
||||
_("Execute _PARAM0_"),
|
||||
_("Network"),
|
||||
_("Files"),
|
||||
"res/actions/launchFile24.png",
|
||||
"res/actions/launchFile.png")
|
||||
.AddParameter("string", _("Command"))
|
||||
|
@@ -14,24 +14,21 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsKeyboardExtension(
|
||||
extension
|
||||
.SetExtensionInformation(
|
||||
"BuiltinKeyboard",
|
||||
_("Keyboard"),
|
||||
_("Keyboard features"),
|
||||
_("Allows your game to respond to keyboard input. Note that this "
|
||||
"does not work with on-screen keyboard on touch devices: use "
|
||||
"instead conditions related to touch when making a game for "
|
||||
"mobile/touchscreen devices."),
|
||||
"Florian Rival",
|
||||
"Open source (MIT License)")
|
||||
.SetExtensionHelpPath("/all-features/keyboard")
|
||||
.SetCategory("Input");
|
||||
extension.AddInstructionOrExpressionGroupMetadata(_("Keyboard"))
|
||||
.SetIcon("res/conditions/keyboard24.png");
|
||||
.SetExtensionHelpPath("/all-features/keyboard");
|
||||
|
||||
extension
|
||||
.AddCondition("KeyPressed",
|
||||
_("Key pressed"),
|
||||
_("Check if a key is pressed"),
|
||||
_("_PARAM1_ key is pressed"),
|
||||
"",
|
||||
_("Keyboard"),
|
||||
"res/conditions/keyboard24.png",
|
||||
"res/conditions/keyboard.png")
|
||||
.AddCodeOnlyParameter("currentScene", "")
|
||||
@@ -42,7 +39,7 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsKeyboardExtension(
|
||||
_("Key released"),
|
||||
_("Check if a key was just released"),
|
||||
_("_PARAM1_ key is released"),
|
||||
"",
|
||||
_("Keyboard"),
|
||||
"res/conditions/keyboard24.png",
|
||||
"res/conditions/keyboard.png")
|
||||
.AddCodeOnlyParameter("currentScene", "")
|
||||
@@ -54,7 +51,7 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsKeyboardExtension(
|
||||
_("Check if a key, retrieved from the result of the "
|
||||
"expression, is pressed"),
|
||||
_("_PARAM1_ key is pressed"),
|
||||
"",
|
||||
_("Keyboard"),
|
||||
"res/conditions/keyboard24.png",
|
||||
"res/conditions/keyboard.png")
|
||||
.AddCodeOnlyParameter("currentScene", "")
|
||||
@@ -67,7 +64,7 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsKeyboardExtension(
|
||||
_("Check if a key, retrieved from the result of the "
|
||||
"expression, was just released"),
|
||||
_("_PARAM1_ key is released"),
|
||||
"",
|
||||
_("Keyboard"),
|
||||
"res/conditions/keyboard24.png",
|
||||
"res/conditions/keyboard.png")
|
||||
.AddCodeOnlyParameter("currentScene", "")
|
||||
@@ -79,7 +76,7 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsKeyboardExtension(
|
||||
_("Any key pressed"),
|
||||
_("Check if any key is pressed"),
|
||||
_("Any key is pressed"),
|
||||
"",
|
||||
_("Keyboard"),
|
||||
"res/conditions/keyboard24.png",
|
||||
"res/conditions/keyboard.png")
|
||||
.AddCodeOnlyParameter("currentScene", "");
|
||||
@@ -89,7 +86,7 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsKeyboardExtension(
|
||||
_("Any key released"),
|
||||
_("Check if any key is released"),
|
||||
_("Any key is released"),
|
||||
"",
|
||||
_("Keyboard"),
|
||||
"res/conditions/keyboard24.png",
|
||||
"res/conditions/keyboard.png")
|
||||
.AddCodeOnlyParameter("currentScene", "");
|
||||
@@ -99,7 +96,7 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsKeyboardExtension(
|
||||
"LastPressedKey",
|
||||
_("Last pressed key"),
|
||||
_("Get the name of the latest key pressed on the keyboard"),
|
||||
"",
|
||||
_("Keyboard"),
|
||||
"res/conditions/keyboard.png")
|
||||
.AddCodeOnlyParameter("currentScene", "");
|
||||
}
|
||||
|
@@ -18,63 +18,13 @@ BuiltinExtensionsImplementer::ImplementsMathematicalToolsExtension(
|
||||
"A set of mathematical functions that can be used in expressions.",
|
||||
"Florian Rival",
|
||||
"Open source (MIT License)");
|
||||
extension.AddInstructionOrExpressionGroupMetadata(_("Mathematical tools"))
|
||||
.SetIcon("res/mathfunction.png");
|
||||
|
||||
extension
|
||||
.AddExpression("Random",
|
||||
_("Random integer"),
|
||||
_("Random integer"),
|
||||
"",
|
||||
"res/dice-6.svg")
|
||||
.SetHelpPath("/all-features/expressions")
|
||||
.AddParameter("expression", _("Maximum value"));
|
||||
|
||||
extension
|
||||
.AddExpression("RandomInRange",
|
||||
_("Random integer in range"),
|
||||
_("Random integer in range"),
|
||||
"",
|
||||
"res/dice-6.svg")
|
||||
.SetHelpPath("/all-features/expressions")
|
||||
.AddParameter("expression", _("Minimum value"))
|
||||
.AddParameter("expression", _("Maximum value"));
|
||||
|
||||
extension
|
||||
.AddExpression("RandomFloat",
|
||||
_("Random float"),
|
||||
_("Random float"),
|
||||
"",
|
||||
"res/dice-6.svg")
|
||||
.SetHelpPath("/all-features/expressions")
|
||||
.AddParameter("expression", _("Maximum value"));
|
||||
|
||||
extension
|
||||
.AddExpression("RandomFloatInRange",
|
||||
_("Random float in range"),
|
||||
_("Random float in range"),
|
||||
"",
|
||||
"res/dice-6.svg")
|
||||
.SetHelpPath("/all-features/expressions")
|
||||
.AddParameter("expression", _("Minimum value"))
|
||||
.AddParameter("expression", _("Maximum value"));
|
||||
|
||||
extension
|
||||
.AddExpression("RandomWithStep",
|
||||
_("Random value in steps"),
|
||||
_("Random value in steps"),
|
||||
"",
|
||||
"res/dice-6.svg")
|
||||
.SetHelpPath("/all-features/expressions")
|
||||
.AddParameter("expression", _("Minimum value"))
|
||||
.AddParameter("expression", _("Maximum value"))
|
||||
.AddParameter("expression", _("Step"));
|
||||
|
||||
extension
|
||||
.AddExpression("normalize",
|
||||
_("Normalize a value between `min` and `max` to a value between 0 and 1."),
|
||||
_("Remap a value between 0 and 1."),
|
||||
"",
|
||||
_("Mathematical tools"),
|
||||
"res/mathfunction.png")
|
||||
.AddParameter("expression", _("Value"))
|
||||
.AddParameter("expression", _("Min"))
|
||||
@@ -84,7 +34,7 @@ BuiltinExtensionsImplementer::ImplementsMathematicalToolsExtension(
|
||||
.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"))
|
||||
@@ -94,7 +44,7 @@ BuiltinExtensionsImplementer::ImplementsMathematicalToolsExtension(
|
||||
.AddExpression("AngleDifference",
|
||||
_("Difference between two angles"),
|
||||
_("Difference between two angles"),
|
||||
"",
|
||||
_("Mathematical tools"),
|
||||
"res/mathfunction.png")
|
||||
.AddParameter("expression", _("First angle"))
|
||||
.AddParameter("expression", _("Second angle"));
|
||||
@@ -103,7 +53,7 @@ BuiltinExtensionsImplementer::ImplementsMathematicalToolsExtension(
|
||||
.AddExpression("AngleBetweenPositions",
|
||||
_("Angle between two positions"),
|
||||
_("Compute the angle between two positions."),
|
||||
"",
|
||||
_("Mathematical tools"),
|
||||
"res/mathfunction.png")
|
||||
.AddParameter("expression", _("First point X position"))
|
||||
.AddParameter("expression", _("First point Y position"))
|
||||
@@ -114,7 +64,7 @@ BuiltinExtensionsImplementer::ImplementsMathematicalToolsExtension(
|
||||
.AddExpression("DistanceBetweenPositions",
|
||||
_("Distance between two positions"),
|
||||
_("Compute the distance between two positions."),
|
||||
"",
|
||||
_("Mathematical tools"),
|
||||
"res/mathfunction.png")
|
||||
.AddParameter("expression", _("First point X position"))
|
||||
.AddParameter("expression", _("First point Y position"))
|
||||
@@ -125,7 +75,7 @@ BuiltinExtensionsImplementer::ImplementsMathematicalToolsExtension(
|
||||
.AddExpression("mod",
|
||||
_("Modulo"),
|
||||
_("x mod y"),
|
||||
"",
|
||||
_("Mathematical tools"),
|
||||
"res/mathfunction.png")
|
||||
.AddParameter("expression", _("x (as in x mod y)"))
|
||||
.AddParameter("expression", _("y (as in x mod y)"));
|
||||
@@ -134,7 +84,7 @@ BuiltinExtensionsImplementer::ImplementsMathematicalToolsExtension(
|
||||
.AddExpression("min",
|
||||
_("Minimum of two numbers"),
|
||||
_("Minimum of two numbers"),
|
||||
"",
|
||||
_("Mathematical tools"),
|
||||
"res/mathfunction.png")
|
||||
.AddParameter("expression", _("First expression"))
|
||||
.AddParameter("expression", _("Second expression"));
|
||||
@@ -143,7 +93,7 @@ BuiltinExtensionsImplementer::ImplementsMathematicalToolsExtension(
|
||||
.AddExpression("max",
|
||||
_("Maximum of two numbers"),
|
||||
_("Maximum of two numbers"),
|
||||
"",
|
||||
_("Mathematical tools"),
|
||||
"res/mathfunction.png")
|
||||
.AddParameter("expression", _("First expression"))
|
||||
.AddParameter("expression", _("Second expression"));
|
||||
@@ -152,7 +102,7 @@ BuiltinExtensionsImplementer::ImplementsMathematicalToolsExtension(
|
||||
.AddExpression("abs",
|
||||
_("Absolute value"),
|
||||
_("Absolute value"),
|
||||
"",
|
||||
_("Mathematical tools"),
|
||||
"res/mathfunction.png")
|
||||
.AddParameter("expression", _("Expression"));
|
||||
|
||||
@@ -160,7 +110,7 @@ BuiltinExtensionsImplementer::ImplementsMathematicalToolsExtension(
|
||||
.AddExpression("acos",
|
||||
_("Arccosine"),
|
||||
_("Arccosine"),
|
||||
"",
|
||||
_("Mathematical tools"),
|
||||
"res/mathfunction.png")
|
||||
.AddParameter("expression", _("Expression"));
|
||||
|
||||
@@ -168,7 +118,7 @@ BuiltinExtensionsImplementer::ImplementsMathematicalToolsExtension(
|
||||
.AddExpression("acosh",
|
||||
_("Hyperbolic arccosine"),
|
||||
_("Hyperbolic arccosine"),
|
||||
"",
|
||||
_("Mathematical tools"),
|
||||
"res/mathfunction.png")
|
||||
.AddParameter("expression", _("Expression"));
|
||||
|
||||
@@ -176,7 +126,7 @@ BuiltinExtensionsImplementer::ImplementsMathematicalToolsExtension(
|
||||
.AddExpression("asin",
|
||||
_("Arcsine"),
|
||||
_("Arcsine"),
|
||||
"",
|
||||
_("Mathematical tools"),
|
||||
"res/mathfunction.png")
|
||||
.AddParameter("expression", _("Expression"));
|
||||
|
||||
@@ -184,7 +134,7 @@ BuiltinExtensionsImplementer::ImplementsMathematicalToolsExtension(
|
||||
.AddExpression("asinh",
|
||||
_("Arcsine"),
|
||||
_("Arcsine"),
|
||||
"",
|
||||
_("Mathematical tools"),
|
||||
"res/mathfunction.png")
|
||||
.AddParameter("expression", _("Expression"));
|
||||
|
||||
@@ -192,7 +142,7 @@ BuiltinExtensionsImplementer::ImplementsMathematicalToolsExtension(
|
||||
.AddExpression("atan",
|
||||
_("Arctangent"),
|
||||
_("Arctangent"),
|
||||
"",
|
||||
_("Mathematical tools"),
|
||||
"res/mathfunction.png")
|
||||
.AddParameter("expression", _("Expression"));
|
||||
|
||||
@@ -200,7 +150,7 @@ BuiltinExtensionsImplementer::ImplementsMathematicalToolsExtension(
|
||||
.AddExpression("atan2",
|
||||
_("2 argument arctangent"),
|
||||
_("2 argument arctangent (atan2)"),
|
||||
"",
|
||||
_("Mathematical tools"),
|
||||
"res/mathfunction.png")
|
||||
.AddParameter("expression", _("Y"))
|
||||
.AddParameter("expression", _("X"));
|
||||
@@ -209,7 +159,7 @@ BuiltinExtensionsImplementer::ImplementsMathematicalToolsExtension(
|
||||
.AddExpression("atanh",
|
||||
_("Hyperbolic arctangent"),
|
||||
_("Hyperbolic arctangent"),
|
||||
"",
|
||||
_("Mathematical tools"),
|
||||
"res/mathfunction.png")
|
||||
.AddParameter("expression", _("Expression"));
|
||||
|
||||
@@ -217,7 +167,7 @@ BuiltinExtensionsImplementer::ImplementsMathematicalToolsExtension(
|
||||
.AddExpression("cbrt",
|
||||
_("Cube root"),
|
||||
_("Cube root"),
|
||||
"",
|
||||
_("Mathematical tools"),
|
||||
"res/mathfunction.png")
|
||||
.AddParameter("expression", _("Expression"));
|
||||
|
||||
@@ -225,41 +175,23 @@ BuiltinExtensionsImplementer::ImplementsMathematicalToolsExtension(
|
||||
.AddExpression("ceil",
|
||||
_("Ceil (round up)"),
|
||||
_("Round number up to an integer"),
|
||||
"",
|
||||
_("Mathematical tools"),
|
||||
"res/mathfunction.png")
|
||||
.AddParameter("expression", _("Expression"));
|
||||
|
||||
extension
|
||||
.AddExpression("ceilTo",
|
||||
_("Ceil (round up) to a decimal point"),
|
||||
_("Round number up to the Nth decimal place"),
|
||||
"",
|
||||
"res/mathfunction.png")
|
||||
.AddParameter("expression", _("Expression"))
|
||||
.AddParameter("expression", _("Expression"), "", true);
|
||||
|
||||
extension
|
||||
.AddExpression("floor",
|
||||
_("Floor (round down)"),
|
||||
_("Round number down to an integer"),
|
||||
"",
|
||||
_("Mathematical tools"),
|
||||
"res/mathfunction.png")
|
||||
.AddParameter("expression", _("Expression"));
|
||||
|
||||
extension
|
||||
.AddExpression("floorTo",
|
||||
_("Floor (round down) to a decimal point"),
|
||||
_("Round number down to the Nth decimal place"),
|
||||
"",
|
||||
"res/mathfunction.png")
|
||||
.AddParameter("expression", _("Expression"))
|
||||
.AddParameter("expression", _("Expression"), "", true);
|
||||
|
||||
extension
|
||||
.AddExpression("cos",
|
||||
_("Cosine"),
|
||||
_("Cosine of a number"),
|
||||
"",
|
||||
_("Mathematical tools"),
|
||||
"res/mathfunction.png")
|
||||
.AddParameter("expression", _("Expression"));
|
||||
|
||||
@@ -267,7 +199,7 @@ BuiltinExtensionsImplementer::ImplementsMathematicalToolsExtension(
|
||||
.AddExpression("cosh",
|
||||
_("Hyperbolic cosine"),
|
||||
_("Hyperbolic cosine"),
|
||||
"",
|
||||
_("Mathematical tools"),
|
||||
"res/mathfunction.png")
|
||||
.AddParameter("expression", _("Expression"));
|
||||
|
||||
@@ -275,7 +207,7 @@ BuiltinExtensionsImplementer::ImplementsMathematicalToolsExtension(
|
||||
.AddExpression("cot",
|
||||
_("Cotangent"),
|
||||
_("Cotangent of a number"),
|
||||
"",
|
||||
_("Mathematical tools"),
|
||||
"res/mathfunction.png")
|
||||
.AddParameter("expression", _("Expression"));
|
||||
|
||||
@@ -283,7 +215,7 @@ BuiltinExtensionsImplementer::ImplementsMathematicalToolsExtension(
|
||||
.AddExpression("csc",
|
||||
_("Cosecant"),
|
||||
_("Cosecant of a number"),
|
||||
"",
|
||||
_("Mathematical tools"),
|
||||
"res/mathfunction.png")
|
||||
.AddParameter("expression", _("Expression"));
|
||||
|
||||
@@ -291,7 +223,7 @@ BuiltinExtensionsImplementer::ImplementsMathematicalToolsExtension(
|
||||
.AddExpression("int",
|
||||
_("Round"),
|
||||
_("Round a number"),
|
||||
"",
|
||||
_("Mathematical tools"),
|
||||
"res/mathfunction.png")
|
||||
.SetHidden()
|
||||
.AddParameter("expression", _("Expression"));
|
||||
@@ -300,7 +232,7 @@ BuiltinExtensionsImplementer::ImplementsMathematicalToolsExtension(
|
||||
.AddExpression("rint",
|
||||
_("Round"),
|
||||
_("Round a number"),
|
||||
"",
|
||||
_("Mathematical tools"),
|
||||
"res/mathfunction.png")
|
||||
.SetHidden()
|
||||
.AddParameter("expression", _("Expression"));
|
||||
@@ -309,24 +241,15 @@ BuiltinExtensionsImplementer::ImplementsMathematicalToolsExtension(
|
||||
.AddExpression("round",
|
||||
_("Round"),
|
||||
_("Round a number"),
|
||||
"",
|
||||
_("Mathematical tools"),
|
||||
"res/mathfunction.png")
|
||||
.AddParameter("expression", _("Expression"));
|
||||
|
||||
extension
|
||||
.AddExpression("roundTo",
|
||||
_("Round to a decimal point"),
|
||||
_("Round a number to the Nth decimal place"),
|
||||
"",
|
||||
"res/mathfunction.png")
|
||||
.AddParameter("expression", _("Expression"))
|
||||
.AddParameter("expression", _("Expression"), "", true);
|
||||
|
||||
extension
|
||||
.AddExpression("exp",
|
||||
_("Exponential"),
|
||||
_("Exponential of a number"),
|
||||
"",
|
||||
_("Mathematical tools"),
|
||||
"res/mathfunction.png")
|
||||
.AddParameter("expression", _("Expression"));
|
||||
|
||||
@@ -334,7 +257,7 @@ BuiltinExtensionsImplementer::ImplementsMathematicalToolsExtension(
|
||||
.AddExpression("log",
|
||||
_("Logarithm"),
|
||||
_("Logarithm"),
|
||||
"",
|
||||
_("Mathematical tools"),
|
||||
"res/mathfunction.png")
|
||||
.AddParameter("expression", _("Expression"));
|
||||
|
||||
@@ -342,7 +265,7 @@ BuiltinExtensionsImplementer::ImplementsMathematicalToolsExtension(
|
||||
.AddExpression("ln",
|
||||
_("Logarithm"),
|
||||
_("Logarithm"),
|
||||
"",
|
||||
_("Mathematical tools"),
|
||||
"res/mathfunction.png")
|
||||
.SetHidden()
|
||||
.AddParameter("expression", _("Expression"));
|
||||
@@ -351,7 +274,7 @@ BuiltinExtensionsImplementer::ImplementsMathematicalToolsExtension(
|
||||
.AddExpression("log2",
|
||||
_("Base-2 logarithm"),
|
||||
_("Base 2 Logarithm"),
|
||||
"",
|
||||
_("Mathematical tools"),
|
||||
"res/mathfunction.png")
|
||||
.AddParameter("expression", _("Expression"));
|
||||
|
||||
@@ -359,7 +282,7 @@ BuiltinExtensionsImplementer::ImplementsMathematicalToolsExtension(
|
||||
.AddExpression("log10",
|
||||
_("Base-10 logarithm"),
|
||||
_("Base-10 logarithm"),
|
||||
"",
|
||||
_("Mathematical tools"),
|
||||
"res/mathfunction.png")
|
||||
.AddParameter("expression", _("Expression"));
|
||||
|
||||
@@ -367,7 +290,7 @@ BuiltinExtensionsImplementer::ImplementsMathematicalToolsExtension(
|
||||
.AddExpression("nthroot",
|
||||
_("Nth root"),
|
||||
_("Nth root of a number"),
|
||||
"",
|
||||
_("Mathematical tools"),
|
||||
"res/mathfunction.png")
|
||||
.AddParameter("expression", _("Number"))
|
||||
.AddParameter("expression", _("N"));
|
||||
@@ -376,7 +299,7 @@ BuiltinExtensionsImplementer::ImplementsMathematicalToolsExtension(
|
||||
.AddExpression("pow",
|
||||
_("Power"),
|
||||
_("Raise a number to power n"),
|
||||
"",
|
||||
_("Mathematical tools"),
|
||||
"res/mathfunction.png")
|
||||
.AddParameter("expression", _("Number"))
|
||||
.AddParameter("expression", _("The exponent (n in x^n)"));
|
||||
@@ -385,7 +308,7 @@ BuiltinExtensionsImplementer::ImplementsMathematicalToolsExtension(
|
||||
.AddExpression("sec",
|
||||
_("Secant"),
|
||||
_("Secant"),
|
||||
"",
|
||||
_("Mathematical tools"),
|
||||
"res/mathfunction.png")
|
||||
.AddParameter("expression", _("Expression"));
|
||||
|
||||
@@ -393,7 +316,7 @@ BuiltinExtensionsImplementer::ImplementsMathematicalToolsExtension(
|
||||
.AddExpression("sign",
|
||||
_("Sign of a number"),
|
||||
_("Return the sign of a number (1,-1 or 0)"),
|
||||
"",
|
||||
_("Mathematical tools"),
|
||||
"res/mathfunction.png")
|
||||
.AddParameter("expression", _("Expression"));
|
||||
|
||||
@@ -401,7 +324,7 @@ BuiltinExtensionsImplementer::ImplementsMathematicalToolsExtension(
|
||||
.AddExpression("sin",
|
||||
_("Sine"),
|
||||
_("Sine of a number"),
|
||||
"",
|
||||
_("Mathematical tools"),
|
||||
"res/mathfunction.png")
|
||||
.AddParameter("expression", _("Expression"));
|
||||
|
||||
@@ -409,7 +332,7 @@ BuiltinExtensionsImplementer::ImplementsMathematicalToolsExtension(
|
||||
.AddExpression("sinh",
|
||||
_("Hyperbolic sine"),
|
||||
_("Hyperbolic sine"),
|
||||
"",
|
||||
_("Mathematical tools"),
|
||||
"res/mathfunction.png")
|
||||
.AddParameter("expression", _("Expression"));
|
||||
|
||||
@@ -417,7 +340,7 @@ BuiltinExtensionsImplementer::ImplementsMathematicalToolsExtension(
|
||||
.AddExpression("sqrt",
|
||||
_("Square root"),
|
||||
_("Square root of a number"),
|
||||
"",
|
||||
_("Mathematical tools"),
|
||||
"res/mathfunction.png")
|
||||
.AddParameter("expression", _("Expression"));
|
||||
|
||||
@@ -425,7 +348,7 @@ BuiltinExtensionsImplementer::ImplementsMathematicalToolsExtension(
|
||||
.AddExpression("tan",
|
||||
_("Tangent"),
|
||||
_("Tangent of a number"),
|
||||
"",
|
||||
_("Mathematical tools"),
|
||||
"res/mathfunction.png")
|
||||
.AddParameter("expression", _("Expression"));
|
||||
|
||||
@@ -433,7 +356,7 @@ BuiltinExtensionsImplementer::ImplementsMathematicalToolsExtension(
|
||||
.AddExpression("tanh",
|
||||
_("Hyperbolic tangent"),
|
||||
_("Hyperbolic tangent"),
|
||||
"",
|
||||
_("Mathematical tools"),
|
||||
"res/mathfunction.png")
|
||||
.AddParameter("expression", _("Expression"));
|
||||
|
||||
@@ -441,7 +364,7 @@ BuiltinExtensionsImplementer::ImplementsMathematicalToolsExtension(
|
||||
.AddExpression("trunc",
|
||||
_("Truncation"),
|
||||
_("Truncate a number"),
|
||||
"",
|
||||
_("Mathematical tools"),
|
||||
"res/mathfunction.png")
|
||||
.AddParameter("expression", _("Expression"));
|
||||
|
||||
@@ -449,7 +372,7 @@ BuiltinExtensionsImplementer::ImplementsMathematicalToolsExtension(
|
||||
.AddExpression("lerp",
|
||||
_("Lerp (Linear interpolation)"),
|
||||
_("Linearly interpolate a to b by x"),
|
||||
"",
|
||||
_("Mathematical tools"),
|
||||
"res/mathfunction.png")
|
||||
.AddParameter("expression", _("a (in a+(b-a)*x)"))
|
||||
.AddParameter("expression", _("b (in a+(b-a)*x)"))
|
||||
@@ -462,7 +385,7 @@ BuiltinExtensionsImplementer::ImplementsMathematicalToolsExtension(
|
||||
"relative to the origin (0;0). This is also known as "
|
||||
"getting the cartesian coordinates of a 2D vector, using "
|
||||
"its polar coordinates."),
|
||||
"",
|
||||
_("Mathematical tools"),
|
||||
"res/mathfunction.png")
|
||||
.AddParameter("expression", _("Angle, in degrees"))
|
||||
.AddParameter("expression", _("Distance"));
|
||||
@@ -474,7 +397,7 @@ BuiltinExtensionsImplementer::ImplementsMathematicalToolsExtension(
|
||||
"relative to the origin (0;0). This is also known as "
|
||||
"getting the cartesian coordinates of a 2D vector, using "
|
||||
"its polar coordinates."),
|
||||
"",
|
||||
_("Mathematical tools"),
|
||||
"res/mathfunction.png")
|
||||
.AddParameter("expression", _("Angle, in degrees"))
|
||||
.AddParameter("expression", _("Distance"));
|
||||
|
@@ -23,10 +23,7 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsMouseExtension(
|
||||
"separately in different events.",
|
||||
"Florian Rival",
|
||||
"Open source (MIT License)")
|
||||
.SetExtensionHelpPath("/all-features/mouse-touch")
|
||||
.SetCategory("Input");
|
||||
extension.AddInstructionOrExpressionGroupMetadata(_("Mouse and touch"))
|
||||
.SetIcon("res/actions/mouse24.png");
|
||||
.SetExtensionHelpPath("/all-features/mouse-touch");
|
||||
|
||||
extension
|
||||
.AddCondition(
|
||||
@@ -35,7 +32,7 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsMouseExtension(
|
||||
_("Check if the mouse wheel is scrolling up. Use MouseWheelDelta "
|
||||
"expression if you want to know the amount that was scrolled."),
|
||||
_("The mouse wheel is scrolling up"),
|
||||
"",
|
||||
_("Mouse and touch"),
|
||||
"res/actions/mouse24.png",
|
||||
"res/actions/mouse.png")
|
||||
|
||||
@@ -49,7 +46,7 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsMouseExtension(
|
||||
_("Check if the mouse wheel is scrolling down. Use MouseWheelDelta "
|
||||
"expression if you want to know the amount that was scrolled."),
|
||||
_("The mouse wheel is scrolling down"),
|
||||
"",
|
||||
_("Mouse and touch"),
|
||||
"res/actions/mouse24.png",
|
||||
"res/actions/mouse.png")
|
||||
|
||||
@@ -67,7 +64,7 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsMouseExtension(
|
||||
"touchscreens. If you want to have multitouch and differentiate "
|
||||
"mouse movement and touches, just deactivate it with this action."),
|
||||
_("Move mouse cursor when touching screen: _PARAM1_"),
|
||||
"",
|
||||
_("Mouse and touch"),
|
||||
"res/conditions/touch24.png",
|
||||
"res/conditions/touch.png")
|
||||
|
||||
@@ -82,7 +79,7 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsMouseExtension(
|
||||
_("Center cursor horizontally"),
|
||||
_("Put the cursor in the middle of the screen horizontally."),
|
||||
_("Center cursor horizontally"),
|
||||
"",
|
||||
_("Mouse and touch"),
|
||||
"res/actions/mouse24.png",
|
||||
"res/actions/mouse.png")
|
||||
|
||||
@@ -94,7 +91,7 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsMouseExtension(
|
||||
_("Center cursor vertically"),
|
||||
_("Put the cursor in the middle of the screen vertically."),
|
||||
_("Center cursor vertically"),
|
||||
"",
|
||||
_("Mouse and touch"),
|
||||
"res/actions/mouse24.png",
|
||||
"res/actions/mouse.png")
|
||||
|
||||
@@ -106,7 +103,7 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsMouseExtension(
|
||||
_("Hide the cursor"),
|
||||
_("Hide the cursor."),
|
||||
_("Hide the cursor"),
|
||||
"",
|
||||
_("Mouse and touch"),
|
||||
"res/actions/mouse24.png",
|
||||
"res/actions/mouse.png")
|
||||
.AddCodeOnlyParameter("currentScene", "")
|
||||
@@ -117,7 +114,7 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsMouseExtension(
|
||||
_("Show the cursor"),
|
||||
_("Show the cursor."),
|
||||
_("Show the cursor"),
|
||||
"",
|
||||
_("Mouse and touch"),
|
||||
"res/actions/mouse24.png",
|
||||
"res/actions/mouse.png")
|
||||
|
||||
@@ -129,7 +126,7 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsMouseExtension(
|
||||
_("Position the cursor of the mouse"),
|
||||
_("Position the cursor at the given coordinates."),
|
||||
_("Position cursor at _PARAM1_;_PARAM2_"),
|
||||
"",
|
||||
_("Mouse and touch"),
|
||||
"res/actions/mouse24.png",
|
||||
"res/actions/mouse.png")
|
||||
|
||||
@@ -143,7 +140,7 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsMouseExtension(
|
||||
_("Center the cursor"),
|
||||
_("Center the cursor on the screen."),
|
||||
_("Center the cursor"),
|
||||
"",
|
||||
_("Mouse and touch"),
|
||||
"res/actions/mouse24.png",
|
||||
"res/actions/mouse.png")
|
||||
|
||||
@@ -157,7 +154,7 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsMouseExtension(
|
||||
_("Cursor X position"),
|
||||
_("the X position of the cursor or of a touch"),
|
||||
_("the cursor (or touch) X position"),
|
||||
"",
|
||||
_("Mouse and touch"),
|
||||
"res/conditions/mouse24.png")
|
||||
.AddCodeOnlyParameter("currentScene", "")
|
||||
.UseStandardParameters("number")
|
||||
@@ -177,7 +174,7 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsMouseExtension(
|
||||
_("Cursor Y position"),
|
||||
_("the Y position of the cursor or of a touch"),
|
||||
_("the cursor (or touch) Y position"),
|
||||
"",
|
||||
_("Mouse and touch"),
|
||||
"res/conditions/mouse24.png")
|
||||
.AddCodeOnlyParameter("currentScene", "")
|
||||
.UseStandardParameters("number")
|
||||
@@ -190,24 +187,13 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsMouseExtension(
|
||||
extension.AddDuplicatedCondition("SourisY", "MouseY").SetHidden();
|
||||
extension.AddDuplicatedExpression("SourisY", "MouseY").SetHidden();
|
||||
|
||||
extension
|
||||
.AddCondition("IsMouseInsideCanvas",
|
||||
_("Mouse cursor is inside the window"),
|
||||
_("Check if the mouse cursor is inside the window."),
|
||||
_("The mouse cursor is inside the window"),
|
||||
"",
|
||||
"res/conditions/mouse24.png",
|
||||
"res/conditions/mouse.png")
|
||||
.AddCodeOnlyParameter("currentScene", "")
|
||||
.MarkAsAdvanced();
|
||||
|
||||
extension
|
||||
.AddCondition("MouseButtonPressed",
|
||||
_("Mouse button pressed or touch held"),
|
||||
_("Check if the specified mouse button is pressed or "
|
||||
"if a touch is in contact with the screen."),
|
||||
_("Touch or _PARAM1_ mouse button is down"),
|
||||
"",
|
||||
_("Mouse and touch"),
|
||||
"res/conditions/mouse24.png",
|
||||
"res/conditions/mouse.png")
|
||||
.AddCodeOnlyParameter("currentScene", "")
|
||||
@@ -223,7 +209,7 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsMouseExtension(
|
||||
_("Mouse button released"),
|
||||
_("Check if the specified mouse button was released."),
|
||||
_("_PARAM1_ mouse button was released"),
|
||||
"",
|
||||
_("Mouse and touch"),
|
||||
"res/conditions/mouse24.png",
|
||||
"res/conditions/mouse.png")
|
||||
.AddCodeOnlyParameter("currentScene", "")
|
||||
@@ -237,13 +223,11 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsMouseExtension(
|
||||
_("Check if a mouse button, retrieved from the result of the "
|
||||
"expression, is pressed."),
|
||||
_("_PARAM1_ mouse button is pressed"),
|
||||
"",
|
||||
_("Mouse and touch"),
|
||||
"res/conditions/mouse24.png",
|
||||
"res/conditions/mouse.png")
|
||||
.AddCodeOnlyParameter("currentScene", "")
|
||||
.AddParameter("stringWithSelector",
|
||||
_("Expression generating the mouse button to check"),
|
||||
"[\"Left\", \"Right\", \"Middle\"]")
|
||||
.AddParameter("string", _("Expression generating the button to check"))
|
||||
.SetParameterLongDescription(
|
||||
_("Possible values are Left, Right and Middle."))
|
||||
.MarkAsAdvanced();
|
||||
@@ -255,13 +239,12 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsMouseExtension(
|
||||
_("Check if a mouse button, retrieved from the result of the "
|
||||
"expression, was just released."),
|
||||
_("_PARAM1_ mouse button is released"),
|
||||
"",
|
||||
_("Mouse and touch"),
|
||||
"res/conditions/mouse24.png",
|
||||
"res/conditions/mouse.png")
|
||||
.AddCodeOnlyParameter("currentScene", "")
|
||||
.AddParameter("stringWithSelector",
|
||||
_("Expression generating the mouse button to check"),
|
||||
"[\"Left\", \"Right\", \"Middle\"]")
|
||||
.AddParameter("string",
|
||||
_("Expression generating the mouse button to check"))
|
||||
.SetParameterLongDescription(
|
||||
_("Possible values are Left, Right and Middle."))
|
||||
.MarkAsAdvanced();
|
||||
@@ -272,7 +255,7 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsMouseExtension(
|
||||
_("Touch X position"),
|
||||
_("the X position of a specific touch"),
|
||||
_("the touch #_PARAM1_ X position"),
|
||||
_("Multitouch"),
|
||||
_("Mouse and touch/Multitouch"),
|
||||
"res/conditions/touch24.png")
|
||||
.AddCodeOnlyParameter("currentScene", "")
|
||||
.AddParameter("expression", _("Touch identifier"))
|
||||
@@ -288,7 +271,7 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsMouseExtension(
|
||||
_("Touch Y position"),
|
||||
_("the Y position of a specific touch"),
|
||||
_("the touch #_PARAM1_ Y position"),
|
||||
_("Multitouch"),
|
||||
_("Mouse and touch/Multitouch"),
|
||||
"res/conditions/touch24.png")
|
||||
.AddCodeOnlyParameter("currentScene", "")
|
||||
.AddParameter("expression", _("Touch identifier"))
|
||||
@@ -308,11 +291,10 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsMouseExtension(
|
||||
"next time you use it, it will be for a new touch, or it will "
|
||||
"return false if no more touches have just started."),
|
||||
_("A new touch has started"),
|
||||
_("Multitouch"),
|
||||
_("Mouse and touch/Multitouch"),
|
||||
"res/conditions/touch24.png",
|
||||
"res/conditions/touch.png")
|
||||
.AddCodeOnlyParameter("currentScene", "")
|
||||
.SetHidden();
|
||||
.AddCodeOnlyParameter("currentScene", "");
|
||||
|
||||
extension
|
||||
.AddCondition(
|
||||
@@ -324,57 +306,11 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsMouseExtension(
|
||||
"time you use it, it will be for a new touch, or it will return "
|
||||
"false if no more touches have just ended."),
|
||||
_("A touch has ended"),
|
||||
_("Multitouch"),
|
||||
"res/conditions/touch24.png",
|
||||
"res/conditions/touch.png")
|
||||
.AddCodeOnlyParameter("currentScene", "")
|
||||
.SetHidden();
|
||||
|
||||
extension
|
||||
.AddCondition(
|
||||
"HasAnyTouchStarted",
|
||||
_("A new touch has started"),
|
||||
_("Check if a touch has just started on this frame. The touch identifiers can be "
|
||||
"accessed using StartedTouchId() and StartedTouchCount()."),
|
||||
_("A new touch has started"),
|
||||
_("Multitouch"),
|
||||
_("Mouse and touch/Multitouch"),
|
||||
"res/conditions/touch24.png",
|
||||
"res/conditions/touch.png")
|
||||
.AddCodeOnlyParameter("currentScene", "");
|
||||
|
||||
extension
|
||||
.AddExpression(
|
||||
"StartedTouchCount",
|
||||
_("Started touch count"),
|
||||
_("The number of touches that have just started on this frame. The touch identifiers can be "
|
||||
"accessed using StartedTouchId()."),
|
||||
_("Multitouch"),
|
||||
"res/conditions/touch.png")
|
||||
.AddCodeOnlyParameter("currentScene", "");
|
||||
|
||||
extension
|
||||
.AddExpression(
|
||||
"StartedTouchId",
|
||||
_("Started touch identifier"),
|
||||
_("The identifier of the touch that has just started on this frame. The touch number of touches can be "
|
||||
"accessed using StartedTouchCount()."),
|
||||
_("Multitouch"),
|
||||
"res/conditions/touch.png")
|
||||
.AddCodeOnlyParameter("currentScene", "")
|
||||
.AddParameter("expression", _("Touch index"));
|
||||
|
||||
extension
|
||||
.AddCondition(
|
||||
"HasTouchEnded",
|
||||
_("A touch has ended"),
|
||||
_("Check if a touch has ended."),
|
||||
_("The touch with identifier _PARAM1_ has ended"),
|
||||
_("Multitouch"),
|
||||
"res/conditions/touch24.png",
|
||||
"res/conditions/touch.png")
|
||||
.AddCodeOnlyParameter("currentScene", "")
|
||||
.AddParameter("expression", _("Touch identifier"));
|
||||
|
||||
extension
|
||||
.AddExpression("MouseWheelDelta",
|
||||
_("Mouse wheel: Displacement"),
|
||||
@@ -387,19 +323,17 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsMouseExtension(
|
||||
.AddExpression("LastTouchId",
|
||||
_("Identifier of the last touch"),
|
||||
_("Identifier of the last touch"),
|
||||
_("Multitouch"),
|
||||
_("Mouse and touch/Multitouch"),
|
||||
"res/conditions/touch.png")
|
||||
.AddCodeOnlyParameter("currentScene", "")
|
||||
.SetHidden();
|
||||
.AddCodeOnlyParameter("currentScene", "");
|
||||
|
||||
extension
|
||||
.AddExpression("LastEndedTouchId",
|
||||
_("Identifier of the last ended touch"),
|
||||
_("Identifier of the last ended touch"),
|
||||
_("Multitouch"),
|
||||
_("Mouse and touch/Multitouch"),
|
||||
"res/conditions/touch.png")
|
||||
.AddCodeOnlyParameter("currentScene", "")
|
||||
.SetHidden();
|
||||
.AddCodeOnlyParameter("currentScene", "");
|
||||
}
|
||||
|
||||
} // namespace gd
|
||||
|
@@ -14,15 +14,12 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsNetworkExtension(
|
||||
extension
|
||||
.SetExtensionInformation(
|
||||
"BuiltinNetwork",
|
||||
_("Network"),
|
||||
_("Basic internet features"),
|
||||
_("Features to send web requests, communicate with external \"APIs\" "
|
||||
"and other network related tasks."),
|
||||
"Florian Rival",
|
||||
"Open source (MIT License)")
|
||||
.SetExtensionHelpPath("/all-features/network")
|
||||
.SetCategory("Network");
|
||||
extension.AddInstructionOrExpressionGroupMetadata(_("Network"))
|
||||
.SetIcon("res/actions/net24.png");
|
||||
.SetExtensionHelpPath("/all-features/network");
|
||||
|
||||
extension
|
||||
.AddAction(
|
||||
@@ -33,7 +30,7 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsNetworkExtension(
|
||||
"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, with protocol")
|
||||
@@ -68,7 +65,7 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsNetworkExtension(
|
||||
"to all requests (cross-domain requests)."),
|
||||
_("Send a _PARAM2_ request to _PARAM0_ with body: _PARAM1_, and "
|
||||
"store the result in _PARAM4_ (or in _PARAM5_ in case of error)"),
|
||||
"",
|
||||
_("Network"),
|
||||
"res/actions/net24.png",
|
||||
"res/actions/net.png")
|
||||
.AddParameter("string", _("URL (API or web-page address)"))
|
||||
@@ -95,37 +92,20 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsNetworkExtension(
|
||||
"explore the results with a *structure variable*."))
|
||||
.AddParameter(
|
||||
"scenevar", _("Variable where to store the error message"), "", true)
|
||||
.SetParameterLongDescription(_(
|
||||
"Optional, only used if an error occurs. This will contain the "
|
||||
"[\"status "
|
||||
"code\"](https://en.wikipedia.org/wiki/List_of_HTTP_status_codes) "
|
||||
"if the server returns a status >= 400. If the request was not sent "
|
||||
"at all (e.g. no internet or CORS issues), the variable will be set "
|
||||
"to "
|
||||
"\"REQUEST_NOT_SENT\"."))
|
||||
.SetParameterLongDescription(
|
||||
_("Optional, only used if an error occurs. This will contain the "
|
||||
"error message (if request could not be sent) or the [\"status "
|
||||
"code\"](https://en.wikipedia.org/wiki/List_of_HTTP_status_codes), "
|
||||
"if the server returns a status >= 400."))
|
||||
.MarkAsComplex();
|
||||
|
||||
extension
|
||||
.AddAction("LaunchFile",
|
||||
_("Open a URL (web page) or a file"),
|
||||
_("This action launches the specified file or URL, in a "
|
||||
"browser (or in a new tab if the game is using the Web "
|
||||
"platform and is launched inside a browser)."),
|
||||
_("Open URL _PARAM0_ in a browser (or new tab)"),
|
||||
"",
|
||||
"res/actions/net24.png",
|
||||
"res/actions/net.png")
|
||||
.AddParameter("string", _("URL (or filename)"))
|
||||
.AddCodeOnlyParameter("currentScene", "")
|
||||
.MarkAsAdvanced();
|
||||
|
||||
extension
|
||||
.AddAction(
|
||||
"DownloadFile",
|
||||
_("Download a file"),
|
||||
_("Download a file from a web site"),
|
||||
_("Download file _PARAM1_ from _PARAM0_ under the name of _PARAM2_"),
|
||||
"",
|
||||
_("Network"),
|
||||
"res/actions/net24.png",
|
||||
"res/actions/net.png")
|
||||
.AddParameter("string", _("Host (for example : http://www.website.com)"))
|
||||
@@ -143,11 +123,78 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsNetworkExtension(
|
||||
"terms of service of your game and if they player gave their "
|
||||
"consent, depending on how your game/company handles this."),
|
||||
_("Enable analytics metrics: _PARAM1_"),
|
||||
"",
|
||||
_("Network"),
|
||||
"res/actions/net24.png",
|
||||
"res/actions/net.png")
|
||||
.AddCodeOnlyParameter("currentScene", "")
|
||||
.AddParameter("yesorno", _("Enable the metrics?"));
|
||||
|
||||
extension
|
||||
.AddAction(
|
||||
"JSONToVariableStructure",
|
||||
_("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",
|
||||
"res/actions/net.png")
|
||||
.AddParameter("string", _("JSON string"))
|
||||
.AddParameter("scenevar", _("Variable where store the JSON object"))
|
||||
.MarkAsAdvanced();
|
||||
|
||||
extension
|
||||
.AddAction("JSONToGlobalVariableStructure",
|
||||
_("Convert JSON to global variable"),
|
||||
_("Parse a JSON object and store it into a global variable"),
|
||||
_("Parse JSON string _PARAM0_ and store it into global "
|
||||
"variable _PARAM1_"),
|
||||
_("Network"),
|
||||
"res/actions/net24.png",
|
||||
"res/actions/net.png")
|
||||
.AddParameter("string", _("JSON string"))
|
||||
.AddParameter("globalvar",
|
||||
_("Global variable where store the JSON object"))
|
||||
.MarkAsAdvanced();
|
||||
|
||||
extension
|
||||
.AddAction("JSONToObjectVariableStructure",
|
||||
_("Convert JSON to object variable"),
|
||||
_("Parse a JSON object and store it into an object variable"),
|
||||
_("Parse JSON string _PARAM0_ and store it into variable "
|
||||
"_PARAM2_ of _PARAM1_"),
|
||||
_("Network"),
|
||||
"res/actions/net24.png",
|
||||
"res/actions/net.png")
|
||||
.AddParameter("string", _("JSON string"))
|
||||
.AddParameter("objectPtr", _("Object"))
|
||||
.AddParameter("objectvar",
|
||||
_("Object variable where store the JSON object"))
|
||||
.MarkAsAdvanced();
|
||||
|
||||
extension
|
||||
.AddStrExpression("ToJSON",
|
||||
_("Convert scene variable to JSON"),
|
||||
_("Convert a scene variable to JSON"),
|
||||
_("Conversion"),
|
||||
"res/conditions/toujours24.png")
|
||||
.AddParameter("scenevar", _("Scene variable to be stringified"));
|
||||
|
||||
extension
|
||||
.AddStrExpression("GlobalVarToJSON",
|
||||
_("Convert global variable to JSON"),
|
||||
_("Convert a global variable to JSON"),
|
||||
_("Conversion"),
|
||||
"res/conditions/toujours24.png")
|
||||
.AddParameter("globalvar", _("The global variable to be stringified"));
|
||||
|
||||
extension
|
||||
.AddStrExpression("ObjectVarToJSON",
|
||||
_("Convert object variable to JSON"),
|
||||
_("Convert an object variable to JSON"),
|
||||
_("Conversion"),
|
||||
"res/conditions/toujours24.png")
|
||||
.AddParameter("objectPtr", _("The object with the variable"))
|
||||
.AddParameter("objectvar", _("The object variable to be stringified"));
|
||||
}
|
||||
|
||||
} // namespace gd
|
||||
|
@@ -14,19 +14,67 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsSceneExtension(
|
||||
extension
|
||||
.SetExtensionInformation(
|
||||
"BuiltinScene",
|
||||
_("Scene"),
|
||||
_("Scene management features"),
|
||||
_("Actions and conditions to manipulate the scenes during the game."),
|
||||
"Florian Rival",
|
||||
"Open source (MIT License)")
|
||||
.SetExtensionHelpPath("" /*TODO: Add a documentation page for this */);
|
||||
extension.AddInstructionOrExpressionGroupMetadata(_("Scene"))
|
||||
.SetIcon("res/conditions/depart24.png");
|
||||
|
||||
|
||||
extension
|
||||
.AddExpression("Random",
|
||||
_("Random integer"),
|
||||
_("Random integer"),
|
||||
_("Random"),
|
||||
"res/actions/position.png")
|
||||
.SetHelpPath("/all-features/expressions")
|
||||
.AddParameter("expression", _("Maximum value"));
|
||||
|
||||
extension
|
||||
.AddExpression("RandomInRange",
|
||||
_("Random integer in range"),
|
||||
_("Random integer in range"),
|
||||
_("Random"),
|
||||
"res/actions/position.png")
|
||||
.SetHelpPath("/all-features/expressions")
|
||||
.AddParameter("expression", _("Minimum value"))
|
||||
.AddParameter("expression", _("Maximum value"));
|
||||
|
||||
extension
|
||||
.AddExpression("RandomFloat",
|
||||
_("Random float"),
|
||||
_("Random float"),
|
||||
_("Random"),
|
||||
"res/actions/position.png")
|
||||
.SetHelpPath("/all-features/expressions")
|
||||
.AddParameter("expression", _("Maximum value"));
|
||||
|
||||
extension
|
||||
.AddExpression("RandomFloatInRange",
|
||||
_("Random float in range"),
|
||||
_("Random float in range"),
|
||||
_("Random"),
|
||||
"res/actions/position.png")
|
||||
.SetHelpPath("/all-features/expressions")
|
||||
.AddParameter("expression", _("Minimum value"))
|
||||
.AddParameter("expression", _("Maximum value"));
|
||||
|
||||
extension
|
||||
.AddExpression("RandomWithStep",
|
||||
_("Random value in steps"),
|
||||
_("Random value in steps"),
|
||||
_("Random"),
|
||||
"res/actions/position.png")
|
||||
.SetHelpPath("/all-features/expressions")
|
||||
.AddParameter("expression", _("Minimum value"))
|
||||
.AddParameter("expression", _("Maximum value"))
|
||||
.AddParameter("expression", _("Step"));
|
||||
|
||||
extension
|
||||
.AddStrExpression("CurrentSceneName",
|
||||
_("Current scene name"),
|
||||
_("Name of the current scene"),
|
||||
"",
|
||||
_("Scene"),
|
||||
"res/actions/texte.png")
|
||||
.AddCodeOnlyParameter("currentScene", "");
|
||||
|
||||
@@ -35,7 +83,7 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsSceneExtension(
|
||||
_("At the beginning of the scene"),
|
||||
_("Is true only when scene just begins."),
|
||||
_("At the beginning of the scene"),
|
||||
"",
|
||||
_("Scene"),
|
||||
"res/conditions/depart24.png",
|
||||
"res/conditions/depart.png")
|
||||
.SetHelpPath("/interface/scene-editor/events")
|
||||
@@ -47,7 +95,7 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsSceneExtension(
|
||||
_("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")
|
||||
@@ -59,7 +107,7 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsSceneExtension(
|
||||
_("Change the scene"),
|
||||
_("Stop this scene and start the specified one instead."),
|
||||
_("Change to scene _PARAM1_"),
|
||||
"",
|
||||
_("Scene"),
|
||||
"res/actions/replaceScene24.png",
|
||||
"res/actions/replaceScene.png")
|
||||
.SetHelpPath("/interface/scene-editor/events")
|
||||
@@ -76,7 +124,7 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsSceneExtension(
|
||||
"can use the \"Stop and go back to previous scene\" action "
|
||||
"to go back to this scene."),
|
||||
_("Pause the scene and start _PARAM1_"),
|
||||
"",
|
||||
_("Scene"),
|
||||
"res/actions/pushScene24.png",
|
||||
"res/actions/pushScene.png")
|
||||
.SetHelpPath("/interface/scene-editor/events")
|
||||
@@ -91,7 +139,7 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsSceneExtension(
|
||||
_("Stop this scene and go back to the previous paused one.\nTo pause "
|
||||
"a scene, use the \"Pause and start a new scene\" action."),
|
||||
_("Stop the scene and go back to the previous paused one"),
|
||||
"",
|
||||
_("Scene"),
|
||||
"res/actions/popScene24.png",
|
||||
"res/actions/popScene.png")
|
||||
.SetHelpPath("/interface/scene-editor/events")
|
||||
@@ -103,7 +151,7 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsSceneExtension(
|
||||
_("Quit the game"),
|
||||
_("Quit the game"),
|
||||
_("Quit the game"),
|
||||
"",
|
||||
_("Scene"),
|
||||
"res/actions/quit24.png",
|
||||
"res/actions/quit.png")
|
||||
.SetHelpPath("/interface/scene-editor/events")
|
||||
@@ -115,7 +163,7 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsSceneExtension(
|
||||
_("Change background color"),
|
||||
_("Change the background color of the scene."),
|
||||
_("Set background color to _PARAM1_"),
|
||||
"",
|
||||
_("Scene"),
|
||||
"res/actions/background24.png",
|
||||
"res/actions/background.png")
|
||||
.SetHelpPath("/interface/scene-editor/events")
|
||||
@@ -129,13 +177,41 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsSceneExtension(
|
||||
_("mouse buttons must be taken "
|
||||
"into account even\nif the window is not active."),
|
||||
_("Disable input when focus is lost: _PARAM1_"),
|
||||
"",
|
||||
_("Scene"),
|
||||
"res/actions/window24.png",
|
||||
"res/actions/window.png")
|
||||
.SetHelpPath("/interface/scene-editor/events")
|
||||
.AddCodeOnlyParameter("currentScene", "")
|
||||
.AddParameter("yesorno", _("Deactivate input when focus is lost"))
|
||||
.MarkAsAdvanced();
|
||||
|
||||
extension
|
||||
.AddCondition("Egal",
|
||||
_("Compare two numbers"),
|
||||
_("Compare the two numbers."),
|
||||
_("_PARAM0_ _PARAM1_ _PARAM2_"),
|
||||
_("Other"),
|
||||
"res/conditions/egal24.png",
|
||||
"res/conditions/egal.png")
|
||||
.SetHelpPath("/all-features/advanced-conditions")
|
||||
.AddParameter("expression", _("First expression"))
|
||||
.AddParameter("relationalOperator", _("Sign of the test"), "number")
|
||||
.AddParameter("expression", _("Second expression"))
|
||||
.MarkAsAdvanced();
|
||||
|
||||
extension
|
||||
.AddCondition("StrEqual",
|
||||
_("Compare two strings"),
|
||||
_("Compare the two strings."),
|
||||
_("_PARAM0_ _PARAM1_ _PARAM2_"),
|
||||
_("Other"),
|
||||
"res/conditions/egal24.png",
|
||||
"res/conditions/egal.png")
|
||||
.SetHelpPath("/all-features/advanced-conditions")
|
||||
.AddParameter("string", _("First string expression"))
|
||||
.AddParameter("relationalOperator", _("Sign of the test"), "string")
|
||||
.AddParameter("string", _("Second string expression"))
|
||||
.MarkAsAdvanced();
|
||||
}
|
||||
|
||||
} // namespace gd
|
||||
|
@@ -121,7 +121,7 @@ void Direction::UnserializeFrom(const gd::SerializerElement& element) {
|
||||
polygonElement.GetChild(k);
|
||||
|
||||
polygon.vertices.push_back(
|
||||
gd::Vector2f(verticeElement.GetDoubleAttribute("x"),
|
||||
sf::Vector2f(verticeElement.GetDoubleAttribute("x"),
|
||||
verticeElement.GetDoubleAttribute("y")));
|
||||
}
|
||||
|
||||
|
@@ -4,7 +4,7 @@
|
||||
* reserved. This project is released under the MIT License.
|
||||
*/
|
||||
#include "Polygon2d.h"
|
||||
#include "GDCore/Vector2.h"
|
||||
#include <SFML/System/Vector2.hpp>
|
||||
#include <cmath>
|
||||
#include <iostream>
|
||||
|
||||
@@ -28,7 +28,7 @@ void Polygon2d::Move(float x, float y) {
|
||||
}
|
||||
|
||||
void Polygon2d::ComputeEdges() const {
|
||||
gd::Vector2f v1, v2;
|
||||
sf::Vector2f v1, v2;
|
||||
edges.clear();
|
||||
|
||||
for (std::size_t i = 0; i < vertices.size(); i++) {
|
||||
@@ -62,8 +62,8 @@ bool Polygon2d::IsConvex() const {
|
||||
return true;
|
||||
}
|
||||
|
||||
gd::Vector2f Polygon2d::ComputeCenter() const {
|
||||
gd::Vector2f center;
|
||||
sf::Vector2f Polygon2d::ComputeCenter() const {
|
||||
sf::Vector2f center;
|
||||
|
||||
for (std::size_t i = 0; i < vertices.size(); i++) {
|
||||
center.x += vertices[i].x;
|
||||
@@ -77,10 +77,10 @@ gd::Vector2f Polygon2d::ComputeCenter() const {
|
||||
|
||||
Polygon2d Polygon2d::CreateRectangle(float width, float height) {
|
||||
Polygon2d rect;
|
||||
rect.vertices.push_back(gd::Vector2f(-width / 2.0f, -height / 2.0f));
|
||||
rect.vertices.push_back(gd::Vector2f(+width / 2.0f, -height / 2.0f));
|
||||
rect.vertices.push_back(gd::Vector2f(+width / 2.0f, +height / 2.0f));
|
||||
rect.vertices.push_back(gd::Vector2f(-width / 2.0f, +height / 2.0f));
|
||||
rect.vertices.push_back(sf::Vector2f(-width / 2.0f, -height / 2.0f));
|
||||
rect.vertices.push_back(sf::Vector2f(+width / 2.0f, -height / 2.0f));
|
||||
rect.vertices.push_back(sf::Vector2f(+width / 2.0f, +height / 2.0f));
|
||||
rect.vertices.push_back(sf::Vector2f(-width / 2.0f, +height / 2.0f));
|
||||
|
||||
return rect;
|
||||
}
|
||||
|
@@ -5,7 +5,7 @@
|
||||
*/
|
||||
#ifndef GDCORE_POLYGON_H
|
||||
#define GDCORE_POLYGON_H
|
||||
#include "GDCore/Vector2.h"
|
||||
#include <SFML/System/Vector2.hpp>
|
||||
#include <vector>
|
||||
|
||||
/**
|
||||
@@ -22,19 +22,19 @@ class GD_CORE_API Polygon2d {
|
||||
Polygon2d(){};
|
||||
virtual ~Polygon2d(){};
|
||||
|
||||
std::vector<gd::Vector2f> vertices; ///< The vertices composing the polygon
|
||||
mutable std::vector<gd::Vector2f>
|
||||
std::vector<sf::Vector2f> vertices; ///< The vertices composing the polygon
|
||||
mutable std::vector<sf::Vector2f>
|
||||
edges; ///< Edges. Can be computed from vertices using ComputeEdges()
|
||||
|
||||
/**
|
||||
* \brief Get the vertices composing the polygon.
|
||||
*/
|
||||
std::vector<gd::Vector2f>& GetVertices() { return vertices; }
|
||||
std::vector<sf::Vector2f>& GetVertices() { return vertices; }
|
||||
|
||||
/**
|
||||
* \brief Get the vertices composing the polygon.
|
||||
*/
|
||||
const std::vector<gd::Vector2f>& GetVertices() const { return vertices; }
|
||||
const std::vector<sf::Vector2f>& GetVertices() const { return vertices; }
|
||||
|
||||
/**
|
||||
* \brief Moves each vertices from the given amount.
|
||||
@@ -68,7 +68,7 @@ class GD_CORE_API Polygon2d {
|
||||
/**
|
||||
* \brief Return the position of the center of the polygon
|
||||
*/
|
||||
gd::Vector2f ComputeCenter() const;
|
||||
sf::Vector2f ComputeCenter() const;
|
||||
|
||||
/** \name Tools
|
||||
* Tool functions
|
||||
|
@@ -4,6 +4,7 @@
|
||||
* reserved. This project is released under the MIT License.
|
||||
*/
|
||||
#include "GDCore/Extensions/Builtin/SpriteExtension/Sprite.h"
|
||||
#include <SFML/Graphics/Sprite.hpp>
|
||||
#include <iostream>
|
||||
#include "GDCore/Extensions/Builtin/SpriteExtension/Polygon2d.h"
|
||||
|
||||
|
@@ -6,6 +6,7 @@
|
||||
|
||||
#ifndef SPRITE_H
|
||||
#define SPRITE_H
|
||||
#include <SFML/Graphics/Sprite.hpp>
|
||||
#include <memory>
|
||||
#include "GDCore/Extensions/Builtin/SpriteExtension/Point.h"
|
||||
#include "GDCore/Extensions/Builtin/SpriteExtension/Polygon2d.h"
|
||||
|
@@ -23,14 +23,11 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsSpriteExtension(
|
||||
"Open source (MIT License)")
|
||||
.SetExtensionHelpPath("/objects/sprite");
|
||||
|
||||
gd::ObjectMetadata& obj =
|
||||
extension
|
||||
.AddObject<SpriteObject>("Sprite",
|
||||
_("Sprite"),
|
||||
_("Animated object which can be used for "
|
||||
"most elements of a game"),
|
||||
"CppPlatform/Extensions/spriteicon.png")
|
||||
.SetCategoryFullName(_("General"));
|
||||
gd::ObjectMetadata& obj = extension.AddObject<SpriteObject>(
|
||||
"Sprite",
|
||||
_("Sprite"),
|
||||
_("Animated object which can be used for most elements of a game"),
|
||||
"CppPlatform/Extensions/spriteicon.png");
|
||||
|
||||
obj.AddAction("Opacity",
|
||||
_("Change sprite opacity"),
|
||||
@@ -81,8 +78,7 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsSpriteExtension(
|
||||
_("Direction"),
|
||||
"res/actions/direction24.png",
|
||||
"res/actions/direction.png")
|
||||
.SetHidden() // Hide as 8 direction is not supported officially in the
|
||||
// interface.
|
||||
.SetHidden() // Hide as 8 direction is not supported officially in the interface.
|
||||
.AddParameter("object", _("Object"), "Sprite")
|
||||
.UseStandardOperatorParameters("number")
|
||||
.MarkAsAdvanced();
|
||||
@@ -199,18 +195,6 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsSpriteExtension(
|
||||
.UseStandardOperatorParameters("number")
|
||||
.MarkAsAdvanced();
|
||||
|
||||
obj.AddCondition("Width",
|
||||
_("Width"),
|
||||
_("Compare the width of a Sprite object."),
|
||||
_("the width"),
|
||||
_("Size"),
|
||||
"res/conditions/scaleWidth24.png",
|
||||
"res/conditions/scaleWidth.png")
|
||||
|
||||
.AddParameter("object", _("Object"), "Sprite")
|
||||
.UseStandardRelationalOperatorParameters("number")
|
||||
.MarkAsAdvanced();
|
||||
|
||||
obj.AddAction("ChangeHeight",
|
||||
_("Height"),
|
||||
_("Change the height of a Sprite object."),
|
||||
@@ -223,31 +207,6 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsSpriteExtension(
|
||||
.UseStandardOperatorParameters("number")
|
||||
.MarkAsAdvanced();
|
||||
|
||||
obj.AddCondition("Height",
|
||||
_("Height"),
|
||||
_("Compare the height of a Sprite object."),
|
||||
_("the height"),
|
||||
_("Size"),
|
||||
"res/conditions/scaleHeight24.png",
|
||||
"res/conditions/scaleHeight.png")
|
||||
|
||||
.AddParameter("object", _("Object"), "Sprite")
|
||||
.UseStandardRelationalOperatorParameters("number")
|
||||
.MarkAsAdvanced();
|
||||
|
||||
obj.AddAction("SetSize",
|
||||
_("Size"),
|
||||
_("Change the size of an object."),
|
||||
_("Change the size of _PARAM0_: set to _PARAM1_x_PARAM2_"),
|
||||
_("Size"),
|
||||
"res/actions/scale24.png",
|
||||
"res/actions/scale.png")
|
||||
|
||||
.AddParameter("object", _("Object"))
|
||||
.AddParameter("expression", _("Width"))
|
||||
.AddParameter("expression", _("Height"))
|
||||
.MarkAsAdvanced();
|
||||
|
||||
obj.AddCondition(
|
||||
"Animation",
|
||||
_("Current animation"),
|
||||
@@ -283,8 +242,7 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsSpriteExtension(
|
||||
_("Direction"),
|
||||
"res/conditions/direction24.png",
|
||||
"res/conditions/direction.png")
|
||||
.SetHidden() // Hide as 8 direction is not supported officially in the
|
||||
// interface.
|
||||
.SetHidden() // Hide as 8 direction is not supported officially in the interface.
|
||||
.AddParameter("object", _("Object"), "Sprite")
|
||||
.UseStandardRelationalOperatorParameters("number");
|
||||
|
||||
@@ -403,7 +361,7 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsSpriteExtension(
|
||||
obj.AddAction("FlipX",
|
||||
_("Flip the object horizontally"),
|
||||
_("Flip the object horizontally"),
|
||||
_("Flip horizontally _PARAM0_: _PARAM1_"),
|
||||
_("Flip horizontally _PARAM0_ : _PARAM1_"),
|
||||
_("Effects"),
|
||||
"res/actions/flipX24.png",
|
||||
"res/actions/flipX.png")
|
||||
@@ -415,7 +373,7 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsSpriteExtension(
|
||||
obj.AddAction("FlipY",
|
||||
_("Flip the object vertically"),
|
||||
_("Flip the object vertically"),
|
||||
_("Flip vertically _PARAM0_: _PARAM1_"),
|
||||
_("Flip vertically _PARAM0_ : _PARAM1_"),
|
||||
_("Effects"),
|
||||
"res/actions/flipY24.png",
|
||||
"res/actions/flipY.png")
|
||||
@@ -506,8 +464,7 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsSpriteExtension(
|
||||
_("Direction of the object"),
|
||||
_("Direction"),
|
||||
"res/actions/direction.png")
|
||||
.SetHidden() // Hide as 8 direction is not supported officially in the
|
||||
// interface.
|
||||
.SetHidden() // Hide as 8 direction is not supported officially in the interface.
|
||||
.AddParameter("object", _("Object"), "Sprite");
|
||||
|
||||
obj.AddExpression("Anim",
|
||||
|
@@ -4,23 +4,23 @@
|
||||
* reserved. This project is released under the MIT License.
|
||||
*/
|
||||
|
||||
#include "GDCore/Extensions/Builtin/SpriteExtension/SpriteObject.h"
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
#include "GDCore/CommonTools.h"
|
||||
#include "GDCore/Extensions/Builtin/SpriteExtension/Animation.h"
|
||||
#include "GDCore/Extensions/Builtin/SpriteExtension/Direction.h"
|
||||
#include "GDCore/Extensions/Builtin/SpriteExtension/Sprite.h"
|
||||
#include "GDCore/IDE/Project/ArbitraryResourceWorker.h"
|
||||
#include "GDCore/Extensions/Builtin/SpriteExtension/SpriteObject.h"
|
||||
#include "GDCore/Project/InitialInstance.h"
|
||||
#include "GDCore/Project/Layout.h"
|
||||
#include "GDCore/Project/Object.h"
|
||||
#include "GDCore/Project/Project.h"
|
||||
#include "GDCore/Project/PropertyDescriptor.h"
|
||||
#include "GDCore/Serialization/SerializerElement.h"
|
||||
#include "GDCore/Tools/Localization.h"
|
||||
|
||||
#include <SFML/Graphics.hpp>
|
||||
#include "GDCore/Project/PropertyDescriptor.h"
|
||||
#include "GDCore/IDE/Project/ArbitraryResourceWorker.h"
|
||||
|
||||
namespace gd {
|
||||
|
||||
Animation SpriteObject::badAnimation;
|
||||
@@ -103,8 +103,7 @@ void SpriteObject::DoSerializeTo(gd::SerializerElement& element) const {
|
||||
}
|
||||
}
|
||||
|
||||
std::map<gd::String, gd::PropertyDescriptor> SpriteObject::GetProperties()
|
||||
const {
|
||||
std::map<gd::String, gd::PropertyDescriptor> SpriteObject::GetProperties() const {
|
||||
std::map<gd::String, gd::PropertyDescriptor> properties;
|
||||
properties[_("Animate even if hidden or far from the screen")]
|
||||
.SetValue(updateIfNotVisible ? "true" : "false")
|
||||
@@ -136,30 +135,22 @@ void SpriteObject::ExposeResources(gd::ArbitraryResourceWorker& worker) {
|
||||
}
|
||||
|
||||
std::map<gd::String, gd::PropertyDescriptor>
|
||||
SpriteObject::GetInitialInstanceProperties(
|
||||
const gd::InitialInstance& initialInstance,
|
||||
gd::Project& project,
|
||||
gd::Layout& scene) {
|
||||
SpriteObject::GetInitialInstanceProperties(const gd::InitialInstance& position,
|
||||
gd::Project& project,
|
||||
gd::Layout& scene) {
|
||||
std::map<gd::String, gd::PropertyDescriptor> properties;
|
||||
properties["animation"] =
|
||||
gd::PropertyDescriptor(
|
||||
gd::String::From(initialInstance.GetRawDoubleProperty("animation")))
|
||||
.SetLabel(_("Animation"))
|
||||
.SetType("number");
|
||||
properties[_("Animation")] = gd::String::From(position.GetRawDoubleProperty("animation"));
|
||||
|
||||
return properties;
|
||||
}
|
||||
|
||||
bool SpriteObject::UpdateInitialInstanceProperty(
|
||||
gd::InitialInstance& initialInstance,
|
||||
const gd::String& name,
|
||||
const gd::String& value,
|
||||
gd::Project& project,
|
||||
gd::Layout& scene) {
|
||||
if (name == "animation") {
|
||||
initialInstance.SetRawDoubleProperty(
|
||||
"animation", std::max(0, value.empty() ? 0 : value.To<int>()));
|
||||
}
|
||||
bool SpriteObject::UpdateInitialInstanceProperty(gd::InitialInstance& position,
|
||||
const gd::String& name,
|
||||
const gd::String& value,
|
||||
gd::Project& project,
|
||||
gd::Layout& scene) {
|
||||
if (name == _("Animation"))
|
||||
position.SetRawDoubleProperty("animation", value.To<int>());
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@@ -20,20 +20,18 @@ BuiltinExtensionsImplementer::ImplementsStringInstructionsExtension(
|
||||
"Florian Rival",
|
||||
"Open source (MIT License)")
|
||||
.SetExtensionHelpPath("" /*TODO: Add a documentation page for this */);
|
||||
extension.AddInstructionOrExpressionGroupMetadata(_("Text manipulation"))
|
||||
.SetIcon("res/actions/text24.png");
|
||||
|
||||
extension.AddStrExpression("NewLine",
|
||||
_("Insert a new line"),
|
||||
_("Insert a new line"),
|
||||
"",
|
||||
_("Manipulation of text"),
|
||||
"res/conditions/toujours24.png");
|
||||
|
||||
extension
|
||||
.AddStrExpression("FromCodePoint",
|
||||
_("Get character from code point"),
|
||||
_("Get character from code point"),
|
||||
"",
|
||||
_("Manipulation of text"),
|
||||
"res/conditions/toujours24.png")
|
||||
|
||||
.AddParameter("expression", _("Code point"));
|
||||
@@ -42,7 +40,7 @@ BuiltinExtensionsImplementer::ImplementsStringInstructionsExtension(
|
||||
.AddStrExpression("ToUpperCase",
|
||||
_("Uppercase a text"),
|
||||
_("Uppercase a text"),
|
||||
"",
|
||||
_("Manipulation of text"),
|
||||
"res/conditions/toujours24.png")
|
||||
|
||||
.AddParameter("string", _("Text"));
|
||||
@@ -51,7 +49,7 @@ BuiltinExtensionsImplementer::ImplementsStringInstructionsExtension(
|
||||
.AddStrExpression("ToLowerCase",
|
||||
_("Lowercase a text"),
|
||||
_("Lowercase a text"),
|
||||
"",
|
||||
_("Manipulation of text"),
|
||||
"res/conditions/toujours24.png")
|
||||
|
||||
.AddParameter("string", _("Text"));
|
||||
@@ -60,7 +58,7 @@ BuiltinExtensionsImplementer::ImplementsStringInstructionsExtension(
|
||||
.AddStrExpression("SubStr",
|
||||
_("Get a portion of a text"),
|
||||
_("Get a portion of a text"),
|
||||
"",
|
||||
_("Manipulation of text"),
|
||||
"res/conditions/toujours24.png")
|
||||
|
||||
.AddParameter("string", _("Text"))
|
||||
@@ -73,7 +71,7 @@ BuiltinExtensionsImplementer::ImplementsStringInstructionsExtension(
|
||||
.AddStrExpression("StrAt",
|
||||
_("Get a character from a text"),
|
||||
_("Get a character from a text"),
|
||||
"",
|
||||
_("Manipulation of text"),
|
||||
"res/conditions/toujours24.png")
|
||||
|
||||
.AddParameter("string", _("Text"))
|
||||
@@ -85,7 +83,7 @@ BuiltinExtensionsImplementer::ImplementsStringInstructionsExtension(
|
||||
.AddStrExpression("StrRepeat",
|
||||
_("Repeat a text"),
|
||||
_("Repeat a text"),
|
||||
"",
|
||||
_("Manipulation of text"),
|
||||
"res/conditions/toujours24.png")
|
||||
|
||||
.AddParameter("string", _("Text to repeat"))
|
||||
@@ -95,7 +93,7 @@ BuiltinExtensionsImplementer::ImplementsStringInstructionsExtension(
|
||||
.AddExpression("StrLength",
|
||||
_("Length of a text"),
|
||||
_("Length of a text"),
|
||||
"",
|
||||
_("Manipulation of text"),
|
||||
"res/conditions/toujours24.png")
|
||||
|
||||
.AddParameter("string", _("Text"));
|
||||
@@ -105,7 +103,7 @@ BuiltinExtensionsImplementer::ImplementsStringInstructionsExtension(
|
||||
_("Search in a text"),
|
||||
_("Search in a text (return the position of the result or "
|
||||
"-1 if not found)"),
|
||||
"",
|
||||
_("Manipulation of text"),
|
||||
"res/conditions/toujours24.png")
|
||||
|
||||
.AddParameter("string", _("Text"))
|
||||
@@ -116,7 +114,7 @@ BuiltinExtensionsImplementer::ImplementsStringInstructionsExtension(
|
||||
"Search in a text from the end",
|
||||
"Search in a text from the end (return the position of "
|
||||
"the result or -1 if not found)",
|
||||
"",
|
||||
_("Manipulation of text"),
|
||||
"res/conditions/toujours24.png")
|
||||
|
||||
.AddParameter("string", _("Text"))
|
||||
@@ -130,7 +128,7 @@ BuiltinExtensionsImplementer::ImplementsStringInstructionsExtension(
|
||||
_("Search the last occurence in a string (return the position of "
|
||||
"the result, from the beginning of the string, or -1 if not "
|
||||
"found)"),
|
||||
"",
|
||||
_("Manipulation of text"),
|
||||
"res/conditions/toujours24.png")
|
||||
|
||||
.AddParameter("string", _("Text"))
|
||||
@@ -141,7 +139,7 @@ BuiltinExtensionsImplementer::ImplementsStringInstructionsExtension(
|
||||
_("Search in a text, starting from a position"),
|
||||
_("Search in a text, starting from a position (return the "
|
||||
"position of the result or -1 if not found)"),
|
||||
"",
|
||||
_("Manipulation of text"),
|
||||
"res/conditions/toujours24.png")
|
||||
|
||||
.AddParameter("string", _("Text"))
|
||||
@@ -156,7 +154,7 @@ BuiltinExtensionsImplementer::ImplementsStringInstructionsExtension(
|
||||
"Search in a text from the end, starting from a position",
|
||||
"Search in a text from the end, starting from a position (return "
|
||||
"the position of the result or -1 if not found)",
|
||||
"",
|
||||
_("Manipulation of text"),
|
||||
"res/conditions/toujours24.png")
|
||||
|
||||
.AddParameter("string", _("Text"))
|
||||
@@ -174,7 +172,7 @@ BuiltinExtensionsImplementer::ImplementsStringInstructionsExtension(
|
||||
"(return "
|
||||
" the position of the result, from the beginning of the string, or "
|
||||
"-1 if not found)"),
|
||||
"",
|
||||
_("Manipulation of text"),
|
||||
"res/conditions/toujours24.png")
|
||||
|
||||
.AddParameter("string", _("Text"))
|
||||
|
@@ -14,56 +14,33 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsTimeExtension(
|
||||
extension
|
||||
.SetExtensionInformation(
|
||||
"BuiltinTime",
|
||||
_("Timers and time"),
|
||||
_("Time"),
|
||||
"Actions and conditions to run timers, get the current time or "
|
||||
"modify the time scale (speed at which the game is running - useful "
|
||||
"for slow motion effects).",
|
||||
"Florian Rival",
|
||||
"Open source (MIT License)")
|
||||
.SetExtensionHelpPath("/all-features/timers-and-time");
|
||||
extension.AddInstructionOrExpressionGroupMetadata(
|
||||
_("Timers and time")
|
||||
)
|
||||
.SetIcon("res/conditions/timer24.png");
|
||||
.SetExtensionHelpPath("/all-features/timers");
|
||||
|
||||
|
||||
// Deprecated and replaced by CompareTimer
|
||||
extension
|
||||
.AddCondition("Timer",
|
||||
_("Value of a scene timer"),
|
||||
_("Test the elapsed time of a scene timer."),
|
||||
_("The timer _PARAM2_ is greater than _PARAM1_ seconds"),
|
||||
|
||||
"",
|
||||
_("Timers and time"),
|
||||
"res/conditions/timer24.png",
|
||||
"res/conditions/timer.png")
|
||||
.AddCodeOnlyParameter("currentScene", "")
|
||||
.AddParameter("expression", _("Time in seconds"))
|
||||
.AddParameter("string", _("Timer's name"))
|
||||
.SetHidden();
|
||||
|
||||
extension
|
||||
.AddCondition("CompareTimer",
|
||||
_("Value of a scene timer"),
|
||||
_("Compare the elapsed time of a scene timer. This "
|
||||
"condition doesn't start the timer."),
|
||||
_("The timer _PARAM1_ _PARAM2_ _PARAM3_ seconds"),
|
||||
|
||||
"",
|
||||
"res/conditions/timer24.png",
|
||||
"res/conditions/timer.png")
|
||||
.AddCodeOnlyParameter("currentScene", "")
|
||||
.AddParameter("string", _("Timer's name"))
|
||||
.AddParameter("relationalOperator", _("Sign of the test"), "time")
|
||||
.AddParameter("expression", _("Time in seconds"))
|
||||
.SetManipulatedType("number");
|
||||
.AddParameter("string", _("Timer's name"));
|
||||
|
||||
extension
|
||||
.AddCondition("TimeScale",
|
||||
_("Time scale"),
|
||||
_("Compare the time scale of the scene."),
|
||||
_("the time scale of the scene"),
|
||||
|
||||
"",
|
||||
_("Timers and time"),
|
||||
"res/conditions/time24.png",
|
||||
"res/conditions/time.png")
|
||||
.AddCodeOnlyParameter("currentScene", "")
|
||||
@@ -75,8 +52,7 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsTimeExtension(
|
||||
_("Scene timer paused"),
|
||||
_("Test if the specified scene timer is paused."),
|
||||
_("The timer _PARAM1_ is paused"),
|
||||
|
||||
"",
|
||||
_("Timers and time"),
|
||||
"res/conditions/timerPaused24.png",
|
||||
"res/conditions/timerPaused.png")
|
||||
.AddCodeOnlyParameter("currentScene", "")
|
||||
@@ -89,9 +65,8 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsTimeExtension(
|
||||
_("Start (or reset) a scene timer"),
|
||||
_("Reset the specified scene timer, if the timer doesn't exist "
|
||||
"it's created and started."),
|
||||
_("Start (or reset) the timer _PARAM1_"),
|
||||
|
||||
"",
|
||||
_("Reset the timer _PARAM1_"),
|
||||
_("Timers and time"),
|
||||
"res/actions/timer24.png",
|
||||
"res/actions/timer.png")
|
||||
.AddCodeOnlyParameter("currentScene", "")
|
||||
@@ -102,8 +77,7 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsTimeExtension(
|
||||
_("Pause a scene timer"),
|
||||
_("Pause a scene timer."),
|
||||
_("Pause timer _PARAM1_"),
|
||||
|
||||
"",
|
||||
_("Timers and time"),
|
||||
"res/actions/pauseTimer24.png",
|
||||
"res/actions/pauseTimer.png")
|
||||
.AddCodeOnlyParameter("currentScene", "")
|
||||
@@ -115,8 +89,7 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsTimeExtension(
|
||||
_("Unpause a scene timer"),
|
||||
_("Unpause a scene timer."),
|
||||
_("Unpause timer _PARAM1_"),
|
||||
|
||||
"",
|
||||
_("Timers and time"),
|
||||
"res/actions/unPauseTimer24.png",
|
||||
"res/actions/unPauseTimer.png")
|
||||
.AddCodeOnlyParameter("currentScene", "")
|
||||
@@ -128,8 +101,7 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsTimeExtension(
|
||||
_("Delete a scene timer"),
|
||||
_("Delete a scene timer from memory."),
|
||||
_("Delete timer _PARAM1_ from memory"),
|
||||
|
||||
"",
|
||||
_("Timers and time"),
|
||||
"res/actions/timer24.png",
|
||||
"res/actions/timer.png")
|
||||
.AddCodeOnlyParameter("currentScene", "")
|
||||
@@ -141,31 +113,18 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsTimeExtension(
|
||||
_("Change time scale"),
|
||||
_("Change the time scale of the scene."),
|
||||
_("Set the time scale of the scene to _PARAM1_"),
|
||||
"",
|
||||
_("Timers and time"),
|
||||
"res/actions/time24.png",
|
||||
"res/actions/time.png")
|
||||
.AddCodeOnlyParameter("currentScene", "")
|
||||
.AddParameter("expression",
|
||||
_("Scale (1: Default, 2: 2x faster, 0.5: 2x slower...)"));
|
||||
|
||||
extension
|
||||
.AddAction("Wait",
|
||||
_("Wait X seconds (experimental)"),
|
||||
_("Waits a number of seconds before running "
|
||||
"the next actions (and sub-events)."),
|
||||
_("Wait _PARAM0_ seconds"),
|
||||
"",
|
||||
"res/timer.svg",
|
||||
"res/timer.svg")
|
||||
.AddParameter("expression", "Time to wait in seconds")
|
||||
.SetHelpPath("/all-features/timers-and-time/wait-action")
|
||||
.SetAsync();
|
||||
|
||||
extension
|
||||
.AddExpression("TimeDelta",
|
||||
_("Time elapsed since the last frame"),
|
||||
_("Time elapsed since the last frame rendered on screen"),
|
||||
"",
|
||||
_("Time"),
|
||||
"res/actions/time.png")
|
||||
.AddCodeOnlyParameter("currentScene", "");
|
||||
|
||||
@@ -173,7 +132,7 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsTimeExtension(
|
||||
.AddExpression("TempsFrame",
|
||||
_("Time elapsed since the last frame"),
|
||||
_("Time elapsed since the last frame rendered on screen"),
|
||||
"",
|
||||
_("Time"),
|
||||
"res/actions/time.png")
|
||||
.SetHidden()
|
||||
.AddCodeOnlyParameter("currentScene", "");
|
||||
@@ -182,7 +141,7 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsTimeExtension(
|
||||
.AddExpression("ElapsedTime",
|
||||
_("Time elapsed since the last frame"),
|
||||
_("Time elapsed since the last frame rendered on screen"),
|
||||
"",
|
||||
_("Time"),
|
||||
"res/actions/time.png")
|
||||
.SetHidden()
|
||||
.AddCodeOnlyParameter("currentScene", "");
|
||||
@@ -191,7 +150,7 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsTimeExtension(
|
||||
.AddExpression("TimerElapsedTime",
|
||||
_("Scene timer value"),
|
||||
_("Value of a scene timer"),
|
||||
"",
|
||||
_("Time"),
|
||||
"res/actions/time.png")
|
||||
.AddCodeOnlyParameter("currentScene", "")
|
||||
.AddParameter("string", _("Timer's name"));
|
||||
@@ -200,7 +159,7 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsTimeExtension(
|
||||
.AddExpression("TimeFromStart",
|
||||
_("Time elapsed since the beginning of the scene"),
|
||||
_("Time elapsed since the beginning of the scene"),
|
||||
"",
|
||||
_("Time"),
|
||||
"res/actions/time.png")
|
||||
.AddCodeOnlyParameter("currentScene", "");
|
||||
|
||||
@@ -208,7 +167,7 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsTimeExtension(
|
||||
.AddExpression("TempsDebut",
|
||||
_("Time elapsed since the beginning of the scene"),
|
||||
_("Time elapsed since the beginning of the scene"),
|
||||
"",
|
||||
_("Time"),
|
||||
"res/actions/time.png")
|
||||
.SetHidden()
|
||||
.AddCodeOnlyParameter("currentScene", "");
|
||||
@@ -217,7 +176,7 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsTimeExtension(
|
||||
.AddExpression("TimeScale",
|
||||
_("Time scale"),
|
||||
_("Returns the time scale of the scene."),
|
||||
"",
|
||||
_("Time"),
|
||||
"res/actions/time.png")
|
||||
.AddCodeOnlyParameter("currentScene", "");
|
||||
|
||||
@@ -225,7 +184,7 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsTimeExtension(
|
||||
.AddExpression("Time",
|
||||
_("Current time"),
|
||||
_("Current time"),
|
||||
"",
|
||||
_("Time"),
|
||||
"res/actions/time.png")
|
||||
.AddCodeOnlyParameter("currentScene", "")
|
||||
.AddParameter(
|
||||
@@ -236,6 +195,7 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsTimeExtension(
|
||||
"timestamp\""),
|
||||
"[\"hour\", \"min\", \"sec\", \"mon\", \"year\", \"wday\", \"mday\", "
|
||||
"\"yday\", \"timestamp\"]");
|
||||
|
||||
}
|
||||
|
||||
} // namespace gd
|
||||
|
@@ -14,7 +14,7 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsVariablesExtension(
|
||||
extension
|
||||
.SetExtensionInformation(
|
||||
"BuiltinVariables",
|
||||
_("Variables"),
|
||||
_("Variable features"),
|
||||
"Actions, conditions and expressions to handle variables, from "
|
||||
"simple variables like the player score, the number of remaining "
|
||||
"lives to complex variables containing arbitrary data like an "
|
||||
@@ -22,15 +22,13 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsVariablesExtension(
|
||||
"Florian Rival",
|
||||
"Open source (MIT License)")
|
||||
.SetExtensionHelpPath("/all-features/variables");
|
||||
extension.AddInstructionOrExpressionGroupMetadata(_("Variables"))
|
||||
.SetIcon("res/conditions/var24.png");
|
||||
|
||||
extension
|
||||
.AddCondition("VarScene",
|
||||
_("Value of a scene variable"),
|
||||
_("Compare the value of a scene variable."),
|
||||
_("the scene variable _PARAM0_"),
|
||||
_("Scene variables"),
|
||||
_("Variables/Scene variables"),
|
||||
"res/conditions/var24.png",
|
||||
"res/conditions/var.png")
|
||||
.AddParameter("scenevar", _("Variable"))
|
||||
@@ -41,7 +39,7 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsVariablesExtension(
|
||||
_("Text of a scene variable"),
|
||||
_("Compare the text of a scene variable."),
|
||||
_("the text of scene variable _PARAM0_"),
|
||||
_("Scene variables"),
|
||||
_("Variables/Scene variables"),
|
||||
"res/conditions/var24.png",
|
||||
"res/conditions/var.png")
|
||||
.AddParameter("scenevar", _("Variable"))
|
||||
@@ -53,7 +51,7 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsVariablesExtension(
|
||||
_("Boolean value of a scene variable"),
|
||||
_("Compare the boolean value of a scene variable."),
|
||||
_("The boolean value of scene variable _PARAM0_ is _PARAM1_"),
|
||||
_("Scene variables"),
|
||||
_("Variables/Scene variables"),
|
||||
"res/conditions/var24.png",
|
||||
"res/conditions/var.png")
|
||||
.AddParameter("scenevar", _("Variable"))
|
||||
@@ -66,7 +64,7 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsVariablesExtension(
|
||||
_("Child existence"),
|
||||
_("Check if the specified child of the scene variable exists."),
|
||||
_("Child _PARAM1_ of scene variable _PARAM0_ exists"),
|
||||
_("Scene variables/Collections/Structures"),
|
||||
_("Variables/Scene variables/Collections/Structures"),
|
||||
"res/conditions/var24.png",
|
||||
"res/conditions/var.png")
|
||||
.AddParameter("scenevar", _("Variable"))
|
||||
@@ -79,7 +77,7 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsVariablesExtension(
|
||||
_("Check if the specified child of the global "
|
||||
"variable exists."),
|
||||
_("Child _PARAM1_ of global variable _PARAM0_ exists"),
|
||||
_("Global variables/Collections/Structures"),
|
||||
_("Variables/Global variables/Collections/Structures"),
|
||||
"res/conditions/var24.png",
|
||||
"res/conditions/var.png")
|
||||
.AddParameter("globalvar", _("Variable"))
|
||||
@@ -91,7 +89,7 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsVariablesExtension(
|
||||
"Test if a scene variable is defined",
|
||||
"Test if the scene variable exists.",
|
||||
"Scene variable _PARAM0_ is defined",
|
||||
_("Scene variables"),
|
||||
_("Variables/Scene variables"),
|
||||
"res/conditions/var24.png",
|
||||
"res/conditions/var.png")
|
||||
.AddCodeOnlyParameter("currentScene", "")
|
||||
@@ -103,7 +101,7 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsVariablesExtension(
|
||||
_("Value of a global variable"),
|
||||
_("Compare the value of a global variable."),
|
||||
_("the global variable _PARAM0_"),
|
||||
_("Global variables"),
|
||||
_("Variables/Global variables"),
|
||||
"res/conditions/var24.png",
|
||||
"res/conditions/var.png")
|
||||
.AddParameter("globalvar", _("Variable"))
|
||||
@@ -115,7 +113,7 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsVariablesExtension(
|
||||
_("Text of a global variable"),
|
||||
_("Compare the text of a global variable."),
|
||||
_("the text of the global variable _PARAM0_"),
|
||||
_("Global variables"),
|
||||
_("Variables/Global variables"),
|
||||
"res/conditions/var24.png",
|
||||
"res/conditions/var.png")
|
||||
.AddParameter("globalvar", _("Variable"))
|
||||
@@ -128,7 +126,7 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsVariablesExtension(
|
||||
_("Boolean value of a global variable"),
|
||||
_("Compare the boolean value of a global variable."),
|
||||
_("The boolean value of global variable _PARAM0_ is _PARAM1_"),
|
||||
_("Global variables"),
|
||||
_("Variables/Global variables"),
|
||||
"res/conditions/var24.png",
|
||||
"res/conditions/var.png")
|
||||
.AddParameter("globalvar", _("Variable"))
|
||||
@@ -140,7 +138,7 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsVariablesExtension(
|
||||
"Test if a global variable is defined",
|
||||
"Test if a global variable exists",
|
||||
"Global variable _PARAM0_ is defined",
|
||||
_("Global variables"),
|
||||
_("Variables/Global variables"),
|
||||
"res/conditions/var24.png",
|
||||
"res/conditions/var.png")
|
||||
.AddCodeOnlyParameter("currentScene", "")
|
||||
@@ -153,7 +151,7 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsVariablesExtension(
|
||||
_("Value of a scene variable"),
|
||||
_("Change the value of a scene variable."),
|
||||
_("the scene variable _PARAM0_"),
|
||||
_("Scene variables"),
|
||||
_("Variables/Scene variables"),
|
||||
"res/actions/var24.png",
|
||||
"res/actions/var.png")
|
||||
.AddParameter("scenevar", _("Variable"))
|
||||
@@ -164,7 +162,7 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsVariablesExtension(
|
||||
_("String of a scene variable"),
|
||||
_("Modify the text of a scene variable."),
|
||||
_("the text of scene variable _PARAM0_"),
|
||||
_("Scene variables"),
|
||||
_("Variables/Scene variables"),
|
||||
"res/actions/var24.png",
|
||||
"res/actions/var.png")
|
||||
.AddParameter("scenevar", _("Variable"))
|
||||
@@ -176,7 +174,7 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsVariablesExtension(
|
||||
_("Boolean value of a scene variable"),
|
||||
_("Modify the boolean value of a scene variable."),
|
||||
_("Set the boolean value of scene variable _PARAM0_ to _PARAM1_"),
|
||||
_("Scene variables"),
|
||||
_("Variables/Scene variables"),
|
||||
"res/conditions/var24.png",
|
||||
"res/conditions/var.png")
|
||||
.AddParameter("scenevar", _("Variable"))
|
||||
@@ -189,7 +187,7 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsVariablesExtension(
|
||||
_("If it was true, it will become false, and if it was "
|
||||
"false it will become true."),
|
||||
_("Toggle the boolean value of scene variable _PARAM0_"),
|
||||
_("Scene variables"),
|
||||
_("Variables/Scene variables"),
|
||||
"res/conditions/var24.png",
|
||||
"res/conditions/var.png")
|
||||
.AddParameter("scenevar", _("Variable"));
|
||||
@@ -199,7 +197,7 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsVariablesExtension(
|
||||
_("Value of a global variable"),
|
||||
_("Change the value of a global variable"),
|
||||
_("the global variable _PARAM0_"),
|
||||
_("Global variables"),
|
||||
_("Variables/Global variables"),
|
||||
"res/actions/var24.png",
|
||||
"res/actions/var.png")
|
||||
.AddParameter("globalvar", _("Variable"))
|
||||
@@ -211,7 +209,7 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsVariablesExtension(
|
||||
_("String of a global variable"),
|
||||
_("Modify the text of a global variable."),
|
||||
_("the text of global variable _PARAM0_"),
|
||||
_("Global variables"),
|
||||
_("Variables/Global variables"),
|
||||
"res/actions/var24.png",
|
||||
"res/actions/var.png")
|
||||
.AddParameter("globalvar", _("Variable"))
|
||||
@@ -224,7 +222,7 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsVariablesExtension(
|
||||
_("Boolean value of a global variable"),
|
||||
_("Modify the boolean value of a global variable."),
|
||||
_("Set the boolean value of global variable _PARAM0_ to _PARAM1_"),
|
||||
_("Global variables"),
|
||||
_("Variables/Global variables"),
|
||||
"res/conditions/var24.png",
|
||||
"res/conditions/var.png")
|
||||
.AddParameter("globalvar", _("Variable"))
|
||||
@@ -237,7 +235,7 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsVariablesExtension(
|
||||
_("If it was true, it will become false, and if it was "
|
||||
"false it will become true."),
|
||||
_("Toggle the boolean value of global variable _PARAM0_"),
|
||||
_("Global variables"),
|
||||
_("Variables/Global variables"),
|
||||
"res/conditions/var24.png",
|
||||
"res/conditions/var.png")
|
||||
.AddParameter("globalvar", _("Variable"));
|
||||
@@ -247,7 +245,7 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsVariablesExtension(
|
||||
_("Remove a child"),
|
||||
_("Remove a child from a scene variable."),
|
||||
_("Remove child _PARAM1_ from scene variable _PARAM0_"),
|
||||
_("Scene variables/Collections/Structures"),
|
||||
_("Variables/Scene variables/Collections/Structures"),
|
||||
"res/actions/var24.png",
|
||||
"res/actions/var.png")
|
||||
.AddParameter("scenevar", _("Variable"))
|
||||
@@ -259,7 +257,7 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsVariablesExtension(
|
||||
_("Remove a child"),
|
||||
_("Remove a child from a global variable."),
|
||||
_("Remove child _PARAM1_ from global variable _PARAM0_"),
|
||||
_("Global variables/Collections/Structures"),
|
||||
_("Variables/Global variables/Collections/Structures"),
|
||||
"res/actions/var24.png",
|
||||
"res/actions/var.png")
|
||||
.AddParameter("globalvar", _("Variable"))
|
||||
@@ -271,7 +269,7 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsVariablesExtension(
|
||||
_("Clear scene variable"),
|
||||
_("Remove all the children from the scene variable."),
|
||||
_("Clear children from scene variable _PARAM0_"),
|
||||
_("Scene variables/Collections"),
|
||||
_("Variables/Scene variables/Collections"),
|
||||
"res/actions/var24.png",
|
||||
"res/actions/var.png")
|
||||
.AddParameter("scenevar", _("Variable"))
|
||||
@@ -282,7 +280,7 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsVariablesExtension(
|
||||
_("Clear global variable"),
|
||||
_("Remove all the children from the global variable."),
|
||||
_("Clear children from global variable _PARAM0_"),
|
||||
_("Global variables/Collections"),
|
||||
_("Variables/Global variables/Collections"),
|
||||
"res/actions/var24.png",
|
||||
"res/actions/var.png")
|
||||
.AddParameter("globalvar", _("Variable"))
|
||||
@@ -293,7 +291,7 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsVariablesExtension(
|
||||
_("Append variable to a scene array"),
|
||||
_("Appends a variable at the end of a scene array variable."),
|
||||
_("Append variable _PARAM1_ to array variable _PARAM0_"),
|
||||
_("Scene variables/Collections/Arrays"),
|
||||
_("Variables/Scene variables/Collections/Arrays"),
|
||||
"res/actions/var24.png",
|
||||
"res/actions/var.png")
|
||||
.AddParameter("scenevar", _("Array variable"))
|
||||
@@ -306,7 +304,7 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsVariablesExtension(
|
||||
_("Append a string to a scene array"),
|
||||
_("Appends a string at the end of a scene array variable."),
|
||||
_("Append string _PARAM1_ to array variable _PARAM0_"),
|
||||
_("Scene variables/Collections/Arrays"),
|
||||
_("Variables/Scene variables/Collections/Arrays"),
|
||||
"res/actions/var24.png",
|
||||
"res/actions/var.png")
|
||||
.AddParameter("scenevar", _("Array variable"))
|
||||
@@ -318,7 +316,7 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsVariablesExtension(
|
||||
_("Append a number to a scene array"),
|
||||
_("Appends a number at the end of a scene array variable."),
|
||||
_("Append number _PARAM1_ to array variable _PARAM0_"),
|
||||
_("Scene variables/Collections/Arrays"),
|
||||
_("Variables/Scene variables/Collections/Arrays"),
|
||||
"res/actions/var24.png",
|
||||
"res/actions/var.png")
|
||||
.AddParameter("scenevar", _("Array variable"))
|
||||
@@ -330,7 +328,7 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsVariablesExtension(
|
||||
_("Append a boolean to a scene array"),
|
||||
_("Appends a boolean at the end of a scene array variable."),
|
||||
_("Append boolean _PARAM1_ to array variable _PARAM0_"),
|
||||
_("Scene variables/Collections/Arrays"),
|
||||
_("Variables/Scene variables/Collections/Arrays"),
|
||||
"res/actions/var24.png",
|
||||
"res/actions/var.png")
|
||||
.AddParameter("scenevar", _("Array variable"))
|
||||
@@ -343,7 +341,7 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsVariablesExtension(
|
||||
_("Remove variable from a scene array (by index)"),
|
||||
_("Removes a variable at the specified index of a scene array variable."),
|
||||
_("Remove variable at index _PARAM1_ from scene array variable _PARAM0_"),
|
||||
_("Scene variables/Collections/Arrays"),
|
||||
_("Variables/Scene variables/Collections/Arrays"),
|
||||
"res/actions/var24.png",
|
||||
"res/actions/var.png")
|
||||
.AddParameter("scenevar", _("Variable"))
|
||||
@@ -355,7 +353,7 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsVariablesExtension(
|
||||
_("Append variable to a global array"),
|
||||
_("Appends a variable at the end of a global array variable."),
|
||||
_("Append variable _PARAM1_ to array variable _PARAM0_"),
|
||||
_("Global variables/Collections/Arrays"),
|
||||
_("Variables/Global variables/Collections/Arrays"),
|
||||
"res/actions/var24.png",
|
||||
"res/actions/var.png")
|
||||
.AddParameter("globalvar", _("Array variable"))
|
||||
@@ -369,7 +367,7 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsVariablesExtension(
|
||||
_("Remove variable from a global array (by index)"),
|
||||
_("Removes a variable at the specified index of a global array variable."),
|
||||
_("Remove variable at index _PARAM1_ from global array variable _PARAM0_"),
|
||||
_("Global variables/Collections/Arrays"),
|
||||
_("Variables/Global variables/Collections/Arrays"),
|
||||
"res/actions/var24.png",
|
||||
"res/actions/var.png")
|
||||
.AddParameter("globalvar", _("Variable"))
|
||||
@@ -381,7 +379,7 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsVariablesExtension(
|
||||
_("Append a string to a global array"),
|
||||
_("Appends a string at the end of a global array variable."),
|
||||
_("Append string _PARAM1_ to array variable _PARAM0_"),
|
||||
_("Global variables/Collections/Arrays"),
|
||||
_("Variables/Global variables/Collections/Arrays"),
|
||||
"res/actions/var24.png",
|
||||
"res/actions/var.png")
|
||||
.AddParameter("globalvar", _("Array variable"))
|
||||
@@ -393,7 +391,7 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsVariablesExtension(
|
||||
_("Append a number to a global array"),
|
||||
_("Appends a number at the end of a global array variable."),
|
||||
_("Append number _PARAM1_ to array variable _PARAM0_"),
|
||||
_("Global variables/Collections/Arrays"),
|
||||
_("Variables/Global variables/Collections/Arrays"),
|
||||
"res/actions/var24.png",
|
||||
"res/actions/var.png")
|
||||
.AddParameter("globalvar", _("Array variable"))
|
||||
@@ -405,7 +403,7 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsVariablesExtension(
|
||||
_("Append a boolean to a global array"),
|
||||
_("Appends a boolean at the end of a global array variable."),
|
||||
_("Append boolean _PARAM1_ to array variable _PARAM0_"),
|
||||
_("Global variables/Collections/Arrays"),
|
||||
_("Variables/Global variables/Collections/Arrays"),
|
||||
"res/actions/var24.png",
|
||||
"res/actions/var.png")
|
||||
.AddParameter("globalvar", _("Array variable"))
|
||||
@@ -416,7 +414,7 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsVariablesExtension(
|
||||
.AddExpression("GlobalVariableChildCount",
|
||||
_("Number of children of a global variable"),
|
||||
_("Number of children of a global variable"),
|
||||
_("Global variables"),
|
||||
_("Variables/Global variables"),
|
||||
"res/actions/var.png")
|
||||
.AddParameter("globalvar", _("Variable"));
|
||||
|
||||
@@ -424,7 +422,7 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsVariablesExtension(
|
||||
.AddExpression("VariableChildCount",
|
||||
_("Number of children of a scene variable"),
|
||||
_("Number of children of a scene variable"),
|
||||
_("Scene variables"),
|
||||
_("Variables/Scene variables"),
|
||||
"res/actions/var.png")
|
||||
.AddParameter("scenevar", _("Variable"));
|
||||
|
||||
@@ -432,7 +430,7 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsVariablesExtension(
|
||||
.AddExpression("Variable",
|
||||
_("Value of a scene variable"),
|
||||
_("Value of a scene variable"),
|
||||
_("Scene variables"),
|
||||
_("Variables/Scene variables"),
|
||||
"res/actions/var.png")
|
||||
.AddParameter("scenevar", _("Variable"));
|
||||
|
||||
@@ -440,7 +438,7 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsVariablesExtension(
|
||||
.AddStrExpression("VariableString",
|
||||
_("Text of a scene variable"),
|
||||
_("Text of a scene variable"),
|
||||
_("Scene variables"),
|
||||
_("Variables/Scene variables"),
|
||||
"res/actions/var.png")
|
||||
.AddParameter("scenevar", _("Variable"));
|
||||
|
||||
@@ -448,7 +446,7 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsVariablesExtension(
|
||||
.AddExpression("GlobalVariable",
|
||||
_("Value of a global variable"),
|
||||
_("Value of a global variable"),
|
||||
_("Global variables"),
|
||||
_("Variables/Global variables"),
|
||||
"res/actions/var.png")
|
||||
.AddParameter("globalvar", _("Name of the global variable"));
|
||||
|
||||
@@ -456,7 +454,7 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsVariablesExtension(
|
||||
.AddStrExpression("GlobalVariableString",
|
||||
_("Text of a global variable"),
|
||||
_("Text of a global variable"),
|
||||
_("Global variables"),
|
||||
_("Variables/Global variables"),
|
||||
"res/actions/var.png")
|
||||
.AddParameter("globalvar", _("Variable"));
|
||||
}
|
||||
|
@@ -14,17 +14,13 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsWindowExtension(
|
||||
extension
|
||||
.SetExtensionInformation(
|
||||
"BuiltinWindow",
|
||||
_("Game window and resolution"),
|
||||
_("Window features"),
|
||||
"Provides actions and conditions to manipulate the game window. "
|
||||
"Depending on the platform on which the game is running, not all of "
|
||||
"these features can be applied.",
|
||||
"Florian Rival",
|
||||
"Open source (MIT License)")
|
||||
.SetExtensionHelpPath("/all-features/window");
|
||||
extension
|
||||
.AddInstructionOrExpressionGroupMetadata(
|
||||
_("Game window and resolution"))
|
||||
.SetIcon("res/actions/window24.png");
|
||||
|
||||
extension
|
||||
.AddAction(
|
||||
@@ -32,7 +28,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 and resolution"),
|
||||
"res/actions/fullscreen24.png",
|
||||
"res/actions/fullscreen.png")
|
||||
.AddCodeOnlyParameter("currentScene", "")
|
||||
@@ -48,7 +44,7 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsWindowExtension(
|
||||
_("Fullscreen activated?"),
|
||||
_("Check if the game is currently in fullscreen."),
|
||||
_("The game is in fullscreen"),
|
||||
"",
|
||||
_("Game's window and resolution"),
|
||||
"res/actions/fullscreen24.png",
|
||||
"res/actions/fullscreen.png")
|
||||
.AddCodeOnlyParameter("currentScene", "");
|
||||
@@ -60,7 +56,7 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsWindowExtension(
|
||||
"game frame and the window borders."),
|
||||
_("Set margins of game window to "
|
||||
"_PARAM1_;_PARAM2_;_PARAM3_;_PARAM4_"),
|
||||
"",
|
||||
_("Game's window and resolution"),
|
||||
"res/actions/window24.png",
|
||||
"res/actions/window.png")
|
||||
.AddCodeOnlyParameter("currentScene", "")
|
||||
@@ -76,7 +72,7 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsWindowExtension(
|
||||
"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", "")
|
||||
@@ -93,7 +89,7 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsWindowExtension(
|
||||
"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", "")
|
||||
@@ -110,7 +106,7 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsWindowExtension(
|
||||
"only works on Windows, macOS and Linux (not when the game "
|
||||
"is executed in a web-browser or on iOS/Android)."),
|
||||
_("Center the game window"),
|
||||
"",
|
||||
_("Game's window and resolution"),
|
||||
"res/actions/window24.png",
|
||||
"res/actions/window.png")
|
||||
.AddCodeOnlyParameter("currentScene", "");
|
||||
@@ -122,7 +118,7 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsWindowExtension(
|
||||
"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", "")
|
||||
@@ -143,7 +139,7 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsWindowExtension(
|
||||
"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", "")
|
||||
@@ -156,7 +152,7 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsWindowExtension(
|
||||
_("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 and resolution"),
|
||||
"res/actions/window24.png",
|
||||
"res/actions/window.png")
|
||||
.AddCodeOnlyParameter("currentScene", "")
|
||||
@@ -167,7 +163,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 and resolution"),
|
||||
"res/actions/window24.png",
|
||||
"res/actions/window.png")
|
||||
.AddCodeOnlyParameter("currentScene", "")
|
||||
@@ -178,7 +174,7 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsWindowExtension(
|
||||
"SceneWindowWidth",
|
||||
_("Width of the scene window"),
|
||||
_("Width of the scene window (or scene canvas for HTML5 games)"),
|
||||
"",
|
||||
_("Screen"),
|
||||
"res/window.png")
|
||||
.AddCodeOnlyParameter("currentScene", "");
|
||||
|
||||
@@ -187,7 +183,7 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsWindowExtension(
|
||||
"SceneWindowHeight",
|
||||
_("Height of the scene window"),
|
||||
_("Height of the scene window (or scene canvas for HTML5 games)"),
|
||||
"",
|
||||
_("Screen"),
|
||||
"res/window.png")
|
||||
.AddCodeOnlyParameter("currentScene", "");
|
||||
|
||||
@@ -195,27 +191,27 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsWindowExtension(
|
||||
"ScreenWidth",
|
||||
_("Width of the screen/page"),
|
||||
_("Width of the screen (or the page for HTML5 games in browser)"),
|
||||
"",
|
||||
_("Screen"),
|
||||
"res/display16.png");
|
||||
|
||||
extension.AddExpression(
|
||||
"ScreenHeight",
|
||||
_("Height of the screen/page"),
|
||||
_("Height of the screen (or the page for HTML5 games in browser)"),
|
||||
"",
|
||||
_("Screen"),
|
||||
"res/display16.png");
|
||||
|
||||
extension.AddExpression("ColorDepth",
|
||||
_("Color depth"),
|
||||
_("Color depth"),
|
||||
"",
|
||||
_("Screen"),
|
||||
"res/display16.png");
|
||||
|
||||
extension
|
||||
.AddStrExpression("WindowTitle",
|
||||
_("Window's title"),
|
||||
_("Window's title"),
|
||||
"",
|
||||
_("Screen"),
|
||||
"res/window.png")
|
||||
.AddCodeOnlyParameter("currentScene", "");
|
||||
}
|
||||
|
@@ -234,40 +234,6 @@ BehaviorMetadata::AddExpressionAndConditionAndAction(
|
||||
const gd::String& sentenceName,
|
||||
const gd::String& group,
|
||||
const gd::String& icon) {
|
||||
if (type != "number" && type != "string" && type != "boolean") {
|
||||
gd::LogError(
|
||||
"Unrecognised type passed to AddExpressionAndConditionAndAction: " +
|
||||
type + ". Verify this type is valid and supported.");
|
||||
}
|
||||
|
||||
gd::String conditionDescriptionTemplate =
|
||||
type == "boolean" ? _("Check if <subject>.") : _("Compare <subject>.");
|
||||
auto& condition =
|
||||
AddScopedCondition(name,
|
||||
fullname,
|
||||
conditionDescriptionTemplate.FindAndReplace(
|
||||
"<subject>", descriptionSubject),
|
||||
sentenceName,
|
||||
group,
|
||||
icon,
|
||||
icon);
|
||||
|
||||
gd::String actionDescriptionTemplate = type == "boolean"
|
||||
? _("Set (or unset) if <subject>.")
|
||||
: _("Change <subject>.");
|
||||
auto& action = AddScopedAction(
|
||||
"Set" + name,
|
||||
fullname,
|
||||
actionDescriptionTemplate.FindAndReplace("<subject>", descriptionSubject),
|
||||
sentenceName,
|
||||
group,
|
||||
icon,
|
||||
icon);
|
||||
|
||||
if (type == "boolean") {
|
||||
return MultipleInstructionMetadata::WithConditionAndAction(condition, action);
|
||||
}
|
||||
|
||||
gd::String expressionDescriptionTemplate = _("Return <subject>.");
|
||||
auto& expression =
|
||||
type == "number"
|
||||
@@ -284,6 +250,27 @@ BehaviorMetadata::AddExpressionAndConditionAndAction(
|
||||
group,
|
||||
icon);
|
||||
|
||||
gd::String conditionDescriptionTemplate = _("Compare <subject>.");
|
||||
auto& condition =
|
||||
AddScopedCondition(name,
|
||||
fullname,
|
||||
conditionDescriptionTemplate.FindAndReplace(
|
||||
"<subject>", descriptionSubject),
|
||||
sentenceName,
|
||||
group,
|
||||
icon,
|
||||
icon);
|
||||
|
||||
gd::String actionDescriptionTemplate = _("Change <subject>.");
|
||||
auto& action = AddScopedAction(
|
||||
"Set" + name,
|
||||
fullname,
|
||||
actionDescriptionTemplate.FindAndReplace("<subject>", descriptionSubject),
|
||||
sentenceName,
|
||||
group,
|
||||
icon,
|
||||
icon);
|
||||
|
||||
return MultipleInstructionMetadata::WithExpressionAndConditionAndAction(
|
||||
expression, condition, action);
|
||||
}
|
||||
|
@@ -250,27 +250,6 @@ class GD_CORE_API BehaviorMetadata {
|
||||
return sharedDatasInstance.get();
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Return a reference to a map containing the names of the actions
|
||||
* (as keys) and the metadata associated with (as values).
|
||||
*/
|
||||
std::map<gd::String, gd::InstructionMetadata>& GetAllActions() { return actionsInfos; };
|
||||
|
||||
/**
|
||||
* \see gd::PlatformExtension::GetAllActions
|
||||
*/
|
||||
std::map<gd::String, gd::InstructionMetadata>& GetAllConditions() { return conditionsInfos; };
|
||||
|
||||
/**
|
||||
* \see gd::PlatformExtension::GetAllActions
|
||||
*/
|
||||
std::map<gd::String, gd::ExpressionMetadata>& GetAllExpressions() { return expressionsInfos; };
|
||||
|
||||
/**
|
||||
* \see gd::PlatformExtension::GetAllActions
|
||||
*/
|
||||
std::map<gd::String, gd::ExpressionMetadata>& GetAllStrExpressions() { return strExpressionsInfos; };
|
||||
|
||||
#if defined(GD_IDE_ONLY)
|
||||
std::map<gd::String, gd::InstructionMetadata> conditionsInfos;
|
||||
std::map<gd::String, gd::InstructionMetadata> actionsInfos;
|
||||
|
@@ -8,7 +8,6 @@
|
||||
#include <functional>
|
||||
#include <map>
|
||||
#include <memory>
|
||||
#include <algorithm>
|
||||
|
||||
#include "GDCore/Project/PropertyDescriptor.h"
|
||||
#include "GDCore/String.h"
|
||||
|
@@ -72,11 +72,4 @@ gd::ExpressionMetadata& ExpressionMetadata::AddCodeOnlyParameter(
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
gd::ExpressionMetadata& ExpressionMetadata::SetRequiresBaseObjectCapability(
|
||||
const gd::String& capability) {
|
||||
requiredBaseObjectCapability = capability;
|
||||
return *this;
|
||||
}
|
||||
|
||||
} // namespace gd
|
||||
|
@@ -222,23 +222,6 @@ class GD_CORE_API ExpressionMetadata {
|
||||
return *this;
|
||||
};
|
||||
|
||||
/**
|
||||
* \brief Mark this (object) expression as requiring the specified capability,
|
||||
* offered by the base object.
|
||||
* This is useful for some objects that don't support this capability, so that
|
||||
* the editor can hide the expression as it does not apply to them.
|
||||
*/
|
||||
ExpressionMetadata& SetRequiresBaseObjectCapability(
|
||||
const gd::String& capability);
|
||||
|
||||
/**
|
||||
* \brief Get the required specified capability for this (object) expression,
|
||||
* or an empty string if there is nothing specific required.
|
||||
*/
|
||||
const gd::String& GetRequiredBaseObjectCapability() const {
|
||||
return requiredBaseObjectCapability;
|
||||
};
|
||||
|
||||
/**
|
||||
* \brief Set the function that should be called when generating the source
|
||||
* code from events.
|
||||
@@ -290,7 +273,6 @@ class GD_CORE_API ExpressionMetadata {
|
||||
gd::String smallIconFilename;
|
||||
gd::String extensionNamespace;
|
||||
bool isPrivate;
|
||||
gd::String requiredBaseObjectCapability;
|
||||
};
|
||||
|
||||
} // namespace gd
|
||||
|
@@ -10,7 +10,6 @@
|
||||
#include "GDCore/CommonTools.h"
|
||||
#include "GDCore/Serialization/SerializerElement.h"
|
||||
#include "GDCore/Tools/Localization.h"
|
||||
#include "GDCore/Tools/Log.h"
|
||||
#include "ParameterMetadata.h"
|
||||
|
||||
namespace gd {
|
||||
@@ -22,7 +21,6 @@ InstructionMetadata::InstructionMetadata()
|
||||
canHaveSubInstructions(false),
|
||||
hidden(true),
|
||||
usageComplexity(5),
|
||||
isAsync(false),
|
||||
isPrivate(false),
|
||||
isObjectInstruction(false),
|
||||
isBehaviorInstruction(false) {}
|
||||
@@ -46,7 +44,6 @@ InstructionMetadata::InstructionMetadata(const gd::String& extensionNamespace_,
|
||||
extensionNamespace(extensionNamespace_),
|
||||
hidden(false),
|
||||
usageComplexity(5),
|
||||
isAsync(false),
|
||||
isPrivate(false),
|
||||
isObjectInstruction(false),
|
||||
isBehaviorInstruction(false) {}
|
||||
@@ -69,9 +66,8 @@ InstructionMetadata& InstructionMetadata::AddParameter(
|
||||
? (supplementaryInformation.empty()
|
||||
? ""
|
||||
: extensionNamespace +
|
||||
supplementaryInformation //... so prefix it with the
|
||||
// extension
|
||||
// namespace.
|
||||
supplementaryInformation //... so prefix it with the extension
|
||||
// namespace.
|
||||
)
|
||||
: supplementaryInformation; // Otherwise don't change anything
|
||||
|
||||
@@ -97,55 +93,32 @@ InstructionMetadata& InstructionMetadata::UseStandardOperatorParameters(
|
||||
const gd::String& type) {
|
||||
SetManipulatedType(type);
|
||||
|
||||
if (type == "boolean") {
|
||||
AddParameter("yesorno", _("New value"));
|
||||
size_t valueParamIndex = parameters.size() - 1;
|
||||
AddParameter("operator", _("Modification's sign"), type);
|
||||
AddParameter(type == "number" ? "expression" : type, _("Value"));
|
||||
size_t operatorParamIndex = parameters.size() - 2;
|
||||
size_t valueParamIndex = parameters.size() - 1;
|
||||
|
||||
if (isObjectInstruction || isBehaviorInstruction) {
|
||||
gd::String templateSentence = _("Set _PARAM0_ as <subject>: <value>");
|
||||
if (isObjectInstruction || isBehaviorInstruction) {
|
||||
gd::String templateSentence =
|
||||
_("Change <subject> of _PARAM0_: <operator> <value>");
|
||||
|
||||
sentence =
|
||||
templateSentence
|
||||
.FindAndReplace("<subject>", sentence)
|
||||
.FindAndReplace("<value>",
|
||||
"_PARAM" + gd::String::From(valueParamIndex) + "_");
|
||||
} else {
|
||||
gd::String templateSentence = _("Change <subject>: <value>");
|
||||
|
||||
sentence =
|
||||
templateSentence
|
||||
.FindAndReplace("<subject>", sentence)
|
||||
.FindAndReplace("<value>",
|
||||
"_PARAM" + gd::String::From(valueParamIndex) + "_");
|
||||
}
|
||||
sentence =
|
||||
templateSentence.FindAndReplace("<subject>", sentence)
|
||||
.FindAndReplace(
|
||||
"<operator>",
|
||||
"_PARAM" + gd::String::From(operatorParamIndex) + "_")
|
||||
.FindAndReplace("<value>",
|
||||
"_PARAM" + gd::String::From(valueParamIndex) + "_");
|
||||
} else {
|
||||
AddParameter("operator", _("Modification's sign"), type);
|
||||
AddParameter(type == "number" ? "expression" : type, _("Value"));
|
||||
gd::String templateSentence = _("Change <subject>: <operator> <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) + "_");
|
||||
}
|
||||
sentence =
|
||||
templateSentence.FindAndReplace("<subject>", sentence)
|
||||
.FindAndReplace(
|
||||
"<operator>",
|
||||
"_PARAM" + gd::String::From(operatorParamIndex) + "_")
|
||||
.FindAndReplace("<value>",
|
||||
"_PARAM" + gd::String::From(valueParamIndex) + "_");
|
||||
}
|
||||
|
||||
return *this;
|
||||
@@ -156,62 +129,34 @@ InstructionMetadata::UseStandardRelationalOperatorParameters(
|
||||
const gd::String& type) {
|
||||
SetManipulatedType(type);
|
||||
|
||||
if (type == "boolean") {
|
||||
if (isObjectInstruction || isBehaviorInstruction) {
|
||||
gd::String templateSentence = _("_PARAM0_ is <subject>");
|
||||
AddParameter("relationalOperator", _("Sign of the test"), type);
|
||||
AddParameter(type == "number" ? "expression" : type, _("Value to compare"));
|
||||
size_t operatorParamIndex = parameters.size() - 2;
|
||||
size_t valueParamIndex = parameters.size() - 1;
|
||||
|
||||
sentence =
|
||||
templateSentence
|
||||
.FindAndReplace("<subject>", sentence);
|
||||
} else {
|
||||
gd::String templateSentence = _("<subject>");
|
||||
if (isObjectInstruction || isBehaviorInstruction) {
|
||||
gd::String templateSentence = _("<subject> of _PARAM0_ <operator> <value>");
|
||||
|
||||
sentence =
|
||||
templateSentence.FindAndReplace("<subject>", sentence);
|
||||
}
|
||||
sentence =
|
||||
templateSentence.FindAndReplace("<subject>", sentence)
|
||||
.FindAndReplace(
|
||||
"<operator>",
|
||||
"_PARAM" + gd::String::From(operatorParamIndex) + "_")
|
||||
.FindAndReplace("<value>",
|
||||
"_PARAM" + gd::String::From(valueParamIndex) + "_");
|
||||
} else {
|
||||
AddParameter("relationalOperator", _("Sign of the test"), type);
|
||||
AddParameter(type == "number" ? "expression" : type, _("Value to compare"));
|
||||
size_t operatorParamIndex = parameters.size() - 2;
|
||||
size_t valueParamIndex = parameters.size() - 1;
|
||||
gd::String templateSentence = _("<subject> <operator> <value>");
|
||||
|
||||
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) + "_");
|
||||
}
|
||||
sentence =
|
||||
templateSentence.FindAndReplace("<subject>", sentence)
|
||||
.FindAndReplace(
|
||||
"<operator>",
|
||||
"_PARAM" + gd::String::From(operatorParamIndex) + "_")
|
||||
.FindAndReplace("<value>",
|
||||
"_PARAM" + gd::String::From(valueParamIndex) + "_");
|
||||
}
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
InstructionMetadata& InstructionMetadata::SetRequiresBaseObjectCapability(
|
||||
const gd::String& capability) {
|
||||
if (!IsObjectInstruction() && !IsBehaviorInstruction()) {
|
||||
gd::LogError("Tried to add capability \"" + capability +
|
||||
"\" to instruction named \"" + fullname +
|
||||
"\", which is not an object or behavior instruction.");
|
||||
return *this;
|
||||
}
|
||||
|
||||
requiredBaseObjectCapability = capability;
|
||||
return *this;
|
||||
}
|
||||
|
||||
} // namespace gd
|
||||
|
@@ -9,7 +9,6 @@
|
||||
#include <functional>
|
||||
#include <map>
|
||||
#include <memory>
|
||||
#include <algorithm>
|
||||
|
||||
#include "GDCore/Events/Instruction.h"
|
||||
#include "GDCore/String.h"
|
||||
@@ -99,23 +98,6 @@ class GD_CORE_API InstructionMetadata {
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the instruction is asynchronous - it will be running in the
|
||||
* background, executing the instructions following it before the frame after
|
||||
* it resolved.
|
||||
*/
|
||||
bool IsAsync() const { return isAsync; }
|
||||
|
||||
/**
|
||||
* Set that the instruction is asynchronous - it will be running in the
|
||||
* background, executing the instructions following it before the frame after
|
||||
* it resolved.
|
||||
*/
|
||||
InstructionMetadata &SetAsync() {
|
||||
isAsync = true;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Notify that the instruction can have sub instructions.
|
||||
*/
|
||||
@@ -156,19 +138,18 @@ class GD_CORE_API InstructionMetadata {
|
||||
* \param description Description for parameter
|
||||
* \param supplementaryInformation Additional information that can be used for
|
||||
* rendering or logic. For example:
|
||||
* - If type is "object", this argument will describe which objects are
|
||||
* allowed. If this argument is empty, all objects are allowed.
|
||||
* - If type is "operator", this argument will be used to display only
|
||||
* pertinent operators. \param parameterIsOptional true if the parameter must
|
||||
* be optional, false otherwise.
|
||||
* - If type is "object", this argument will describe which objects are allowed.
|
||||
* If this argument is empty, all objects are allowed.
|
||||
* - If type is "operator", this argument will be used to display only pertinent operators.
|
||||
* \param parameterIsOptional true if the parameter must be optional, false
|
||||
* otherwise.
|
||||
*
|
||||
* \see EventsCodeGenerator::GenerateParametersCodes
|
||||
*/
|
||||
InstructionMetadata &AddParameter(
|
||||
const gd::String &type,
|
||||
const gd::String &label,
|
||||
const gd::String &supplementaryInformation = "",
|
||||
bool parameterIsOptional = false);
|
||||
InstructionMetadata &AddParameter(const gd::String &type,
|
||||
const gd::String &label,
|
||||
const gd::String &supplementaryInformation = "",
|
||||
bool parameterIsOptional = false);
|
||||
|
||||
/**
|
||||
* \brief Add a parameter not displayed in editor.
|
||||
@@ -216,7 +197,8 @@ class GD_CORE_API InstructionMetadata {
|
||||
* \see AddParameter
|
||||
*/
|
||||
InstructionMetadata &SetParameterExtraInfo(const gd::String &extraInfo) {
|
||||
if (!parameters.empty()) parameters.back().SetExtraInfo(extraInfo);
|
||||
if (!parameters.empty())
|
||||
parameters.back().SetExtraInfo(extraInfo);
|
||||
return *this;
|
||||
};
|
||||
|
||||
@@ -254,29 +236,16 @@ class GD_CORE_API InstructionMetadata {
|
||||
/**
|
||||
* \brief Check if the instruction is an object instruction.
|
||||
*/
|
||||
bool IsObjectInstruction() const { return isObjectInstruction; }
|
||||
bool IsObjectInstruction() const {
|
||||
return isObjectInstruction;
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Check if the instruction is a behavior instruction.
|
||||
*/
|
||||
bool IsBehaviorInstruction() const { return isBehaviorInstruction; }
|
||||
|
||||
/**
|
||||
* \brief Mark this (object) instruction as requiring the specified
|
||||
* capability, offered by the base object. This is useful for some objects
|
||||
* that don't support this capability, so that the editor can hide the
|
||||
* instruction as it does not apply to them.
|
||||
*/
|
||||
InstructionMetadata &SetRequiresBaseObjectCapability(
|
||||
const gd::String &capability);
|
||||
|
||||
/**
|
||||
* \brief Get the required specified capability for this (object) instruction,
|
||||
* or an empty string if there is nothing specific required.
|
||||
*/
|
||||
const gd::String &GetRequiredBaseObjectCapability() const {
|
||||
return requiredBaseObjectCapability;
|
||||
};
|
||||
bool IsBehaviorInstruction() const {
|
||||
return isBehaviorInstruction;
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Consider that the instruction is easy for a user to understand.
|
||||
@@ -479,10 +448,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 isAsync;
|
||||
bool isObjectInstruction;
|
||||
bool isBehaviorInstruction;
|
||||
gd::String requiredBaseObjectCapability;
|
||||
};
|
||||
|
||||
} // namespace gd
|
||||
|
@@ -1,31 +0,0 @@
|
||||
/*
|
||||
* GDevelop Core
|
||||
* Copyright 2008-2022 Florian Rival (Florian.Rival@gmail.com). All rights
|
||||
* reserved. This project is released under the MIT License.
|
||||
*/
|
||||
#pragma once
|
||||
#include "GDCore/String.h"
|
||||
|
||||
namespace gd {
|
||||
/**
|
||||
* \brief Contains information about how to display a group of instructions
|
||||
* to the user.
|
||||
*/
|
||||
class GD_CORE_API InstructionOrExpressionGroupMetadata {
|
||||
public:
|
||||
InstructionOrExpressionGroupMetadata(){};
|
||||
|
||||
/**
|
||||
* \brief Sets the icon shown to users.
|
||||
*/
|
||||
InstructionOrExpressionGroupMetadata& SetIcon(const gd::String& icon_) {
|
||||
icon = icon_;
|
||||
return *this;
|
||||
};
|
||||
|
||||
const gd::String& GetIcon() const { return icon; };
|
||||
|
||||
private:
|
||||
gd::String icon;
|
||||
};
|
||||
} // namespace gd
|
@@ -31,11 +31,6 @@ class GD_CORE_API MultipleInstructionMetadata {
|
||||
gd::InstructionMetadata &action) {
|
||||
return MultipleInstructionMetadata(expression, condition, action);
|
||||
}
|
||||
static MultipleInstructionMetadata WithConditionAndAction(
|
||||
gd::InstructionMetadata &condition,
|
||||
gd::InstructionMetadata &action) {
|
||||
return MultipleInstructionMetadata(condition, action);
|
||||
}
|
||||
|
||||
/**
|
||||
* \see gd::InstructionMetadata::AddParameter
|
||||
@@ -101,17 +96,6 @@ class GD_CORE_API MultipleInstructionMetadata {
|
||||
return *this;
|
||||
};
|
||||
|
||||
/**
|
||||
* \see gd::InstructionMetadata::SetRequiresBaseObjectCapability
|
||||
*/
|
||||
MultipleInstructionMetadata &SetRequiresBaseObjectCapability(
|
||||
const gd::String &capability) {
|
||||
if (expression) expression->SetRequiresBaseObjectCapability(capability);
|
||||
if (condition) condition->SetRequiresBaseObjectCapability(capability);
|
||||
if (action) action->SetRequiresBaseObjectCapability(capability);
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* \see gd::InstructionMetadata::UseStandardOperatorParameters
|
||||
* \see gd::InstructionMetadata::UseStandardRelationalOperatorParameters
|
||||
@@ -195,9 +179,6 @@ class GD_CORE_API MultipleInstructionMetadata {
|
||||
gd::InstructionMetadata &condition_,
|
||||
gd::InstructionMetadata &action_)
|
||||
: expression(&expression_), condition(&condition_), action(&action_){};
|
||||
MultipleInstructionMetadata(gd::InstructionMetadata &condition_,
|
||||
gd::InstructionMetadata &action_)
|
||||
: expression(nullptr), condition(&condition_), action(&action_){};
|
||||
|
||||
gd::ExpressionMetadata *expression;
|
||||
gd::InstructionMetadata *condition;
|
||||
|
@@ -261,41 +261,6 @@ ObjectMetadata::AddExpressionAndConditionAndAction(
|
||||
const gd::String& sentenceName,
|
||||
const gd::String& group,
|
||||
const gd::String& icon) {
|
||||
if (type != "number" && type != "string" && type != "boolean") {
|
||||
gd::LogError(
|
||||
"Unrecognised type passed to AddExpressionAndConditionAndAction: " +
|
||||
type + ". Verify this type is valid and supported.");
|
||||
}
|
||||
|
||||
gd::String conditionDescriptionTemplate =
|
||||
type == "boolean" ? _("Check if <subject>.") : _("Compare <subject>.");
|
||||
auto& condition =
|
||||
AddScopedCondition(name,
|
||||
fullname,
|
||||
conditionDescriptionTemplate.FindAndReplace(
|
||||
"<subject>", descriptionSubject),
|
||||
sentenceName,
|
||||
group,
|
||||
icon,
|
||||
icon);
|
||||
|
||||
gd::String actionDescriptionTemplate = type == "boolean"
|
||||
? _("Set (or unset) if <subject>.")
|
||||
: _("Change <subject>.");
|
||||
auto& action = AddScopedAction(
|
||||
"Set" + name,
|
||||
fullname,
|
||||
actionDescriptionTemplate.FindAndReplace("<subject>", descriptionSubject),
|
||||
sentenceName,
|
||||
group,
|
||||
icon,
|
||||
icon);
|
||||
|
||||
|
||||
if (type == "boolean") {
|
||||
return MultipleInstructionMetadata::WithConditionAndAction(condition, action);
|
||||
}
|
||||
|
||||
gd::String expressionDescriptionTemplate = _("Return <subject>.");
|
||||
auto& expression =
|
||||
type == "number"
|
||||
@@ -306,11 +271,32 @@ ObjectMetadata::AddExpressionAndConditionAndAction(
|
||||
group,
|
||||
icon)
|
||||
: AddStrExpression(name,
|
||||
fullname,
|
||||
expressionDescriptionTemplate.FindAndReplace(
|
||||
"<subject>", descriptionSubject),
|
||||
group,
|
||||
icon);
|
||||
fullname,
|
||||
expressionDescriptionTemplate.FindAndReplace(
|
||||
"<subject>", descriptionSubject),
|
||||
group,
|
||||
icon);
|
||||
|
||||
gd::String conditionDescriptionTemplate = _("Compare <subject>.");
|
||||
auto& condition =
|
||||
AddScopedCondition(name,
|
||||
fullname,
|
||||
conditionDescriptionTemplate.FindAndReplace(
|
||||
"<subject>", descriptionSubject),
|
||||
sentenceName,
|
||||
group,
|
||||
icon,
|
||||
icon);
|
||||
|
||||
gd::String actionDescriptionTemplate = _("Change <subject>.");
|
||||
auto& action = AddScopedAction(
|
||||
"Set" + name,
|
||||
fullname,
|
||||
actionDescriptionTemplate.FindAndReplace("<subject>", descriptionSubject),
|
||||
sentenceName,
|
||||
group,
|
||||
icon,
|
||||
icon);
|
||||
|
||||
return MultipleInstructionMetadata::WithExpressionAndConditionAndAction(
|
||||
expression, condition, action);
|
||||
|
@@ -7,7 +7,6 @@
|
||||
#define OBJECTMETADATA_H
|
||||
#include <functional>
|
||||
#include <map>
|
||||
#include <set>
|
||||
#include <memory>
|
||||
|
||||
#include "GDCore/Extensions/Metadata/ExpressionMetadata.h"
|
||||
@@ -201,48 +200,13 @@ class GD_CORE_API ObjectMetadata {
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Set the (user friendly) name of the group this object must
|
||||
* be categorised in.
|
||||
*/
|
||||
ObjectMetadata& SetCategoryFullName(const gd::String& categoryFullName_) {
|
||||
categoryFullName = categoryFullName_;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief The "capabilities" that are offered by the base object that are
|
||||
* *not* supported by this object, and should be hidden in the editor
|
||||
* inferface.
|
||||
*/
|
||||
const std::set<gd::String>& GetUnsupportedBaseObjectCapabilities() const {
|
||||
return unsupportedBaseObjectCapabilities;
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Add a "capability" that is offered by the base object that is *not*
|
||||
* supported by this object, and should be hidden in the editor inferface.
|
||||
*/
|
||||
ObjectMetadata& AddUnsupportedBaseObjectCapability(
|
||||
const gd::String& capability) {
|
||||
unsupportedBaseObjectCapabilities.insert(capability);
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Check if a "capability" that is offered by the base object is *not*
|
||||
* supported by this object, and should be hidden in the editor inferface.
|
||||
*/
|
||||
bool IsUnsupportedBaseObjectCapability(const gd::String& capability) const {
|
||||
return unsupportedBaseObjectCapabilities.find(capability) != unsupportedBaseObjectCapabilities.end();
|
||||
}
|
||||
|
||||
const gd::String& GetName() const { return name; }
|
||||
#if defined(GD_IDE_ONLY)
|
||||
const gd::String& GetFullName() const { return fullname; }
|
||||
const gd::String& GetCategoryFullName() const { return categoryFullName; }
|
||||
const gd::String& GetHelpUrl() const { return helpUrl; }
|
||||
const gd::String& GetDescription() const { return description; }
|
||||
const gd::String& GetIconFilename() const { return iconFilename; }
|
||||
#endif
|
||||
|
||||
/**
|
||||
* \brief Set the URL pointing to the help page about this object
|
||||
@@ -263,27 +227,7 @@ class GD_CORE_API ObjectMetadata {
|
||||
*/
|
||||
ObjectMetadata& AddIncludeFile(const gd::String& includeFile);
|
||||
|
||||
/**
|
||||
* \brief Return a reference to a map containing the names of the actions
|
||||
* (as keys) and the metadata associated with (as values).
|
||||
*/
|
||||
std::map<gd::String, gd::InstructionMetadata>& GetAllActions() { return actionsInfos; };
|
||||
|
||||
/**
|
||||
* \see gd::PlatformExtension::GetAllActions
|
||||
*/
|
||||
std::map<gd::String, gd::InstructionMetadata>& GetAllConditions() { return conditionsInfos; };
|
||||
|
||||
/**
|
||||
* \see gd::PlatformExtension::GetAllActions
|
||||
*/
|
||||
std::map<gd::String, gd::ExpressionMetadata>& GetAllExpressions() { return expressionsInfos; };
|
||||
|
||||
/**
|
||||
* \see gd::PlatformExtension::GetAllActions
|
||||
*/
|
||||
std::map<gd::String, gd::ExpressionMetadata>& GetAllStrExpressions() { return strExpressionsInfos; };
|
||||
|
||||
#if defined(GD_IDE_ONLY)
|
||||
std::map<gd::String, gd::InstructionMetadata> conditionsInfos;
|
||||
std::map<gd::String, gd::InstructionMetadata> actionsInfos;
|
||||
std::map<gd::String, gd::ExpressionMetadata> expressionsInfos;
|
||||
@@ -291,19 +235,19 @@ class GD_CORE_API ObjectMetadata {
|
||||
|
||||
std::vector<gd::String> includeFiles;
|
||||
gd::String className;
|
||||
#endif
|
||||
CreateFunPtr createFunPtr;
|
||||
|
||||
private:
|
||||
gd::String extensionNamespace;
|
||||
gd::String name;
|
||||
gd::String helpPath;
|
||||
#if defined(GD_IDE_ONLY)
|
||||
gd::String helpUrl; ///< Deprecated. Use helpPath instead.
|
||||
gd::String fullname;
|
||||
gd::String description;
|
||||
gd::String iconFilename;
|
||||
gd::String categoryFullName;
|
||||
std::set<gd::String> unsupportedBaseObjectCapabilities;
|
||||
|
||||
#endif
|
||||
std::shared_ptr<gd::Object>
|
||||
blueprintObject; ///< The "blueprint" object to be copied when a new
|
||||
///< object is asked. Can be null in case a creation
|
||||
|
@@ -9,7 +9,6 @@
|
||||
#if defined(GD_IDE_ONLY)
|
||||
#include <map>
|
||||
#include <memory>
|
||||
|
||||
#include "GDCore/String.h"
|
||||
namespace gd {
|
||||
class Project;
|
||||
@@ -152,16 +151,15 @@ class GD_CORE_API ParameterMetadata {
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Return true if the type of the parameter is representing one object
|
||||
* (or more, i.e: an object group).
|
||||
* \brief Return true if the type of the parameter is "object", "objectPtr" or
|
||||
* "objectList".
|
||||
*
|
||||
* \see gd::ParameterMetadata::GetType
|
||||
*/
|
||||
static bool IsObject(const gd::String ¶meterType) {
|
||||
return parameterType == "object" || parameterType == "objectPtr" ||
|
||||
parameterType == "objectList" ||
|
||||
parameterType == "objectListOrEmptyIfJustDeclared" ||
|
||||
parameterType == "objectListOrEmptyWithoutPicking";
|
||||
parameterType == "objectListWithoutPicking";
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -196,10 +194,7 @@ class GD_CORE_API ParameterMetadata {
|
||||
parameterType == "objectEffectName" ||
|
||||
parameterType == "objectEffectParameterName" ||
|
||||
parameterType == "objectPointName" ||
|
||||
parameterType == "objectAnimationName" ||
|
||||
parameterType == "functionParameterName" ||
|
||||
parameterType == "externalLayoutName" ||
|
||||
parameterType == "leaderboardId";
|
||||
parameterType == "objectAnimationName";
|
||||
} else if (type == "variable") {
|
||||
return parameterType == "objectvar" || parameterType == "globalvar" ||
|
||||
parameterType == "scenevar";
|
||||
|
@@ -4,7 +4,6 @@
|
||||
* reserved. This project is released under the MIT License.
|
||||
*/
|
||||
#include "Platform.h"
|
||||
|
||||
#include "GDCore/Extensions/PlatformExtension.h"
|
||||
#include "GDCore/Project/Object.h"
|
||||
#include "GDCore/String.h"
|
||||
@@ -15,21 +14,16 @@ using namespace std;
|
||||
|
||||
namespace gd {
|
||||
|
||||
InstructionOrExpressionGroupMetadata
|
||||
Platform::badInstructionOrExpressionGroupMetadata;
|
||||
|
||||
Platform::Platform() : enableExtensionLoadingLogs(false) {}
|
||||
Platform::Platform(): enableExtensionLoadingLogs(false) {}
|
||||
|
||||
Platform::~Platform() {}
|
||||
|
||||
bool Platform::AddExtension(std::shared_ptr<gd::PlatformExtension> extension) {
|
||||
if (!extension) return false;
|
||||
|
||||
if (enableExtensionLoadingLogs)
|
||||
std::cout << "Loading " << extension->GetName() << "...";
|
||||
if (enableExtensionLoadingLogs) std::cout << "Loading " << extension->GetName() << "...";
|
||||
if (IsExtensionLoaded(extension->GetName())) {
|
||||
if (enableExtensionLoadingLogs)
|
||||
std::cout << " (replacing existing extension)";
|
||||
if (enableExtensionLoadingLogs) std::cout << " (replacing existing extension)";
|
||||
RemoveExtension(extension->GetName());
|
||||
}
|
||||
if (enableExtensionLoadingLogs) std::cout << std::endl;
|
||||
@@ -44,11 +38,6 @@ bool Platform::AddExtension(std::shared_ptr<gd::PlatformExtension> extension) {
|
||||
extension->GetObjectCreationFunctionPtr(objectsTypes[i]);
|
||||
}
|
||||
|
||||
for (const auto& it :
|
||||
extension->GetAllInstructionOrExpressionGroupMetadata()) {
|
||||
instructionOrExpressionGroupMetadata[it.first] = it.second;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@@ -9,9 +9,8 @@
|
||||
#include <map>
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
|
||||
#include "GDCore/Extensions/Metadata/InstructionOrExpressionGroupMetadata.h"
|
||||
#include "GDCore/String.h"
|
||||
|
||||
namespace gd {
|
||||
class InstructionsMetadataHolder;
|
||||
class Project;
|
||||
@@ -53,6 +52,7 @@ class GD_CORE_API Platform {
|
||||
*/
|
||||
virtual gd::String GetFullName() const { return "Unnamed platform"; }
|
||||
|
||||
#if defined(GD_IDE_ONLY)
|
||||
/**
|
||||
* \brief Must return a text describing the platform in a few words.
|
||||
*/
|
||||
@@ -67,6 +67,7 @@ class GD_CORE_API Platform {
|
||||
* \brief Must return a filename to a 32*32 image file for the platform.
|
||||
*/
|
||||
virtual gd::String GetIcon() const { return ""; }
|
||||
#endif
|
||||
|
||||
/** \name Extensions management
|
||||
* Member functions used to manage the extensions
|
||||
@@ -122,19 +123,6 @@ class GD_CORE_API Platform {
|
||||
* anymore.
|
||||
*/
|
||||
virtual void RemoveExtension(const gd::String& name);
|
||||
|
||||
/**
|
||||
* \brief Get the metadata (icon, etc...) of a group used for instructions or
|
||||
* expressions.
|
||||
*/
|
||||
const InstructionOrExpressionGroupMetadata& GetInstructionOrExpressionGroupMetadata(
|
||||
const gd::String& name) const {
|
||||
auto it = instructionOrExpressionGroupMetadata.find(name);
|
||||
if (it == instructionOrExpressionGroupMetadata.end())
|
||||
return badInstructionOrExpressionGroupMetadata;
|
||||
|
||||
return it->second;
|
||||
}
|
||||
///@}
|
||||
|
||||
/** \name Factory method
|
||||
@@ -149,6 +137,7 @@ class GD_CORE_API Platform {
|
||||
std::unique_ptr<gd::Object> CreateObject(gd::String type,
|
||||
const gd::String& name) const;
|
||||
|
||||
#if defined(GD_IDE_ONLY)
|
||||
/**
|
||||
* \brief Create an event of given type
|
||||
*/
|
||||
@@ -160,18 +149,28 @@ class GD_CORE_API Platform {
|
||||
* \brief Activate or disable the logs on the standard output when
|
||||
* loading an extension.
|
||||
*/
|
||||
void EnableExtensionLoadingLogs(bool enable) {
|
||||
enableExtensionLoadingLogs = enable;
|
||||
};
|
||||
void EnableExtensionLoadingLogs(bool enable) { enableExtensionLoadingLogs = enable; };
|
||||
|
||||
/**
|
||||
* \brief Called when the IDE is about to shut down: Take this opportunity for
|
||||
* erasing for example any temporary file.
|
||||
* @deprecated This should be removed.
|
||||
*/
|
||||
virtual void OnIDEClosed(){};
|
||||
|
||||
/**
|
||||
* \brief Called when the IDE is initialized and ready to be used.
|
||||
* @deprecated This should be removed.
|
||||
*/
|
||||
virtual void OnIDEInitialized(){};
|
||||
|
||||
#endif
|
||||
|
||||
private:
|
||||
std::vector<std::shared_ptr<PlatformExtension>>
|
||||
extensionsLoaded; ///< Extensions of the platform
|
||||
std::map<gd::String, CreateFunPtr>
|
||||
creationFunctionTable; ///< Creation functions for objects
|
||||
std::map<gd::String, InstructionOrExpressionGroupMetadata>
|
||||
instructionOrExpressionGroupMetadata;
|
||||
static InstructionOrExpressionGroupMetadata badInstructionOrExpressionGroupMetadata;
|
||||
bool enableExtensionLoadingLogs;
|
||||
};
|
||||
|
||||
|
@@ -165,40 +165,6 @@ PlatformExtension::AddExpressionAndConditionAndAction(
|
||||
const gd::String& sentenceName,
|
||||
const gd::String& group,
|
||||
const gd::String& icon) {
|
||||
if (type != "number" && type != "string" && type != "boolean") {
|
||||
gd::LogError(
|
||||
"Unrecognised type passed to AddExpressionAndConditionAndAction: " +
|
||||
type + ". Verify this type is valid and supported.");
|
||||
}
|
||||
|
||||
gd::String conditionDescriptionTemplate =
|
||||
type == "boolean" ? _("Check if <subject>.") : _("Compare <subject>.");
|
||||
auto& condition = AddCondition(name,
|
||||
fullname,
|
||||
conditionDescriptionTemplate.FindAndReplace(
|
||||
"<subject>", descriptionSubject),
|
||||
sentenceName,
|
||||
group,
|
||||
icon,
|
||||
icon);
|
||||
|
||||
gd::String actionDescriptionTemplate = type == "boolean"
|
||||
? _("Set (or unset) if <subject>.")
|
||||
: _("Change <subject>.");
|
||||
auto& action = AddAction(
|
||||
"Set" + name,
|
||||
fullname,
|
||||
actionDescriptionTemplate.FindAndReplace("<subject>", descriptionSubject),
|
||||
sentenceName,
|
||||
group,
|
||||
icon,
|
||||
icon);
|
||||
|
||||
if (type == "boolean") {
|
||||
return MultipleInstructionMetadata::WithConditionAndAction(condition,
|
||||
action);
|
||||
}
|
||||
|
||||
gd::String expressionDescriptionTemplate = _("Return <subject>.");
|
||||
auto& expression =
|
||||
type == "number"
|
||||
@@ -209,11 +175,32 @@ PlatformExtension::AddExpressionAndConditionAndAction(
|
||||
group,
|
||||
icon)
|
||||
: AddStrExpression(name,
|
||||
fullname,
|
||||
expressionDescriptionTemplate.FindAndReplace(
|
||||
"<subject>", descriptionSubject),
|
||||
group,
|
||||
icon);
|
||||
fullname,
|
||||
expressionDescriptionTemplate.FindAndReplace(
|
||||
"<subject>", descriptionSubject),
|
||||
group,
|
||||
icon);
|
||||
|
||||
gd::String conditionDescriptionTemplate = _("Compare <subject>.");
|
||||
auto& condition = AddCondition(name,
|
||||
fullname,
|
||||
conditionDescriptionTemplate.FindAndReplace(
|
||||
"<subject>", descriptionSubject),
|
||||
sentenceName,
|
||||
group,
|
||||
icon,
|
||||
icon);
|
||||
|
||||
// TODO: update the checks
|
||||
gd::String actionDescriptionTemplate = _("Change <subject>.");
|
||||
auto& action = AddAction(
|
||||
"Set" + name,
|
||||
fullname,
|
||||
actionDescriptionTemplate.FindAndReplace("<subject>", descriptionSubject),
|
||||
sentenceName,
|
||||
group,
|
||||
icon,
|
||||
icon);
|
||||
|
||||
return MultipleInstructionMetadata::WithExpressionAndConditionAndAction(
|
||||
expression, condition, action);
|
||||
@@ -385,13 +372,9 @@ gd::InstructionMetadata& PlatformExtension::AddDuplicatedAction(
|
||||
}
|
||||
|
||||
gd::InstructionMetadata& PlatformExtension::AddDuplicatedCondition(
|
||||
const gd::String& newConditionName,
|
||||
const gd::String& copiedConditionName,
|
||||
gd::DuplicatedInstructionOptions options) {
|
||||
gd::String newNameWithNamespace =
|
||||
(options.unscoped ? "" : GetNameSpace()) + newConditionName;
|
||||
gd::String copiedNameWithNamespace =
|
||||
(options.unscoped ? "" : GetNameSpace()) + copiedConditionName;
|
||||
const gd::String& newConditionName, const gd::String& copiedConditionName) {
|
||||
gd::String newNameWithNamespace = GetNameSpace() + newConditionName;
|
||||
gd::String copiedNameWithNamespace = GetNameSpace() + copiedConditionName;
|
||||
|
||||
auto copiedCondition = conditionsInfos.find(copiedNameWithNamespace);
|
||||
if (copiedCondition == conditionsInfos.end()) {
|
||||
@@ -529,8 +512,7 @@ PlatformExtension::GetAllStrExpressionsForBehavior(gd::String autoType) {
|
||||
return badExpressionsMetadata;
|
||||
}
|
||||
|
||||
gd::BaseEventSPtr PlatformExtension::CreateEvent(
|
||||
const gd::String& eventType) const {
|
||||
gd::BaseEventSPtr PlatformExtension::CreateEvent(const gd::String& eventType) const {
|
||||
if (eventsInfos.find(eventType) != eventsInfos.end()) {
|
||||
if (eventsInfos.find(eventType)->second.instance ==
|
||||
std::shared_ptr<BaseEvent>()) {
|
||||
@@ -772,8 +754,7 @@ void PlatformExtension::StripUnimplementedInstructionsAndExpressions() {
|
||||
}
|
||||
#endif
|
||||
|
||||
PlatformExtension::PlatformExtension()
|
||||
: deprecated(false), category(_("General")) {}
|
||||
PlatformExtension::PlatformExtension() : deprecated(false) {}
|
||||
|
||||
PlatformExtension::~PlatformExtension() {}
|
||||
|
||||
|
@@ -5,7 +5,8 @@
|
||||
* project is released under the MIT License.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#ifndef GDCORE_PLATFORMEXTENSION_H
|
||||
#define GDCORE_PLATFORMEXTENSION_H
|
||||
#include <map>
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
@@ -15,7 +16,6 @@
|
||||
#include "GDCore/Extensions/Metadata/DependencyMetadata.h"
|
||||
#include "GDCore/Extensions/Metadata/EffectMetadata.h"
|
||||
#include "GDCore/Extensions/Metadata/EventMetadata.h"
|
||||
#include "GDCore/Extensions/Metadata/InstructionOrExpressionGroupMetadata.h"
|
||||
#include "GDCore/Extensions/Metadata/ObjectMetadata.h"
|
||||
#include "GDCore/Project/PropertyDescriptor.h"
|
||||
#include "GDCore/String.h"
|
||||
@@ -71,10 +71,6 @@ class GD_CORE_API CompilationInfo {
|
||||
int sizeOfpInt;
|
||||
};
|
||||
|
||||
struct GD_CORE_API DuplicatedInstructionOptions {
|
||||
bool unscoped;
|
||||
};
|
||||
|
||||
/**
|
||||
* \brief Base class for implementing platform's extensions.
|
||||
*
|
||||
@@ -109,18 +105,10 @@ class GD_CORE_API PlatformExtension {
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Set the category of the extension.
|
||||
*/
|
||||
PlatformExtension& SetCategory(const gd::String& category_) {
|
||||
category = category_;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Set the path to the help, relative to the GDevelop documentation
|
||||
* root. For example, "/all-features/collisions" for
|
||||
* "https://wiki.gdevelop.io/gdevelop5/all-features/collisions".
|
||||
* "http://wiki.compilgames.net/doku.php/gdevelop5/all-features/collisions".
|
||||
*
|
||||
* The instructions, objects and behaviors will have this help path set by
|
||||
* default, unless you call SetHelpPath on them.
|
||||
@@ -283,6 +271,7 @@ class GD_CORE_API PlatformExtension {
|
||||
const gd::String& smallicon_,
|
||||
std::shared_ptr<gd::BaseEvent> instance);
|
||||
|
||||
#if defined(GD_IDE_ONLY)
|
||||
/**
|
||||
* \brief Create a new action which is the duplicate of the specified one.
|
||||
*
|
||||
@@ -299,8 +288,7 @@ class GD_CORE_API PlatformExtension {
|
||||
*/
|
||||
gd::InstructionMetadata& AddDuplicatedCondition(
|
||||
const gd::String& newConditionName,
|
||||
const gd::String& copiedConditionName,
|
||||
gd::DuplicatedInstructionOptions options = {.unscoped = false});
|
||||
const gd::String& copiedConditionName);
|
||||
/**
|
||||
* \brief Create a new expression which is the duplicate of the specified one.
|
||||
*
|
||||
@@ -327,15 +315,7 @@ class GD_CORE_API PlatformExtension {
|
||||
gd::PropertyDescriptor& RegisterProperty(const gd::String& name) {
|
||||
return extensionPropertiesMetadata[name];
|
||||
};
|
||||
|
||||
/**
|
||||
* \brief Add some metadata (icon, etc...) for a group used for instructions
|
||||
* or expressions.
|
||||
*/
|
||||
InstructionOrExpressionGroupMetadata& AddInstructionOrExpressionGroupMetadata(
|
||||
const gd::String& name) {
|
||||
return instructionOrExpressionGroupMetadata[name];
|
||||
}
|
||||
#endif
|
||||
|
||||
/**
|
||||
* \brief Delete all instructions having no function name or custom code
|
||||
@@ -359,11 +339,6 @@ class GD_CORE_API PlatformExtension {
|
||||
*/
|
||||
const gd::String& GetName() const { return name; }
|
||||
|
||||
/**
|
||||
* \brief Return the category of the extension
|
||||
*/
|
||||
const gd::String& GetCategory() const { return category; }
|
||||
|
||||
/**
|
||||
* \brief Return a description of the extension
|
||||
*/
|
||||
@@ -477,6 +452,7 @@ class GD_CORE_API PlatformExtension {
|
||||
*/
|
||||
std::map<gd::String, gd::EventMetadata>& GetAllEvents();
|
||||
|
||||
#if defined(GD_IDE_ONLY)
|
||||
/**
|
||||
* \brief Return a reference to a map containing the names of the actions
|
||||
* (as keys) and the metadata associated with (as values).
|
||||
@@ -561,16 +537,8 @@ class GD_CORE_API PlatformExtension {
|
||||
std::map<gd::String, gd::PropertyDescriptor>& GetAllProperties() {
|
||||
return extensionPropertiesMetadata;
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Get the metadata (icon, etc...) for groups used for instructions
|
||||
* or expressions.
|
||||
*/
|
||||
const std::map<gd::String, InstructionOrExpressionGroupMetadata>&
|
||||
GetAllInstructionOrExpressionGroupMetadata() const {
|
||||
return instructionOrExpressionGroupMetadata;
|
||||
}
|
||||
///@}
|
||||
#endif
|
||||
|
||||
/**
|
||||
* \brief Return the name of all the extensions which are considered provided
|
||||
@@ -598,7 +566,6 @@ class GD_CORE_API PlatformExtension {
|
||||
///< actions/conditions/expressions/objects/behavior/event.
|
||||
gd::String fullname; ///< Name displayed to users in the editor.
|
||||
gd::String informations; ///< Description displayed to users in the editor.
|
||||
gd::String category;
|
||||
gd::String author; ///< Author displayed to users in the editor.
|
||||
gd::String license; ///< License name displayed to users in the editor.
|
||||
bool deprecated; ///< true if the extension is deprecated and shouldn't be
|
||||
@@ -610,6 +577,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;
|
||||
std::map<gd::String, gd::ExpressionMetadata> expressionsInfos;
|
||||
@@ -617,12 +585,12 @@ class GD_CORE_API PlatformExtension {
|
||||
std::vector<gd::DependencyMetadata> extensionDependenciesMetadata;
|
||||
std::map<gd::String, gd::EventMetadata> eventsInfos;
|
||||
std::map<gd::String, gd::PropertyDescriptor> extensionPropertiesMetadata;
|
||||
std::map<gd::String, InstructionOrExpressionGroupMetadata>
|
||||
instructionOrExpressionGroupMetadata;
|
||||
#endif
|
||||
|
||||
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
|
||||
///< extension
|
||||
@@ -632,10 +600,12 @@ class GD_CORE_API PlatformExtension {
|
||||
static std::map<gd::String, gd::ExpressionMetadata>
|
||||
badExpressionsMetadata; ///< Used when an expression is not found in the
|
||||
///< extension
|
||||
#endif
|
||||
};
|
||||
|
||||
} // namespace gd
|
||||
|
||||
#if defined(GD_IDE_ONLY)
|
||||
/** \brief Macro used by extensions in their constructor to declare how they
|
||||
* have been compiled. \see gd::CompilationInfo
|
||||
*/
|
||||
@@ -649,5 +619,23 @@ class GD_CORE_API PlatformExtension {
|
||||
compilationInfo.gccMinorVersion = __GNUC_MINOR__; \
|
||||
compilationInfo.gccPatchLevel = __GNUC_PATCHLEVEL__; \
|
||||
compilationInfo.informationCompleted = true;
|
||||
#else
|
||||
/** \brief Macro used by extensions in their constructor to declare how they
|
||||
* have been compiled. \see gd::CompilationInfo
|
||||
*/
|
||||
#define GD_COMPLETE_EXTENSION_COMPILATION_INFORMATION() \
|
||||
compilationInfo.runtimeOnly = true; \
|
||||
compilationInfo.sfmlMajorVersion = 2; \
|
||||
compilationInfo.sfmlMinorVersion = 0; \
|
||||
compilationInfo.gdCoreVersion = GD_VERSION_STRING; \
|
||||
compilationInfo.sizeOfpInt = sizeof(int*); \
|
||||
compilationInfo.gccMajorVersion = __GNUC__; \
|
||||
compilationInfo.gccMinorVersion = __GNUC_MINOR__; \
|
||||
compilationInfo.gccPatchLevel = __GNUC_PATCHLEVEL__; \
|
||||
compilationInfo.informationCompleted = true;
|
||||
|
||||
#endif
|
||||
|
||||
#include "GDCore/Extensions/PlatformExtension.inl"
|
||||
|
||||
#endif // GDCORE_PLATFORMEXTENSION_H
|
||||
|
@@ -19,34 +19,4 @@ class GD_CORE_API EventsListUnfolder {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void FoldAll(gd::EventsList& list) {
|
||||
for (size_t i = 0; i < list.size(); ++i) {
|
||||
gd::BaseEvent& event = list[i];
|
||||
event.SetFolded(true);
|
||||
if (event.CanHaveSubEvents() && event.GetSubEvents().size() > 0) {
|
||||
FoldAll(event.GetSubEvents());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Recursively unfold all the events until a certain level of depth.
|
||||
* 0 is the top level. If you want to unfold all events regardless of its depth,
|
||||
* use `maxLevel = -1`. `currentLevel` is used for the recursion.
|
||||
*/
|
||||
static void UnfoldToLevel(gd::EventsList& list,
|
||||
const int8_t maxLevel,
|
||||
const std::size_t currentLevel = 0) {
|
||||
if (maxLevel >= 0 && currentLevel > maxLevel) return;
|
||||
|
||||
for (size_t i = 0; i < list.size(); ++i) {
|
||||
gd::BaseEvent& event = list[i];
|
||||
event.SetFolded(false);
|
||||
if (event.CanHaveSubEvents() && event.GetSubEvents().size() > 0 &&
|
||||
(maxLevel == -1 || currentLevel <= maxLevel)) {
|
||||
UnfoldToLevel(event.GetSubEvents(), maxLevel, currentLevel + 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@@ -1,27 +0,0 @@
|
||||
#include "GDCore/IDE/Events/EventsPositionFinder.h"
|
||||
|
||||
#include <map>
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
|
||||
#include "GDCore/Events/Event.h"
|
||||
#include "GDCore/Events/EventsList.h"
|
||||
#include "GDCore/String.h"
|
||||
|
||||
namespace gd {
|
||||
class BaseEvent;
|
||||
class EventsList;
|
||||
} // namespace gd
|
||||
|
||||
namespace gd {
|
||||
bool EventsPositionFinder::DoVisitEvent(gd::BaseEvent& event) {
|
||||
auto it = std::find(searchedEvents.begin(), searchedEvents.end(), &event);
|
||||
if (it != searchedEvents.end()) {
|
||||
positions[it - searchedEvents.begin()] = index;
|
||||
}
|
||||
index++;
|
||||
return false;
|
||||
}
|
||||
EventsPositionFinder::~EventsPositionFinder() {}
|
||||
|
||||
} // namespace gd
|
@@ -1,48 +0,0 @@
|
||||
#ifndef EventsPositionFinder_H
|
||||
#define EventsPositionFinder_H
|
||||
#include "GDCore/Events/EventsList.h"
|
||||
#include "GDCore/IDE/Events/ArbitraryEventsWorker.h"
|
||||
#include "GDCore/String.h"
|
||||
|
||||
namespace gd {
|
||||
class BaseEvent;
|
||||
class EventsList;
|
||||
} // namespace gd
|
||||
|
||||
namespace gd {
|
||||
|
||||
/**
|
||||
* \brief Scans an event list to retrieve the position of a list of searched
|
||||
* events when the events list is flattened.
|
||||
*
|
||||
* \ingroup IDE
|
||||
*/
|
||||
class GD_CORE_API EventsPositionFinder : public ArbitraryEventsWorker {
|
||||
public:
|
||||
EventsPositionFinder() : index(0){};
|
||||
virtual ~EventsPositionFinder();
|
||||
|
||||
/**
|
||||
* Return the positions of all searched events
|
||||
*/
|
||||
const std::vector<std::size_t>& GetPositions() const { return positions; }
|
||||
|
||||
/**
|
||||
* Add an event for which the position must be reported in `GetPositions`.
|
||||
*/
|
||||
void AddEventToSearch(gd::BaseEvent* event) {
|
||||
searchedEvents.push_back(event);
|
||||
positions.push_back(gd::String::npos);
|
||||
}
|
||||
|
||||
private:
|
||||
bool DoVisitEvent(gd::BaseEvent& event) override;
|
||||
|
||||
std::vector<gd::BaseEvent*> searchedEvents;
|
||||
std::vector<std::size_t> positions;
|
||||
std::size_t index;
|
||||
};
|
||||
|
||||
} // namespace gd
|
||||
|
||||
#endif // EventsPositionFinder_H
|
@@ -542,8 +542,7 @@ void EventsRefactorer::ReplaceStringInEvents(gd::ObjectsContainer& project,
|
||||
gd::String newString,
|
||||
bool matchCase,
|
||||
bool inConditions,
|
||||
bool inActions,
|
||||
bool inEventStrings) {
|
||||
bool inActions) {
|
||||
for (std::size_t i = 0; i < events.size(); ++i) {
|
||||
if (inConditions) {
|
||||
vector<gd::InstructionsList*> conditionsVectors =
|
||||
@@ -572,11 +571,6 @@ void EventsRefactorer::ReplaceStringInEvents(gd::ObjectsContainer& project,
|
||||
}
|
||||
}
|
||||
|
||||
if (inEventStrings) {
|
||||
bool eventStringModified = ReplaceStringInEventSearchableStrings(
|
||||
project, layout, events[i], toReplace, newString, matchCase);
|
||||
}
|
||||
|
||||
if (events[i].CanHaveSubEvents())
|
||||
ReplaceStringInEvents(project,
|
||||
layout,
|
||||
@@ -585,8 +579,7 @@ void EventsRefactorer::ReplaceStringInEvents(gd::ObjectsContainer& project,
|
||||
newString,
|
||||
matchCase,
|
||||
inConditions,
|
||||
inActions,
|
||||
inEventStrings);
|
||||
inActions);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -684,29 +677,6 @@ bool EventsRefactorer::ReplaceStringInConditions(
|
||||
return somethingModified;
|
||||
}
|
||||
|
||||
bool EventsRefactorer::ReplaceStringInEventSearchableStrings(
|
||||
gd::ObjectsContainer& project,
|
||||
gd::ObjectsContainer& layout,
|
||||
gd::BaseEvent& event,
|
||||
gd::String toReplace,
|
||||
gd::String newString,
|
||||
bool matchCase) {
|
||||
vector<gd::String> newEventStrings;
|
||||
vector<gd::String> stringEvent = event.GetAllSearchableStrings();
|
||||
|
||||
for (std::size_t sNb = 0; sNb < stringEvent.size(); ++sNb) {
|
||||
gd::String newStringEvent =
|
||||
matchCase ? stringEvent[sNb].FindAndReplace(toReplace, newString, true)
|
||||
: ReplaceAllOccurencesCaseUnsensitive(
|
||||
stringEvent[sNb], toReplace, newString);
|
||||
newEventStrings.push_back(newStringEvent);
|
||||
}
|
||||
|
||||
bool somethingModified = event.ReplaceAllSearchableStrings(newEventStrings);
|
||||
|
||||
return somethingModified;
|
||||
}
|
||||
|
||||
vector<EventsSearchResult> EventsRefactorer::SearchInEvents(
|
||||
const gd::Platform& platform,
|
||||
gd::EventsList& events,
|
||||
|
@@ -117,8 +117,7 @@ class GD_CORE_API EventsRefactorer {
|
||||
gd::String newString,
|
||||
bool matchCase,
|
||||
bool inConditions,
|
||||
bool inActions,
|
||||
bool inEventString);
|
||||
bool inActions);
|
||||
|
||||
virtual ~EventsRefactorer(){};
|
||||
|
||||
@@ -209,20 +208,6 @@ class GD_CORE_API EventsRefactorer {
|
||||
gd::String newString,
|
||||
bool matchCase);
|
||||
|
||||
/**
|
||||
* Replace all occurrences of a gd::String in strings of events (for example:
|
||||
* comments and name of groups).
|
||||
*
|
||||
* \return true if something was modified.
|
||||
*/
|
||||
static bool ReplaceStringInEventSearchableStrings(
|
||||
gd::ObjectsContainer& project,
|
||||
gd::ObjectsContainer& layout,
|
||||
gd::BaseEvent& event,
|
||||
gd::String toReplace,
|
||||
gd::String newString,
|
||||
bool matchCase);
|
||||
|
||||
static bool SearchStringInFormattedText(const gd::Platform& platform,
|
||||
gd::Instruction& instruction,
|
||||
gd::String search,
|
||||
|
@@ -95,7 +95,7 @@ class GD_CORE_API ExpressionParameterMover
|
||||
// Move parameter of an object function
|
||||
const gd::String& thisObjectType = gd::GetTypeOfObject(
|
||||
globalObjectsContainer, objectsContainer, node.objectName);
|
||||
if (thisObjectType == objectType) {
|
||||
if (thisObjectType == behaviorType) {
|
||||
moveParameter(node.parameters);
|
||||
hasDoneMoving = true;
|
||||
}
|
||||
|
@@ -33,4 +33,11 @@ gd::Platform* PlatformManager::GetPlatform(
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void PlatformManager::NotifyPlatformIDEInitialized() const {
|
||||
for (std::size_t i = 0; i < platformsLoaded.size(); ++i) {
|
||||
if (platformsLoaded[i] != std::shared_ptr<gd::Platform>())
|
||||
platformsLoaded[i]->OnIDEInitialized();
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace gd
|
||||
|
@@ -43,6 +43,12 @@ class GD_CORE_API PlatformManager {
|
||||
return platformsLoaded;
|
||||
};
|
||||
|
||||
/**
|
||||
* \brief Notify each platform that the IDE is ready, by calling their
|
||||
* OnIDEInitialized member function.
|
||||
*/
|
||||
void NotifyPlatformIDEInitialized() const;
|
||||
|
||||
static PlatformManager *Get() {
|
||||
if (NULL == _singleton) {
|
||||
_singleton = new PlatformManager;
|
||||
@@ -59,6 +65,11 @@ class GD_CORE_API PlatformManager {
|
||||
*/
|
||||
static void DestroySingleton() {
|
||||
if (NULL != _singleton) {
|
||||
for (std::size_t i = 0; i < _singleton->platformsLoaded.size(); ++i) {
|
||||
if (_singleton->platformsLoaded[i] != std::shared_ptr<gd::Platform>())
|
||||
_singleton->platformsLoaded[i]->OnIDEClosed();
|
||||
}
|
||||
|
||||
delete _singleton;
|
||||
_singleton = NULL;
|
||||
}
|
||||
|
@@ -117,16 +117,6 @@ void EffectsContainer::SwapEffects(std::size_t firstEffectIndex,
|
||||
effects[secondEffectIndex] = temp;
|
||||
}
|
||||
|
||||
void EffectsContainer::MoveEffect(std::size_t oldIndex, std::size_t newIndex) {
|
||||
if (oldIndex >= effects.size() || newIndex >= effects.size() ||
|
||||
newIndex == oldIndex)
|
||||
return;
|
||||
|
||||
auto effect = effects[oldIndex];
|
||||
effects.erase(effects.begin() + oldIndex);
|
||||
effects.insert(effects.begin() + newIndex, effect);
|
||||
}
|
||||
|
||||
void EffectsContainer::SerializeTo(SerializerElement& element) const {
|
||||
element.ConsiderAsArrayOf("effect");
|
||||
for (std::size_t i = 0; i < GetEffectsCount(); ++i) {
|
||||
|
@@ -7,7 +7,6 @@
|
||||
#define GDCORE_EFFECTS_CONTAINER_H
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
#include <algorithm>
|
||||
|
||||
#include "GDCore/String.h"
|
||||
|
||||
@@ -90,11 +89,6 @@ class GD_CORE_API EffectsContainer {
|
||||
*/
|
||||
void RemoveEffect(const gd::String& name);
|
||||
|
||||
/**
|
||||
* \brief Move the specified effect at a new position in the list.
|
||||
*/
|
||||
void MoveEffect(std::size_t oldIndex, std::size_t newIndex);
|
||||
|
||||
/**
|
||||
* Swap the position of two effects.
|
||||
*/
|
||||
|
@@ -3,6 +3,7 @@
|
||||
* Copyright 2008-2016 Florian Rival (Florian.Rival@gmail.com). All rights
|
||||
* reserved. This project is released under the MIT License.
|
||||
*/
|
||||
#if defined(GD_IDE_ONLY)
|
||||
#include "EventsFunctionsExtension.h"
|
||||
|
||||
#include "EventsBasedBehavior.h"
|
||||
@@ -33,7 +34,6 @@ void EventsFunctionsExtension::Init(const gd::EventsFunctionsExtension& other) {
|
||||
description = other.description;
|
||||
name = other.name;
|
||||
fullName = other.fullName;
|
||||
category = other.category;
|
||||
tags = other.tags;
|
||||
author = other.author;
|
||||
authorIds = other.authorIds;
|
||||
@@ -51,12 +51,6 @@ void EventsFunctionsExtension::SerializeTo(SerializerElement& element) const {
|
||||
element.SetAttribute("description", description);
|
||||
element.SetAttribute("name", name);
|
||||
element.SetAttribute("fullName", fullName);
|
||||
element.SetAttribute("category", category);
|
||||
if (!originName.empty() || !originIdentifier.empty()) {
|
||||
element.AddChild("origin")
|
||||
.SetAttribute("name", originName)
|
||||
.SetAttribute("identifier", originIdentifier);
|
||||
}
|
||||
auto& tagsElement = element.AddChild("tags");
|
||||
tagsElement.ConsiderAsArray();
|
||||
for (const auto& tag : tags) {
|
||||
@@ -89,20 +83,11 @@ void EventsFunctionsExtension::UnserializeFrom(
|
||||
description = element.GetStringAttribute("description");
|
||||
name = element.GetStringAttribute("name");
|
||||
fullName = element.GetStringAttribute("fullName");
|
||||
category = element.GetStringAttribute("category");
|
||||
author = element.GetStringAttribute("author");
|
||||
previewIconUrl = element.GetStringAttribute("previewIconUrl");
|
||||
iconUrl = element.GetStringAttribute("iconUrl");
|
||||
helpPath = element.GetStringAttribute("helpPath");
|
||||
|
||||
if (element.HasChild("origin")) {
|
||||
gd::String originName =
|
||||
element.GetChild("origin").GetStringAttribute("name", "");
|
||||
gd::String originIdentifier =
|
||||
element.GetChild("origin").GetStringAttribute("identifier", "");
|
||||
SetOrigin(originName, originIdentifier);
|
||||
}
|
||||
|
||||
tags.clear();
|
||||
auto& tagsElement = element.GetChild("tags");
|
||||
if (!tagsElement.IsValueUndefined()) {
|
||||
@@ -153,3 +138,5 @@ bool EventsFunctionsExtension::IsExtensionLifecycleEventsFunction(
|
||||
}
|
||||
|
||||
} // namespace gd
|
||||
|
||||
#endif
|
||||
|
@@ -3,6 +3,7 @@
|
||||
* Copyright 2008-2016 Florian Rival (Florian.Rival@gmail.com). All rights
|
||||
* reserved. This project is released under the MIT License.
|
||||
*/
|
||||
#if defined(GD_IDE_ONLY)
|
||||
#ifndef GDCORE_EVENTSFUNCTIONEXTENSION_H
|
||||
#define GDCORE_EVENTSFUNCTIONEXTENSION_H
|
||||
|
||||
@@ -84,12 +85,6 @@ class GD_CORE_API EventsFunctionsExtension : public EventsFunctionsContainer {
|
||||
return *this;
|
||||
}
|
||||
|
||||
const gd::String& GetCategory() const { return category; };
|
||||
EventsFunctionsExtension& SetCategory(const gd::String& category_) {
|
||||
category = category_;
|
||||
return *this;
|
||||
}
|
||||
|
||||
const std::vector<gd::String>& GetTags() const { return tags; };
|
||||
std::vector<gd::String>& GetTags() { return tags; };
|
||||
|
||||
@@ -145,23 +140,6 @@ class GD_CORE_API EventsFunctionsExtension : public EventsFunctionsContainer {
|
||||
return eventsBasedBehaviors;
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Sets an extension origin. This method is not present since the
|
||||
* beginning so the projects created before that will have extensions
|
||||
* installed from the store without an origin. Keep that in mind when creating
|
||||
* features that rely on an extension's origin.
|
||||
*/
|
||||
virtual void SetOrigin(const gd::String& originName_,
|
||||
const gd::String& originIdentifier_) {
|
||||
originName = originName_;
|
||||
originIdentifier = originIdentifier_;
|
||||
}
|
||||
|
||||
virtual const gd::String& GetOriginName() const { return originName; }
|
||||
virtual const gd::String& GetOriginIdentifier() const {
|
||||
return originIdentifier;
|
||||
}
|
||||
|
||||
/** \name Dependencies
|
||||
*/
|
||||
///@{
|
||||
@@ -244,13 +222,10 @@ class GD_CORE_API EventsFunctionsExtension : public EventsFunctionsContainer {
|
||||
gd::String description;
|
||||
gd::String name;
|
||||
gd::String fullName;
|
||||
gd::String category;
|
||||
std::vector<gd::String> tags;
|
||||
std::vector<gd::String> authorIds;
|
||||
gd::String author;
|
||||
gd::String previewIconUrl;
|
||||
gd::String originName;
|
||||
gd::String originIdentifier;
|
||||
gd::String iconUrl;
|
||||
gd::String helpPath; ///< The relative path to the help for this extension in
|
||||
///< the documentation (or an absolute URL).
|
||||
@@ -261,3 +236,4 @@ class GD_CORE_API EventsFunctionsExtension : public EventsFunctionsContainer {
|
||||
} // namespace gd
|
||||
|
||||
#endif // GDCORE_EVENTSFUNCTIONEXTENSION_H
|
||||
#endif
|
||||
|
@@ -217,7 +217,7 @@ class GD_CORE_API Layout : public ObjectsContainer {
|
||||
/**
|
||||
* Must add a new the layer constructed from the layout passed as parameter.
|
||||
* \note No pointer or reference must be kept on the layer passed as
|
||||
* parameter. \param theLayer the layer that must be copied and inserted
|
||||
* parameter. \param theLayer The the layer that must be copied and inserted
|
||||
* into the project \param position Insertion position. Even if the position
|
||||
* is invalid, the layer must be inserted at the end of the layers list.
|
||||
*/
|
||||
|
@@ -5,7 +5,7 @@
|
||||
*/
|
||||
#ifndef GDCORE_OBJECT_H
|
||||
#define GDCORE_OBJECT_H
|
||||
#include "GDCore/Vector2.h"
|
||||
#include <SFML/System/Vector2.hpp>
|
||||
#include <map>
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
|
@@ -7,7 +7,6 @@
|
||||
#ifndef GDCORE_OBJECTGROUPSCONTAINER_H
|
||||
#define GDCORE_OBJECTGROUPSCONTAINER_H
|
||||
#include <vector>
|
||||
#include <algorithm>
|
||||
#include "GDCore/Project/ObjectGroup.h"
|
||||
#include "GDCore/String.h"
|
||||
namespace gd {
|
||||
@@ -78,6 +77,7 @@ class GD_CORE_API ObjectGroupsContainer {
|
||||
*/
|
||||
bool IsEmpty() const { return objectGroups.empty(); };
|
||||
|
||||
#if defined(GD_IDE_ONLY)
|
||||
/**
|
||||
* \brief return the position of the group called "name" in the group list
|
||||
*/
|
||||
@@ -107,6 +107,7 @@ class GD_CORE_API ObjectGroupsContainer {
|
||||
* \brief Move the specified group at a new position in the list.
|
||||
*/
|
||||
void Move(std::size_t oldIndex, std::size_t newIndex);
|
||||
#endif
|
||||
|
||||
/**
|
||||
* \brief Clear all groups of the container.
|
||||
|
@@ -9,6 +9,7 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <SFML/System/Utf.hpp>
|
||||
#include <cctype>
|
||||
#include <fstream>
|
||||
#include <map>
|
||||
@@ -65,9 +66,6 @@ Project::Project()
|
||||
projectUuid(""),
|
||||
useDeprecatedZeroAsDefaultZOrder(false),
|
||||
useExternalSourceFiles(false),
|
||||
isPlayableWithKeyboard(false),
|
||||
isPlayableWithGamepad(false),
|
||||
isPlayableWithMobile(false),
|
||||
currentPlatform(NULL),
|
||||
gdMajorVersion(gd::VersionWrapper::Major()),
|
||||
gdMinorVersion(gd::VersionWrapper::Minor()),
|
||||
@@ -497,7 +495,6 @@ void Project::UnserializeFrom(const SerializerElement& element) {
|
||||
const SerializerElement& propElement =
|
||||
element.GetChild("properties", 0, "Info");
|
||||
SetName(propElement.GetChild("name", 0, "Nom").GetValue().GetString());
|
||||
SetDescription(propElement.GetChild("description", 0).GetValue().GetString());
|
||||
SetVersion(propElement.GetStringAttribute("version", "1.0.0"));
|
||||
SetGameResolutionSize(
|
||||
propElement.GetChild("windowWidth", 0, "WindowW").GetValue().GetInt(),
|
||||
@@ -538,27 +535,6 @@ void Project::UnserializeFrom(const SerializerElement& element) {
|
||||
authorIds.push_back(authorIdsElement.GetChild(i).GetStringValue());
|
||||
}
|
||||
|
||||
categories.clear();
|
||||
auto& categoriesElement = propElement.GetChild("categories");
|
||||
categoriesElement.ConsiderAsArray();
|
||||
for (std::size_t i = 0; i < categoriesElement.GetChildrenCount(); ++i) {
|
||||
categories.push_back(categoriesElement.GetChild(i).GetStringValue());
|
||||
}
|
||||
|
||||
auto& playableDevicesElement = propElement.GetChild("playableDevices");
|
||||
playableDevicesElement.ConsiderAsArray();
|
||||
for (std::size_t i = 0; i < playableDevicesElement.GetChildrenCount(); ++i) {
|
||||
const auto& playableDevice =
|
||||
playableDevicesElement.GetChild(i).GetStringValue();
|
||||
if (playableDevice == "keyboard") {
|
||||
isPlayableWithKeyboard = true;
|
||||
} else if (playableDevice == "gamepad") {
|
||||
isPlayableWithGamepad = true;
|
||||
} else if (playableDevice == "mobile") {
|
||||
isPlayableWithMobile = true;
|
||||
}
|
||||
}
|
||||
|
||||
// Compatibility with GD <= 5.0.0-beta101
|
||||
if (VersionWrapper::IsOlderOrEqual(
|
||||
gdMajorVersion, gdMinorVersion, gdBuildVersion, 0, 4, 0, 98, 0) &&
|
||||
@@ -658,7 +634,6 @@ void Project::UnserializeFrom(const SerializerElement& element) {
|
||||
layoutElement.GetStringAttribute("name", "", "nom"), -1);
|
||||
layout.UnserializeFrom(*this, layoutElement);
|
||||
}
|
||||
SetFirstLayout(element.GetChild("firstLayout").GetStringValue());
|
||||
|
||||
externalEvents.clear();
|
||||
const SerializerElement& externalEventsElement =
|
||||
@@ -728,7 +703,6 @@ void Project::SerializeTo(SerializerElement& element) const {
|
||||
|
||||
SerializerElement& propElement = element.AddChild("properties");
|
||||
propElement.AddChild("name").SetValue(GetName());
|
||||
propElement.AddChild("description").SetValue(GetDescription());
|
||||
propElement.SetAttribute("version", GetVersion());
|
||||
propElement.AddChild("author").SetValue(GetAuthor());
|
||||
propElement.AddChild("windowWidth").SetValue(GetGameResolutionWidth());
|
||||
@@ -759,24 +733,6 @@ void Project::SerializeTo(SerializerElement& element) const {
|
||||
authorIdsElement.AddChild("").SetStringValue(authorId);
|
||||
}
|
||||
|
||||
auto& categoriesElement = propElement.AddChild("categories");
|
||||
categoriesElement.ConsiderAsArray();
|
||||
for (const auto& category : categories) {
|
||||
categoriesElement.AddChild("").SetStringValue(category);
|
||||
}
|
||||
|
||||
auto& playableDevicesElement = propElement.AddChild("playableDevices");
|
||||
playableDevicesElement.ConsiderAsArray();
|
||||
if (isPlayableWithKeyboard) {
|
||||
playableDevicesElement.AddChild("").SetStringValue("keyboard");
|
||||
}
|
||||
if (isPlayableWithGamepad) {
|
||||
playableDevicesElement.AddChild("").SetStringValue("gamepad");
|
||||
}
|
||||
if (isPlayableWithMobile) {
|
||||
playableDevicesElement.AddChild("").SetStringValue("mobile");
|
||||
}
|
||||
|
||||
// Compatibility with GD <= 5.0.0-beta101
|
||||
if (useDeprecatedZeroAsDefaultZOrder) {
|
||||
propElement.SetAttribute("useDeprecatedZeroAsDefaultZOrder", true);
|
||||
@@ -952,9 +908,6 @@ Project& Project::operator=(const Project& other) {
|
||||
|
||||
void Project::Init(const gd::Project& game) {
|
||||
name = game.name;
|
||||
categories = game.categories;
|
||||
description = game.description;
|
||||
firstLayout = game.firstLayout;
|
||||
version = game.version;
|
||||
windowWidth = game.windowWidth;
|
||||
windowHeight = game.windowHeight;
|
||||
@@ -970,9 +923,6 @@ void Project::Init(const gd::Project& game) {
|
||||
|
||||
author = game.author;
|
||||
authorIds = game.authorIds;
|
||||
isPlayableWithKeyboard = game.isPlayableWithKeyboard;
|
||||
isPlayableWithGamepad = game.isPlayableWithGamepad;
|
||||
isPlayableWithMobile = game.isPlayableWithMobile;
|
||||
packageName = game.packageName;
|
||||
orientation = game.orientation;
|
||||
folderProject = game.folderProject;
|
||||
|
@@ -56,35 +56,15 @@ class GD_CORE_API Project : public ObjectsContainer {
|
||||
///@{
|
||||
|
||||
/**
|
||||
* \brief Change the project name
|
||||
* \brief Change project name
|
||||
*/
|
||||
void SetName(const gd::String& name_) { name = name_; };
|
||||
|
||||
/**
|
||||
* \brief Get the project name
|
||||
* \brief Get project name
|
||||
*/
|
||||
const gd::String& GetName() const { return name; }
|
||||
|
||||
/**
|
||||
* \brief Get the categories/genres of the project.
|
||||
*/
|
||||
const std::vector<gd::String>& GetCategories() const { return categories; };
|
||||
|
||||
/**
|
||||
* \brief Get the categories of the project, to modify them (non-const).
|
||||
*/
|
||||
std::vector<gd::String>& GetCategories() { return categories; };
|
||||
|
||||
/**
|
||||
* \brief Change the project description
|
||||
*/
|
||||
void SetDescription(const gd::String& description_) { description = description_; };
|
||||
|
||||
/**
|
||||
* \brief Get the project description
|
||||
*/
|
||||
const gd::String& GetDescription() const { return description; }
|
||||
|
||||
/**
|
||||
* \brief Change the version of the project.
|
||||
* This can be freely set, but should follow "X.Y.Z" format for compatibility
|
||||
@@ -93,7 +73,7 @@ class GD_CORE_API Project : public ObjectsContainer {
|
||||
void SetVersion(const gd::String& version_) { version = version_; };
|
||||
|
||||
/**
|
||||
* \brief Get the project version.
|
||||
* \brief Get project version.
|
||||
*/
|
||||
const gd::String& GetVersion() const { return version; }
|
||||
|
||||
@@ -103,7 +83,7 @@ class GD_CORE_API Project : public ObjectsContainer {
|
||||
void SetAuthor(const gd::String& author_) { author = author_; };
|
||||
|
||||
/**
|
||||
* \brief Get the project author name.
|
||||
* \brief Get project author name.
|
||||
*/
|
||||
const gd::String& GetAuthor() const { return author; }
|
||||
|
||||
@@ -118,47 +98,14 @@ class GD_CORE_API Project : public ObjectsContainer {
|
||||
std::vector<gd::String>& GetAuthorIds() { return authorIds; };
|
||||
|
||||
/**
|
||||
* Define the project as playable with a keyboard.
|
||||
* \param enable True to define the project as playable with a keyboard.
|
||||
*/
|
||||
void SetPlayableWithKeyboard(bool playable = true) { isPlayableWithKeyboard = playable; }
|
||||
|
||||
/**
|
||||
* Check if the project is defined as playable with a keyboard.
|
||||
*/
|
||||
bool IsPlayableWithKeyboard() const { return isPlayableWithKeyboard; }
|
||||
|
||||
/**
|
||||
* Define the project as playable with a gamepad.
|
||||
* \param enable True to define the project as playable with a gamepad.
|
||||
*/
|
||||
void SetPlayableWithGamepad(bool playable = true) { isPlayableWithGamepad = playable; }
|
||||
|
||||
/**
|
||||
* Check if the project is defined as playable with a gamepad.
|
||||
*/
|
||||
bool IsPlayableWithGamepad() const { return isPlayableWithGamepad; }
|
||||
|
||||
/**
|
||||
* Define the project as playable on a mobile.
|
||||
* \param enable True to define the project as playable on a mobile.
|
||||
*/
|
||||
void SetPlayableWithMobile(bool playable = true) { isPlayableWithMobile = playable; }
|
||||
|
||||
/**
|
||||
* Check if the project is defined as playable on a mobile.
|
||||
*/
|
||||
bool IsPlayableWithMobile() const { return isPlayableWithMobile; }
|
||||
|
||||
/**
|
||||
* \brief Change the project package name.
|
||||
* \brief Change project package name.
|
||||
*/
|
||||
void SetPackageName(const gd::String& packageName_) {
|
||||
packageName = packageName_;
|
||||
};
|
||||
|
||||
/**
|
||||
* \brief Get the project package name.
|
||||
* \brief Get project package name.
|
||||
*/
|
||||
const gd::String& GetPackageName() const { return packageName; }
|
||||
|
||||
@@ -172,7 +119,7 @@ class GD_CORE_API Project : public ObjectsContainer {
|
||||
};
|
||||
|
||||
/**
|
||||
* \brief Get the project orientation ("default", "landscape", "portrait").
|
||||
* \brief Get project orientation ("default", "landscape", "portrait").
|
||||
*/
|
||||
const gd::String& GetOrientation() const { return orientation; }
|
||||
|
||||
@@ -937,7 +884,6 @@ class GD_CORE_API Project : public ObjectsContainer {
|
||||
void Init(const gd::Project& project);
|
||||
|
||||
gd::String name; ///< Game name
|
||||
gd::String description; ///< Game description
|
||||
gd::String version; ///< Game version number (used for some exports)
|
||||
unsigned int windowWidth; ///< Window default width
|
||||
unsigned int windowHeight; ///< Window default height
|
||||
@@ -977,11 +923,6 @@ class GD_CORE_API Project : public ObjectsContainer {
|
||||
gd::String author; ///< Game author name, for publishing purpose.
|
||||
std::vector<gd::String>
|
||||
authorIds; ///< Game author ids, from GDevelop users DB.
|
||||
std::vector<gd::String>
|
||||
categories; ///< Game categories
|
||||
bool isPlayableWithKeyboard; ///< The project is playable with a keyboard.
|
||||
bool isPlayableWithGamepad; ///< The project is playable with a gamepad.
|
||||
bool isPlayableWithMobile; ///< The project is playable on a mobile.
|
||||
gd::String packageName; ///< Game package name
|
||||
gd::String orientation; ///< Lock game orientation (on mobile devices).
|
||||
///< "default", "landscape" or "portrait".
|
||||
|
@@ -19,7 +19,6 @@ void PropertyDescriptor::SerializeTo(SerializerElement& element) const {
|
||||
element.AddChild("type").SetStringValue(type);
|
||||
element.AddChild("label").SetStringValue(label);
|
||||
element.AddChild("description").SetStringValue(description);
|
||||
element.AddChild("group").SetStringValue(group);
|
||||
SerializerElement& extraInformationElement =
|
||||
element.AddChild("extraInformation");
|
||||
extraInformationElement.ConsiderAsArray();
|
||||
@@ -34,7 +33,6 @@ void PropertyDescriptor::UnserializeFrom(const SerializerElement& element) {
|
||||
type = element.GetChild("type").GetStringValue();
|
||||
label = element.GetChild("label").GetStringValue();
|
||||
description = element.GetChild("description").GetStringValue();
|
||||
group = element.GetChild("group").GetStringValue();
|
||||
|
||||
extraInformation.clear();
|
||||
const SerializerElement& extraInformationElement =
|
||||
|
@@ -76,14 +76,6 @@ class GD_CORE_API PropertyDescriptor {
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Change the group where this property is displayed to the user, if any.
|
||||
*/
|
||||
PropertyDescriptor& SetGroup(gd::String group_) {
|
||||
group = group_;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Set and replace the additional information for the property.
|
||||
*/
|
||||
@@ -108,7 +100,6 @@ class GD_CORE_API PropertyDescriptor {
|
||||
const gd::String& GetType() const { return type; }
|
||||
const gd::String& GetLabel() const { return label; }
|
||||
const gd::String& GetDescription() const { return description; }
|
||||
const gd::String& GetGroup() const { return group; }
|
||||
|
||||
const std::vector<gd::String>& GetExtraInfo() const {
|
||||
return extraInformation;
|
||||
@@ -162,7 +153,6 @@ class GD_CORE_API PropertyDescriptor {
|
||||
///< the class responsible for updating the property grid.
|
||||
gd::String label; //< The user-friendly property name
|
||||
gd::String description; //< The user-friendly property description
|
||||
gd::String group; //< The user-friendly property group
|
||||
std::vector<gd::String>
|
||||
extraInformation; ///< Can be used to store for example the available
|
||||
///< choices, if a property is a displayed as a combo
|
||||
|
@@ -18,25 +18,18 @@
|
||||
#include "GDCore/Tools/Localization.h"
|
||||
#include "GDCore/Tools/Log.h"
|
||||
|
||||
namespace {
|
||||
gd::String NormalizePathSeparator(const gd::String& path) {
|
||||
gd::String normalizedPath = path;
|
||||
while (normalizedPath.find('\\') != gd::String::npos)
|
||||
normalizedPath.replace(normalizedPath.find('\\'), 1, "/");
|
||||
|
||||
return normalizedPath;
|
||||
}
|
||||
} // namespace
|
||||
|
||||
namespace gd {
|
||||
|
||||
gd::String Resource::badStr;
|
||||
|
||||
Resource ResourcesManager::badResource;
|
||||
gd::String ResourcesManager::badResourceName;
|
||||
#if defined(GD_IDE_ONLY)
|
||||
ResourceFolder ResourcesManager::badFolder;
|
||||
Resource ResourceFolder::badResource;
|
||||
#endif
|
||||
|
||||
#if defined(GD_IDE_ONLY)
|
||||
void ResourceFolder::Init(const ResourceFolder& other) {
|
||||
name = other.name;
|
||||
|
||||
@@ -45,16 +38,19 @@ void ResourceFolder::Init(const ResourceFolder& other) {
|
||||
resources.push_back(std::shared_ptr<Resource>(other.resources[i]->Clone()));
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
void ResourcesManager::Init(const ResourcesManager& other) {
|
||||
resources.clear();
|
||||
for (std::size_t i = 0; i < other.resources.size(); ++i) {
|
||||
resources.push_back(std::shared_ptr<Resource>(other.resources[i]->Clone()));
|
||||
}
|
||||
#if defined(GD_IDE_ONLY)
|
||||
folders.clear();
|
||||
for (std::size_t i = 0; i < other.folders.size(); ++i) {
|
||||
folders.push_back(other.folders[i]);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
Resource& ResourcesManager::GetResource(const gd::String& name) {
|
||||
@@ -136,22 +132,22 @@ std::vector<gd::String> ResourcesManager::GetAllResourceNames() const {
|
||||
}
|
||||
|
||||
std::vector<gd::String> ResourcesManager::FindFilesNotInResources(
|
||||
const std::vector<gd::String>& filePathsToCheck) const {
|
||||
std::unordered_set<gd::String> resourceFilePaths;
|
||||
for (const auto& resource : resources) {
|
||||
resourceFilePaths.insert(NormalizePathSeparator(resource->GetFile()));
|
||||
const std::vector<gd::String>& filesToCheck) const {
|
||||
std::unordered_set<gd::String> resourceFiles;
|
||||
for (const auto& resource: resources) {
|
||||
resourceFiles.insert(resource->GetFile());
|
||||
}
|
||||
|
||||
std::vector<gd::String> filePathsNotInResources;
|
||||
for (const gd::String& file : filePathsToCheck) {
|
||||
gd::String normalizedPath = NormalizePathSeparator(file);
|
||||
if (resourceFilePaths.find(normalizedPath) == resourceFilePaths.end())
|
||||
filePathsNotInResources.push_back(file);
|
||||
std::vector<gd::String> filesNotInResources;
|
||||
for(const gd::String& file: filesToCheck) {
|
||||
if (resourceFiles.find(file) == resourceFiles.end())
|
||||
filesNotInResources.push_back(file);
|
||||
}
|
||||
|
||||
return filePathsNotInResources;
|
||||
return filesNotInResources;
|
||||
}
|
||||
|
||||
#if defined(GD_IDE_ONLY)
|
||||
std::map<gd::String, gd::PropertyDescriptor> Resource::GetProperties() const {
|
||||
std::map<gd::String, gd::PropertyDescriptor> nothing;
|
||||
return nothing;
|
||||
@@ -447,7 +443,9 @@ void ResourcesManager::RemoveResource(const gd::String& name) {
|
||||
for (std::size_t i = 0; i < folders.size(); ++i)
|
||||
folders[i].RemoveResource(name);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(GD_IDE_ONLY)
|
||||
void ResourceFolder::UnserializeFrom(const SerializerElement& element,
|
||||
gd::ResourcesManager& parentManager) {
|
||||
name = element.GetStringAttribute("name");
|
||||
@@ -472,6 +470,7 @@ void ResourceFolder::SerializeTo(SerializerElement& element) const {
|
||||
.SetAttribute("name", resources[i]->GetName());
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
void ResourcesManager::UnserializeFrom(const SerializerElement& element) {
|
||||
resources.clear();
|
||||
@@ -501,6 +500,7 @@ void ResourcesManager::UnserializeFrom(const SerializerElement& element) {
|
||||
resources.push_back(resource);
|
||||
}
|
||||
|
||||
#if defined(GD_IDE_ONLY)
|
||||
folders.clear();
|
||||
const SerializerElement& resourcesFoldersElement =
|
||||
element.GetChild("resourceFolders", 0, "ResourceFolders");
|
||||
@@ -511,8 +511,10 @@ void ResourcesManager::UnserializeFrom(const SerializerElement& element) {
|
||||
|
||||
folders.push_back(folder);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
#if defined(GD_IDE_ONLY)
|
||||
void ResourcesManager::SerializeTo(SerializerElement& element) const {
|
||||
SerializerElement& resourcesElement = element.AddChild("resources");
|
||||
resourcesElement.ConsiderAsArrayOf("resource");
|
||||
@@ -541,9 +543,14 @@ void ResourcesManager::SerializeTo(SerializerElement& element) const {
|
||||
for (std::size_t i = 0; i < folders.size(); ++i)
|
||||
folders[i].SerializeTo(resourcesFoldersElement.AddChild("folder"));
|
||||
}
|
||||
#endif
|
||||
|
||||
void ImageResource::SetFile(const gd::String& newFile) {
|
||||
file = NormalizePathSeparator(newFile);
|
||||
file = newFile;
|
||||
|
||||
// Convert all backslash to slashs.
|
||||
while (file.find('\\') != gd::String::npos)
|
||||
file.replace(file.find('\\'), 1, "/");
|
||||
}
|
||||
|
||||
void ImageResource::UnserializeFrom(const SerializerElement& element) {
|
||||
@@ -553,15 +560,21 @@ void ImageResource::UnserializeFrom(const SerializerElement& element) {
|
||||
SetFile(element.GetStringAttribute("file"));
|
||||
}
|
||||
|
||||
#if defined(GD_IDE_ONLY)
|
||||
void ImageResource::SerializeTo(SerializerElement& element) const {
|
||||
element.SetAttribute("alwaysLoaded", alwaysLoaded);
|
||||
element.SetAttribute("smoothed", smooth);
|
||||
element.SetAttribute("userAdded", IsUserAdded());
|
||||
element.SetAttribute("file", GetFile());
|
||||
}
|
||||
#endif
|
||||
|
||||
void AudioResource::SetFile(const gd::String& newFile) {
|
||||
file = NormalizePathSeparator(newFile);
|
||||
file = newFile;
|
||||
|
||||
// Convert all backslash to slashs.
|
||||
while (file.find('\\') != gd::String::npos)
|
||||
file.replace(file.find('\\'), 1, "/");
|
||||
}
|
||||
|
||||
void AudioResource::UnserializeFrom(const SerializerElement& element) {
|
||||
@@ -571,15 +584,21 @@ void AudioResource::UnserializeFrom(const SerializerElement& element) {
|
||||
SetPreloadAsSound(element.GetBoolAttribute("preloadAsSound"));
|
||||
}
|
||||
|
||||
#if defined(GD_IDE_ONLY)
|
||||
void AudioResource::SerializeTo(SerializerElement& element) const {
|
||||
element.SetAttribute("userAdded", IsUserAdded());
|
||||
element.SetAttribute("file", GetFile());
|
||||
element.SetAttribute("preloadAsMusic", PreloadAsMusic());
|
||||
element.SetAttribute("preloadAsSound", PreloadAsSound());
|
||||
}
|
||||
#endif
|
||||
|
||||
void FontResource::SetFile(const gd::String& newFile) {
|
||||
file = NormalizePathSeparator(newFile);
|
||||
file = newFile;
|
||||
|
||||
// Convert all backslash to slashs.
|
||||
while (file.find('\\') != gd::String::npos)
|
||||
file.replace(file.find('\\'), 1, "/");
|
||||
}
|
||||
|
||||
void FontResource::UnserializeFrom(const SerializerElement& element) {
|
||||
@@ -587,13 +606,19 @@ void FontResource::UnserializeFrom(const SerializerElement& element) {
|
||||
SetFile(element.GetStringAttribute("file"));
|
||||
}
|
||||
|
||||
#if defined(GD_IDE_ONLY)
|
||||
void FontResource::SerializeTo(SerializerElement& element) const {
|
||||
element.SetAttribute("userAdded", IsUserAdded());
|
||||
element.SetAttribute("file", GetFile());
|
||||
}
|
||||
#endif
|
||||
|
||||
void VideoResource::SetFile(const gd::String& newFile) {
|
||||
file = NormalizePathSeparator(newFile);
|
||||
file = newFile;
|
||||
|
||||
// Convert all backslash to slashs.
|
||||
while (file.find('\\') != gd::String::npos)
|
||||
file.replace(file.find('\\'), 1, "/");
|
||||
}
|
||||
|
||||
void VideoResource::UnserializeFrom(const SerializerElement& element) {
|
||||
@@ -601,13 +626,19 @@ void VideoResource::UnserializeFrom(const SerializerElement& element) {
|
||||
SetFile(element.GetStringAttribute("file"));
|
||||
}
|
||||
|
||||
#if defined(GD_IDE_ONLY)
|
||||
void VideoResource::SerializeTo(SerializerElement& element) const {
|
||||
element.SetAttribute("userAdded", IsUserAdded());
|
||||
element.SetAttribute("file", GetFile());
|
||||
}
|
||||
#endif
|
||||
|
||||
void JsonResource::SetFile(const gd::String& newFile) {
|
||||
file = NormalizePathSeparator(newFile);
|
||||
file = newFile;
|
||||
|
||||
// Convert all backslash to slashs.
|
||||
while (file.find('\\') != gd::String::npos)
|
||||
file.replace(file.find('\\'), 1, "/");
|
||||
}
|
||||
|
||||
void JsonResource::UnserializeFrom(const SerializerElement& element) {
|
||||
@@ -616,6 +647,7 @@ void JsonResource::UnserializeFrom(const SerializerElement& element) {
|
||||
DisablePreload(element.GetBoolAttribute("disablePreload", false));
|
||||
}
|
||||
|
||||
#if defined(GD_IDE_ONLY)
|
||||
void JsonResource::SerializeTo(SerializerElement& element) const {
|
||||
element.SetAttribute("userAdded", IsUserAdded());
|
||||
element.SetAttribute("file", GetFile());
|
||||
@@ -640,8 +672,14 @@ bool JsonResource::UpdateProperty(const gd::String& name,
|
||||
return true;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
void BitmapFontResource::SetFile(const gd::String& newFile) {
|
||||
file = NormalizePathSeparator(newFile);
|
||||
file = newFile;
|
||||
|
||||
// Convert all backslash to slashs.
|
||||
while (file.find('\\') != gd::String::npos)
|
||||
file.replace(file.find('\\'), 1, "/");
|
||||
}
|
||||
|
||||
void BitmapFontResource::UnserializeFrom(const SerializerElement& element) {
|
||||
@@ -649,11 +687,14 @@ void BitmapFontResource::UnserializeFrom(const SerializerElement& element) {
|
||||
SetFile(element.GetStringAttribute("file"));
|
||||
}
|
||||
|
||||
#if defined(GD_IDE_ONLY)
|
||||
void BitmapFontResource::SerializeTo(SerializerElement& element) const {
|
||||
element.SetAttribute("userAdded", IsUserAdded());
|
||||
element.SetAttribute("file", GetFile());
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(GD_IDE_ONLY)
|
||||
ResourceFolder::ResourceFolder(const ResourceFolder& other) { Init(other); }
|
||||
|
||||
ResourceFolder& ResourceFolder::operator=(const ResourceFolder& other) {
|
||||
@@ -661,6 +702,7 @@ ResourceFolder& ResourceFolder::operator=(const ResourceFolder& other) {
|
||||
|
||||
return *this;
|
||||
}
|
||||
#endif
|
||||
|
||||
ResourcesManager::ResourcesManager(const ResourcesManager& other) {
|
||||
Init(other);
|
||||
|
@@ -104,6 +104,7 @@ class GD_CORE_API Resource {
|
||||
*/
|
||||
virtual const gd::String& GetMetadata() const { return metadata; }
|
||||
|
||||
#if defined(GD_IDE_ONLY)
|
||||
/** \name Resources properties
|
||||
* Reading and updating resources properties
|
||||
*/
|
||||
@@ -135,6 +136,7 @@ class GD_CORE_API Resource {
|
||||
return false;
|
||||
};
|
||||
///@}
|
||||
#endif
|
||||
|
||||
/**
|
||||
* \brief Serialize the object
|
||||
@@ -184,6 +186,7 @@ class GD_CORE_API ImageResource : public Resource {
|
||||
*/
|
||||
virtual void SetFile(const gd::String& newFile) override;
|
||||
|
||||
#if defined(GD_IDE_ONLY)
|
||||
virtual bool UseFile() override { return true; }
|
||||
|
||||
std::map<gd::String, gd::PropertyDescriptor> GetProperties() const override;
|
||||
@@ -193,6 +196,7 @@ class GD_CORE_API ImageResource : public Resource {
|
||||
* \brief Serialize the object
|
||||
*/
|
||||
void SerializeTo(SerializerElement& element) const override;
|
||||
#endif
|
||||
|
||||
/**
|
||||
* \brief Unserialize the objectt.
|
||||
@@ -234,12 +238,14 @@ class GD_CORE_API AudioResource : public Resource {
|
||||
virtual const gd::String& GetFile() const override { return file; };
|
||||
virtual void SetFile(const gd::String& newFile) override;
|
||||
|
||||
#if defined(GD_IDE_ONLY)
|
||||
virtual bool UseFile() override { return true; }
|
||||
|
||||
std::map<gd::String, gd::PropertyDescriptor> GetProperties() const override;
|
||||
bool UpdateProperty(const gd::String& name, const gd::String& value) override;
|
||||
|
||||
void SerializeTo(SerializerElement& element) const override;
|
||||
#endif
|
||||
|
||||
void UnserializeFrom(const SerializerElement& element) override;
|
||||
|
||||
@@ -286,8 +292,10 @@ class GD_CORE_API FontResource : public Resource {
|
||||
virtual const gd::String& GetFile() const override { return file; };
|
||||
virtual void SetFile(const gd::String& newFile) override;
|
||||
|
||||
#if defined(GD_IDE_ONLY)
|
||||
virtual bool UseFile() override { return true; }
|
||||
void SerializeTo(SerializerElement& element) const override;
|
||||
#endif
|
||||
|
||||
void UnserializeFrom(const SerializerElement& element) override;
|
||||
|
||||
@@ -312,8 +320,10 @@ class GD_CORE_API VideoResource : public Resource {
|
||||
virtual const gd::String& GetFile() const override { return file; };
|
||||
virtual void SetFile(const gd::String& newFile) override;
|
||||
|
||||
#if defined(GD_IDE_ONLY)
|
||||
virtual bool UseFile() override { return true; }
|
||||
void SerializeTo(SerializerElement& element) const override;
|
||||
#endif
|
||||
|
||||
void UnserializeFrom(const SerializerElement& element) override;
|
||||
|
||||
@@ -338,12 +348,14 @@ class GD_CORE_API JsonResource : public Resource {
|
||||
virtual const gd::String& GetFile() const override { return file; };
|
||||
virtual void SetFile(const gd::String& newFile) override;
|
||||
|
||||
#if defined(GD_IDE_ONLY)
|
||||
virtual bool UseFile() override { return true; }
|
||||
|
||||
std::map<gd::String, gd::PropertyDescriptor> GetProperties() const override;
|
||||
bool UpdateProperty(const gd::String& name, const gd::String& value) override;
|
||||
|
||||
void SerializeTo(SerializerElement& element) const override;
|
||||
#endif
|
||||
|
||||
void UnserializeFrom(const SerializerElement& element) override;
|
||||
|
||||
@@ -379,8 +391,10 @@ class GD_CORE_API BitmapFontResource : public Resource {
|
||||
virtual const gd::String& GetFile() const override { return file; };
|
||||
virtual void SetFile(const gd::String& newFile) override;
|
||||
|
||||
#if defined(GD_IDE_ONLY)
|
||||
virtual bool UseFile() override { return true; }
|
||||
void SerializeTo(SerializerElement& element) const override;
|
||||
#endif
|
||||
|
||||
void UnserializeFrom(const SerializerElement& element) override;
|
||||
|
||||
@@ -447,8 +461,9 @@ class GD_CORE_API ResourcesManager {
|
||||
* \brief Return a list of the files, from the specified input list,
|
||||
* that are not used as files by the resources.
|
||||
*/
|
||||
std::vector<gd::String> FindFilesNotInResources(const std::vector<gd::String>& filePathsToCheck) const;
|
||||
std::vector<gd::String> FindFilesNotInResources(const std::vector<gd::String>& filesToCheck) const;
|
||||
|
||||
#if defined(GD_IDE_ONLY)
|
||||
/**
|
||||
* \brief Return a (smart) pointer to a resource.
|
||||
*/
|
||||
@@ -542,6 +557,7 @@ class GD_CORE_API ResourcesManager {
|
||||
* \brief Serialize the object
|
||||
*/
|
||||
void SerializeTo(SerializerElement& element) const;
|
||||
#endif
|
||||
|
||||
/**
|
||||
* \brief Unserialize the objectt.
|
||||
@@ -552,13 +568,18 @@ class GD_CORE_API ResourcesManager {
|
||||
void Init(const ResourcesManager& other);
|
||||
|
||||
std::vector<std::shared_ptr<Resource> > resources;
|
||||
#if defined(GD_IDE_ONLY)
|
||||
std::vector<ResourceFolder> folders;
|
||||
#endif
|
||||
|
||||
#if defined(GD_IDE_ONLY)
|
||||
static ResourceFolder badFolder;
|
||||
#endif
|
||||
static Resource badResource;
|
||||
static gd::String badResourceName;
|
||||
};
|
||||
|
||||
#if defined(GD_IDE_ONLY)
|
||||
class GD_CORE_API ResourceFolder {
|
||||
public:
|
||||
ResourceFolder(){};
|
||||
@@ -633,6 +654,7 @@ class GD_CORE_API ResourceFolder {
|
||||
void Init(const ResourceFolder& other);
|
||||
static Resource badResource;
|
||||
};
|
||||
#endif
|
||||
|
||||
} // namespace gd
|
||||
|
||||
|
@@ -92,7 +92,7 @@ double Variable::GetValue() const {
|
||||
return value;
|
||||
} else if (type == Type::String) {
|
||||
double retVal = str.empty() ? 0.0 : str.To<double>();
|
||||
if (std::isnan(retVal)) retVal = 0.0;
|
||||
if(std::isnan(retVal)) retVal = 0.0;
|
||||
return retVal;
|
||||
} else if (type == Type::Boolean) {
|
||||
return boolVal ? 1.0 : 0.0;
|
||||
@@ -188,15 +188,6 @@ const Variable& Variable::GetAtIndex(const size_t index) const {
|
||||
return *childrenArray.at(index);
|
||||
};
|
||||
|
||||
void Variable::MoveChildInArray(const size_t oldIndex, const size_t newIndex) {
|
||||
if (oldIndex >= childrenArray.size() || newIndex >= childrenArray.size())
|
||||
return;
|
||||
|
||||
std::shared_ptr<gd::Variable> object = std::move(childrenArray[oldIndex]);
|
||||
childrenArray.erase(childrenArray.begin() + oldIndex);
|
||||
childrenArray.insert(childrenArray.begin() + newIndex, std::move(object));
|
||||
}
|
||||
|
||||
Variable& Variable::PushNew() { return GetAtIndex(GetChildrenCount()); };
|
||||
|
||||
void Variable::RemoveAtIndex(const size_t index) {
|
||||
@@ -204,29 +195,8 @@ void Variable::RemoveAtIndex(const size_t index) {
|
||||
childrenArray.erase(childrenArray.begin() + index);
|
||||
};
|
||||
|
||||
bool Variable::InsertAtIndex(const gd::Variable& variable, const size_t index) {
|
||||
if (type != Type::Array) return false;
|
||||
auto newVariable = std::make_shared<gd::Variable>(variable);
|
||||
if (index < childrenArray.size()) {
|
||||
childrenArray.insert(childrenArray.begin() + index, newVariable);
|
||||
} else {
|
||||
childrenArray.push_back(newVariable);
|
||||
}
|
||||
return true;
|
||||
};
|
||||
|
||||
bool Variable::InsertChild(const gd::String& name,
|
||||
const gd::Variable& variable) {
|
||||
if (type != Type::Structure || HasChild(name)) {
|
||||
return false;
|
||||
}
|
||||
children[name] = std::make_shared<gd::Variable>(variable);
|
||||
return true;
|
||||
};
|
||||
|
||||
void Variable::SerializeTo(SerializerElement& element) const {
|
||||
element.SetStringAttribute("type", TypeAsString(GetType()));
|
||||
if (IsFolded()) element.SetBoolAttribute("folded", true);
|
||||
|
||||
if (type == Type::String) {
|
||||
element.SetStringAttribute("value", GetString());
|
||||
@@ -264,7 +234,6 @@ void Variable::UnserializeFrom(const SerializerElement& element) {
|
||||
if (element.HasChild("children", "Children") && IsPrimitive(type))
|
||||
type = Type::Structure;
|
||||
// end of compatibility code
|
||||
SetFolded(element.GetBoolAttribute("folded", false));
|
||||
|
||||
if (IsPrimitive(type)) {
|
||||
if (type == Type::String) {
|
||||
@@ -336,7 +305,6 @@ void Variable::RemoveRecursively(const gd::Variable& variableToRemove) {
|
||||
Variable::Variable(const Variable& other)
|
||||
: value(other.value),
|
||||
str(other.str),
|
||||
folded(other.folded),
|
||||
boolVal(other.boolVal),
|
||||
type(other.type) {
|
||||
CopyChildren(other);
|
||||
@@ -346,7 +314,6 @@ Variable& Variable::operator=(const Variable& other) {
|
||||
if (this != &other) {
|
||||
value = other.value;
|
||||
str = other.str;
|
||||
folded = other.folded;
|
||||
boolVal = other.boolVal;
|
||||
type = other.type;
|
||||
CopyChildren(other);
|
||||
|
@@ -6,10 +6,10 @@
|
||||
|
||||
#ifndef GDCORE_VARIABLE_H
|
||||
#define GDCORE_VARIABLE_H
|
||||
#include <cmath>
|
||||
#include <map>
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
#include <cmath>
|
||||
|
||||
#include "GDCore/String.h"
|
||||
namespace gd {
|
||||
@@ -98,7 +98,7 @@ class GD_CORE_API Variable {
|
||||
void SetValue(double val) {
|
||||
value = val;
|
||||
// NaN values are not supported by GDevelop nor the serializer.
|
||||
if (std::isnan(value)) value = 0.0;
|
||||
if(std::isnan(value)) value = 0.0;
|
||||
type = Type::Number;
|
||||
}
|
||||
|
||||
@@ -185,9 +185,9 @@ class GD_CORE_API Variable {
|
||||
* \brief Get the count of children that the variable has.
|
||||
*/
|
||||
size_t GetChildrenCount() const {
|
||||
return type == Type::Structure ? children.size()
|
||||
: type == Type::Array ? childrenArray.size()
|
||||
: 0;
|
||||
return type == Type::Structure
|
||||
? children.size()
|
||||
: type == Type::Array ? childrenArray.size() : 0;
|
||||
};
|
||||
|
||||
/** \name Structure
|
||||
@@ -290,38 +290,12 @@ class GD_CORE_API Variable {
|
||||
*/
|
||||
void RemoveAtIndex(const size_t index);
|
||||
|
||||
/**
|
||||
* \brief Move child in array.
|
||||
*/
|
||||
void MoveChildInArray(const size_t oldIndex, const size_t newIndex);
|
||||
|
||||
/**
|
||||
* \brief Insert child in array.
|
||||
*/
|
||||
bool InsertAtIndex(const gd::Variable& variable, const size_t index);
|
||||
|
||||
/**
|
||||
* \brief Insert a child in a structure.
|
||||
*/
|
||||
bool InsertChild(const gd::String& name, const gd::Variable& variable);
|
||||
|
||||
/**
|
||||
* \brief Get the vector containing all the children.
|
||||
*/
|
||||
const std::vector<std::shared_ptr<Variable>>& GetAllChildrenArray() const {
|
||||
return childrenArray;
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Set if the children must be folded.
|
||||
*/
|
||||
void SetFolded(bool fold = true) { folded = fold; }
|
||||
|
||||
/**
|
||||
* \brief True if the children should be folded in the variables editor.
|
||||
*/
|
||||
bool IsFolded() const { return folded; }
|
||||
|
||||
///@}
|
||||
///@}
|
||||
|
||||
@@ -351,7 +325,6 @@ class GD_CORE_API Variable {
|
||||
*/
|
||||
static Type StringAsType(const gd::String& str);
|
||||
|
||||
bool folded;
|
||||
mutable Type type;
|
||||
mutable gd::String str;
|
||||
mutable double value;
|
||||
|
@@ -4,10 +4,8 @@
|
||||
* reserved. This project is released under the MIT License.
|
||||
*/
|
||||
#include "GDCore/Project/VariablesContainer.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <iostream>
|
||||
|
||||
#include "GDCore/Project/Variable.h"
|
||||
#include "GDCore/Serialization/SerializerElement.h"
|
||||
#include "GDCore/String.h"
|
||||
@@ -90,6 +88,7 @@ Variable& VariablesContainer::Insert(const gd::String& name,
|
||||
}
|
||||
}
|
||||
|
||||
#if defined(GD_IDE_ONLY)
|
||||
void VariablesContainer::Remove(const gd::String& varName) {
|
||||
variables.erase(
|
||||
std::remove_if(
|
||||
@@ -152,14 +151,13 @@ void VariablesContainer::Swap(std::size_t firstVariableIndex,
|
||||
}
|
||||
|
||||
void VariablesContainer::Move(std::size_t oldIndex, std::size_t newIndex) {
|
||||
if (oldIndex >= variables.size() || newIndex >= variables.size() ||
|
||||
oldIndex == newIndex)
|
||||
return;
|
||||
if (oldIndex >= variables.size() || newIndex >= variables.size()) return;
|
||||
|
||||
auto nameAndVariable = variables[oldIndex];
|
||||
variables.erase(variables.begin() + oldIndex);
|
||||
variables.insert(variables.begin() + newIndex, nameAndVariable);
|
||||
}
|
||||
#endif
|
||||
|
||||
void VariablesContainer::SerializeTo(SerializerElement& element) const {
|
||||
element.ConsiderAsArrayOf("variable");
|
||||
|
@@ -77,6 +77,8 @@ bool SerializerElement::GetBoolAttribute(const gd::String& name,
|
||||
}
|
||||
}
|
||||
|
||||
std::cout << "Bool attribute \"" << name << "\" not found, returning "
|
||||
<< defaultValue;
|
||||
return defaultValue;
|
||||
}
|
||||
|
||||
|
@@ -9,6 +9,7 @@
|
||||
#include <algorithm>
|
||||
#include <string.h>
|
||||
|
||||
#include <SFML/System/String.hpp>
|
||||
#include "GDCore/CommonTools.h"
|
||||
#include "GDCore/Utf8/utf8proc.h"
|
||||
|
||||
@@ -27,6 +28,11 @@ String::String(const char *characters) : m_string()
|
||||
*this = characters;
|
||||
}
|
||||
|
||||
String::String(const sf::String &string) : m_string()
|
||||
{
|
||||
*this = string;
|
||||
}
|
||||
|
||||
String::String(const std::u32string &string) : m_string()
|
||||
{
|
||||
*this = string;
|
||||
@@ -38,6 +44,26 @@ String& String::operator=(const char *characters)
|
||||
return *this;
|
||||
}
|
||||
|
||||
String& String::operator=(const sf::String &string)
|
||||
{
|
||||
m_string.clear();
|
||||
|
||||
//In theory, an UTF8 character can be up to 6 bytes (even if in the current Unicode standard,
|
||||
//the last character is 4 bytes long when encoded in UTF8).
|
||||
//So, reserve the maximum possible size to avoid reallocations.
|
||||
m_string.reserve( string.getSize() * 6 );
|
||||
|
||||
//Push_back all characters inside the string.
|
||||
for( sf::String::ConstIterator it = string.begin(); it != string.end(); ++it )
|
||||
{
|
||||
push_back( *it );
|
||||
}
|
||||
|
||||
m_string.shrink_to_fit();
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
String& String::operator=(const std::u32string &string)
|
||||
{
|
||||
m_string.clear();
|
||||
@@ -86,7 +112,7 @@ String::const_iterator String::end() const
|
||||
String String::FromLocale( const std::string &localizedString )
|
||||
{
|
||||
#if defined(WINDOWS)
|
||||
return FromUTF8(localizedString); //Don't need to use the current locale, on Windows, std::locale is always the C locale
|
||||
return FromSfString(sf::String(localizedString)); //Don't need to use the current locale, on Windows, std::locale is always the C locale
|
||||
#elif defined(MACOS)
|
||||
return FromUTF8(localizedString); //Assume UTF8 is the current locale
|
||||
#elif defined(EMSCRIPTEN)
|
||||
@@ -98,7 +124,7 @@ String String::FromLocale( const std::string &localizedString )
|
||||
std::locale("").name().find("UTF8") != std::string::npos)
|
||||
return FromUTF8(localizedString); //UTF8 is already the current locale
|
||||
else
|
||||
return FromUTF8(localizedString); //Use the current locale (std::locale("")) for conversion
|
||||
return FromSfString(sf::String(localizedString, std::locale(""))); //Use the current locale (std::locale("")) for conversion
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -110,6 +136,11 @@ String String::FromUTF32( const std::u32string &string )
|
||||
return str;
|
||||
}
|
||||
|
||||
String String::FromSfString( const sf::String &sfString )
|
||||
{
|
||||
return String(sfString);
|
||||
}
|
||||
|
||||
String String::FromUTF8( const std::string &utf8Str )
|
||||
{
|
||||
String str(utf8Str.c_str());
|
||||
@@ -133,7 +164,7 @@ String String::FromWide( const std::wstring &wstr )
|
||||
std::string String::ToLocale() const
|
||||
{
|
||||
#if defined(WINDOWS)
|
||||
return m_string;
|
||||
return ToSfString().toAnsiString();
|
||||
#elif defined(MACOS)
|
||||
return m_string;
|
||||
#elif defined(EMSCRIPTEN)
|
||||
@@ -145,7 +176,7 @@ std::string String::ToLocale() const
|
||||
std::locale("").name().find("UTF8") != std::string::npos)
|
||||
return m_string; //UTF8 is already the current locale on Linux
|
||||
else
|
||||
return m_string; //Use the current locale for conversion
|
||||
return ToSfString().toAnsiString(std::locale("")); //Use the current locale for conversion
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -160,6 +191,20 @@ std::u32string String::ToUTF32() const
|
||||
return u32str;
|
||||
}
|
||||
|
||||
sf::String String::ToSfString() const
|
||||
{
|
||||
sf::String str;
|
||||
for(const_iterator it = begin(); it != end(); ++it)
|
||||
str += sf::String(static_cast<sf::Uint32>(*it));
|
||||
|
||||
return str;
|
||||
}
|
||||
|
||||
String::operator sf::String() const
|
||||
{
|
||||
return ToSfString();
|
||||
}
|
||||
|
||||
std::string String::ToUTF8() const
|
||||
{
|
||||
return m_string;
|
||||
@@ -622,7 +667,7 @@ int String::compare( const String &other ) const
|
||||
namespace priv
|
||||
{
|
||||
/**
|
||||
* As the casefolded version of a string can have a different size, the positions
|
||||
* As the the casefolded version of a string can have a different size, the positions
|
||||
* in the two versions of the string are not the same.
|
||||
* \return where the **pos** position in the original string **str** is in the
|
||||
* casefolded version of **str**
|
||||
@@ -636,7 +681,7 @@ namespace priv
|
||||
}
|
||||
|
||||
/**
|
||||
* As the casefolded version of a string can have a different size, the positions
|
||||
* As the the casefolded version of a string can have a different size, the positions
|
||||
* in the two versions of the string are not the same.
|
||||
* \return where the **pos** position in the casefolded string of **str** is in the
|
||||
* original version **str**
|
||||
|
@@ -13,9 +13,12 @@
|
||||
#include <sstream>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <SFML/System/String.hpp>
|
||||
|
||||
#include "GDCore/Utf8/utf8.h"
|
||||
|
||||
namespace sf {class String;};
|
||||
|
||||
namespace gd
|
||||
{
|
||||
|
||||
@@ -118,6 +121,11 @@ public:
|
||||
*/
|
||||
String(const std::u32string &string);
|
||||
|
||||
/**
|
||||
* Constructs a string from an sf::String.
|
||||
*/
|
||||
String(const sf::String &string);
|
||||
|
||||
/**
|
||||
* \}
|
||||
*/
|
||||
@@ -138,6 +146,8 @@ public:
|
||||
*/
|
||||
String& operator=(const char *characters);
|
||||
|
||||
String& operator=(const sf::String &string);
|
||||
|
||||
String& operator=(const std::u32string &string);
|
||||
|
||||
/**
|
||||
@@ -219,6 +229,7 @@ public:
|
||||
static String From(T value)
|
||||
{
|
||||
static_assert(!std::is_same<T, std::string>::value, "Can't use gd::String::From with std::string.");
|
||||
static_assert(!std::is_same<T, sf::String>::value, "Can't use gd::String::From with sf::String.");
|
||||
|
||||
std::ostringstream oss;
|
||||
oss << value;
|
||||
@@ -233,6 +244,7 @@ public:
|
||||
T To() const
|
||||
{
|
||||
static_assert(!std::is_same<T, std::string>::value, "Can't use gd::String::To with std::string.");
|
||||
static_assert(!std::is_same<T, sf::String>::value, "Can't use gd::String::To with sf::String.");
|
||||
|
||||
T value;
|
||||
std::istringstream oss(m_string);
|
||||
@@ -262,6 +274,13 @@ public:
|
||||
*/
|
||||
static String FromUTF32( const std::u32string &string );
|
||||
|
||||
/**
|
||||
* \return a String created from a sf::String (UTF32).
|
||||
*
|
||||
* See \ref Conversions1 for more information.
|
||||
*/
|
||||
static String FromSfString( const sf::String &sfString );
|
||||
|
||||
/**
|
||||
* \return a String created an UTF8 encoded std::string.
|
||||
*/
|
||||
@@ -293,6 +312,20 @@ public:
|
||||
*/
|
||||
std::u32string ToUTF32() const;
|
||||
|
||||
/**
|
||||
* \return a sf::String from the current string.
|
||||
*
|
||||
* See \ref Conversions1 for more information.
|
||||
*/
|
||||
sf::String ToSfString() const;
|
||||
|
||||
/**
|
||||
* Implicit conversion operator to sf::String.
|
||||
*
|
||||
* See \ref Conversions1 for more information.
|
||||
*/
|
||||
operator sf::String() const;
|
||||
|
||||
/**
|
||||
* \return a UTF8 encoded std::string from the current string.
|
||||
*/
|
||||
@@ -852,7 +885,7 @@ namespace std
|
||||
* on the string size and so is the operator[]().
|
||||
*
|
||||
* \section Conversion Conversions from/to other string types
|
||||
* The String handles implicit conversion with std::String (implicit constructor and implicit conversion
|
||||
* The String handles implicit conversion with sf::String (implicit constructor and implicit conversion
|
||||
* operator).
|
||||
*
|
||||
* **However, this is not the case with std::string** as this conversion is not often lossless (mostly on Windows).
|
||||
@@ -861,6 +894,16 @@ namespace std
|
||||
* directly use the operator=() or the constructor as they are supporting const char* as argument (it assumes the string
|
||||
* literal is encoded in UTF8, so you'll need to put the u8 prefix).
|
||||
*
|
||||
* \subsection Conversions1 Implicit conversion from/to sf::String
|
||||
* \code
|
||||
* //Get a String from sf::String
|
||||
* sf::String sfmlStr("This is a test ! ");
|
||||
* gd::String str1(sfmlStr); //Now contains "This is a test ! " encoded in UTF8
|
||||
*
|
||||
* //Get a sf::String from String
|
||||
* sf::String anotherSfmlString = str; //anotherSfmlString now contains "Another test ! "
|
||||
* \endcode
|
||||
*
|
||||
* \subsection Conversions2 Conversion from/to std::string
|
||||
* \code
|
||||
* //Get a String from a std::string encoded in the current locale
|
||||
|
200
Core/GDCore/Tools/FileStream.cpp
Normal file
200
Core/GDCore/Tools/FileStream.cpp
Normal file
@@ -0,0 +1,200 @@
|
||||
#include "GDCore/Tools/FileStream.h"
|
||||
|
||||
#if defined(WINDOWS)
|
||||
#if __GLIBCXX__
|
||||
#include <ext/stdio_filebuf.h>
|
||||
#endif
|
||||
#endif
|
||||
|
||||
namespace gd {
|
||||
|
||||
namespace {
|
||||
|
||||
#if FSTREAM_WINDOWS_MINGW
|
||||
|
||||
#define MODE(in_val, out_val, trunc_val, app_val) \
|
||||
((((mode & std::ios_base::in) != 0) == in_val) && \
|
||||
(((mode & std::ios_base::out) != 0) == out_val) && \
|
||||
(((mode & std::ios_base::trunc) != 0) == trunc_val) && \
|
||||
(((mode & std::ios_base::app) != 0) == app_val))
|
||||
|
||||
std::wstring GetStdioMode(std::ios_base::openmode mode) {
|
||||
std::wstring strMode;
|
||||
|
||||
/// Thanks to https://gcc.gnu.org/ml/libstdc++/2007-06/msg00013.html
|
||||
if (MODE(false, true, false, false))
|
||||
strMode += L"w";
|
||||
else if (MODE(false, true, false, true))
|
||||
strMode += L"a";
|
||||
else if (MODE(true, true, false, true))
|
||||
strMode += L"a+";
|
||||
else if (MODE(false, true, true, false))
|
||||
strMode += L"w";
|
||||
else if (MODE(true, false, false, false))
|
||||
strMode += L"r";
|
||||
else if (MODE(true, true, false, false))
|
||||
strMode += L"r+";
|
||||
else if (MODE(true, true, true, false))
|
||||
strMode += L"w+";
|
||||
|
||||
if ((mode & std::ios_base::binary) != 0) strMode += L"b";
|
||||
|
||||
return strMode;
|
||||
}
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Open the given file into a filebuf and return it.
|
||||
* On Windows, return the associated FILE* inside the file argument.
|
||||
*/
|
||||
FileStream::InternalBufferType* OpenBuffer(const gd::String& path,
|
||||
std::ios_base::openmode mode,
|
||||
FILE** file) {
|
||||
#if FSTREAM_WINDOWS_MINGW
|
||||
*file = _wfopen(path.ToWide().c_str(), GetStdioMode(mode).c_str());
|
||||
if (!(*file)) return nullptr;
|
||||
return new __gnu_cxx::stdio_filebuf<char>(*file, mode);
|
||||
#else
|
||||
auto* filebuffer = new std::filebuf();
|
||||
return filebuffer->open(path.ToLocale().c_str(), mode);
|
||||
#endif
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
FileStream::FileStream() : std::iostream(nullptr) {}
|
||||
|
||||
FileStream::FileStream(const gd::String& path, std::ios_base::openmode mode)
|
||||
: std::iostream(nullptr),
|
||||
m_file(nullptr),
|
||||
m_buffer(OpenBuffer(path, mode, &m_file)) {
|
||||
setstate(ios_base::goodbit);
|
||||
if (m_buffer) {
|
||||
std::iostream::init(m_buffer.get());
|
||||
if ((mode & std::ios_base::ate) != 0) seekg(0, end);
|
||||
} else
|
||||
setstate(ios_base::badbit);
|
||||
}
|
||||
|
||||
FileStream::~FileStream() {
|
||||
if (is_open()) close();
|
||||
}
|
||||
|
||||
/*
|
||||
WILL WORK with GCC>=5 (not 4.9 used on Windows)
|
||||
FileStream::FileStream(FileStream && other) :
|
||||
std::iostream(std::move(other)),
|
||||
m_buffer(std::move(other.m_buffer))
|
||||
{
|
||||
|
||||
}*/
|
||||
|
||||
/*FileStream& FileStream::operator=(FileStream && other)
|
||||
{
|
||||
std::iostream::operator=(std::move(other));
|
||||
m_buffer = std::move(other.m_buffer);
|
||||
}*/
|
||||
|
||||
void FileStream::open(const gd::String& path, std::ios_base::openmode mode) {
|
||||
setstate(ios_base::goodbit);
|
||||
|
||||
if (is_open()) {
|
||||
setstate(ios_base::failbit);
|
||||
std::cout << "is_open true when trying to open!" << std::endl;
|
||||
} else {
|
||||
auto* newBuffer = OpenBuffer(path, mode, &m_file);
|
||||
if (newBuffer) {
|
||||
m_buffer.reset(newBuffer);
|
||||
std::iostream::init(m_buffer.get());
|
||||
if ((mode & std::ios_base::ate) != 0) seekg(0, end);
|
||||
} else {
|
||||
setstate(ios_base::badbit);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool FileStream::is_open() const {
|
||||
if (!m_buffer) return false;
|
||||
return m_buffer->is_open();
|
||||
}
|
||||
|
||||
void FileStream::close() {
|
||||
#if FSTREAM_WINDOWS_MINGW
|
||||
if (m_buffer) m_buffer->close();
|
||||
|
||||
if (m_file && fclose(m_file) != 0) {
|
||||
setstate(ios_base::failbit);
|
||||
}
|
||||
|
||||
m_buffer.reset(nullptr);
|
||||
m_file = nullptr;
|
||||
#else
|
||||
if (!m_buffer || m_buffer->close() == nullptr) {
|
||||
setstate(ios_base::failbit);
|
||||
} else {
|
||||
m_buffer.reset(nullptr);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
/*void FileStream::swap(FileStream & other) //WILL WORK with GCC>=5 (not 4.9
|
||||
used on Windows)
|
||||
{
|
||||
std::iostream::swap(other);
|
||||
std::swap(m_buffer, other.m_buffer);
|
||||
}*/
|
||||
|
||||
SFMLFileStream::SFMLFileStream() : m_file(nullptr) {}
|
||||
|
||||
SFMLFileStream::~SFMLFileStream() {
|
||||
if (m_file) fclose(m_file);
|
||||
}
|
||||
|
||||
bool SFMLFileStream::open(const gd::String& filename) {
|
||||
if (m_file) fclose(m_file);
|
||||
|
||||
#if FSTREAM_WINDOWS_MINGW
|
||||
m_file = _wfopen(filename.ToWide().c_str(), L"rb");
|
||||
#else
|
||||
m_file = fopen(filename.ToLocale().c_str(), "rb");
|
||||
#endif
|
||||
|
||||
return m_file != NULL;
|
||||
}
|
||||
|
||||
sf::Int64 SFMLFileStream::read(void* data, sf::Int64 size) {
|
||||
if (m_file)
|
||||
return fread(data, 1, static_cast<std::size_t>(size), m_file);
|
||||
else
|
||||
return -1;
|
||||
}
|
||||
|
||||
sf::Int64 SFMLFileStream::seek(sf::Int64 position) {
|
||||
if (m_file) {
|
||||
fseek(m_file, static_cast<std::size_t>(position), SEEK_SET);
|
||||
return tell();
|
||||
} else {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
sf::Int64 SFMLFileStream::tell() {
|
||||
if (m_file)
|
||||
return ftell(m_file);
|
||||
else
|
||||
return -1;
|
||||
}
|
||||
|
||||
sf::Int64 SFMLFileStream::getSize() {
|
||||
if (m_file) {
|
||||
sf::Int64 position = tell();
|
||||
fseek(m_file, 0, SEEK_END);
|
||||
sf::Int64 size = tell();
|
||||
seek(position);
|
||||
return size;
|
||||
} else {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace gd
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user