41 lines
1.1 KiB
C++
41 lines
1.1 KiB
C++
#pragma once
|
|
|
|
#include <stdint.h>
|
|
|
|
#include "../datatypes.cpp"
|
|
#include "../helpers.cpp"
|
|
#include "../buffer.cpp"
|
|
#include "../shader.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;
|
|
} else if (shader.shaderType == BUFFER) {
|
|
buffer.drawPixel(x, y, ShaderMethods::buffer(shader.u0, shader.v0, shader.buffer, x, y));
|
|
}
|
|
return;
|
|
}
|
|
};
|
|
} |