diff options
| author | jussi | 2024-11-21 23:25:28 +0200 |
|---|---|---|
| committer | jussi | 2024-11-21 23:25:28 +0200 |
| commit | c9ebe23d6282e96b410dc7687e0be1c4f3ba1b4d (patch) | |
| tree | dfd26a87fb2b2f702f77728b98a1e6c193684631 /examples/snake/main.lua | |
| parent | d96e33bb1772c28f630de32e09201c0cdea6f896 (diff) | |
| download | reilua-enhanced-c9ebe23d6282e96b410dc7687e0be1c4f3ba1b4d.tar.gz reilua-enhanced-c9ebe23d6282e96b410dc7687e0be1c4f3ba1b4d.tar.bz2 reilua-enhanced-c9ebe23d6282e96b410dc7687e0be1c4f3ba1b4d.zip | |
RL.config and InitWindow.
Diffstat (limited to 'examples/snake/main.lua')
| -rw-r--r-- | examples/snake/main.lua | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/examples/snake/main.lua b/examples/snake/main.lua index fe30403..f88794f 100644 --- a/examples/snake/main.lua +++ b/examples/snake/main.lua @@ -13,8 +13,6 @@ local STATE = { TITLE = 0, GAME = 1, OVER = 2 } -- Enum. -- Resources local framebuffer = nil local monitor = 0 -local monitorPos = Vector2:newT( RL.GetMonitorPosition( monitor ) ) -local monitorSize = Vector2:newT( RL.GetMonitorSize( monitor ) ) local winScale = 6 local winSize = Vector2:new( RESOLUTION.x * winScale, RESOLUTION.y * winScale ) local gameState = STATE.GAME @@ -69,16 +67,22 @@ local function setApplePos() end end --- Init. +-- Config. -function RL.init() - RL.SetWindowState( RL.FLAG_WINDOW_RESIZABLE ) - RL.SetWindowState( RL.FLAG_VSYNC_HINT ) - RL.SetWindowSize( winSize ) - RL.SetWindowPosition( { monitorPos.x + monitorSize.x / 2 - winSize.x / 2, monitorPos.y + monitorSize.y / 2 - winSize.y / 2 } ) - RL.SetWindowTitle( "Snake" ) +function RL.config() + RL.SetConfigFlags( RL.FLAG_WINDOW_RESIZABLE ) + RL.SetConfigFlags( RL.FLAG_VSYNC_HINT ) + RL.InitWindow( winSize, "Snake" ) RL.SetWindowIcon( RL.LoadImage( RL.GetBasePath().."../resources/images/apple.png" ) ) + local monitorPos = Vector2:newT( RL.GetMonitorPosition( monitor ) ) + local monitorSize = Vector2:newT( RL.GetMonitorSize( monitor ) ) + RL.SetWindowPosition( { monitorPos.x + monitorSize.x / 2 - winSize.x / 2, monitorPos.y + monitorSize.y / 2 - winSize.y / 2 } ) +end + +-- Init. + +function RL.init() framebuffer = RL.LoadRenderTexture( RESOLUTION ) grassTexture = RL.LoadTexture( RL.GetBasePath().."../resources/images/grass.png" ) snakeTexture = RL.LoadTexture( RL.GetBasePath().."../resources/images/snake.png" ) |
