summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2021-11-28 22:15:38 +0100
committerDaniel Friesel <derf@finalrewind.org>2021-11-28 22:15:38 +0100
commit392aec889cff9400d512970868a6dcfba3b72ce1 (patch)
treeec4e7d3671588ea92ffb0cb642785ce22c64fb93 /src
parent91910f8045317d8b7fd91c6ad090433d0434cd7d (diff)
framebuffer: add drawBattery function
Diffstat (limited to 'src')
-rw-r--r--src/os/object/framebuffer.cc11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/os/object/framebuffer.cc b/src/os/object/framebuffer.cc
index e8b0ee0..82f26e3 100644
--- a/src/os/object/framebuffer.cc
+++ b/src/os/object/framebuffer.cc
@@ -71,6 +71,17 @@ void Framebuffer::drawAt(unsigned int x, unsigned int y, unsigned int w, unsigne
}
}
+void Framebuffer::drawBattery(unsigned int x, unsigned int y, unsigned char percent)
+{
+ for (unsigned char i = 0; i < 13; i++) {
+ data[(x+i) * (height/8) + y] = 0x81 | (0xff * (percent >= (i*8)));
+ }
+ data[(x+11) * (height/8) + y/8] |= 0xe7;
+ data[(x+12) * (height/8) + y/8] &= ~0x81;
+ data[(x+12) * (height/8) + y/8] |= 0x24;
+ data[(x+13) * (height/8) + y/8] = 0x3c;
+}
+
void Framebuffer::scroll()
{
for (unsigned int pos_x = 0; pos_x < width; pos_x++) {