ElixirQuake.Menu (elixir_quake v0.1.0)

Copy Markdown View Source

Quake's menus, as the player moves through them: the main menu, single player, options, customize controls, help and quit, each answering the keys Quake's do.

menu = ElixirQuake.Menu.open(settings)
%{menu: menu, settings: settings, sounds: sounds} = ElixirQuake.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 it changes live in the settings: key bindings, the sound volume, and under :options the screen size (30 to 120), gamma (0.5 to 1.0, lower brighter), mouse speed (1 to 11), always run and invert mouse. "Use mouse" adds or removes the mouse bindings of the mouse preset. New game is sent to the world as the request :new_game; quitting leaves it. Multiplayer, loading and saving answer that they are not part of this game.

Summary

Functions

The controls the customize page lists, as {name, action}.

The player options and their defaults.

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

Whether the mouse is bound to anything in settings.

The menu as Escape opens it: the main menu, with a quit message chosen.

The options page's items, in order.

Types

t()

@type t() :: %ElixirQuake.Menu{
  back: term(),
  cursor: term(),
  grab?: term(),
  help: term(),
  notice: term(),
  page: term(),
  quit: term(),
  settings: term()
}

Functions

commands()

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

The controls the customize page lists, as {name, action}.

defaults()

@spec defaults() :: map()

The player options and their defaults.

event(menu, event, settings)

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

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

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, with a quit message chosen.

option_items()

@spec option_items() :: [atom()]

The options page's items, in order.