Skip to content

Latest commit

 

History

History
61 lines (48 loc) · 1.79 KB

README.md

File metadata and controls

61 lines (48 loc) · 1.79 KB

firefly-elixir

The official SDK for writing apps and games for Firefly Zero in Elixir using Orb.

Warning This SDK is highly experimental! The Orb project is in its early alpha testing stage and has a lot of rough edges and missed features. As a consequence, the SDK itself also doesn't implement some of the functions available in other SDKs.

Usage

  1. Install Elixir

  2. Install wabt

  3. Install firefly_cli

  4. Create a new Elixir project: mix new hello

  5. Add the SDK into mix.exs:

    defp deps do
      [
        {:firefly_elixir, "~> 0.1.0"}
      ]
    end
  6. Fetch dependencies: mix deps.get

  7. Write some code:

    defmodule Hello do
      use Firefly
    
      defw boot() do
        draw_triangle(
          %Point{x: 60, y: 10},
          %Point{x: 40, y: 40},
          %Point{x: 80, y: 40},
          %Style{fill_color: :light_gray, stroke_color: :dark_blue, stroke_width: 1}
        )
      end
    end
  8. Create firefly.toml:

    author_id = "demo"
    app_id = "hello"
    author_name = "Demo"
    app_name = "Hello"
    
    [files]
    _bin = { path = "main.wasm", copy = true }
  9. Build wat: mix wasm Hello > main.wat

  10. Build wasm: wat2wasm main.wat -o main.wasm

  11. Build the Firefly Zero app: firefly_cli build