An open API service indexing awesome lists of open source software.

https://github.com/firefly-zero/firefly-elixir

๐Ÿงช Experimental Elixir SDK for making Firefly Zero games
https://github.com/firefly-zero/firefly-elixir

elixir firefly-zero gamedev orb sdk wasm

Last synced: about 1 year ago
JSON representation

๐Ÿงช Experimental Elixir SDK for making Firefly Zero games

Awesome Lists containing this project

README

          

# firefly-elixir

The official SDK for writing apps and games for [Firefly Zero](https://fireflyzero.com/) in [Elixir](https://elixir-lang.org/) using [Orb](https://github.com/RoyalIcing/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.

* [โ–ถ๏ธ runtime docs](https://docs.fireflyzero.com/dev/getting-started/)
* [๐Ÿ“„ api docs](https://hexdocs.pm/firefly_elixir/api-reference.html)
* [๐Ÿ“ฆ hex.pm](https://hex.pm/packages/firefly_elixir)
* [๐Ÿ™ github](https://github.com/firefly-zero/firefly-elixir)

## Usage

1. [Install Elixir](https://elixir-lang.org/install.html)
1. [Install wabt](https://github.com/WebAssembly/wabt/releases)
1. [Install firefly_cli](https://docs.fireflyzero.com/dev/getting-started/#-install-tools)
1. Create a new Elixir project: `mix new hello`
1. Add the SDK into `mix.exs`:

```elixir
defp deps do
[
{:firefly_elixir, "~> 0.1.0"}
]
end
```

1. Fetch dependencies: `mix deps.get`
1. Write some code:

```elixir
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
```

1. Create `firefly.toml`:

```toml
author_id = "demo"
app_id = "hello"
author_name = "Demo"
app_name = "Hello"

[files]
_bin = { path = "main.wasm", copy = true }
```

1. Build wat: `mix wasm Hello > main.wat`
1. Build wasm: `wat2wasm main.wat -o main.wasm`
1. Build the Firefly Zero app: `firefly_cli build`