From 44a539758fe82f4c55bbdaaaf74d212f3aad7825 Mon Sep 17 00:00:00 2001 From: Nikita Kruglickiy Date: Fri, 26 Mar 2021 19:11:31 +0600 Subject: [PATCH] render.rotatedSimpleText --- koptilnya/libs/render.txt | 28 +++++++++++++++++++--------- 1 file changed, 19 insertions(+), 9 deletions(-) diff --git a/koptilnya/libs/render.txt b/koptilnya/libs/render.txt index be32eff..e933bb3 100644 --- a/koptilnya/libs/render.txt +++ b/koptilnya/libs/render.txt @@ -44,16 +44,26 @@ function render.drawArc(x, y, ang, p, rad, seg) end function render.drawFilledCircle(x, y, radius, seg) - local cir = {} + local cir = {} - table.insert(cir, { x = x, y = y, u = 0.5, v = 0.5 }) - for i = 0, seg do - local a = math.rad(( i / seg ) * -360) - table.insert(cir, { x = x + math.sin( a ) * radius, y = y + math.cos( a ) * radius, u = math.sin( a ) / 2 + 0.5, v = math.cos( a ) / 2 + 0.5 }) - end + table.insert(cir, { x = x, y = y, u = 0.5, v = 0.5 }) + for i = 0, seg do + local a = math.rad(( i / seg ) * -360) + table.insert(cir, { x = x + math.sin( a ) * radius, y = y + math.cos( a ) * radius, u = math.sin( a ) / 2 + 0.5, v = math.cos( a ) / 2 + 0.5 }) + end - local a = math.rad(0) - table.insert(cir, { x = x + math.sin( a ) * radius, y = y + math.cos( a ) * radius, u = math.sin( a ) / 2 + 0.5, v = math.cos( a ) / 2 + 0.5 }) + local a = math.rad(0) + table.insert(cir, { x = x + math.sin( a ) * radius, y = y + math.cos( a ) * radius, u = math.sin( a ) / 2 + 0.5, v = math.cos( a ) / 2 + 0.5 }) - render.drawPoly(cir) + render.drawPoly(cir) +end + +function render.drawRotatedSimpleText(x, y, text, ang) + local m = Matrix() + m:translate(Vector(x, y, 0 )) + m:rotate(Angle(0, ang, 0)) + + render.pushMatrix(m) + render.drawSimpleText(0, 0, text) + render.popMatrix() end \ No newline at end of file