5 Star 22 Fork 6

Gitee 极速下载/gdevelop

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
此仓库是为了提升国内下载速度的镜像仓库,每日同步一次。 原始仓库: https://github.com/4ian/GDevelop
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README

GDevelop.js

These are the bindings of GDevelop core classes to WebAssembly+JavaScript. This allows GDevelop Core libraries to run in a browser or on Node.js.

How to build

👋 Usually, if you're working on the GDevelop editor or extensions in JavaScript, you don't need to rebuild GDevelop.js. If you want to make changes in C++ extensions or classes, read this section.

  • Prerequisite tools installed:

    • CMake 3.17+ (3.5+ should work on Linux/macOS). On macOS, you can install it via Homebrew (recommended for Apple M1 Architectures).
    • Node.js. (We recommend using nvm to be able to switch between Node versions easily).
    • Python (via pyenv for versions management).
  • Install Emscripten version 3.1.21, as explained below or on the Emscripten installation instructions:

    git clone https://github.com/emscripten-core/emsdk/
    cd emsdk
    git pull
    ./emsdk install 3.1.21
    ./emsdk activate 3.1.21
    
    # On Windows, also install an additional Python package:
    pip install setuptools
    
  • Whenever you try to build GDevelop.js in the future, you will have to load the emsdk environement into your terminal window again by running:

    Linux/macOS Windows (Powershell) Windows (cmd.exe)
    source ./emsdk_env.sh ./emsdk_env.ps1 ./emsdk_env.bat
  • With the emscripten environement loaded into your terminal, launch the build from GDevelop.js folder:

    cd GDevelop.js
    npm install # Only the first time.
    npm run build # After any C++ changes.
    

    ⏱ The linking (last step) of the build can be made a few seconds faster, useful for development: npm run build -- --variant=dev.

  • You can then launch GDevelop 5 that will use your build of GDevelop.js:

    cd ..
    cd newIDE/app
    npm install
    npm start
    

More information in GDevelop 5 README.

Tests

npm test

Debugging

You can build the library with various level of debugging and memory checks.

npm run build -- --variant=debug # Build with debugging information (useful for stacktraces)
npm run build -- --variant=debug-assertions # Build with assertions and "SAFE_HEAP=1", useful to find memory bugs.
npm run build -- --variant=debug-sanitizers # Build with memory sanitizers. Will be very slow.

It's then recommended to run the tests (npm test) to check if there are any obvious memory bugs found.

About the internal steps of compilation

The npm build task:

  • Creates Binaries/embuild directory,
  • Launches CMake inside to compile GDevelop with emconfigure to use Emscripten toolchain,
  • Updates the glue.cpp and glue.js from Bindings.idl using Emscripten WebIDL Binder,
  • Launches the compilation with make (or ninja on Windows with CMake 3.17+) (you can also compile using MinGW-32 using npm run build-with-MinGW).

See the CMakeLists.txt for the arguments passed to the Emscripten linker. For instance, if you want to see the function names in stacks or for profiling, the compilation flags can be changed.

Documentation

马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
JavaScript
1
https://gitee.com/mirrors/gdevelop.git
git@gitee.com:mirrors/gdevelop.git
mirrors
gdevelop
gdevelop
master

搜索帮助