diff options
| author | jussi | 2023-10-30 00:04:11 +0200 |
|---|---|---|
| committer | jussi | 2023-10-30 00:04:11 +0200 |
| commit | d287078c658d26d41a28f92b62b023048c5503ce (patch) | |
| tree | fb045110fde9329782d21324cc7a9092128a1126 /examples | |
| parent | 992310fb90832ddf493ec33f1099dbbf3e0987f3 (diff) | |
| download | reilua-enhanced-d287078c658d26d41a28f92b62b023048c5503ce.tar.gz reilua-enhanced-d287078c658d26d41a28f92b62b023048c5503ce.tar.bz2 reilua-enhanced-d287078c658d26d41a28f92b62b023048c5503ce.zip | |
Userdata objects can be referenced with lightuserdata.
Diffstat (limited to 'examples')
| -rw-r--r-- | examples/pixelated/main.lua | 4 | ||||
| -rw-r--r-- | examples/platformer/main.lua | 9 | ||||
| -rw-r--r-- | examples/snake/main.lua | 4 |
3 files changed, 3 insertions, 14 deletions
diff --git a/examples/pixelated/main.lua b/examples/pixelated/main.lua index 3d79ccd..174b2b9 100644 --- a/examples/pixelated/main.lua +++ b/examples/pixelated/main.lua @@ -5,7 +5,6 @@ local monitor = 0 local mPos = RL.GetMonitorPosition( monitor ) local mSize = RL.GetMonitorSize( monitor ) local framebuffer = nil -local framebufferTex = nil local res = { 320, 180 } local scale = 5 local winSize = { res[1] * scale, res[2] * scale } @@ -18,7 +17,6 @@ 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 ) @@ -52,5 +50,5 @@ function RL.draw() RL.DrawTriangle( { 0, 32 }, { 32, 16 }, { 0, 0 }, RL.RED ) RL.EndTextureMode() - RL.DrawTexturePro( framebufferTex, { 0, 0, res[1], -res[2] }, { 0, 0, winSize[1], winSize[2] }, { 0, 0 }, 0.0, { 255, 255, 255 } ) + RL.DrawTexturePro( RL.GetRenderTextureTexture( framebuffer ), { 0, 0, res[1], -res[2] }, { 0, 0, winSize[1], winSize[2] }, { 0, 0 }, 0.0, { 255, 255, 255 } ) end diff --git a/examples/platformer/main.lua b/examples/platformer/main.lua index cee0627..821839a 100644 --- a/examples/platformer/main.lua +++ b/examples/platformer/main.lua @@ -16,7 +16,6 @@ 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 ), @@ -294,12 +293,6 @@ function RL.draw() drawPlayer() RL.EndTextureMode() - -- 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.DrawTexturePro( RL.GetRenderTextureTexture( framebuffer ), { 0, 0, res.x, -res.y }, { 0, 0, winSize.x, winSize.y }, { 0, 0 }, 0.0, RL.WHITE ) -- 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 2465d1e..e90c732 100644 --- a/examples/snake/main.lua +++ b/examples/snake/main.lua @@ -6,7 +6,6 @@ local STATE = { TITLE = 0, GAME = 1, OVER = 2 } -- Enum wannabe. -- Resources local framebuffer = nil -local framebufferTex = nil local monitor = 0 local monitorPos = RL.GetMonitorPosition( monitor ) local monitorSize = RL.GetMonitorSize( monitor ) @@ -74,7 +73,6 @@ 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" ) @@ -220,5 +218,5 @@ function RL.draw() RL.EndTextureMode() -- Draw framebuffer to window. - RL.DrawTexturePro( framebufferTex, { 0, 0, RESOLUTION[1], -RESOLUTION[2] }, { 0, 0, winSize[1], winSize[2] }, { 0, 0 }, 0.0, RL.WHITE ) + RL.DrawTexturePro( RL.GetRenderTextureTexture( framebuffer ), { 0, 0, RESOLUTION[1], -RESOLUTION[2] }, { 0, 0, winSize[1], winSize[2] }, { 0, 0 }, 0.0, RL.WHITE ) end |
