From 5fc4914180c0abb2a0b2ecbf80fa2be31fa95678 Mon Sep 17 00:00:00 2001 From: Redacted Date: Tue, 17 Sep 2024 23:19:55 -0400 Subject: [PATCH] fix logger --- include/JGL/JGL.h | 1 - include/JGL/logger/{logger.hpp => logger.h} | 2 +- src/JGL.cpp | 41 +++++++++++---------- src/TextRendering.cpp | 2 +- src/logger/logger.cpp | 4 +- src/types/VRamList.cpp | 10 ++--- 6 files changed, 30 insertions(+), 30 deletions(-) rename include/JGL/logger/{logger.hpp => logger.h} (85%) diff --git a/include/JGL/JGL.h b/include/JGL/JGL.h index 3c86aa2..ae0a97e 100644 --- a/include/JGL/JGL.h +++ b/include/JGL/JGL.h @@ -25,7 +25,6 @@ #include #include #include -#include "JGL/logger/logger.hpp" /// OpenGL Wrapper for rendering 2D & 3D graphics in both a 2D and 3D context. namespace JGL { diff --git a/include/JGL/logger/logger.hpp b/include/JGL/logger/logger.h similarity index 85% rename from include/JGL/logger/logger.hpp rename to include/JGL/logger/logger.h index bea80af..75bf8aa 100644 --- a/include/JGL/logger/logger.hpp +++ b/include/JGL/logger/logger.h @@ -1,6 +1,6 @@ #pragma once -#include "jlog/Logger.hpp" +#include namespace JGL::Logger { using namespace jlog; diff --git a/src/JGL.cpp b/src/JGL.cpp index 0005891..267f213 100644 --- a/src/JGL.cpp +++ b/src/JGL.cpp @@ -5,6 +5,7 @@ #include #include #include +#include JGL::RenderTarget* render_target = nullptr; GLfloat oldColor[4] = {0, 0, 0, 1}; @@ -113,7 +114,7 @@ namespace JGL { if (!inJ3D) 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) { 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) { if (!inJ2D) - JGL::Logger::Error("Drawing J2D element before J2D begin."); + Logger::Error("Drawing J2D element before J2D begin."); Vector2 vertices[] = {coordinates}; @@ -182,7 +183,7 @@ namespace JGL { void J2D::DrawLine(const Color4& color, const Vector2& A, const Vector2& B, float thickness) { if (!inJ2D) - JGL::Logger::Error("Drawing J2D element before J2D begin."); + Logger::Error("Drawing J2D element before J2D begin."); Vector2 vertices[] = {A, B}; 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) { if (!inJ2D) - JGL::Logger::Error("Drawing J2D element before J2D begin."); + Logger::Error("Drawing J2D element before J2D begin."); Vector2 vertices[] = {A, B}; 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) { 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}}; @@ -232,7 +233,7 @@ namespace JGL { void J2D::FillRect(const Color4& color, const Vector2& pos, const Vector2& size) { 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}}; 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) { 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}}; std::vector colors{}; @@ -276,7 +277,7 @@ namespace JGL { void J2D::FillRoundedRect(const Color4& color, const Vector2& pos, const Vector2& size, float radius, unsigned int subdivisions) { 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, 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, const Vector2& scale, const Color4& color, Direction inversion) { if (!inJ2D) - JGL::Logger::Error("Drawing J2D element before J2D begin."); + Logger::Error("Drawing J2D element before J2D begin."); const Vector2 size = texture.GetDimensions(); @@ -375,7 +376,7 @@ namespace JGL { const Vector2& sub_texture_size, float rad_rotation, const Vector2& origin, const Vector2& scale, const Color4& color, Direction inversion) { if (!inJ2D) - JGL::Logger::Error("Drawing J2D element before J2D begin."); + Logger::Error("Drawing J2D element before J2D begin."); 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) { if (!inJ2D) - JGL::Logger::Error("Drawing J2D element before J2D begin."); + Logger::Error("Drawing J2D element before J2D begin."); 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()); 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) { 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; std::vector vertices{}; @@ -530,7 +531,7 @@ namespace JGL { void J2D::FillCircle(const Color4& color, const Vector2& center, float radius, unsigned int subdivisions) { if (!inJ2D) - JGL::Logger::Error("Drawing J2D element before J2D begin."); + Logger::Error("Drawing J2D element before J2D begin."); GLfloat angle, x, y; 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) { 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}}; @@ -560,7 +561,7 @@ namespace JGL { void J2D::FillTriangle(const Color4& color, const Triangle2D& tri) { 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}}; @@ -572,7 +573,7 @@ namespace JGL { void J2D::FillGradientTriangle(const Color4& a_color, const Color4& b_color, const Color4& c_color, const Triangle2D& tri) { 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}}; 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& points, float thickness) { if (!inJ2D) - JGL::Logger::Error("Drawing J2D element before J2D begin."); + Logger::Error("Drawing J2D element before J2D begin."); if (points.front() != points.back()) throw std::runtime_error("J2D::OutlinePolygon: The first point and the last point must connect."); @@ -703,7 +704,7 @@ namespace JGL { if (!inJ2D) inJ3D = true; 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() { @@ -732,7 +733,7 @@ namespace JGL { void J3D::DrawLine(const Color4& color, const Vector3& A, const Vector3& B, float thickness) { 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}; diff --git a/src/TextRendering.cpp b/src/TextRendering.cpp index f90e775..fdc8c3e 100644 --- a/src/TextRendering.cpp +++ b/src/TextRendering.cpp @@ -15,7 +15,7 @@ #include #include -#include "JGL/logger/logger.hpp" +#include "JGL/logger/logger.h" namespace JGL { CachedFont* CacheFont(const Font& font, u32 size) { diff --git a/src/logger/logger.cpp b/src/logger/logger.cpp index 9d2f5f2..07db25b 100644 --- a/src/logger/logger.cpp +++ b/src/logger/logger.cpp @@ -1,6 +1,6 @@ -#include "JGL/logger/logger.hpp" +#include -namespace ReWindow::Logger { +namespace JGL::Logger { using namespace jlog; GenericLogger Fatal {"JGL::fatal", GlobalLogFile, Colors::Reds::Crimson, Colors::Gray, Colors::Gray, Colors::Reds::Crimson, Colors::White}; diff --git a/src/types/VRamList.cpp b/src/types/VRamList.cpp index b7fa763..84f6acf 100644 --- a/src/types/VRamList.cpp +++ b/src/types/VRamList.cpp @@ -20,23 +20,23 @@ void JGL::VRamList::load(const GLuint* 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) { - load(data, sizeof(GLuint) * size); + load(data, (long) sizeof(GLuint) * size); } JGL::VRamList::VRamList(Vector2* data, const long& size) { - load(reinterpret_cast(data), sizeof(Vector2) * size); + load(reinterpret_cast(data), (long) sizeof(Vector2) * size); } JGL::VRamList::VRamList(Vector3* data, const long& size) { - load(reinterpret_cast(data), sizeof(Vector3) * size); + load(reinterpret_cast(data), (long) sizeof(Vector3) * size); } JGL::VRamList::VRamList(Vector4* data, const long& size) { - load(reinterpret_cast(data), sizeof(Vector4) * size); + load(reinterpret_cast(data), (long) sizeof(Vector4) * size); } void JGL::VRamList::Erase() {