rewrote example.cpp to use composition

This commit is contained in:
2026-07-07 07:25:49 -07:00
parent 3907c88f31
commit aa49a32ace
6 changed files with 81 additions and 121 deletions
+28
View File
@@ -0,0 +1,28 @@
#pragma once
#include <stdint.h>
#include "datatypes.cpp"
#include "helpers.cpp"
#include "buffer.cpp"
namespace UwU {
// point
class Point {
public:
Point(uint16_t x, uint16_t y) {
this->x = x;
this->y = y;
}
Point() {}
uint16_t x;
uint16_t y;
// Draw a rectangle
void draw (Buffer buffer, Color color) {
if (x > buffer.width || y > buffer.height) {return;};
buffer.drawPixel(Coord2(x, y), color);
return;
}
};
}