Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Page about HashLink #104

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
2 changes: 2 additions & 0 deletions HTML5.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

Heaps is able to compile to JavaScript and therefore it can run in the web browser.

A step by step guide can be found in [[Hello-World]].

See the following example on how to prepare your Heaps project for HTML5.

## Compile for Javascript:
Expand Down
42 changes: 36 additions & 6 deletions HashLink.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,29 @@

[HashLink](https://hashlink.haxe.org/) is a virtual machine for the Haxe programming language. By targeting HashLink you are also able to generate Native C code for your project.

Heaps is able to support both SDL and DirectX. In order to specify which you'd like to use, you simple need to include the appropriate library when compiling your project.
A step by step guide can be found in [[Hello-HashLink]].

For DirectX
HashLink is able to support both [SDL](https://lib.haxe.org/p/hlsdl) and [DirectX](https://lib.haxe.org/p/hldx). At least one and only one is required.
[OpenAL](https://lib.haxe.org/p/hlopenal) provides using sound.

For SDL
```hxml
-lib hlsdl
```

For DirectX (Windows)
```hxml
-lib hldx
```

For SDL
OpenAL (for sound)
```hxml
-lib hlsdl
-lib hlopenal
```

More available libraries can be found [here](https://lib.haxe.org/search/?v=hashlink).


## Compile for HashLink:

To compile for HashLink use the following example.
Expand All @@ -28,9 +39,28 @@ To compile for HashLink use the following example.

# libraries
-lib heaps
-lib hldx
#-lib hlsdl
-lib hlsdl
#-lib hldx

# output
-hl bin/game.hl
```


## Hot Reload

Hot reload allows to program new features into a game ***while*** it is running.

Use the following flag to allow that Hot Reload is being used.
```
-D hot-reload
```

Now run your HashLink program with
`hl --hot-reload mygame.hl`

Now everytime you re-compile, the running game also gets updated.

Note that this has its limits and this feature is still under development and being tested. Currently no new fields can be implemented. However it works well for modifying the behaviour of an already existing method (class function), for instance the `update` method and all other functions called inside it.

(See details here: https://github.com/HaxeFoundation/hashlink/wiki/Hot-Reload)