Skip to content

Button Graphic with more options #205

Closed
@xescugc

Description

@xescugc

I'm using now the widget.ButtonOpts.Graphic(img) which allows to set an image to the BTN without using Stacked.

I would like to have the same logic I did on #184 but also adding Pressed.

So which is the best route? I was thinking on adding a new widget.ButtonOpts.GraphicImages(imgs) that would basically use the same API I did for the other PR. That is easy, the issues is when trying to do the Pressed as the Widget has no knowledge of it, should we also add a Widget.Pressed same way we have Widget.Disabled?

If not the other way is to copy part of the logic on TextAndImage that has:

type ButtonImageImage struct {
	Idle     *ebiten.Image
	Disabled *ebiten.Image
}

We could add the Pressed and on Render extend the logic already existent to use either Idle or Disabled to check the b.pressed (and the other check done on other methods) to change the image of the Graphic to the one we want.

WDYT is the one you prefer?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions