Fork Heaps on GitHub
Menu

H2D

Heaps' 2D API (package `h2d`) defines a collection of classes for 2D graphics. The following sections cover its usage.

  • Introduction

    The code samples in the first pages in the H2D section are coded without any external resources allowing to just copy and paste the code and compiling it directly on your machine...

    Read more
  • Object

    Like shown previously in the introduction to give our Heaps application visual (2D) content we need classes that are built upon h2d.Object...

    Read more
  • Scenes

    In the previous sections we already used s2d which represents the active current scene rendered by the hxd.App...

    Read more
  • Events and interaction

    Making objects interactive (with the mouse) is done by creating a h2d.Interactive 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)...

    Read more
  • Drawable

    H2D classes that can display something on screen usually extend the h2d.Drawable class...

    Read more
  • Graphical surfaces

    Read more
  • Drawing Tiles

    Tiles can be drawn with multiple approaches, some of which will be discussed below...

    Read more
  • Optimizing bitmaps

    Some tips:..

    Read more
  • Filters

    Filters apply to the display tree, so can be used to create screen effects. You can assign a filter to a h2d.Sprite...

    Read more
  • Shaders

    You can add a Shader in H2D using drawable.addShader...

    Read more
  • Flow

    The h2d.Flow class allows to properly arrange child objects (h2d.Object)...

    Read more
  • Creating simple sprites

    To create a sprite we load a h2d.Tile into the RAM. From there we can fetch the tile to instantiate a h2d.Bitmap which can finally be placed inside our scene...

    Read more