keharriso / love-nuklear

Lightweight immediate mode GUI for LÖVE games
MIT License
350 stars 32 forks source link

Help : draw text #58

Closed deb75 closed 2 years ago

deb75 commented 3 years ago

Hello,

I successfully run love-nuklear in my project. But I have difficulty to make just simple things as draw a rectangle with some text in it.

What I need is to make appear a simple box without title and semi-transparent with one or two lines of text in it. I do not need to make it move or to have buttons

Currently, I tried this :

    ui:frameBegin()
    if
        ui:windowBegin(
            "Simple Example",
            100,
            100,
            200,
            160,
            "border",
            "title",
            "movable"
        )
    then
        ui:label("ezezeze")
    end
    ui:windowEnd()
    ui:frameEnd()

But the text label does not appear anywhere (or is it of the same color as background ?)

Could anyone using this nice library give me some piece of advice ?

Also : can you round the window corners ?

Regards

keharriso commented 3 years ago

You are almost there. You need to apply a layout before drawing widgets. Try:

    ui:frameBegin()
    if
        ui:windowBegin(
            "Simple Example",
            100,
            100,
            200,
            160,
            "border",
            "title",
            "movable"
        )
    then
        ui:layoutRow('dynamic', 30, 1)
        ui:label("ezezeze")
    end
    ui:windowEnd()
    ui:frameEnd()

You can round window corners by applying an image style. See the skin example in the examples folder: https://github.com/keharriso/love-nuklear/tree/master/example