Move glPixelStore call inside of InitTextEngine so users don't need to call it. Also adjusted Color3 and Color4, more work coming soon.
Some checks failed
Run ReCI Build Test / Explore-Gitea-Actions (push) Failing after 2m18s
Some checks failed
Run ReCI Build Test / Explore-Gitea-Actions (push) Failing after 2m18s
This commit is contained in:
@@ -3,4 +3,17 @@
|
||||
namespace JGL
|
||||
{
|
||||
|
||||
u8 Color3::RedChannel() const { return r; }
|
||||
|
||||
u8 Color3::GreenChannel() const { return g; }
|
||||
|
||||
u8 Color3::BlueChannel() const { return b; }
|
||||
|
||||
float Color3::RedChannelNormalized() const { return static_cast<float>(r) / 255.f;}
|
||||
|
||||
float Color3::BlueChannelNormalized() const { return static_cast<float>(b) / 255.f;}
|
||||
|
||||
float Color3::GreenChannelNormalized() const { return static_cast<float>(g) / 255.f;}
|
||||
|
||||
Color3::Color3(u8 R, u8 G, u8 B) : r(R), g(G), b(B) {}
|
||||
}
|
@@ -3,4 +3,25 @@
|
||||
namespace JGL
|
||||
{
|
||||
|
||||
Color4::Color4(u8 red, u8 green, u8 blue, u8 alpha) : r(red), g(green), b(blue), a(alpha) {}
|
||||
|
||||
Color4::Color4(const Color3 &color3, u8 alpha) {r = color3.r; g = color3.g; b = color3.b; a = alpha;}
|
||||
|
||||
Color4 Color4::FromColor3(const Color3 &color3, u8 alpha) {return Color4(color3, alpha);}
|
||||
|
||||
u8 Color4::RedChannel() const { return r;}
|
||||
|
||||
u8 Color4::GreenChannel() const { return g;}
|
||||
|
||||
u8 Color4::BlueChannel() const {return b;}
|
||||
|
||||
u8 Color4::AlphaChannel() const {return a;}
|
||||
|
||||
float Color4::RedChannelNormalized() const {return static_cast<float>(r/255.f); }
|
||||
|
||||
float Color4::GreenChannelNormalized() const {return static_cast<float>(g/255.f); }
|
||||
|
||||
float Color4::BlueChannelNormalized() const {return static_cast<float>(b/255.f); }
|
||||
|
||||
float Color4::AlphaChannelNormalized() const {return static_cast<float>(a/255.f); }
|
||||
}
|
@@ -2,7 +2,7 @@
|
||||
#include <vector>
|
||||
#include <string>
|
||||
#include <iostream>
|
||||
|
||||
#include <glad/glad.h>
|
||||
|
||||
#if __linux__
|
||||
#include <freetype2/ft2build.h>
|
||||
@@ -49,6 +49,10 @@ namespace JGL::Detail
|
||||
}
|
||||
|
||||
bool InitTextEngine() {
|
||||
|
||||
glPixelStorei(GL_UNPACK_ALIGNMENT, 1); // NOTE: This MUST be called for text rendering to work properly!!!
|
||||
// Keep note of this, might cause problems later?
|
||||
|
||||
if (ft != nullptr)
|
||||
throw std::runtime_error("Error::FREETYPE: FT_Library was initialized but is already initialized.");
|
||||
|
||||
|
Reference in New Issue
Block a user