diff options
| author | jussi | 2023-10-27 22:53:56 +0300 |
|---|---|---|
| committer | jussi | 2023-10-27 22:53:56 +0300 |
| commit | 7ef87c8e2f7824a8abfe715aef23b4a6d2e4db78 (patch) | |
| tree | a1a669e8af511c79657cbad1de69419c86212127 /examples | |
| parent | 4cb4edcaf0d8b08d888a60d1a5d36f6e3690a4df (diff) | |
| download | reilua-enhanced-7ef87c8e2f7824a8abfe715aef23b4a6d2e4db78.tar.gz reilua-enhanced-7ef87c8e2f7824a8abfe715aef23b4a6d2e4db78.tar.bz2 reilua-enhanced-7ef87c8e2f7824a8abfe715aef23b4a6d2e4db78.zip | |
New object types for Image, Texture, RenderTexture, Camera2D, Camera3D and Shader.
Diffstat (limited to 'examples')
| -rw-r--r-- | examples/gui/main.lua | 2 | ||||
| -rw-r--r-- | examples/platformer/main.lua | 8 | ||||
| -rw-r--r-- | examples/snake/main.lua | 6 | ||||
| -rw-r--r-- | examples/window/main.lua | 9 |
4 files changed, 21 insertions, 4 deletions
diff --git a/examples/gui/main.lua b/examples/gui/main.lua index 18d8b41..3db60bb 100644 --- a/examples/gui/main.lua +++ b/examples/gui/main.lua @@ -43,7 +43,7 @@ function RL.draw() end -- RL.GuiSetStyle( RL.DEFAULT, RL.TEXT_SIZE, 20 ) - RL.GuiButton( { 112, 64, 96, 32 }, RL.GuiIconText( 113, "Kissa" ) ) + RL.GuiButton( { 112, 64, 96, 32 }, RL.GuiIconText( 113, "Cat" ) ) -- RL.GuiSetStyle( RL.DEFAULT, RL.TEXT_SIZE, 10 ) if windowOpen and RL.GuiWindowBox( { 300, 16, 200, 320 }, "Window" ) then diff --git a/examples/platformer/main.lua b/examples/platformer/main.lua index f989aec..cee0627 100644 --- a/examples/platformer/main.lua +++ b/examples/platformer/main.lua @@ -16,6 +16,7 @@ local res = Vec2:new( 160, 144 ) local winScale = 5 local winSize = res:scale( winScale ) local framebuffer = RL.LoadRenderTexture( res ) +local framebufferTex = RL.GetRenderTextureTexture( framebuffer ) local monitor = 0 local tilemap = { size = Vec2:new( res.x / TILE_SIZE, res.y / TILE_SIZE ), @@ -293,7 +294,12 @@ function RL.draw() drawPlayer() RL.EndTextureMode() - RL.DrawTexturePro( framebuffer, { 0, 0, res.x, -res.y }, { 0, 0, winSize.x, winSize.y }, { 0, 0 }, 0.0, RL.WHITE ) + -- local framebufferTex = RL.GetRenderTextureTexture( framebuffer ) + -- local texId = RL.GetTextureId( framebufferTex ) + -- print( "texId", texId ) + RL.DrawTexturePro( framebufferTex, { 0, 0, res.x, -res.y }, { 0, 0, winSize.x, winSize.y }, { 0, 0 }, 0.0, RL.WHITE ) + + -- collectgarbage( "collect" ) -- RL.glBlitFramebuffer( framebuffer, -1, res, winSize, RL.GL_COLOR_BUFFER_BIT, RL.GL_NEAREST ) end diff --git a/examples/snake/main.lua b/examples/snake/main.lua index 4bcec1b..53eb287 100644 --- a/examples/snake/main.lua +++ b/examples/snake/main.lua @@ -5,7 +5,8 @@ local LEVEL_SIZE = RESOLUTION[1] / TILE_SIZE local STATE = { TITLE = 0, GAME = 1, OVER = 2 } -- Enum wannabe. -- Resources -local framebuffer = -1 +local framebuffer = nil +local framebufferTex = nil local monitor = 0 local monitorPos = RL.GetMonitorPosition( monitor ) local monitorSize = RL.GetMonitorSize( monitor ) @@ -73,6 +74,7 @@ function RL.init() RL.SetWindowIcon( RL.LoadImage( RL.GetBasePath().."../resources/images/apple.png" ) ) framebuffer = RL.LoadRenderTexture( RESOLUTION ) + framebufferTex = RL.GetRenderTextureTexture( framebuffer ) grassTexture = RL.LoadTexture( RL.GetBasePath().."../resources/images/grass.png" ) snakeTexture = RL.LoadTexture( RL.GetBasePath().."../resources/images/snake.png" ) appleTexture = RL.LoadTexture( RL.GetBasePath().."../resources/images/apple.png" ) @@ -218,5 +220,5 @@ function RL.draw() RL.EndTextureMode() -- Draw framebuffer to window. - RL.DrawTexturePro( framebuffer, { 0, 0, RESOLUTION[1], -RESOLUTION[2] }, { 0, 0, winSize[1], winSize[2] }, { 0, 0 }, 0.0, RL.WHITE ) + RL.DrawTexturePro( framebufferTex, { 0, 0, RESOLUTION[1], -RESOLUTION[2] }, { 0, 0, winSize[1], winSize[2] }, { 0, 0 }, 0.0, RL.WHITE ) end diff --git a/examples/window/main.lua b/examples/window/main.lua index 0479f5e..2fcba93 100644 --- a/examples/window/main.lua +++ b/examples/window/main.lua @@ -1,10 +1,18 @@ local textColor = RL.BLACK local textPos = { 192, 200 } local text = "Congrats! You created your first window!" +local texture = nil function RL.init() RL.SetWindowTitle( "First window" ) RL.SetWindowState( RL.FLAG_VSYNC_HINT ) + + local path = RL.GetBasePath().."../resources/images/cat.png" + print( "path", path ) + + texture = RL.LoadTexture( path ) + + print( "texture", texture ) end function RL.process( delta ) @@ -24,5 +32,6 @@ end function RL.draw() RL.ClearBackground( RL.RAYWHITE ) + RL.DrawTexture( texture, { 20, 20 }, RL.WHITE ) RL.DrawText( 0, text, textPos, 20, 2, textColor ) end |
