Added various missing functions.

This commit is contained in:
jussi
2024-02-25 14:06:59 +02:00
parent 631cea6aa7
commit 47ed28b006
21 changed files with 697 additions and 178 deletions

View File

@@ -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 )

View File

@@ -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

View File

@@ -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

View File

@@ -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 ),

View File

@@ -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