MayaFlux 1.0.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches
Tend.cpp
Go to the documentation of this file.
1#include "Tend.hpp"
2
4
5namespace {
6
7 std::shared_ptr<Buffers::FormaBuffer> make_text_buffer(Surface& surface)
8 {
10 surface.render_config({ .additional_textures = { { "text", nullptr } } }));
11 }
12
13} // namespace
14
16 Surface& surface,
17 Kinesis::AABB2D bounds,
18 std::shared_ptr<Portal::Text::PressParams> params,
19 std::string initial_text,
20 bool scrollable)
21{
22 if (!scrollable) {
23 return TextField {}.place(
24 make_text_buffer(surface), surface, bounds, std::move(params), std::move(initial_text));
25 }
26
27 const auto batch = make_text_buffer(surface);
28 auto viewport_target = FormaTarget::slice_of(batch, Graphics::PrimitiveTopology::TRIANGLE_STRIP);
29 auto viewport = Scrollable {}.place(std::move(viewport_target), surface, bounds);
30
31 return TextField {}.scrollable(
32 FormaTarget::slice_of(batch, Graphics::PrimitiveTopology::TRIANGLE_LIST),
33 surface, viewport, std::move(params), std::move(initial_text));
34}
35
36} // namespace MayaFlux::Portal::Forma
Named owner of a (Window, Layer, Context) triple: the Forma canvas.
Definition Surface.hpp:121
std::shared_ptr< Buffers::FormaBuffer > create_buffer(Graphics::RenderConfig render)
The single buffer construction path.
Definition Atelier.cpp:117
Atelier & atelier()
Accessor for the process-wide Atelier.
Definition Atelier.hpp:304
TextField create_text_field(Surface &surface, Kinesis::AABB2D bounds, std::shared_ptr< Portal::Text::PressParams > params, std::string initial_text, bool scrollable)
Build a text-capable FormaBuffer, register a TextField, and wire text editing onto it in one call.
Definition Tend.cpp:15
Axis-aligned bounding rectangle in a 2D coordinate space.
Definition Bounds.hpp:63
MAYAFLUX_API Scrollable & place(FormaTarget in_buf, Surface &surface, Kinesis::AABB2D viewport)
Register the viewport element, wire wheel scrolling, and populate scroll, offset, buf,...
A clipped, scroll-offset viewport over content taller than it.
MAYAFLUX_API TextField & place(FormaTarget in_buf, Surface &surface, Kinesis::AABB2D bounds, std::shared_ptr< Portal::Text::PressParams > in_params, std::string initial_text={})
Register the text field element and wire text editing onto it.
MAYAFLUX_API TextField & scrollable(FormaTarget in_buf, Surface &surface, Scrollable &scroller, std::shared_ptr< Portal::Text::PressParams > in_params, std::string initial_text={}, float content_multiplier=3.F)
Fluent creator: place this field inside an already-placed Scrollable, growing itself taller than its ...
An editable text region: keyboard/text-input wiring over an Element the caller already has a buffer f...
Definition TextField.hpp:88