flamendless / Slab

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

Multiple Input does not work #34

Closed flamendless closed 4 years ago

flamendless commented 4 years ago

Hi, im doing something like this

    Slab.BeginWindow("Bump3DCollision", {Title = "Bump3DCollision"})
    local items, len = self.bump3d_world:getItems()
    for i = 1, len do
        local e = items[i]
        Slab.Text(e.bump3d.id)
        Slab.Indent()

        local x = e.collider3d.size.x
        local y = e.collider3d.size.y
        local z = e.collider3d.size.z

        Slab.Text("x: ")
        Slab.SameLine()
        if Slab.Input("input_x", {Text = tostring(x), ReturnOnText = false, NumbersOnly = true}) then
            x = tonumber(Slab.GetInputText())
        end

        Slab.Text("y: ")
        Slab.SameLine()
        if Slab.Input("input_y", {Text = tostring(y), ReturnOnText = false, NumbersOnly = true}) then
            y = tonumber(Slab.GetInputText())
        end

        Slab.Text("z: ")
        Slab.SameLine()
        if Slab.Input("input_z", {Text = tostring(z), ReturnOnText = false, NumbersOnly = true}) then
            z = tonumber(Slab.GetInputText())
        end

        Slab.Unindent()
    end
    Slab.EndWindow()

it properly shows but i cant click and change any value in the Slab.Input

flamendless commented 4 years ago

It seems that the problem arises because of conflicting ID of Slab.Input, a workaround is to do Slab.Input("input_x_" .. i)