ElixirDoom.Menu (elixir_doom v0.1.0)

Copy Markdown View Source

Doom's menus, as the player moves through them: main, episode, skill, options, sound volume, controls, the read-this screens, and Doom's messages that wait for a key or for y or n.

menu = ElixirDoom.Menu.open(settings)
%{menu: menu, settings: settings, sounds: sounds} = ElixirDoom.Menu.event(menu, {:key, :down}, settings)

event/3 returns what Cauldron2D.Client.Game's menu_event/3 returns, the menu holding the settings it shows (:settings). The options live in the settings: key bindings, the sound and music volumes, and under :options messages on or off, :high or :low detail, the screen size in Doom's blocks (3 to 11) and the mouse sensitivity (0 to 9). A new game is sent to the world as the request {:new_game, episode, skill} (skill 1 to 5); ending the game or quitting leaves it. An episode the WAD lacks answers with Doom's shareware message; loading and saving answer that they are not part of this game.

Summary

Functions

The controls page's rows, as {name, action}; :mouse is the use-mouse switch.

The player options and their defaults, as Doom starts.

How many episodes the episode menu lists: four where the WAD has a fourth's title, else three.

Take one event; see the module documentation for what comes back.

The rows of a page: an item, or nil for the slider beneath the one above it.

Whether the mouse is bound to anything in settings.

The menu as Escape opens it: the main menu.

Types

t()

@type t() :: %ElixirDoom.Menu{
  cursor: term(),
  grab?: term(),
  message: term(),
  page: term(),
  settings: term()
}

Functions

controls()

@spec controls() :: [{String.t(), atom()}]

The controls page's rows, as {name, action}; :mouse is the use-mouse switch.

defaults()

@spec defaults() :: map()

The player options and their defaults, as Doom starts.

episodes()

@spec episodes() :: 3..4

How many episodes the episode menu lists: four where the WAD has a fourth's title, else three.

event(menu, event, settings)

@spec event(t(), term(), map()) :: map()

Take one event; see the module documentation for what comes back.

items(page)

@spec items(atom()) :: [term()]

The rows of a page: an item, or nil for the slider beneath the one above it.

mouse?(settings)

@spec mouse?(map()) :: boolean()

Whether the mouse is bound to anything in settings.

open(settings)

@spec open(map()) :: t()

The menu as Escape opens it: the main menu.