X-Git-Url: https://git.sesse.net/?p=ccbs;a=blobdiff_plain;f=bigscreen%2Ffonts.cpp;h=2a7d2742ce6a663fcf8a7f9c3cdf1a4f9ab5d55e;hp=a2ac91b5a91c121cca23e7a8b79f947c65ea617c;hb=88b3ef1f363e8181e7eb04e24f1646fe9782bb44;hpb=bc35fe826101ca7eb29a6fa2e06eba2cd6c99222 diff --git a/bigscreen/fonts.cpp b/bigscreen/fonts.cpp index a2ac91b..2a7d274 100644 --- a/bigscreen/fonts.cpp +++ b/bigscreen/fonts.cpp @@ -88,3 +88,31 @@ unsigned my_draw_text(const widestring &str, unsigned char *buf, double size, in return x; } + +void my_draw_text_deferred(std::vector &td, const widestring &str, double size, int xpos, int ypos) +{ + TextDefer newtd; + newtd.str = str; + newtd.size = size; + newtd.xpos = xpos; + newtd.ypos = ypos; + td.push_back(newtd); +} + +void draw_all_deferred_text(unsigned char *buf, std::vector ¤t, std::vector &old) +{ + for (unsigned i = 0; i < current.size(); ++i) { + int r, g, b; + if (i < old.size() && current[i].str != old[i].str) { + // changed text + r = 255; + g = 0; + b = 0; + } else { + r = g = b = 255; + } + + my_draw_text(current[i].str, buf, current[i].size, current[i].xpos, current[i].ypos, r, g, b); + } +} +