diff options
| author | jussi | 2024-02-25 14:06:59 +0200 |
|---|---|---|
| committer | jussi | 2024-02-25 14:06:59 +0200 |
| commit | 47ed28b006db71d823cfaa24fa143ab5cfcf279b (patch) | |
| tree | adf35906662b0646a14adfa6a37260c797cd325a /README.md | |
| parent | 631cea6aa7510ba53d4f14b5537e1719a72976b9 (diff) | |
| download | reilua-enhanced-47ed28b006db71d823cfaa24fa143ab5cfcf279b.tar.gz reilua-enhanced-47ed28b006db71d823cfaa24fa143ab5cfcf279b.tar.bz2 reilua-enhanced-47ed28b006db71d823cfaa24fa143ab5cfcf279b.zip | |
Added various missing functions.
Diffstat (limited to 'README.md')
| -rw-r--r-- | README.md | 15 |
1 files changed, 11 insertions, 4 deletions
@@ -41,27 +41,34 @@ Example of basic "main.lua" file that will show basic windows with text. ```Lua local textColor = RL.BLACK local textPos = { 192, 200 } +local textSize = 20 +local text = "Congrats! You created your first window!" function RL.init() RL.SetWindowTitle( "First window" ) + RL.SetWindowState( RL.FLAG_VSYNC_HINT ) end function RL.update( delta ) if RL.IsKeyPressed( RL.KEY_ENTER ) then - textColor = BLUE - textPos = { 230, 230 } + 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 if RL.IsKeyPressed( RL.KEY_SPACE ) then - textColor = RL.BLACK + textColor = RL.RED textPos = { 192, 200 } end end function RL.draw() RL.ClearBackground( RL.RAYWHITE ) - RL.DrawText( RL.GetFontDefault(), "Congrats! You created your first window!", textPos, 20, 2, textColor ) + RL.DrawText( text, textPos, textSize, textColor ) end + ``` Application folder structure should be... |
