Font round 1

This commit is contained in:
2023-06-02 21:04:35 -07:00
parent d20e8e8e7a
commit 6dda9a6797
12 changed files with 258 additions and 40 deletions

View File

@ -7,7 +7,12 @@
#include "dawnlibs.hpp"
namespace Dawn {
struct Color {
struct ColorU8 {
uint8_t r, g, b, a;
};
#pragma pack(push, 1)
struct __attribute__ ((packed)) Color {
float_t r, g, b, a;
struct Color operator * (const float_t &x) {
@ -36,7 +41,17 @@ namespace Dawn {
a + color.a
};
}
operator struct ColorU8() const {
return {
(uint8_t)(r * 255),
(uint8_t)(g * 255),
(uint8_t)(b * 255),
(uint8_t)(a * 255)
};
}
};
#pragma pack(pop)
#define COLOR_WHITE { 1.0f, 1.0f, 1.0f, 1.0f }
#define COLOR_RED { 1.0f, 0, 0, 1.0f }

View File

@ -99,7 +99,7 @@ namespace Dawn {
* @param pixels Array of pixels you're trying to buffer.
* @return The amount of bytes buffered to the texture.
*/
virtual void buffer(struct Color pixels[]) = 0;
virtual void buffer(struct ColorU8 pixels[]) = 0;
virtual void buffer(uint8_t pixels[]) = 0;
};
}