Skip to content

Commit ee8c5a6

Browse files
Updated Animation, Drawable, Events & Interactivity. (#103)
1 parent df8f822 commit ee8c5a6

5 files changed

+18
-67
lines changed

Diff for: Animation.md

+2-8
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ You can learn more about Heaps resource management and using [`hxd.Res`](https:/
3030

3131
## Properties and methods
3232

33-
The following properties and methods can be accessed on [h2d.Anim](https://github.com/ncannasse/heaps/blob/master/h2d/Anim.hx):
33+
The following properties and methods can be accessed on [h2d.Anim](https://heaps.io/api/h2d/Anim.html):
3434

3535
* `speed` : changes the playback speed of the animation, in frames per seconds.
3636
* `loop` : tells if the animation will loop after it reaches the last frame.
@@ -42,10 +42,4 @@ anim.onAnimEnd = function() {
4242
}
4343
```
4444

45-
`Anim` instances have other properties which can be discovered by reviewing the [`h2d.Anim`](https://github.com/ncannasse/heaps/blob/master/h2d/Anim.hx) class.
46-
47-
## Using image resources
48-
49-
What you'll probably need for your game is actually using your image resources and sprites.
50-
- This is a small external github sample: https://github.com/Beeblerox/Simplest-Heaps-Examples/tree/master/04_heaps_anim
51-
It uses an image to create a sprite strip/sheet from it.
45+
`Anim` instances have other properties which can be discovered by reviewing the [`h2d.Anim`](https://heaps.io/api/h2d/Anim.html) class.

Diff for: Drawable.md

+8-5
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
# Drawable
22

3-
H2D classes that can display something on screen usually extend the [`h2d.Drawable`](https://github.com/ncannasse/heaps/blob/master/h2d/Drawable.hx) class.
3+
H2D classes that can display something on screen usually extend the [`h2d.Drawable`](https://heaps.io/api/h2d/Drawable.html) class.
44

5-
Each Drawable (including [`h2d.Bitmap`](https://github.com/ncannasse/heaps/blob/master/h2d/Bitmap.hx)) has several properties that can be manipulated:
5+
Each Drawable (including [`h2d.Bitmap`](https://heaps.io/api/h2d/Bitmap.html)) has several properties that can be manipulated:
66

77
* `alpha` : this will change the amount of transparency your drawable is displayed with. For instance a value of 0.5 will display a Tile with 50% opacity.
88
* `color` : color is the color multiplier of the drawable. You can access its individual channels with (r,g,b,a) components. It is initialy set to white (all components are set to 1.). Setting for instance the (r,g,b) components to 0.5 will make the tile appear darker.
@@ -18,7 +18,7 @@ Each Drawable (including [`h2d.Bitmap`](https://github.com/ncannasse/heaps/blob/
1818
* `filter` : when a sprite is scaled (upscaled or downscaled), by default Heaps will use the nearest pixel in the Tile to display it. This will create a nice pixelated effect for some games, but might not looks good on your game. You can try to set the filter value to true, which will enable bilinear filtering on the sprite, making it looks less sharp and more smooth/blurry.
1919
* `shaders` : each `Drawable` can have shaders added to modify their display. Shaders are introduced [here](https://github.com/HeapsIO/heaps/wiki/H2D-Shaders).
2020

21-
`Drawable` instances have other properties which can be discovered by visiting the [`h2d.Drawable`](https://github.com/ncannasse/heaps/blob/master/h2d/Drawable.hx) API section.
21+
`Drawable` instances have other properties which can be discovered by visiting the [`h2d.Drawable`](https://heaps.io/api/h2d/Drawable.html) API section.
2222

2323
## Sample
2424

@@ -31,8 +31,11 @@ A collection of different objects that all inherit from `h2d.Drawable`:
3131
### Code
3232

3333
```haxe
34-
class SomeDrawables extends hxd.App {
35-
static function main() {new SomeDrawables();}
34+
class Main extends hxd.App {
35+
static function main() {
36+
new Main();
37+
}
38+
3639
override function init() {
3740
3841
// a h2d.Text (like from the Hello World! sample)

Diff for: First-outlook.md

-2
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,6 @@ There are many samples that haven't yet been added to the site of Heaps. The sam
1818

1919
When compiling the `all.hxml` file all samples should get compiled (which currently takes about 227 MB of disk space).
2020

21-
Sidenote (Windows): When using HashLink you can run them very quickly when [adding HashLink to your right mouse menues](https://github.com/HaxeFoundation/hashlink/wiki/Further-Tips#working-on-windows).
22-
2321
### 👩‍💻👨‍💻 Samples from other users
2422

2523
You can also learn from external public repositories from other **members of the community**

Diff for: H2D-Events-and-Interactivity.md

+8-8
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Events and interaction
22

3-
Making objects interactive (with the mouse) is done creating a [`h2d.Interactive`](api/h2d/Interactive.html) instance. You provide it an interaction area and attach it to a sprite. This can be used to implement **buttons for the UI** but also for any other object that responds on being clicked or hovered (for instance *an old wooden chest* opened by mouse or *an enemy* the player hits by clicking on it).
3+
Making objects interactive (with the mouse) is done by creating a [`h2d.Interactive`](https://heaps.io/api/h2d/Interactive.html) instance. You provide it with an interaction area and attach it to a sprite. This can be used to implement buttons for the UI, but also for any other object that responds to being clicked or hovered over (for instance, an old wooden chest opened by mouse or an enemy the player hits by clicking on it).
44

55
```haxe
66
var interaction = new h2d.Interactive(300, 100, mySprite);
@@ -23,19 +23,19 @@ interaction.onClick = function(event : hxd.Event) {
2323

2424
## Global events
2525

26-
You can listen to global events (keyboard, touch, mouse, window) by adding event listener to the [`hxd.Window`](api/hxd/Window.html) instance.
26+
You can listen to global events (keyboard, touch, mouse, window) by adding an event listener to the [`hxd.Window`](https://heaps.io/api/hxd/Window.html) instance.
2727

2828
```haxe
2929
function onEvent(event : hxd.Event) {
3030
trace(event.toString());
3131
}
3232
hxd.Window.getInstance().addEventTarget(onEvent);
3333
```
34-
Don't forget to remove the event using removeEventTarget when disposing your objects.
34+
Don't forget to remove the event using `removeEventTarget` when disposing of your objects.
3535

3636
## Keyboard events
3737

38-
Keyboard events can be observed using the global event, check if the `event.kind` is `EKeyDown` or `EKeyUp`.
38+
Keyboard events can be captured using the global event. Check if the `event.kind` is `EKeyDown` or `EKeyUp`.
3939

4040
```haxe
4141
function onEvent(event : hxd.Event) {
@@ -58,7 +58,7 @@ if (Key.isPressed(Key.SPACE)) {
5858

5959
## Resize events
6060

61-
You can listen to resize events by adding `addResizeEvent` listener to the [`hxd.Window`](api/hxd/Window.html) instance.
61+
You can listen to resize events by adding `addResizeEvent` listener to the [`hxd.Window`](https://heaps.io/api/hxd/Window.html) instance.
6262

6363
```haxe
6464
function onResize() {
@@ -67,10 +67,10 @@ function onResize() {
6767
}
6868
hxd.Window.getInstance().addResizeEvent(onResize);
6969
```
70-
Don't forget to remove the event using removeEventTarget when disposing your objects.
70+
Don't forget to remove the event using `removeEventTarget` when disposing your objects.
7171

72-
All events callbacks in Heaps receive a [`hxd.Event`](api/hxd/Event.html) instance, which contains info about the event.
72+
All events callbacks in Heaps receive a [`hxd.Event`](https://heaps.io/api/hxd/Event.html) instance, which contains info about the event.
7373

7474
## Touch screen
7575

76-
[hxd.System.getValue(IsTouch)](api/hxd/System.html#getValue) can be used to detect whether a device has a touch screen or not (currently only detected on mobile devices). This value could be used for example to implement a long press with a timer on touch screen platforms only.
76+
[hxd.System.getValue(IsTouch)](https://heaps.io/api/hxd/System.html#getValue) can be used to detect whether a device has a touch screen or not (currently only detected on mobile devices). This value could be used for example to implement a long press with a timer on touch screen platforms only.

Diff for: H2D-Interactive.md

-44
This file was deleted.

0 commit comments

Comments
 (0)