Skip to content

Can I position window automatically, just like layout? #157

Closed Answered by flamendless
NoRuBal asked this question in Q&A
Discussion options

You must be logged in to vote

Hello there! Thanks for the kind words about this awesome library!.

My first question is if there is any way to set windows position automatically.

Yes, you can use the X and Y parameter in the BeginWindow.

I want to position my window at center of the screen

You can do this with something like:

local ww, wh = 640, 480 -- slab window's size
local w, h = love.windows.getDimensions()
local cx = w/2 - ww/2
local cy = h/2 - wh/2
Slab.BeginWindow('login', {Title = ":: Login", AllowMove = false, ShowMinimize = false, X = cx, Y = cy, W = ww, H = wh, AutoSizeWindow = false})
...

But I wonder if it's possible to set window position automatically, just like setting AlignX element of layout.

I…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@NoRuBal
Comment options

Answer selected by flamendless
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants