Files
UwUGL/datatypes.cpp
T

57 lines
1.2 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;
};
// // trapezoid datatype (horizontally constrained)
// struct Trapezoid {
// Trapezoid(uint16_t y0, uint16_t y1, uint16_t xl0, uint16_t xl1, uint16_t xr0, uint16_t xr1) {
// this->y0 = y0;
// this->y1 = y1;
// this->xl0 = xl0;
// this->xl1 = xl1;
// this->xr0 = xr0;
// this->xr1 = xr1;
// }
// Trapezoid() {}
// uint16_t y0;
// uint16_t y1;
// uint16_t xl0;
// uint16_t xl1;
// uint16_t xr0;
// uint16_t xr1;
// };
}