From 47ed28b006db71d823cfaa24fa143ab5cfcf279b Mon Sep 17 00:00:00 2001 From: jussi Date: Sun, 25 Feb 2024 14:06:59 +0200 Subject: Added various missing functions. --- examples/image_draw/main.lua | 2 +- examples/pong/main.lua | 2 +- examples/resources/lib/gui.lua | 2 +- examples/resources/lib/raygui.lua | 2 +- examples/window/main.lua | 7 ++++--- 5 files changed, 8 insertions(+), 7 deletions(-) (limited to 'examples') diff --git a/examples/image_draw/main.lua b/examples/image_draw/main.lua index ba8881a..4a62840 100644 --- a/examples/image_draw/main.lua +++ b/examples/image_draw/main.lua @@ -31,7 +31,7 @@ function RL.init() RL.ImageDraw( image, catCopy, src, { 600, 200, src[3], src[4] }, RL.WHITE ) - textImage = RL.ImageText( RL.GetFontDefault(), "Cat", 10, 4, RL.WHITE ) + textImage = RL.ImageTextEx( RL.GetFontDefault(), "Cat", 10, 4, RL.WHITE ) local imageSize = RL.GetImageSize( textImage ) RL.ImageDraw( image, textImage, { 0, 0, imageSize[1], imageSize[2] }, { 250, 40, imageSize[1], imageSize[2] }, RL.WHITE ) diff --git a/examples/pong/main.lua b/examples/pong/main.lua index fc8cd75..f898ce3 100644 --- a/examples/pong/main.lua +++ b/examples/pong/main.lua @@ -127,6 +127,6 @@ function RL.draw() -- Draw score. RL.DrawText( tostring( playerLeft.score ), { 50, 10 }, 40, RL.WHITE ) - local rightTextSize = Vec2:new( RL.MeasureText( RL.GetFontDefault(), tostring( playerRight.score ), 40, 2 ) ) + local rightTextSize = Vec2:new( RL.MeasureTextEx( RL.GetFontDefault(), tostring( playerRight.score ), 40, 2 ) ) RL.DrawText( tostring( playerRight.score ), { winSize.x - 50 - rightTextSize.x, 10 }, 40, RL.WHITE ) end diff --git a/examples/resources/lib/gui.lua b/examples/resources/lib/gui.lua index bdb4ce1..413fcf6 100644 --- a/examples/resources/lib/gui.lua +++ b/examples/resources/lib/gui.lua @@ -243,7 +243,7 @@ function Text:set( text ) self.text = text end - local textSize = Vec2:new( RL.MeasureText( self.font, self.text, self.fontSize, self.spacing ) ) + local textSize = Vec2:new( RL.MeasureTextEx( self.font, self.text, self.fontSize, self.spacing ) ) self.bounds.width = textSize.x self.bounds.height = textSize.y diff --git a/examples/resources/lib/raygui.lua b/examples/resources/lib/raygui.lua index cd02c78..875a0f5 100644 --- a/examples/resources/lib/raygui.lua +++ b/examples/resources/lib/raygui.lua @@ -1852,7 +1852,7 @@ function Raygui:_addLastProperty( property ) end function Raygui:drawTooltip() - local textSize = Vec2:new( RL.MeasureText( + local textSize = Vec2:new( RL.MeasureTextEx( self.defaultFont, self.tooltip.text, RL.GuiGetStyle( RL.DEFAULT, RL.TEXT_SIZE ), diff --git a/examples/window/main.lua b/examples/window/main.lua index 99e8524..ec2377b 100644 --- a/examples/window/main.lua +++ b/examples/window/main.lua @@ -1,5 +1,6 @@ local textColor = RL.BLACK local textPos = { 192, 200 } +local textSize = 20 local text = "Congrats! You created your first window!" function RL.init() @@ -9,9 +10,9 @@ end function RL.update( delta ) if RL.IsKeyPressed( RL.KEY_ENTER ) then - local textSize = RL.MeasureText( RL.GetFontDefault(), text, 20, 2 ) local winSize = RL.GetScreenSize() - + + textSize = RL.MeasureText( text, textSize ) textColor = RL.BLUE textPos = { winSize[1] / 2 - textSize[1] / 2, winSize[2] / 2 - textSize[2] / 2 } end @@ -24,5 +25,5 @@ end function RL.draw() RL.ClearBackground( RL.RAYWHITE ) - RL.DrawText( text, textPos, 20, textColor ) + RL.DrawText( text, textPos, textSize, textColor ) end -- cgit v1.2.3