airstruck / luigi

Lovely User Interfaces for Game Inventors
MIT License
114 stars 23 forks source link

Can't get LUIGI buttons to get pressed by keys under LÖVE2d 0.10.2 #55

Closed Mutos closed 7 years ago

Mutos commented 7 years ago

Hello airstruck,

I'm new to LÖVE2d and testing various GUIs, among them is LUIGI. It works OK for my needs, except I can't get it to respond to keypress.

I built a simple layout with 4 buttons as the only active controls, it also has two panels to hold the buttons, and a status bar. I declared the "key" attribute on the buttons, but they never respond when I press the corresponding keys.

I suspect this is an issue with intercepting the keypressed and keyreleased events, but I can't get a clue on the example. Also, there is a "Backend" object in the example, that is not documented, and whose role is unclear. I'm searching also in that direction, but to no avail for now.

Thanks in advance for any answer and documentation update on the topic.

Benoît 'Mutos' Robin

Mutos commented 7 years ago

Here is the project's ZIP. It runs under LÖVE2d 0.10.2. I removed the LUIGI framework, which normally resides in the lib/luigi folder.

The goal is to make a classical asteroids game, with a menu to select the ship, display options and credits, begin playing and exit. The menu uses LUIGI and I intend to add two simple on-button layouts for circling through the ships.

The code may be ugly and full of commented out lines, I'm experimenting and adapting from hour to hour...

The issue baseline lies in how LUIGI intercepts the keypresses and uses them to activate a button's onPress event when it fits the button's "key" attribute, and how a noob user can guess this mechanism.

007-AsteroidsSurvival+Menu.zip

airstruck commented 7 years ago

I changed it from "key" to "shortcut" at some point and never documented it, sorry about that. Also apparently "alt" needs to be lowercase, should probably be made case insensitive.

shortcut = "alt-x"
Mutos commented 7 years ago

Hi airstruck,

Thanks for your answer, it works perfectly ^-^

Benoît 'Mutos' Robin