| TGX 1.0.4 A tiny 2D/3D graphics library optimized for 32 bits microcontrollers.

Loading...
Searching...
No Matches
Classes | Typedefs | Enumerations | Functions
Box2.h File Reference

2D box class More...

`#include "Misc.h"`
`#include "Vec2.h"`
`#include <type_traits>`
`#include <stdint.h>`

Go to the source code of this file.

## Classes
struct | tgx::Box2< T >
| Generic 2D Box [specializations iBox2 , fBox2, dBox2]. More...

## Typedefs
typedef Box2< int > | tgx::iBox2
| Integer-valued 2D box.
typedef Box2< float > | tgx::fBox2
| Floating point valued 2D box with single (float) precision.
typedef Box2< double > | tgx::dBox2
| Floating point valued 2D box with double precision.

## Enumerations
enum | tgx::Anchor { tgx::CENTER = 0 , tgx::LEFT = 1 , tgx::RIGHT = 2 , tgx::TOP = 4 , tgx::BOTTOM = 8 , tgx::BASELINE = 16 , tgx::TOPLEFT = TOP | LEFT , tgx::TOPRIGHT = TOP | RIGHT , tgx::BOTTOMLEFT = BOTTOM | LEFT , tgx::BOTTOMRIGHT = BOTTOM | RIGHT , tgx::CENTERLEFT = CENTER | LEFT , tgx::CENTERRIGHT = CENTER | RIGHT , tgx::CENTERTOP = CENTER | TOP , tgx::CENTERBOTTOM = CENTER | BOTTOM , tgx::DEFAULT_TEXT_ANCHOR = BASELINE | LEFT }
| Define the placement of an anchor point inside a box. More...
enum | tgx::BoxSplit { tgx::SPLIT_LEFT = Anchor::LEFT , tgx::SPLIT_RIGHT = Anchor::RIGHT , tgx::SPLIT_TOP = Anchor::TOP , tgx::SPLIT_BOTTOM = Anchor::BOTTOM , tgx::SPLIT_TOPLEFT = Anchor::TOPLEFT , tgx::SPLIT_TOPRIGHT = Anchor::TOPRIGHT , tgx::SPLIT_BOTTOMLEFT = Anchor::BOTTOMLEFT , tgx::SPLIT_BOTTOMRIGHT = Anchor::BOTTOMRIGHT }
| Splitting of a box in half and quarters. More...

## Functions
constexpr Anchor | tgx::operator| (Anchor a1, Anchor a2)
| Enable bitwise `|` operator for enum Anchor.
Anchor & | tgx::operator|= (Anchor &a1, Anchor a2)
| Enable bitwise `|=` operator for enum Anchor.
constexpr Anchor | tgx::operator& (Anchor a1, Anchor a2)
| Enable bitwise `&` operator for enum Anchor.
Anchor & | tgx::operator&= (Anchor &a1, Anchor a2)
| Enable bitwise `&=` operator for enum Anchor.
constexpr BoxSplit | tgx::operator| (BoxSplit a1, BoxSplit a2)
| Enable bitwise `|` operator for enum BoxSplit.
BoxSplit & | tgx::operator|= (BoxSplit &a1, BoxSplit a2)
| Enable bitwise `|=` operator for enum BoxSplit.
constexpr BoxSplit | tgx::operator& (BoxSplit a1, BoxSplit a2)
| Enable bitwise `&` operator for enum BoxSplit.
BoxSplit & | tgx::operator&= (BoxSplit &a1, BoxSplit a2)
| Enable bitwise `&=` operator for enum BoxSplit.

## Detailed Description

2D box class

## Enumeration Type Documentation

## ◆ Anchor

enum tgx::Anchor

Define the placement of an anchor point inside a box.

left center right
top +-----------------------+
| . |
| . |
| . |
center | ..................... |
| . |
baseline | ..................... |
| . |
bottom +-----------------------+

Remarks
  - The default value is `CENTER` which is used when either the horizontal or vertical placement is not specified.
  - `BASELINE` only make sense for a text bounding and a given font. Otherwise, it is ignored (and implicitly replaced by `CENTER`).

Enumerator
CENTER | Center (vertical/horizontal alignement). This is the default placement if not specitified.
LEFT | Left side (horizontal alignement)
RIGHT | Right side (horizontal alignement)
TOP | Top side (vertical alignement)
BOTTOM | Bottom side (vertical alignement)
BASELINE | Baseline height (vertical alignement). only makes sense with a font (when drawing text), replaced by center otherwise
TOPLEFT | Top-left corner.
TOPRIGHT | Top-right corner.
BOTTOMLEFT | bottom-left corner
BOTTOMRIGHT | Bottom-right corner.
CENTERLEFT | center point on the left side
CENTERRIGHT | center point on the right side
CENTERTOP | center point on the top side
CENTERBOTTOM | center point on the bottom side
DEFAULT_TEXT_ANCHOR | Default location for text anchoring.

## ◆ BoxSplit

enum tgx::BoxSplit

Splitting of a box in half and quarters.

Enumerator
SPLIT_LEFT | left half
SPLIT_RIGHT | right half
SPLIT_TOP | top half
SPLIT_BOTTOM | bottom half
SPLIT_TOPLEFT | top left quarter
SPLIT_TOPRIGHT | top right quarter
SPLIT_BOTTOMLEFT | bottom left quarter
SPLIT_BOTTOMRIGHT | bottom right quarter