flamendless / Slab

An immediate mode GUI for the Love2D framework.
MIT License
289 stars 25 forks source link

GetLayoutSize does not return number of columns #89

Closed flamendless closed 3 years ago

flamendless commented 3 years ago
function love.update(dt)
    Slab.Update(dt)
    Slab.BeginWindow("test", {Title = "Test"})
    Slab.BeginLayout("layout_test", {Columns = 3})
    for i = 1, 10 do
        print(Slab.GetLayoutSize()) -- prints two numbers instead of 3
        Slab.Text(tostring(i))
    end
    Slab.EndLayout()
    Slab.EndWindow()
end
flamendless commented 3 years ago

Fixed in 38d39c894872800758527c6ecb9c10933d5e6b48 (retracted as it doesnt make sense) and aeb432de4552e0eadfd5c1bbdb40766f1d11da87

A more fitting API is added for wiith a use case for something more dynamic

    Slab.BeginLayout("layout_test", {Columns = 3})
    for i = 1, 3 do
        Slab.SetLayoutColumn(i)
        Slab.Text(tostring(i))
    end
    Slab.EndLayout()