ElixirDoom.Assets (elixir_doom v0.1.0)

Copy Markdown View Source

The WAD a game is played from, read once and shared by every process: its pictures, levels, sounds and music, and the tables derived from them.

ElixirDoom.Assets.load("DOOM1.WAD")
ElixirDoom.Assets.get().graphics
ElixirDoom.Assets.level("E1M1")

load/1 reads the WAD, builds the pictures and installs everything under a :persistent_term key; get/0 reads it back from any process. Levels are read the first time they are asked for and kept.

Summary

Functions

The picture each animated picture shows at tic tic, for those that have moved on.

The installed assets; raises when none are.

Level name, read on first use and kept.

Read the WAD at path and install it. Gives the assets, or the reason it could not.

Whether a WAD is loaded.

Types

t()

@type t() :: %ElixirDoom.Assets{
  animations: [tuple()],
  graphics: ElixirDoom.Graphics.t(),
  levels: [String.t()],
  path: Path.t(),
  switches: %{required(non_neg_integer()) => non_neg_integer()},
  wad: ElixirDoom.Wad.t()
}

Functions

animation_frame(assets, tic)

@spec animation_frame(t(), non_neg_integer()) :: %{
  required(non_neg_integer()) => non_neg_integer()
}

The picture each animated picture shows at tic tic, for those that have moved on.

get()

@spec get() :: t()

The installed assets; raises when none are.

level(name)

@spec level(String.t()) :: {:ok, ElixirDoom.Level.t()} | {:error, term()}

Level name, read on first use and kept.

load(path, opts \\ [])

@spec load(Path.t(), keyword()) :: {:ok, t()} | {:error, term()}

Read the WAD at path and install it. Gives the assets, or the reason it could not.

loaded?()

@spec loaded?() :: boolean()

Whether a WAD is loaded.