Complete example for the C++ API.
- See on GitHub
- Checkout the common folder for the
state
implementation
#include "font-chef/font-chef.hpp"
#include "common/font.h"
#include "common/state.hpp"
int main(int argc, char const ** const argv) {
xx::state state;
xx::texture font_texture = state.texture(font.
pixels());
.
render(
"Hello, handsome! I mean... world!")
.
wrap(state.bounds().right * 0.66f)
.
move(0.0f, state.bounds().bottom / 2 - 20);
while (state.update()) {
for (auto & map : result) {
font_texture.render(map.source, map.target);
}
}
return 0;
}
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
render_result & move(float left=0.0f, float baseline=0.0f) &
This is a wrapper to fc_move. Consult its documentation for more information.
Definition: render-result.hpp:169
font from(uint8_t const *font_data, fc::font_size const &font_size, fc::color const &font_color)
A helper method to ease font cooking via method chaining.
Definition: font.hpp:238