Add some documenation to Frame.
This commit is contained in:
parent
7602decc76
commit
12d0903a77
1 changed files with 34 additions and 0 deletions
|
@ -9,6 +9,10 @@ defmodule Vivid.Frame do
|
||||||
@doc """
|
@doc """
|
||||||
Initialize a frame buffer.
|
Initialize a frame buffer.
|
||||||
|
|
||||||
|
* `width` the width of the frame, in pixels.
|
||||||
|
* `height` the height of the frame, in pixels.
|
||||||
|
* `colour_depth` the colour depth of the frame, in bits.
|
||||||
|
|
||||||
## Example
|
## Example
|
||||||
|
|
||||||
iex> Vivid.Frame.init(4, 4, 1)
|
iex> Vivid.Frame.init(4, 4, 1)
|
||||||
|
@ -108,6 +112,36 @@ defmodule Vivid.Frame do
|
||||||
%{frame | buffer: buffer}
|
%{frame | buffer: buffer}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@doc """
|
||||||
|
Return the width of the frame.
|
||||||
|
|
||||||
|
## Example
|
||||||
|
|
||||||
|
iex> Vivid.Frame.init(80, 25, 4) |> Vivid.Frame.width
|
||||||
|
80
|
||||||
|
"""
|
||||||
|
def width(%Frame{width: w}), do: w
|
||||||
|
|
||||||
|
@doc """
|
||||||
|
Return the height of the frame.
|
||||||
|
|
||||||
|
## Example
|
||||||
|
|
||||||
|
iex> Vivid.Frame.init(80, 25, 4) |> Vivid.Frame.height
|
||||||
|
25
|
||||||
|
"""
|
||||||
|
def height(%Frame{height: h}), do: h
|
||||||
|
|
||||||
|
@doc """
|
||||||
|
Return the colour depth of the frame.
|
||||||
|
|
||||||
|
## Example
|
||||||
|
|
||||||
|
iex> Vivid.Frame.init(80, 25, 4) |> Vivid.Frame.colour_depth
|
||||||
|
4
|
||||||
|
"""
|
||||||
|
def colour_depth(%Frame{colour_depth: d}), do: d
|
||||||
|
|
||||||
@doc ~S"""
|
@doc ~S"""
|
||||||
Convert a frame buffer to a string for debugging.
|
Convert a frame buffer to a string for debugging.
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue