fullscreen (LÖVE2D only)
Some games need only one resolution and you want it the same no matter how the window resizes. When going into fullscreen mode the default mode in LÖVE2D is desktop and the preset resolution changes from perhaps 800x600 to 1024x768 pixels.
To prevent this from happening and thus reducing some scaling and translation operations you only put this into the conf.lua file near the main.file :
-- resolution set exactly your numbers so the window can not get smaller
t.window.width = 800
t.window.height = 600
t.window.minwidth = 800
t.window.minheight = 600
-- change to true when you need fullscreen from start of your app
t.window.resizable = false
and then after this put a newline for fullscreen :
-- when the resolution is 800x600 the fullscreen will be 800x600
t.window.fullscreen = false
t.window.fullscreentype = "exclusive"
For perfect pixel precission so the game looks pixelated instead of smoothed put into main.lua inside the love.load function this :
love.graphics.setDefaultFilter("nearest","nearest",0)
For toggling fullscreen on/off you can add to main.lua :
function love.keyreleased(key)
if key == "f9" then
local fullscreen = not love.window.getFullscreen()
love.window.setFullscreen(fullscreen)
end
end
And you are ready to make some good looking pixel retro game.
NOTE : For other lua engines i use the fullscreen can be set by a command but the resolution changes as if getting bigger and thus you need to scale it around to look better. This is not bad, but can drastically slow down the game because the pixel fillrate goes up.
LUA game developing for dumbies
Some nice ways of doing the lua game developing .
Status | In development |
Category | Other |
Author | Bastian |
More posts
- classes and oop2 days ago
- trajectories2 days ago
- general base of project5 days ago
- fonts9 days ago
- scaling the screen12 days ago
- sorting13 days ago
Leave a comment
Log in with itch.io to leave a comment.