Wraps a std::vector<fc_character_mapping>
.
More...
#include <render-result.hpp>
Wraps a std::vector<fc_character_mapping>
.
It's mainly a quality of life improvement over working with a vector directly. It supports move semantics to allow for method chaining and it also supports iterators and range-based for loops.
Example
- Examples
- main.cpp.
◆ render_result() [1/2]
Constructs a fc::render_result instance with a font and with a mapping vector.
This constructor exists mainly to be used by fc::font::render. You probably will never use it directly.
- Parameters
-
font | The font used to generate the contained mapping |
mapping | A movable reference to a vector of character mappings |
- See also
- fc::font::render
◆ render_result() [2/2]
◆ operator=() [1/2]
◆ operator=() [2/2]
◆ wrap() [1/2]
render_result& fc::render_result::wrap |
( |
float |
line_width, |
|
|
float |
line_height_multiplier = 1.0f , |
|
|
fc_alignment |
alignment = fc_align_left |
|
) |
| & |
|
inline |
Calls fc_wrap on the vector of character mappings.
The arguments are similar to fc_render_wrapped but calling this is much simpler. It produces the same result. Calling fc::render_result::wrap multiple times produces weird results. Call it only once after fc::font::render.
This is the lvalue version of this function.
Example
auto result =
font.render(
"Hello world!");
- Parameters
-
line_width | The maximum line width, in target/screen size (e.g, pixels) |
line_height_multiplier | A value that can be used to increase the line height/spacing |
alignment | Which aligment should lines follow |
- Returns
- *this
- Examples
- main.cpp.
◆ wrap() [2/2]
render_result&& fc::render_result::wrap |
( |
float |
line_width, |
|
|
float |
line_height_multiplier = 1.0f , |
|
|
fc_alignment |
alignment = fc_align_left |
|
) |
| && |
|
inline |
Calls fc_wrap on the vector of character mappings.
The arguments are similar to fc_render_wrapped but calling this is much simpler. It produces the same result. Calling fc::render_result::wrap multiple times produces weird results. Call it only once after fc::font::render.
This is the rvalue version of this function and returns a moveable *this. It is here mainly to assist in method chaining.
Example
auto result =
font.render(
"Hello world!").wrap(80.0f);
- Parameters
-
line_width | The maximum line width, in target/screen size (e.g, pixels) |
line_height_multiplier | A value that can be used to increase the line height/spacing |
alignment | Which aligment should lines follow |
- Returns
- *this
◆ move() [1/2]
render_result& fc::render_result::move |
( |
float |
left = 0.0f , |
|
|
float |
baseline = 0.0f |
|
) |
| & |
|
inline |
This is a wrapper to fc_move. Consult its documentation for more information.
This is the lvalue (non-moveable) version of this function
Example
auto result =
font.render(
"Hello world!").move(0.0f, 50.0f);
- Parameters
-
left | Left position where the text should start rendering |
baseline | Amount to add to the text baseline |
- Examples
- main.cpp.
◆ move() [2/2]
render_result&& fc::render_result::move |
( |
float |
left = 0.0f , |
|
|
float |
baseline = 0.0f |
|
) |
| && |
|
inline |
This is a wrapper to fc_move. Consult its documentation for more information.
This is the rvalue (moveable) version of this function mainly to be used with method chaining.
Example
auto result =
font.render(
"Hello world!").move(0.0f, 50.0f);
- Parameters
-
left | Left position where the text should start rendering |
baseline | Amount to add to the text baseline |
◆ begin()
Returns an iterator pointing to the first character mapping.
- Returns
- mapping.begin();
◆ end()
Returns an iterator pointing to the end+1 character mapping.
- Returns
- mapping.end();
◆ size()
size_t fc::render_result::size |
( |
| ) |
const |
|
inline |
Returns the size of the mapping vector (i.e, the number of mappings)
- Returns
- mapping.size();
The documentation for this struct was generated from the following file:
render_result & wrap(float line_width, float line_height_multiplier=1.0f, fc_alignment alignment=fc_align_left) &
Calls fc_wrap on the vector of character mappings.
Definition: render-result.hpp:115