From f57e2eabe0a10c9732c83532e01654a499fb8dcf Mon Sep 17 00:00:00 2001 From: Benji Dial Date: Mon, 21 Jun 2021 17:47:13 -0400 Subject: many, many changes; settings is broken --- src/user/include/cxx/raleigh/s/text_flower.h | 40 ++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 src/user/include/cxx/raleigh/s/text_flower.h (limited to 'src/user/include/cxx/raleigh/s/text_flower.h') diff --git a/src/user/include/cxx/raleigh/s/text_flower.h b/src/user/include/cxx/raleigh/s/text_flower.h new file mode 100644 index 0000000..f5cfcca --- /dev/null +++ b/src/user/include/cxx/raleigh/s/text_flower.h @@ -0,0 +1,40 @@ +#ifndef RALEIGH_S_TEXT_FLOWER_H +#define RALEIGH_S_TEXT_FLOWER_H + +#include +#include + +namespace raleigh { + class text_flower { + public: + //max_rows or cols 0 means no limit + //s is not copied + text_flower(const char *s, uint32_t cols=50, uint32_t max_rows=0); + + uint32_t get_n_lines() __attribute__ ((pure)); + //not a copy + char *get_nth_line(uint32_t n) __attribute__ ((pure)); + uint32_t get_line_offset(uint32_t n) __attribute__ ((pure)); + + void draw_text(_pixel_t *start, uint32_t pitch, const struct font_info *fi, _pixel_t color); + void flow_text(); + + //call flow_text after any changes + const char *s; + + private: + alist lines; + alist offsets; + + uint32_t max_rows; + uint32_t cols; + + //for use inside flow_text + const char *on_char; + const char *line_start; + uint32_t row_len; + void push_line(); + }; +} + +#endif \ No newline at end of file -- cgit v1.2.3