|
TinyMaterialDesign
|
Places item rects evenly spaced around a circle. More...
#include <RadialLayout.h>
Public Member Functions | |
| RadialLayout (Bounds container, int32_t radius, float startDegrees=0.0f) | |
| Bounds | itemRect (int index, int count, int32_t width, int32_t height) const |
Places item rects evenly spaced around a circle.
Not a widget - see GridLayout.h for the rationale. Useful for round displays (watch-face style dials/menus) where LinearLayout/GridLayout's rectilinear packing doesn't fit the screen shape:
RadialLayout dial(Bounds(0, 0, 240, 240), 90); // radius from center for (int i = 0; i < 6; ++i) items[i].bounds = dial.itemRect(i, 6, 36, 36);
Angle 0 points up (12 o'clock) and items are placed clockwise, matching how a clock/dial reads; pass a non-zero startDegrees to rotate the whole ring.
|
inline |
|
inline |
Bounds for the index-th of count items, each width x height, centered on a point evenly spaced around the circle.