diff options
| author | jussi | 2023-10-29 19:45:18 +0200 |
|---|---|---|
| committer | jussi | 2023-10-29 19:45:18 +0200 |
| commit | 992310fb90832ddf493ec33f1099dbbf3e0987f3 (patch) | |
| tree | 5eb19defdf61ce7c091756ea07686d9251412440 /examples | |
| parent | fcd2d2d8b583f6a11a9ce32a75da8e18c8c88d32 (diff) | |
| download | reilua-enhanced-992310fb90832ddf493ec33f1099dbbf3e0987f3.tar.gz reilua-enhanced-992310fb90832ddf493ec33f1099dbbf3e0987f3.tar.bz2 reilua-enhanced-992310fb90832ddf493ec33f1099dbbf3e0987f3.zip | |
Fixed examples.
Diffstat (limited to 'examples')
| -rw-r--r-- | examples/bunnymark/main.lua | 4 | ||||
| -rw-r--r-- | examples/events/main.lua | 2 | ||||
| -rw-r--r-- | examples/free_camera3d/main.lua | 2 | ||||
| -rw-r--r-- | examples/gui/main.lua | 2 | ||||
| -rw-r--r-- | examples/image_draw/main.lua | 6 | ||||
| -rw-r--r-- | examples/pixelated/main.lua | 8 | ||||
| -rw-r--r-- | examples/point_triangle_collision/main.lua | 2 | ||||
| -rw-r--r-- | examples/pong/main.lua | 6 | ||||
| -rw-r--r-- | examples/pong_vec/main.lua | 6 | ||||
| -rw-r--r-- | examples/ray/main.lua | 2 | ||||
| -rw-r--r-- | examples/resources/lib/gui.lua | 2 | ||||
| -rw-r--r-- | examples/snake/main.lua | 2 |
12 files changed, 23 insertions, 21 deletions
diff --git a/examples/bunnymark/main.lua b/examples/bunnymark/main.lua index 8274327..9f877e6 100644 --- a/examples/bunnymark/main.lua +++ b/examples/bunnymark/main.lua @@ -83,7 +83,7 @@ function RL.draw() end RL.DrawRectangle( { 0, 0, screenWidth, 40 }, RL.BLACK) - RL.DrawText( 0, "bunnies: " .. #bunnies, { 120, 10 }, 20, 2, RL.GREEN ) - RL.DrawText( 0, "batched draw calls: " .. math.ceil( 1 + #bunnies / MAX_BATCH_ELEMENTS ), { 320, 10 }, 20, 2, RL.RED ) + RL.DrawText( RL.defaultFont, "bunnies: " .. #bunnies, { 120, 10 }, 20, 2, RL.GREEN ) + RL.DrawText( RL.defaultFont, "batched draw calls: " .. math.ceil( 1 + #bunnies / MAX_BATCH_ELEMENTS ), { 320, 10 }, 20, 2, RL.RED ) RL.DrawFPS( { 10, 10 } ) end diff --git a/examples/events/main.lua b/examples/events/main.lua index f03ae70..8a8fb34 100644 --- a/examples/events/main.lua +++ b/examples/events/main.lua @@ -100,5 +100,5 @@ function RL.draw() RL.ClearBackground( RL.RED ) end - RL.DrawText( 0, text, textPos, 20, 2, RL.BLACK ) + RL.DrawText( RL.defaultFont, text, textPos, 20, 2, RL.BLACK ) end diff --git a/examples/free_camera3d/main.lua b/examples/free_camera3d/main.lua index be3195c..6478ebb 100644 --- a/examples/free_camera3d/main.lua +++ b/examples/free_camera3d/main.lua @@ -68,5 +68,5 @@ function RL.draw() text = text.."\nPress T to toggle target visible.\nVisible: "..tostring( targetVisible ) - RL.DrawText( 0, text, { 16, 16 }, 30, 4, RL.WHITE ) + RL.DrawText( RL.defaultFont, text, { 16, 16 }, 30, 4, RL.WHITE ) end diff --git a/examples/gui/main.lua b/examples/gui/main.lua index 3db60bb..01e063e 100644 --- a/examples/gui/main.lua +++ b/examples/gui/main.lua @@ -26,7 +26,7 @@ function RL.init() local mSize = RL.GetMonitorSize( monitor ) local winSize = { 1920, 1080 } - RL.GuiSetFont( 0 ) + RL.GuiSetFont( RL.defaultFont ) RL.SetWindowState( RL.FLAG_WINDOW_RESIZABLE ) RL.SetWindowState( RL.FLAG_VSYNC_HINT ) RL.SetWindowSize( winSize ) diff --git a/examples/image_draw/main.lua b/examples/image_draw/main.lua index 8c1ea82..ac8e7e6 100644 --- a/examples/image_draw/main.lua +++ b/examples/image_draw/main.lua @@ -13,7 +13,7 @@ function RL.init() RL.SetWindowState( RL.FLAG_WINDOW_RESIZABLE ) RL.SetWindowState( RL.FLAG_VSYNC_HINT ) RL.SetWindowPosition( { mPos[1] + mSize[1] / 2 - winSize[1] / 2, mPos[2] + mSize[2] / 2 - winSize[2] / 2 } ) - image = RL.GenImageColor( winSize[1], winSize[2], RL.WHITE ) + image = RL.GenImageColor( winSize, RL.WHITE ) -- Test changing working directory. RL.ChangeDirectory( RL.GetBasePath().."../resources" ) catImage = RL.LoadImage( RL.GetWorkingDirectory().."/images/cat.png" ) @@ -24,14 +24,14 @@ function RL.init() RL.ImageDrawRectangle( image, { 120, 64, 32, 64 }, RL.BLUE ) RL.ImageDrawRectangleLines( image, { 160, 64, 32, 64 }, 2.0, RL.BLUE ) RL.ImageDraw( image, catImage, { 143, 25, 230, 250 }, { 200, 200, 230, 250 }, RL.WHITE ) - RL.ImageDrawTextEx( image, 0, "Hello", { 300, 32 }, 48.0, 1.0, RL.WHITE ) + RL.ImageDrawTextEx( image, RL.defaultFont, "Hello", { 300, 32 }, 48.0, 1.0, RL.WHITE ) local src = { 80, 70, 96, 96 } catCopy = RL.ImageFromImage( catImage, src ) RL.ImageDraw( image, catCopy, src, { 600, 200, src[3], src[4] }, RL.WHITE ) - textImage = RL.ImageText( 0, "Cat", 10, 4, RL.WHITE ) + textImage = RL.ImageText( RL.defaultFont, "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/pixelated/main.lua b/examples/pixelated/main.lua index 75a9045..3d79ccd 100644 --- a/examples/pixelated/main.lua +++ b/examples/pixelated/main.lua @@ -4,7 +4,8 @@ local speed = 60.0 local monitor = 0 local mPos = RL.GetMonitorPosition( monitor ) local mSize = RL.GetMonitorSize( monitor ) -local framebuffer = -1 +local framebuffer = nil +local framebufferTex = nil local res = { 320, 180 } local scale = 5 local winSize = { res[1] * scale, res[2] * scale } @@ -17,6 +18,7 @@ function RL.init() tex = RL.LoadTexture( RL.GetBasePath().."../resources/images/cat.png" ) -- Create framebuffer. framebuffer = RL.LoadRenderTexture( res ) + framebufferTex = RL.GetRenderTextureTexture( framebuffer ) end function RL.process( delta ) @@ -46,9 +48,9 @@ function RL.draw() RL.DrawLine( { 120, 100 }, { 140, 150 }, 2.4, { 255, 150, 255 } ) RL.DrawRectangle( { 200, 120, 40, 50 }, { 100, 170, 255 } ) RL.DrawTexturePro( tex, { 166, 138, 128, 128 }, { pos[1], pos[2], 128, 128 }, { 16, 16 }, 0.0, RL.WHITE ) - RL.DrawText( 0, "Cat MIAU!!", { 16, 32 }, 10, 1, { 255, 180, 155 } ) + RL.DrawText( RL.defaultFont, "Cat MIAU!!", { 16, 32 }, 10, 1, { 255, 180, 155 } ) RL.DrawTriangle( { 0, 32 }, { 32, 16 }, { 0, 0 }, RL.RED ) RL.EndTextureMode() - RL.DrawTexturePro( framebuffer, { 0, 0, res[1], -res[2] }, { 0, 0, winSize[1], winSize[2] }, { 0, 0 }, 0.0, { 255, 255, 255 } ) + RL.DrawTexturePro( framebufferTex, { 0, 0, res[1], -res[2] }, { 0, 0, winSize[1], winSize[2] }, { 0, 0 }, 0.0, { 255, 255, 255 } ) end diff --git a/examples/point_triangle_collision/main.lua b/examples/point_triangle_collision/main.lua index ec837d0..9a302dc 100644 --- a/examples/point_triangle_collision/main.lua +++ b/examples/point_triangle_collision/main.lua @@ -116,5 +116,5 @@ function RL.draw() RL.DrawSphereWires( point.pos, point.radius, 3, 8, point.color ) RL.EndMode3D() - RL.DrawText( 0, debugText, { 10, 10 }, 30, 4, RL.WHITE ) + RL.DrawText( RL.defaultFont, debugText, { 10, 10 }, 30, 4, RL.WHITE ) end diff --git a/examples/pong/main.lua b/examples/pong/main.lua index cc980ea..80c4346 100644 --- a/examples/pong/main.lua +++ b/examples/pong/main.lua @@ -121,7 +121,7 @@ function RL.draw() RL.DrawCircle( ball.pos, ball.radius, RL.WHITE ) -- Draw scire - RL.DrawText( 0, playerLeft.score, { 50, 10 }, 40, 2, RL.WHITE ) - local rightTextSize = RL.MeasureText( 0, playerRight.score, 40, 2 ) - RL.DrawText( 0, playerRight.score, { winSize[1] - 50 - rightTextSize[1], 10 }, 40, 2, RL.WHITE ) + RL.DrawText( RL.defaultFont, playerLeft.score, { 50, 10 }, 40, 2, RL.WHITE ) + local rightTextSize = RL.MeasureText( RL.defaultFont, playerRight.score, 40, 2 ) + RL.DrawText( RL.defaultFont, playerRight.score, { winSize[1] - 50 - rightTextSize[1], 10 }, 40, 2, RL.WHITE ) end diff --git a/examples/pong_vec/main.lua b/examples/pong_vec/main.lua index cf8e86c..0b8ff62 100644 --- a/examples/pong_vec/main.lua +++ b/examples/pong_vec/main.lua @@ -126,7 +126,7 @@ function RL.draw() RL.DrawCircle( ball.pos, ball.radius, RL.WHITE ) -- Draw score. - RL.DrawText( 0, tostring( playerLeft.score ), { 50, 10 }, 40, 2, RL.WHITE ) - local rightTextSize = Vec2:new( RL.MeasureText( 0, tostring( playerRight.score ), 40, 2 ) ) - RL.DrawText( 0, tostring( playerRight.score ), { winSize.x - 50 - rightTextSize.x, 10 }, 40, 2, RL.WHITE ) + RL.DrawText( RL.defaultFont, tostring( playerLeft.score ), { 50, 10 }, 40, 2, RL.WHITE ) + local rightTextSize = Vec2:new( RL.MeasureText( RL.defaultFont, tostring( playerRight.score ), 40, 2 ) ) + RL.DrawText( RL.defaultFont, tostring( playerRight.score ), { winSize.x - 50 - rightTextSize.x, 10 }, 40, 2, RL.WHITE ) end diff --git a/examples/ray/main.lua b/examples/ray/main.lua index 9e09683..6bee146 100644 --- a/examples/ray/main.lua +++ b/examples/ray/main.lua @@ -53,7 +53,7 @@ function RL.draw() RL.DrawGrid( 8, 1 ) RL.DrawRay( ray, { 255, 100, 100 } ) - RL.DrawMesh( sphereMesh, 0, RL.MatrixIdentity() ) + RL.DrawMesh( sphereMesh, RL.defaultMaterial, RL.MatrixIdentity() ) RL.DrawSphereWires( rayCol.point, 0.05, 4, 8, RL.BLUE ) RL.DrawLine3D( rayCol.point, RL.Vector3Add( rayCol.point, rayCol.normal ), RL.GREEN ) RL.EndMode3D() diff --git a/examples/resources/lib/gui.lua b/examples/resources/lib/gui.lua index 8bec529..bca87bd 100644 --- a/examples/resources/lib/gui.lua +++ b/examples/resources/lib/gui.lua @@ -40,7 +40,7 @@ Gui = { }, mouseButton = RL.MOUSE_BUTTON_LEFT, - font = 0, + font = RL.defaultFont, fontSize = 20, padding = 2, spacing = 4, diff --git a/examples/snake/main.lua b/examples/snake/main.lua index 53eb287..2465d1e 100644 --- a/examples/snake/main.lua +++ b/examples/snake/main.lua @@ -215,7 +215,7 @@ function RL.draw() drawApple() if gameState == STATE.OVER then - RL.DrawText( 0, "Press Enter to\nrestart", { 10, 10 }, 10, 2, RL.WHITE ) + RL.DrawText( RL.defaultFont, "Press Enter to\nrestart", { 10, 10 }, 10, 2, RL.WHITE ) end RL.EndTextureMode() |
