aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/framebuffer.cpp
diff options
context:
space:
mode:
authorEmulatedSeasons <89668582+EmulatedSeasons@users.noreply.github.com>2024-05-07 11:07:03 -0400
committerEmulatedSeasons <89668582+EmulatedSeasons@users.noreply.github.com>2024-05-07 11:07:03 -0400
commitabaab98bd757cd0818cfcddc983eee25ab7672ed (patch)
tree4e5d407cf55877b38699ac12b904be2dc3d99864 /kernel/framebuffer.cpp
parent47d94ed4fd724d0e8b7819e7e3d0783c798ea190 (diff)
Made framebuffer class, serial write functions, and finally got makefile to build without having to make clean
Diffstat (limited to 'kernel/framebuffer.cpp')
-rw-r--r--kernel/framebuffer.cpp22
1 files changed, 22 insertions, 0 deletions
diff --git a/kernel/framebuffer.cpp b/kernel/framebuffer.cpp
new file mode 100644
index 0000000..a07d61a
--- /dev/null
+++ b/kernel/framebuffer.cpp
@@ -0,0 +1,22 @@
+#include <framebuffer.h>
+#include <stdint.h>
+#include <stddef.h>
+
+Framebuffer::Framebuffer(uint32_t* addr, const uint64_t width, const uint64_t height)
+ : addr {addr}, width {width}, height {height} {
+ clear();
+}
+
+void Framebuffer::clear() {
+ for (size_t y = 0; y < height; y++) {
+ for (size_t x = 0; x < width; x++) {
+ const size_t i = y * width + x;
+ addr[i] = 0x000000;
+ }
+ }
+}
+
+void Framebuffer::drawpixel(const uint64_t x, const uint64_t y, const uint32_t color) {
+ const size_t pos = y * width + x;
+ addr[pos] = color;
+} \ No newline at end of file