ElixirDoom.Render.Weapon (elixir_doom v0.2.0)

Copy Markdown View Source

The weapon in the player's hands and its muzzle flash, drawn over the view as Doom draws its player sprites: placed on Doom's 320 by 168 view stretched to the view's size, lit by the player's sector, unlit when bright, through the fixed light table when one is in force, and as a shimmer while the player is partly invisible.

frame = ElixirDoom.Render.Weapon.draw(frame, graphics, view, {width, height}, fixed)
ElixirDoom.Render.Weapon.sprites(graphics, view, {width, height}, fixed)

Summary

Functions

frame with the weapon drawn over it, the view being width by height.

The weapon and flash pictures to draw for a view width by height: each its picture, the rectangle it fills in view pixels, its light table, and whether it shimmers.

Types

sprite()

@type sprite() :: %{
  picture: non_neg_integer(),
  rect: {float(), float(), float(), float()},
  light: non_neg_integer(),
  shimmer: boolean()
}

Functions

draw(frame, graphics, view, size, fixed)

frame with the weapon drawn over it, the view being width by height.

sprites(graphics, view, arg, fixed)

@spec sprites(
  ElixirDoom.Graphics.t(),
  map(),
  {pos_integer(), pos_integer()},
  integer() | nil
) :: [
  sprite()
]

The weapon and flash pictures to draw for a view width by height: each its picture, the rectangle it fills in view pixels, its light table, and whether it shimmers.