ExTermbox v0.3.1 ExTermbox.Position View Source
Represents a position on the screen by encoding a pair of cartesian
coordinates. The origin is the top-left-most character on the screen
(0, 0)
, while x and y increase from left to right and top to bottom,
respectively.
Link to this section Summary
Functions
Translates (moves) a position by some delta x and y
Translate a position by a delta x
Translate a position by a delta y
Link to this section Types
Link to this type
t()
View Source
t()
View Source
t() :: %ExTermbox.Position{x: non_neg_integer(), y: non_neg_integer()}
t() :: %ExTermbox.Position{x: non_neg_integer(), y: non_neg_integer()}
Link to this section Functions
Link to this function
translate(position, dx, dy) View Source
Translates (moves) a position by some delta x and y.
Returns a new %Position{}
.
Examples
iex> translate(%Position{x: 0, y: 0}, 1, 2)
%Position{x: 1, y: 2}
iex> translate(%Position{x: 10, y: 0}, -1, 0)
%Position{x: 9, y: 0}
Link to this function
translate_x(pos, dx) View Source
Translate a position by a delta x.
Link to this function
translate_y(pos, dy) View Source
Translate a position by a delta y.