Files
UwUGL/primatives/point.cpp
T

39 lines
986 B
C++
Raw Normal View History

2026-07-07 07:25:49 -07:00
#pragma once
#include <stdint.h>
#include "../datatypes.cpp"
#include "../helpers.cpp"
#include "../buffer.cpp"
#include "../shader.cpp"
2026-07-07 07:25:49 -07:00
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
2026-07-08 15:17:30 -07:00
void draw (Buffer buffer, Shader shader) {
2026-07-07 07:25:49 -07:00
if (x > buffer.width || y > buffer.height) {return;};
2026-07-08 15:17:30 -07:00
if (shader.shaderType == COLOR) {
buffer.drawPixel(x, y, shader.c0);
return;
} else if (shader.shaderType == HGRADIENT) {
buffer.drawPixel(x, y, ShaderMethods::gradient(shader.u0, shader.scale, shader.c0, shader.c1, x));
return;
} else if (shader.shaderType == VGRADIENT) {
buffer.drawPixel(x, y, ShaderMethods::gradient(shader.v0, shader.scale, shader.c0, shader.c1, y));
return;
}
2026-07-07 07:25:49 -07:00
return;
}
};
}