MayaFlux 1.0.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches

◆ add_text_row()

MAYAFLUX_API std::pair< uint32_t, std::shared_ptr< Element > > MayaFlux::Portal::Forma::internal::add_text_row ( Surface & surface,
std::string_view label,
Kinesis::AABB2D bounds,
glm::uvec2 dims,
const std::shared_ptr< Buffers::FormaBuffer > & batch = {} )
nodiscard

Register a clickable text row on surface.

Draws label over the idle background and adds the element to the surface's layer. The row is a slice of batch when one is given, otherwise of the surface's shared buffer.

Parameters
surfaceSurface to register on.
labelRow text.
boundsNDC region of the row.
dimsPixel size to lay the text out at.
batchText-capable buffer to draw into as a slice, or empty for the surface's shared buffer.
Returns
Element id on the layer, and the row element for later set_text().

Definition at line 28 of file TextRow.cpp.

34{
35 FormaTarget buf = batch
37 : atelier().batch_slice(surface, Graphics::PrimitiveTopology::TRIANGLE_LIST);
38
39 auto row = std::make_shared<Element>();
40 row->with_name(std::string(label))
41 .with_bounds(bounds)
42 .with_buffer(buf)
43 .with_text(row_caption(label), row_press_params(dims, row_idle_color()), bounds);
44
45 return { surface.add(*row), row };
46}
static FormaTarget slice_of(const std::shared_ptr< Buffers::FormaBuffer > &buffer, std::optional< Graphics::PrimitiveTopology > topology=std::nullopt)
A new empty slice of buffer, drawn after the others.
Definition Target.cpp:19
Where an element's geometry and texture are written.
Definition Target.hpp:22
Layer::Slot add(Element element)
Forward an Element to layer().add() and return the Slot.
Definition Surface.hpp:210
Text::PressParams row_press_params(glm::uvec2 dims, glm::vec4 background)
White text over background, laid out at dims pixels.
Definition TextRow.cpp:18
Atelier & atelier()
Accessor for the process-wide Atelier.
Definition Atelier.hpp:352
std::string row_caption(std::string_view label)
Caption drawn for a row labelled label.
Definition TextRow.cpp:13

References MayaFlux::Portal::Forma::Surface::add(), atelier(), MayaFlux::Portal::Forma::internal::Atelier::batch_slice(), row_caption(), row_idle_color(), row_press_params(), MayaFlux::Portal::Forma::FormaTarget::slice_of(), and MayaFlux::Portal::Graphics::TRIANGLE_LIST.

Referenced by MayaFlux::Portal::Forma::pick(), and MayaFlux::Portal::Forma::Dropdown::place().

Here is the call graph for this function:
Here is the caller graph for this function: