38 lines
961 B
C++
38 lines
961 B
C++
#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, Shader shader) {
|
|
if (x > buffer.width || y > buffer.height) {return;};
|
|
|
|
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;
|
|
}
|
|
return;
|
|
}
|
|
};
|
|
} |