GamesEngine.Grid (games_engine v0.3.0)
Grid component - represents a collection of Coordinates
Summary
Functions
Adds a new attributes to a %Tile{}
Will not overwrite the attribute if it already exists
Creates a new %Grid{}
struct
Automatically populates the :coordinates
attribute with a map of
%Coordinate{}
s based on the supplied dimensions
Populates a %Grid{}
with %Tile{}
s
Replaces the attributes of a tile
Updates an existing attribute of a %Tile{}
Types
Functions
Link to this function
add_tile_attribute(grid, ind, key, value)
Adds a new attributes to a %Tile{}
Will not overwrite the attribute if it already exists
Link to this function
new(rows, cols)
@spec new(non_neg_integer(), non_neg_integer()) :: t() | {:error, String.t()}
Creates a new %Grid{}
struct
Automatically populates the :coordinates
attribute with a map of
%Coordinate{}
s based on the supplied dimensions
Link to this function
populate(grid, attributes \\ %{})
Populates a %Grid{}
with %Tile{}
s
Link to this function
replace_tile_attributes(grid, ind, attributes)
@spec replace_tile_attributes(t(), non_neg_integer(), map()) :: t() | {:error, String.t()}
Replaces the attributes of a tile
Link to this function
update_tile_attribute(grid, ind, key, value)
Updates an existing attribute of a %Tile{}