Files
UwUGL/datatypes.cpp
T

85 lines
1.6 KiB
C++

#pragma once
#include <stdint.h>
namespace UwU {
// Color datatype returns individual channel values from rgba hexcode
struct Color {
Color(uint32_t hex) {
this->a = hex & 0x000000ff;
this->b = (hex & 0x0000ff00) >> 8;
this->g = (hex & 0x00ff0000) >> 16;
this->r = (hex & 0xff000000) >> 24;
}
Color(uint8_t r, uint8_t g, uint8_t b, uint8_t a) {
this->r = r;
this->g = g;
this->b = b;
this->a = a;
}
Color() {}
uint8_t r;
uint8_t g;
uint8_t b;
uint8_t a;
};
// Coord2 datatype for xy coordinates, from top-left of surface
// struct Coord2 {
// Coord2(uint16_t x, uint16_t y) {
// this->x = x;
// this->y = y;
// }
// Coord2() {}
// uint16_t x;
// uint16_t y;
// };
// Vec2 datatype for signed x, y coordinates
// struct Vec2 {
// Vec2(int16_t x, int16_t y) {
// this->x = x;
// this->y = y;
// }
// Vec2() {}
// int16_t x;
// int16_t y;
// };
// // 2x2 matrix, Q15.16 signed fixed point
// struct Matrix4 {
// Matrix4(int32_t xx, int32_t xy, int32_t yx, int32_t yy) {
// this->xx = xx;
// this->xy = xy;
// this->yx = yx;
// this->yy = yy;
// }
// Matrix4() {}
// int32_t xx; // x' = x*xx + y*xy
// int32_t xy;
// int32_t yx; // y' = x*yx + y*yy
// int32_t yy;
// };
// class Mapper {
// public:
// Mapper() {
// }
// uint16_t *xxMap;
// };
enum ShaderType {
COLOR,
HGRADIENT,
VGRADIENT,
BUFFER
};
enum Direction {
H,
V
};
}