Rotate sprite & sub-sprite about origin
Some checks failed
Run ReCI Build Test / Explore-Gitea-Actions (push) Failing after 5m24s

This commit is contained in:
2024-09-08 21:52:49 -04:00
parent d15b3f660d
commit e809b1b665
3 changed files with 50 additions and 38 deletions

View File

@@ -140,6 +140,7 @@ public:
Vector3 textAngle = {0,0,0};
float fov = 90;
float sprite_radians = 0;
bool fov_increasing = true;
unsigned long long frames = 0;
bool framerate_measurement = false;
@@ -162,26 +163,26 @@ public:
fov_increasing = true;
J3D::ChangeFOV(fov);
sprite_radians += 0.05;
textAngle.y += 2.0f;
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
camera->render();
///All 3D elements of the scene and JGL elements *must* be rendered before the 2d stuff.
J3D::Begin();
J3D::DrawLine(Colors::Red, {-0.33,-0.125,1}, {-1,-0.125,1});
J3D::DrawLine(Colors::Red, {-0.33,-0.125,1}, {-0.33,0.25,1});
J3D::DrawString(Colors::Red, "JGL Sample Text", {-0.33, -0.1, 1.0f}, 1.f, 32, FreeSans, textAngle);
J3D::DrawString(Colors::Red, "JGL Sample Text", {-0.33, -0.1, 1.0f}, 1.f, 32, FreeSans, textAngle, true);
J3D::End();
J2D::Begin();
J2D::FillQuad(Color4(Colors::Red), {500, 52}, {500, 152}, {600, 152}, {600, 52});
J2D::FillRect(Colors::Blue, {0,52}, {100,100});
J2D::DrawSprite(*image, {252, 252}, {0.5, 0.5});
J2D::DrawPartialSprite(*image, {200, 252}, image->GetDimensions() * 0.25, image->GetDimensions() * 0.75, {0.5, 0.5});
J2D::DrawSprite(*image, {252, 252}, sprite_radians, {0.5, 0.5});
J2D::DrawPartialSprite(*image, {200, 252}, image->GetDimensions() * 0.25, image->GetDimensions() * 0.75, sprite_radians, {0.5, 0.5});
J2D::FillRect(Colors::Pinks::HotPink, {68, 120}, {32, 32});
J2D::FillGradientRect(Colors::Red, Colors::Blue, Gradient::DiagonalBottomLeft, {100,52}, {100,100});
J2D::FillRoundedRect(Colors::Red, {200, 52}, {100, 100}, 8, 8);