FTXUI  0.11.0
C++ functional terminal UI.
Loading...
Searching...
No Matches
box.cpp
Go to the documentation of this file.
2
3#include <algorithm>
4
5namespace ftxui {
6/// @return the biggest Box contained in both |a| and |b|.
7/// @ingroup screen
8// static
10 return Box{
11 std::max(a.x_min, b.x_min),
12 std::min(a.x_max, b.x_max),
13 std::max(a.y_min, b.y_min),
14 std::min(a.y_max, b.y_max),
15 };
16}
17
18/// @return whether (x,y) is contained inside the box.
19/// @ingroup screen
20bool Box::Contain(int x, int y) {
21 return x_min <= x && //
22 x_max >= x && //
23 y_min <= y && //
24 y_max >= y;
25}
26
27} // namespace ftxui
28
29// Copyright 2020 Arthur Sonzogni. All rights reserved.
30// Use of this source code is governed by the MIT license that can be found in
31// the LICENSE file.
int x_max
Definition box.hpp:8
int y_min
Definition box.hpp:9
bool Contain(int x, int y)
Definition box.cpp:20
int y_max
Definition box.hpp:10
int x_min
Definition box.hpp:7
static Box Intersection(Box a, Box b)
Definition box.cpp:9