From 1cba7f3faa4cea05d262d689683c984ba5020a31 Mon Sep 17 00:00:00 2001 From: cosmonaut Date: Sat, 9 Dec 2023 17:40:02 -0800 Subject: [PATCH] change Wellspring_Draw to Wellspring_AddToTextBatch --- include/Wellspring.h | 5 +---- src/Wellspring.c | 14 ++++++-------- 2 files changed, 7 insertions(+), 12 deletions(-) diff --git a/include/Wellspring.h b/include/Wellspring.h index 0c58834..71e2133 100644 --- a/include/Wellspring.h +++ b/include/Wellspring.h @@ -138,12 +138,9 @@ WELLSPRINGAPI uint8_t Wellspring_TextBounds( Wellspring_Rectangle *pRectangle ); -WELLSPRINGAPI uint8_t Wellspring_Draw( +WELLSPRINGAPI uint8_t Wellspring_AddToTextBatch( Wellspring_TextBatch *textBatch, - float x, - float y, int pixelSize, - float depth, Wellspring_Color *color, Wellspring_HorizontalAlignment horizontalAlignment, Wellspring_VerticalAlignment verticalAlignment, diff --git a/src/Wellspring.c b/src/Wellspring.c index b664b6b..2cb1f92 100644 --- a/src/Wellspring.c +++ b/src/Wellspring.c @@ -729,12 +729,9 @@ uint8_t Wellspring_TextBounds( ); } -uint8_t Wellspring_Draw( +uint8_t Wellspring_AddToTextBatch( Wellspring_TextBatch *textBatch, - float x, - float y, int pixelSize, - float depth, Wellspring_Color *color, Wellspring_HorizontalAlignment horizontalAlignment, Wellspring_VerticalAlignment verticalAlignment, @@ -756,6 +753,7 @@ uint8_t Wellspring_Draw( Wellspring_Rectangle bounds; uint32_t i, j; float sizeFactor = pixelSize / font->pixelsPerEm; + float x = 0, y = 0; y += Wellspring_INTERNAL_GetVerticalAlignOffset(font, verticalAlignment, sizeFactor * font->scale); @@ -858,7 +856,7 @@ uint8_t Wellspring_Draw( batch->vertices[vertexBufferIndex].x = charQuad.x0; batch->vertices[vertexBufferIndex].y = charQuad.y0; - batch->vertices[vertexBufferIndex].z = depth; + batch->vertices[vertexBufferIndex].z = 0; batch->vertices[vertexBufferIndex].u = charQuad.s0; batch->vertices[vertexBufferIndex].v = charQuad.t0; batch->vertices[vertexBufferIndex].r = color->r; @@ -868,7 +866,7 @@ uint8_t Wellspring_Draw( batch->vertices[vertexBufferIndex + 1].x = charQuad.x0; batch->vertices[vertexBufferIndex + 1].y = charQuad.y1; - batch->vertices[vertexBufferIndex + 1].z = depth; + batch->vertices[vertexBufferIndex + 1].z = 0; batch->vertices[vertexBufferIndex + 1].u = charQuad.s0; batch->vertices[vertexBufferIndex + 1].v = charQuad.t1; batch->vertices[vertexBufferIndex + 1].r = color->r; @@ -878,7 +876,7 @@ uint8_t Wellspring_Draw( batch->vertices[vertexBufferIndex + 2].x = charQuad.x1; batch->vertices[vertexBufferIndex + 2].y = charQuad.y0; - batch->vertices[vertexBufferIndex + 2].z = depth; + batch->vertices[vertexBufferIndex + 2].z = 0; batch->vertices[vertexBufferIndex + 2].u = charQuad.s1; batch->vertices[vertexBufferIndex + 2].v = charQuad.t0; batch->vertices[vertexBufferIndex + 2].r = color->r; @@ -888,7 +886,7 @@ uint8_t Wellspring_Draw( batch->vertices[vertexBufferIndex + 3].x = charQuad.x1; batch->vertices[vertexBufferIndex + 3].y = charQuad.y1; - batch->vertices[vertexBufferIndex + 3].z = depth; + batch->vertices[vertexBufferIndex + 3].z = 0; batch->vertices[vertexBufferIndex + 3].u = charQuad.s1; batch->vertices[vertexBufferIndex + 3].v = charQuad.t1; batch->vertices[vertexBufferIndex + 3].r = color->r;