ftxui::Box
cpp
#include <ftxui/screen/box.hpp>Box is a structure that represents a rectangular area in a 2D space.
It is defined by its minimum and maximum coordinates along the x and y axes. Note that the coordinates are inclusive, meaning that the box includes both the minimum and maximum values.
Summary
| Symbol | Description |
|---|---|
x_min | |
x_max | |
y_min | |
y_max | |
Intersection | Returns: the biggest Box contained in both a and b. |
Union | Returns: the smallest Box containing both a and b. |
Shift | Shift the box by (x,y). |
Contain | Returns: whether (x,y) is contained inside the box. |
IsEmpty | Returns: whether the box is empty. |
operator== | Returns: whether other is the same as this |
operator!= | Returns: whether other and this are different. |
Public Attributes
x_min
cpp
int x_min = 0;x_max
cpp
int x_max = 0;y_min
cpp
int y_min = 0;y_max
cpp
int y_max = 0;Static Functions
Intersection
cpp
static Box Intersection(Box a, Box b);Returns: the biggest Box contained in both a and b.
Union
Returns: the smallest Box containing both a and b.
Public Member Functions
Shift
cpp
void Shift(int x, int y);Shift the box by (x,y).
Parameters:
x: horizontal shift.y: vertical shift.
Contain
cpp
bool Contain(int x, int y) const;Returns: whether (x,y) is contained inside the box.
IsEmpty
cpp
bool IsEmpty() const;Returns: whether the box is empty.
operator==
cpp
bool operator==(const Box & other) const;Returns: whether other is the same as this
operator!=
cpp
bool operator!=(const Box & other) const;Returns: whether other and this are different.