fix logger
Some checks failed
Run ReCI Build Test / Explore-Gitea-Actions (push) Failing after 1m45s
Some checks failed
Run ReCI Build Test / Explore-Gitea-Actions (push) Failing after 1m45s
This commit is contained in:
@@ -25,7 +25,6 @@
|
|||||||
#include <J3ML/Geometry/Sphere.hpp>
|
#include <J3ML/Geometry/Sphere.hpp>
|
||||||
#include <J3ML/Geometry/Capsule.hpp>
|
#include <J3ML/Geometry/Capsule.hpp>
|
||||||
#include <J3ML/Geometry/Triangle2D.hpp>
|
#include <J3ML/Geometry/Triangle2D.hpp>
|
||||||
#include "JGL/logger/logger.hpp"
|
|
||||||
|
|
||||||
/// OpenGL Wrapper for rendering 2D & 3D graphics in both a 2D and 3D context.
|
/// OpenGL Wrapper for rendering 2D & 3D graphics in both a 2D and 3D context.
|
||||||
namespace JGL {
|
namespace JGL {
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "jlog/Logger.hpp"
|
#include <jlog/Logger.hpp>
|
||||||
|
|
||||||
namespace JGL::Logger {
|
namespace JGL::Logger {
|
||||||
using namespace jlog;
|
using namespace jlog;
|
41
src/JGL.cpp
41
src/JGL.cpp
@@ -5,6 +5,7 @@
|
|||||||
#include <JGL/JGL.h>
|
#include <JGL/JGL.h>
|
||||||
#include <glad/glad.h>
|
#include <glad/glad.h>
|
||||||
#include <J3ML/Algorithm/Bezier.hpp>
|
#include <J3ML/Algorithm/Bezier.hpp>
|
||||||
|
#include <JGL/logger/logger.h>
|
||||||
|
|
||||||
JGL::RenderTarget* render_target = nullptr;
|
JGL::RenderTarget* render_target = nullptr;
|
||||||
GLfloat oldColor[4] = {0, 0, 0, 1};
|
GLfloat oldColor[4] = {0, 0, 0, 1};
|
||||||
@@ -113,7 +114,7 @@ namespace JGL {
|
|||||||
|
|
||||||
if (!inJ3D)
|
if (!inJ3D)
|
||||||
inJ2D = true;
|
inJ2D = true;
|
||||||
else { JGL::Logger::Error("Attempt to Begin J2D inside of J3D context."); }
|
else { Logger::Error("Attempt to Begin J2D inside of J3D context."); }
|
||||||
|
|
||||||
if (rt != nullptr && clear_buffers) {
|
if (rt != nullptr && clear_buffers) {
|
||||||
glClearColor(rt->GetClearColor().R(), rt->GetClearColor().G(), rt->GetClearColor().B(), rt->GetClearColor().A());
|
glClearColor(rt->GetClearColor().R(), rt->GetClearColor().G(), rt->GetClearColor().B(), rt->GetClearColor().A());
|
||||||
@@ -165,7 +166,7 @@ namespace JGL {
|
|||||||
|
|
||||||
void J2D::DrawPoint(const Color4& color, const Vector2& coordinates, float radius) {
|
void J2D::DrawPoint(const Color4& color, const Vector2& coordinates, float radius) {
|
||||||
if (!inJ2D)
|
if (!inJ2D)
|
||||||
JGL::Logger::Error("Drawing J2D element before J2D begin.");
|
Logger::Error("Drawing J2D element before J2D begin.");
|
||||||
|
|
||||||
Vector2 vertices[] = {coordinates};
|
Vector2 vertices[] = {coordinates};
|
||||||
|
|
||||||
@@ -182,7 +183,7 @@ namespace JGL {
|
|||||||
|
|
||||||
void J2D::DrawLine(const Color4& color, const Vector2& A, const Vector2& B, float thickness) {
|
void J2D::DrawLine(const Color4& color, const Vector2& A, const Vector2& B, float thickness) {
|
||||||
if (!inJ2D)
|
if (!inJ2D)
|
||||||
JGL::Logger::Error("Drawing J2D element before J2D begin.");
|
Logger::Error("Drawing J2D element before J2D begin.");
|
||||||
Vector2 vertices[] = {A, B};
|
Vector2 vertices[] = {A, B};
|
||||||
|
|
||||||
glLineWidth(thickness);
|
glLineWidth(thickness);
|
||||||
@@ -198,7 +199,7 @@ namespace JGL {
|
|||||||
|
|
||||||
void J2D::DrawGradientLine(const Color4& color1, const Color4& color2, const Vector2& A, const Vector2& B, float thickness) {
|
void J2D::DrawGradientLine(const Color4& color1, const Color4& color2, const Vector2& A, const Vector2& B, float thickness) {
|
||||||
if (!inJ2D)
|
if (!inJ2D)
|
||||||
JGL::Logger::Error("Drawing J2D element before J2D begin.");
|
Logger::Error("Drawing J2D element before J2D begin.");
|
||||||
|
|
||||||
Vector2 vertices[] = {A, B};
|
Vector2 vertices[] = {A, B};
|
||||||
GLfloat colors[8] = {color1.RedChannelNormalized(), color1.GreenChannelNormalized(), color1.BlueChannelNormalized(), color1.AlphaChannelNormalized(),
|
GLfloat colors[8] = {color1.RedChannelNormalized(), color1.GreenChannelNormalized(), color1.BlueChannelNormalized(), color1.AlphaChannelNormalized(),
|
||||||
@@ -219,7 +220,7 @@ namespace JGL {
|
|||||||
|
|
||||||
void J2D::OutlineRect(const Color4& color, const Vector2& pos, const Vector2& size, float thickness) {
|
void J2D::OutlineRect(const Color4& color, const Vector2& pos, const Vector2& size, float thickness) {
|
||||||
if (!inJ2D)
|
if (!inJ2D)
|
||||||
JGL::Logger::Error("Drawing J2D element before J2D begin.");
|
Logger::Error("Drawing J2D element before J2D begin.");
|
||||||
|
|
||||||
Vector2 vertices[] = {{pos.x, pos.y}, {pos.x, pos.y + size.y}, {pos.x + size.x, pos.y + size.y}, {pos.x + size.x, pos.y}};
|
Vector2 vertices[] = {{pos.x, pos.y}, {pos.x, pos.y + size.y}, {pos.x + size.x, pos.y + size.y}, {pos.x + size.x, pos.y}};
|
||||||
|
|
||||||
@@ -232,7 +233,7 @@ namespace JGL {
|
|||||||
|
|
||||||
void J2D::FillRect(const Color4& color, const Vector2& pos, const Vector2& size) {
|
void J2D::FillRect(const Color4& color, const Vector2& pos, const Vector2& size) {
|
||||||
if (!inJ2D)
|
if (!inJ2D)
|
||||||
JGL::Logger::Error("Drawing J2D element before J2D begin.");
|
Logger::Error("Drawing J2D element before J2D begin.");
|
||||||
|
|
||||||
Vector2 vertices[] = {{pos.x, pos.y}, {pos.x, pos.y + size.y}, {pos.x + size.x, pos.y + size.y}, {pos.x + size.x, pos.y}};
|
Vector2 vertices[] = {{pos.x, pos.y}, {pos.x, pos.y + size.y}, {pos.x + size.x, pos.y + size.y}, {pos.x + size.x, pos.y}};
|
||||||
glColor4ubv(color.ptr());
|
glColor4ubv(color.ptr());
|
||||||
@@ -243,7 +244,7 @@ namespace JGL {
|
|||||||
|
|
||||||
void J2D::FillGradientRect(const Color4& color1, const Color4& color2, const Direction& gradient, const Vector2& pos, const Vector2& size) {
|
void J2D::FillGradientRect(const Color4& color1, const Color4& color2, const Direction& gradient, const Vector2& pos, const Vector2& size) {
|
||||||
if (!inJ2D)
|
if (!inJ2D)
|
||||||
JGL::Logger::Error("Drawing J2D element before J2D begin.");
|
Logger::Error("Drawing J2D element before J2D begin.");
|
||||||
|
|
||||||
Vector2 vertices[] = {{pos.x, pos.y}, {pos.x, pos.y + size.y}, {pos.x + size.x, pos.y + size.y}, {pos.x + size.x, pos.y}};
|
Vector2 vertices[] = {{pos.x, pos.y}, {pos.x, pos.y + size.y}, {pos.x + size.x, pos.y + size.y}, {pos.x + size.x, pos.y}};
|
||||||
std::vector<GLfloat> colors{};
|
std::vector<GLfloat> colors{};
|
||||||
@@ -276,7 +277,7 @@ namespace JGL {
|
|||||||
|
|
||||||
void J2D::FillRoundedRect(const Color4& color, const Vector2& pos, const Vector2& size, float radius, unsigned int subdivisions) {
|
void J2D::FillRoundedRect(const Color4& color, const Vector2& pos, const Vector2& size, float radius, unsigned int subdivisions) {
|
||||||
if (!inJ2D)
|
if (!inJ2D)
|
||||||
JGL::Logger::Error("Drawing J2D element before J2D begin.");
|
Logger::Error("Drawing J2D element before J2D begin.");
|
||||||
|
|
||||||
J2D::FillRect(color, {pos.x + radius, pos.y}, {size.x - 2 * radius, size.y});
|
J2D::FillRect(color, {pos.x + radius, pos.y}, {size.x - 2 * radius, size.y});
|
||||||
J2D::FillRect(color, {pos.x, pos.y + radius}, {size.x, size.y - 2 * radius});
|
J2D::FillRect(color, {pos.x, pos.y + radius}, {size.x, size.y - 2 * radius});
|
||||||
@@ -309,7 +310,7 @@ namespace JGL {
|
|||||||
void J2D::DrawSprite(const Texture& texture, const Vector2& pos, float rad_rotation, const Vector2& origin,
|
void J2D::DrawSprite(const Texture& texture, const Vector2& pos, float rad_rotation, const Vector2& origin,
|
||||||
const Vector2& scale, const Color4& color, Direction inversion) {
|
const Vector2& scale, const Color4& color, Direction inversion) {
|
||||||
if (!inJ2D)
|
if (!inJ2D)
|
||||||
JGL::Logger::Error("Drawing J2D element before J2D begin.");
|
Logger::Error("Drawing J2D element before J2D begin.");
|
||||||
|
|
||||||
|
|
||||||
const Vector2 size = texture.GetDimensions();
|
const Vector2 size = texture.GetDimensions();
|
||||||
@@ -375,7 +376,7 @@ namespace JGL {
|
|||||||
const Vector2& sub_texture_size, float rad_rotation, const Vector2& origin,
|
const Vector2& sub_texture_size, float rad_rotation, const Vector2& origin,
|
||||||
const Vector2& scale, const Color4& color, Direction inversion) {
|
const Vector2& scale, const Color4& color, Direction inversion) {
|
||||||
if (!inJ2D)
|
if (!inJ2D)
|
||||||
JGL::Logger::Error("Drawing J2D element before J2D begin.");
|
Logger::Error("Drawing J2D element before J2D begin.");
|
||||||
|
|
||||||
const Vector2 textureSize = texture.GetDimensions();
|
const Vector2 textureSize = texture.GetDimensions();
|
||||||
|
|
||||||
@@ -444,10 +445,10 @@ namespace JGL {
|
|||||||
|
|
||||||
void J2D::DrawMirrorSprite(const Texture& texture, const Vector2& position, Direction mirror_axis, float rad_rotation, const Vector2& origin, const Vector2& scale, const Color4& color) {
|
void J2D::DrawMirrorSprite(const Texture& texture, const Vector2& position, Direction mirror_axis, float rad_rotation, const Vector2& origin, const Vector2& scale, const Color4& color) {
|
||||||
if (!inJ2D)
|
if (!inJ2D)
|
||||||
JGL::Logger::Error("Drawing J2D element before J2D begin.");
|
Logger::Error("Drawing J2D element before J2D begin.");
|
||||||
|
|
||||||
if (mirror_axis == Direction::None)
|
if (mirror_axis == Direction::None)
|
||||||
JGL::Logger::Warning("Drawing non-mirrored sprite with J2D::DrawMirrorSprite?");
|
Logger::Warning("Drawing non-mirrored sprite with J2D::DrawMirrorSprite?");
|
||||||
|
|
||||||
glBindTexture(GL_TEXTURE_2D, texture.GetGLTextureHandle());
|
glBindTexture(GL_TEXTURE_2D, texture.GetGLTextureHandle());
|
||||||
Vector2 size = texture.GetDimensions();
|
Vector2 size = texture.GetDimensions();
|
||||||
@@ -509,7 +510,7 @@ namespace JGL {
|
|||||||
|
|
||||||
void J2D::OutlineCircle(const Color4& color, const Vector2& center, float radius, unsigned int subdivisions, float thickness) {
|
void J2D::OutlineCircle(const Color4& color, const Vector2& center, float radius, unsigned int subdivisions, float thickness) {
|
||||||
if (!inJ2D)
|
if (!inJ2D)
|
||||||
JGL::Logger::Error("Drawing J2D element before J2D begin.");
|
Logger::Error("Drawing J2D element before J2D begin.");
|
||||||
|
|
||||||
float step = (2.f * Math::Pi) / (float) subdivisions;
|
float step = (2.f * Math::Pi) / (float) subdivisions;
|
||||||
std::vector<Vector2> vertices{};
|
std::vector<Vector2> vertices{};
|
||||||
@@ -530,7 +531,7 @@ namespace JGL {
|
|||||||
|
|
||||||
void J2D::FillCircle(const Color4& color, const Vector2& center, float radius, unsigned int subdivisions) {
|
void J2D::FillCircle(const Color4& color, const Vector2& center, float radius, unsigned int subdivisions) {
|
||||||
if (!inJ2D)
|
if (!inJ2D)
|
||||||
JGL::Logger::Error("Drawing J2D element before J2D begin.");
|
Logger::Error("Drawing J2D element before J2D begin.");
|
||||||
|
|
||||||
GLfloat angle, x, y;
|
GLfloat angle, x, y;
|
||||||
float step = (2.f * Math::Pi) / (float) subdivisions;
|
float step = (2.f * Math::Pi) / (float) subdivisions;
|
||||||
@@ -547,7 +548,7 @@ namespace JGL {
|
|||||||
|
|
||||||
void J2D::OutlineTriangle(const Color4& color, const Triangle2D& tri, float thickness) {
|
void J2D::OutlineTriangle(const Color4& color, const Triangle2D& tri, float thickness) {
|
||||||
if (!inJ2D)
|
if (!inJ2D)
|
||||||
JGL::Logger::Error("Drawing J2D element before J2D begin.");
|
Logger::Error("Drawing J2D element before J2D begin.");
|
||||||
|
|
||||||
Vector2 vertices[] = {{tri.A.x, tri.A.y}, {tri.B.x, tri.B.y}, {tri.C.x, tri.C.y}};
|
Vector2 vertices[] = {{tri.A.x, tri.A.y}, {tri.B.x, tri.B.y}, {tri.C.x, tri.C.y}};
|
||||||
|
|
||||||
@@ -560,7 +561,7 @@ namespace JGL {
|
|||||||
|
|
||||||
void J2D::FillTriangle(const Color4& color, const Triangle2D& tri) {
|
void J2D::FillTriangle(const Color4& color, const Triangle2D& tri) {
|
||||||
if (!inJ2D)
|
if (!inJ2D)
|
||||||
JGL::Logger::Error("Drawing J2D element before J2D begin.");
|
Logger::Error("Drawing J2D element before J2D begin.");
|
||||||
|
|
||||||
Vector2 vertices[] = {{tri.A.x, tri.A.y}, {tri.B.x, tri.B.y}, {tri.C.x, tri.C.y}};
|
Vector2 vertices[] = {{tri.A.x, tri.A.y}, {tri.B.x, tri.B.y}, {tri.C.x, tri.C.y}};
|
||||||
|
|
||||||
@@ -572,7 +573,7 @@ namespace JGL {
|
|||||||
|
|
||||||
void J2D::FillGradientTriangle(const Color4& a_color, const Color4& b_color, const Color4& c_color, const Triangle2D& tri) {
|
void J2D::FillGradientTriangle(const Color4& a_color, const Color4& b_color, const Color4& c_color, const Triangle2D& tri) {
|
||||||
if (!inJ2D)
|
if (!inJ2D)
|
||||||
JGL::Logger::Error("Drawing J2D element before J2D begin.");
|
Logger::Error("Drawing J2D element before J2D begin.");
|
||||||
|
|
||||||
Vector2 vertices[] = {{tri.A.x, tri.A.y}, {tri.B.x, tri.B.y}, {tri.C.x, tri.C.y}};
|
Vector2 vertices[] = {{tri.A.x, tri.A.y}, {tri.B.x, tri.B.y}, {tri.C.x, tri.C.y}};
|
||||||
GLfloat colors[] = {a_color.RedChannelNormalized(), a_color.GreenChannelNormalized(), a_color.BlueChannelNormalized(), a_color.AlphaChannelNormalized(),
|
GLfloat colors[] = {a_color.RedChannelNormalized(), a_color.GreenChannelNormalized(), a_color.BlueChannelNormalized(), a_color.AlphaChannelNormalized(),
|
||||||
@@ -607,7 +608,7 @@ namespace JGL {
|
|||||||
|
|
||||||
void J2D::OutlinePolygon(const Color4 &color, const std::vector<Vector2>& points, float thickness) {
|
void J2D::OutlinePolygon(const Color4 &color, const std::vector<Vector2>& points, float thickness) {
|
||||||
if (!inJ2D)
|
if (!inJ2D)
|
||||||
JGL::Logger::Error("Drawing J2D element before J2D begin.");
|
Logger::Error("Drawing J2D element before J2D begin.");
|
||||||
|
|
||||||
if (points.front() != points.back())
|
if (points.front() != points.back())
|
||||||
throw std::runtime_error("J2D::OutlinePolygon: The first point and the last point must connect.");
|
throw std::runtime_error("J2D::OutlinePolygon: The first point and the last point must connect.");
|
||||||
@@ -703,7 +704,7 @@ namespace JGL {
|
|||||||
if (!inJ2D)
|
if (!inJ2D)
|
||||||
inJ3D = true;
|
inJ3D = true;
|
||||||
else
|
else
|
||||||
JGL::Logger::Error("Can't begin J3D context inside J2D context.");
|
Logger::Error("Can't begin J3D context inside J2D context.");
|
||||||
}
|
}
|
||||||
|
|
||||||
void J3D::End() {
|
void J3D::End() {
|
||||||
@@ -732,7 +733,7 @@ namespace JGL {
|
|||||||
|
|
||||||
void J3D::DrawLine(const Color4& color, const Vector3& A, const Vector3& B, float thickness) {
|
void J3D::DrawLine(const Color4& color, const Vector3& A, const Vector3& B, float thickness) {
|
||||||
if (!inJ3D)
|
if (!inJ3D)
|
||||||
JGL::Logger::Error("Attempt to Render J3D element before J3D begin.");
|
Logger::Error("Attempt to Render J3D element before J3D begin.");
|
||||||
|
|
||||||
Vector3 vertices[] = {A, B};
|
Vector3 vertices[] = {A, B};
|
||||||
|
|
||||||
|
@@ -15,7 +15,7 @@
|
|||||||
|
|
||||||
#include <JGL/types/Font.h>
|
#include <JGL/types/Font.h>
|
||||||
#include <JGL/types/FontCache.h>
|
#include <JGL/types/FontCache.h>
|
||||||
#include "JGL/logger/logger.hpp"
|
#include "JGL/logger/logger.h"
|
||||||
|
|
||||||
namespace JGL {
|
namespace JGL {
|
||||||
CachedFont* CacheFont(const Font& font, u32 size) {
|
CachedFont* CacheFont(const Font& font, u32 size) {
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
#include "JGL/logger/logger.hpp"
|
#include <JGL/logger/logger.h>
|
||||||
|
|
||||||
namespace ReWindow::Logger {
|
namespace JGL::Logger {
|
||||||
using namespace jlog;
|
using namespace jlog;
|
||||||
|
|
||||||
GenericLogger Fatal {"JGL::fatal", GlobalLogFile, Colors::Reds::Crimson, Colors::Gray, Colors::Gray, Colors::Reds::Crimson, Colors::White};
|
GenericLogger Fatal {"JGL::fatal", GlobalLogFile, Colors::Reds::Crimson, Colors::Gray, Colors::Gray, Colors::Reds::Crimson, Colors::White};
|
||||||
|
@@ -20,23 +20,23 @@ void JGL::VRamList::load(const GLuint* data, const long& size) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
JGL::VRamList::VRamList(const GLfloat* data, const long& size) {
|
JGL::VRamList::VRamList(const GLfloat* data, const long& size) {
|
||||||
load(data, sizeof(GLfloat) * size);
|
load(data, (long) sizeof(GLfloat) * size);
|
||||||
}
|
}
|
||||||
|
|
||||||
JGL::VRamList::VRamList(const GLuint* data, const long& size) {
|
JGL::VRamList::VRamList(const GLuint* data, const long& size) {
|
||||||
load(data, sizeof(GLuint) * size);
|
load(data, (long) sizeof(GLuint) * size);
|
||||||
}
|
}
|
||||||
|
|
||||||
JGL::VRamList::VRamList(Vector2* data, const long& size) {
|
JGL::VRamList::VRamList(Vector2* data, const long& size) {
|
||||||
load(reinterpret_cast<GLfloat*>(data), sizeof(Vector2) * size);
|
load(reinterpret_cast<GLfloat*>(data), (long) sizeof(Vector2) * size);
|
||||||
}
|
}
|
||||||
|
|
||||||
JGL::VRamList::VRamList(Vector3* data, const long& size) {
|
JGL::VRamList::VRamList(Vector3* data, const long& size) {
|
||||||
load(reinterpret_cast<GLfloat*>(data), sizeof(Vector3) * size);
|
load(reinterpret_cast<GLfloat*>(data), (long) sizeof(Vector3) * size);
|
||||||
}
|
}
|
||||||
|
|
||||||
JGL::VRamList::VRamList(Vector4* data, const long& size) {
|
JGL::VRamList::VRamList(Vector4* data, const long& size) {
|
||||||
load(reinterpret_cast<GLfloat*>(data), sizeof(Vector4) * size);
|
load(reinterpret_cast<GLfloat*>(data), (long) sizeof(Vector4) * size);
|
||||||
}
|
}
|
||||||
|
|
||||||
void JGL::VRamList::Erase() {
|
void JGL::VRamList::Erase() {
|
||||||
|
Reference in New Issue
Block a user