Beman's challenge
- See also
- N3791 Lightweight Drawing Library ideas
int ui_main()
{
ui::dialog dlg("Boost.UI Beman's challenge");
ui::canvas canvas(dlg);
auto repaint = [&]
{
canvas.painter()
.clear_rect(0, 0, canvas.width(), canvas.height())
.font(canvas.font())
.fill_text("Hello C++ World", paint_pos)
;
};
canvas
.on_resize(repaint)
.on_left_mouse_down_event([&](ui::mouse_event& e)
{
drag_start_pos = e.pos();
})
.on_mouse_drag_event([&](ui::mouse_event& e)
{
paint_pos += e.pos() - drag_start_pos;
repaint();
drag_start_pos = e.pos();
})
;
dlg.show_modal();
return 0;
}
int main(int argc, char* argv[])
{
}