From 7ef87c8e2f7824a8abfe715aef23b4a6d2e4db78 Mon Sep 17 00:00:00 2001 From: jussi Date: Fri, 27 Oct 2023 22:53:56 +0300 Subject: New object types for Image, Texture, RenderTexture, Camera2D, Camera3D and Shader. --- examples/snake/main.lua | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'examples/snake') 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 -- cgit v1.2.3