You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Apr 25, 2019. It is now read-only.
This is a port of some parts of [GDevelop] to Javascript using [Emscripten].
4
+
This is a port of some parts of **[GDevelop]** to Javascript using **[Emscripten]**.
5
5
6
6
GDevelop is a full featured, cross-platform, open-source game creator software requiring no programming skills. Download it on [the official website](http://compilgames.net) and check its [GitHub page](https://github.com/4ian/GD).
7
7
8
+
This module is used to power [GDevApp], a radically innovative game creator that can be used by anyone to create games directly from a desktop or tablet web browser.
9
+
8
10
How to build
9
11
------------
10
12
11
13
Make sure you have [CMake](http://www.cmake.org/) and [Emscripten](https://github.com/kripken/emscripten) installed (your OS package manager should be able to provide both). You need Emscripten 1.33.1 at least to avoid [this bug](https://github.com/kripken/emscripten/pull/3479).
12
14
13
-
* Clone [GDevelop repository](https://github.com/4ian/GD) and this repository at the root of GD
15
+
* Clone [GDevelop repository](https://github.com/4ian/GD) and this repository at the root of GD repository:
cd GD && git clone https://github.com/4ian/libGD.js.git
18
20
```
19
21
20
-
* Patch SFML (TODO)
21
-
* Patch WebIDL binder (TODO)
22
-
* Launch grunt
22
+
* Patch WebIDL binder to support returning javascript boolean. Go to path/to/emscripten/tools/webidl_binder.py, search for
23
23
24
-
```shell
25
-
grunt shell:cmake #The first time only
26
-
grunt build
24
+
```python
25
+
elif return_type =='String':
26
+
call_prefix +='Pointer_stringify('
27
+
call_postfix +=')'
27
28
```
28
29
29
-
### Internal steps for compilation
30
+
and add just after:
30
31
31
-
Internally, the grunt build task create `Binaries/embuild` directory, launch CMake inside to compile GDevelop with *Emscripten toolchain file*, update the glue.cpp and glue.js from Bindings.idl using *Emscripten WebIDL Binder*, launch the compilation with *make* and wrap the generated `libGD.js.raw` into the final `libGD.js` file.
32
+
```python
33
+
elif return_type =='Boolean':
34
+
call_prefix +='!!('
35
+
call_postfix +=')'
36
+
```
32
37
33
-
It also create a compressed `libGD.js.gz` file which is handy for distributing the library pre-compressed to web browsers.
38
+
* Launch the build:
39
+
40
+
```shell
41
+
cd libGD.js
42
+
grunt shell:cmake #The first time only
43
+
grunt build
44
+
```
45
+
46
+
Output is created in */path/to/GD/Binaries/Output/libGD.js/*.
34
47
35
48
Launch tests and examples
36
49
-------------------------
@@ -39,5 +52,35 @@ Launch tests with grunt:
39
52
40
53
grunt test
41
54
55
+
Or launch example:
56
+
57
+
cd examples && node demo.js
58
+
59
+
The demo generate a json file that can be opened with [GDevelop] or [GDevApp]!
60
+
61
+
### About the internal steps of compilation
62
+
63
+
The grunt *build* task:
64
+
65
+
* create `Binaries/embuild` directory,
66
+
* patch SFML `Config.hpp` file to make Emscripten recognized as a linux target,
67
+
* launch CMake inside to compile GDevelop with *Emscripten toolchain file*,
68
+
* update the glue.cpp and glue.js from Bindings.idl using *Emscripten WebIDL Binder*,
69
+
* launch the compilation with *make* and wrap the generated `libGD.js.raw` into the final `libGD.js` file.
70
+
71
+
It also create a compressed `libGD.js.gz` file which is handy for distributing the library pre-compressed to web browsers.
72
+
73
+
Documentation
74
+
-------------
75
+
76
+
Refer to [GDevelop documentation](http://4ian.github.io/GD-Documentation/GDCore%20Documentation/) for detailed documentation of the original C++ classes. The file Bindings.idl describes all the classes available in libGD.js.
77
+
78
+
License
79
+
-------
80
+
81
+
* This library is distributed under the **MIT license**.
82
+
* GDevelop is under the MIT license (and GPL v3 license for the GUI).
0 commit comments