Compare commits

...

6 Commits

Author SHA1 Message Date
9f9191a9db Temp patch for text size bounds. Needs to be fixed properly.
All checks were successful
Run ReCI Build Test / Explore-Gitea-Actions (push) Successful in 2m13s
2025-06-09 15:54:48 -05:00
2d536cd611 Merged several branches, fixed small error, updated dependency packages.
All checks were successful
Run ReCI Build Test / Explore-Gitea-Actions (push) Successful in 5m14s
2025-06-06 13:02:29 -05:00
40412a300a Merge pull request 'Completed Shaders Task' (#47) from shaders_again into master
Some checks failed
Run ReCI Build Test / Explore-Gitea-Actions (push) Failing after 1m39s
Reviewed-on: #47
2025-06-06 13:44:47 -04:00
819539247e Merge pull request 'shader_preprocessor' (#43) from shader_preprocessor into shaders_again
Some checks failed
Run ReCI Build Test / Explore-Gitea-Actions (push) Failing after 26m34s
Reviewed-on: #43
2025-06-06 13:38:29 -04:00
b3fb28be38 Package Maintenance - Update mcolor to 7.1
Some checks failed
Run ReCI Build Test / Explore-Gitea-Actions (push) Failing after 1m41s
2025-04-22 17:19:00 -04:00
a1ca7ace77 Flip order of J2D::DrawString argument, so that we can default scale to 1, and add vector2 overload.
All checks were successful
Run ReCI Build Test / Explore-Gitea-Actions (push) Successful in 1m59s
2025-04-17 13:57:03 -04:00
7 changed files with 22 additions and 10 deletions

View File

@@ -17,7 +17,7 @@ include(cmake/CPM.cmake)
CPMAddPackage(
NAME mcolor
URL https://git.redacted.cc/maxine/mcolor/archive/Prerelease-6.2.zip
URL https://git.redacted.cc/maxine/mcolor/archive/Release-1.zip
)
CPMAddPackage(
@@ -27,7 +27,7 @@ CPMAddPackage(
CPMAddPackage(
NAME ReWindow
URL https://git.redacted.cc/Redacted/ReWindow/archive/Prerelease-32.zip
URL https://git.redacted.cc/Redacted/ReWindow/archive/Prerelease-34.zip
)
CPMAddPackage(
@@ -37,7 +37,7 @@ CPMAddPackage(
CPMAddPackage(
NAME jlog
URL https://git.redacted.cc/josh/jlog/Prerelease-17.zip
URL https://git.redacted.cc/josh/jlog/Prerelease-19.zip
)
if (WIN32)

View File

@@ -72,6 +72,8 @@ vec4 DefaultInstanced() {
return gl_ModelViewProjectionMatrix * vec4(world_pos, 0.0, 1.0);
}
#include "shared.glsl"
void main() {
GL_TEXTURE0_COORD = gl_MultiTexCoord0.xy;
GL_TEXTURE1_COORD = gl_MultiTexCoord1.xy;

View File

@@ -385,8 +385,9 @@ namespace JGL::J2D {
/// @param scale The value (in both axes) to scale the text by. Defaults to {1,1}.
/// @param size The point-size at which to render the font out. Re-using the same point-size allows efficient glyph caching.
/// @param font The font to use for rendering. @see Font.
void DrawString(const Color4& color, const std::string& text, float x, float y, float scale, u32 size, const Font& font = Fonts::Jupiteroid);
void DrawString(const Color4& color, const std::string& text, float x, float y, u32 size, float scale = 1.f, const Font& font = Fonts::Jupiteroid);
void DrawString(const Color4& color, const std::string& text, const Vector2& pos, u32 size, float scale = 1.f, const Font& font = Fonts::Jupiteroid);
/// Draws an Arc (section of a circle) to the screen.
/// @param color A 3-or-4 channel color value. @see class Color3, class Color4

View File

@@ -1519,3 +1519,8 @@ void J2D::DrawSprite(const TextureAtlas* texture_atlas, const AtlasRegion& atlas
void J2D::DrawSprite(const TextureAtlas& texture_atlas, const AtlasRegion& atlas_region, const Vector2& position, float rad_rotation, const Vector2& origin, const Vector2& scale, const Color4& color) {
J2D::DrawSprite(&texture_atlas, atlas_region, position, rad_rotation, origin, scale, color);
}
void J2D::DrawString(const Color4 &color, const std::string &text, const Vector2 &pos, u32 size, float scale,
const Font &font) {
DrawString(color, text, pos.x, pos.y, size, scale, font);
}

View File

@@ -98,7 +98,7 @@ namespace JGL {
return cachedFont;
}
void J2D::DrawString(const Color4& color, const std::string& text, float x, float y, float scale, u32 size, const Font& font) {
void J2D::DrawString(const Color4& color, const std::string& text, float x, float y, u32 size, float scale, const Font& font) {
// Offset by height to render at "correct" location.
y += size;

View File

@@ -112,7 +112,11 @@ namespace JGL {
Vector2 extents = Vector2::Zero;
for(auto& f : fontCache.getFonts()) {
if (f->getFontIndex() == this->index) {
// This edit technically "works" by solving the immediate problem of text-bounds returning incorrectly,
// But I am **sure** this is not how it should be implemented, I will leave that to Will to fix.
if (f->getFontIndex() == this->index && f->getFontSize() == ptSize) {
for (const char &c: text) {
auto glyph = f->getGlyph(c);
extents.x += glyph->advanceX;

View File

@@ -14,7 +14,7 @@ namespace JGL {
bool stack_top = (already_included.size() == 0);
if (stack_top) {
already_included.emplace_back(filepath);
already_included.emplace_back(filepath.string());
}
std::string ret_data = "";
@@ -42,7 +42,7 @@ namespace JGL {
#elif __linux__
std::replace(rel_include_path.begin(), rel_include_path.end(), '\\', '/');
#endif
std::string full_include_path = extract_path(filepath) + rel_include_path;
std::string full_include_path = extract_path(filepath.string()) + rel_include_path;
// Avoid including self
if (filepath == full_include_path) {
@@ -117,8 +117,8 @@ namespace JGL {
Shader::Shader(const std::filesystem::path& vertex_source_path, const std::filesystem::path& fragment_source_path, const std::vector<std::pair<std::string, GLint>>& attribute_bindings) :
Shader(ReadFile(vertex_source_path), ReadFile(fragment_source_path), attribute_bindings) {
vertexPath = vertex_source_path;
fragmentPath = fragment_source_path;
vertexPath = vertex_source_path.string();
fragmentPath = fragment_source_path.string();
}
void Shader::checkCompileErrors(GLuint shader, const std::string& type) {