diff options
author | Benji Dial <benji6283@gmail.com> | 2021-06-21 17:47:13 -0400 |
---|---|---|
committer | Benji Dial <benji6283@gmail.com> | 2021-06-21 17:47:13 -0400 |
commit | f57e2eabe0a10c9732c83532e01654a499fb8dcf (patch) | |
tree | cbf91a23fcdd65e0ea7ed55b0940ca7042d59bef /src/user/include/cxx/raleigh/s | |
parent | 83835306d57461205a7bcfef9f4c3e06bc504006 (diff) | |
download | portland-os-f57e2eabe0a10c9732c83532e01654a499fb8dcf.tar.gz |
many, many changes; settings is broken
Diffstat (limited to 'src/user/include/cxx/raleigh/s')
-rw-r--r-- | src/user/include/cxx/raleigh/s/text_flower.h | 40 |
1 files changed, 40 insertions, 0 deletions
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 <libfont/fonts.h> +#include <structs/alist.h> + +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<char *> lines; + alist<uint32_t> 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 |