Comments (6)
Hello, you can create your menu without using menu.mainloop
to test events and manually delegate events to the menu. See https://pygame-menu.readthedocs.io/en/4.3.9/_source/create_menu.html#display-a-menu.
Could you also check out #422. In particular, you can customize the events by creating your own controller object. See https://pygame-menu.readthedocs.io/en/4.3.9/_source/advanced_controller.html
from pygame-menu.
Hello, you can create your menu without using
menu.mainloop
to test events and manually delegate events to the menu. See https://pygame-menu.readthedocs.io/en/4.3.9/_source/create_menu.html#display-a-menu.Could you also check out #422. In particular, you can customize the events by creating your own controller object. See https://pygame-menu.readthedocs.io/en/4.3.9/_source/advanced_controller.html
Thanks for your help! I unfortunately still cannot get it to work. Does it work by default with any specific controller? I'm ready to give up on the vintage USB nintendo controller :(
from pygame-menu.
It does work with controllers right out of the box. However, it might not work for some controllers because of incorrect mapping.
Could you test if the menu responds to any event by cloning and testing the menu event function? Maybe the events do not match the controller you're using:
pygame-menu/pygame_menu/menu.py
Lines 2465 to 2502 in faf29b3
What happens if you print the event list?
from pygame-menu.
When I print the events using pygame and not pygame menu, ( couldn't quite get the provided code to work, I'm really scratching my head here! I'm still learning programming) I get the following:
pygame 2.2.0 (SDL 2.0.22, Python 3.8.10)
Hello from the pygame community. https://www.pygame.org/contribute.html
<Event(1541-JoyDeviceAdded {'device_index': 0, 'guid': '03000000790000001100000000000000'})>
#Now lets press the A button, it gives us 2 events
<Event(1539-JoyButtonDown {'joy': 0, 'instance_id': 0, 'button': 1})>
<Event(1540-JoyButtonUp {'joy': 0, 'instance_id': 0, 'button': 1})>
#Likewise, if we push button b, also two events:
<Event(1539-JoyButtonDown {'joy': 0, 'instance_id': 0, 'button': 2})>
<Event(1540-JoyButtonUp {'joy': 0, 'instance_id': 0, 'button': 2})>
#Start Button:
<Event(1539-JoyButtonDown {'joy': 0, 'instance_id': 0, 'button': 9})>
<Event(1540-JoyButtonUp {'joy': 0, 'instance_id': 0, 'button': 9})>
#Select Button:
<Event(1539-JoyButtonDown {'joy': 0, 'instance_id': 0, 'button': 8})>
<Event(1540-JoyButtonUp {'joy': 0, 'instance_id': 0, 'button': 8})>
#Joystick Up: Please note: for the initial click it always displays the resting axis value first
<Event(1536-JoyAxisMotion {'joy': 0, 'instance_id': 0, 'axis': 4, 'value': -0.007812738425855281})>
<Event(1536-JoyAxisMotion {'joy': 0, 'instance_id': 0, 'axis': 4, 'value': -1.000030518509476})>
<Event(1536-JoyAxisMotion {'joy': 0, 'instance_id': 0, 'axis': 4, 'value': -0.007812738425855281})>
#Joystick Down:
<Event(1536-JoyAxisMotion {'joy': 0, 'instance_id': 0, 'axis': 4, 'value': -0.007812738425855281})>
<Event(1536-JoyAxisMotion {'joy': 0, 'instance_id': 0, 'axis': 4, 'value': 1.0})>
<Event(1536-JoyAxisMotion {'joy': 0, 'instance_id': 0, 'axis': 4, 'value': -0.007812738425855281})>
#Joystick Left: (note: this usb controller actually considers 4 different axis for left and right
I will only display one axis, axis 0, again, 3 events for first click, two thereafter)
<Event(1536-JoyAxisMotion {'joy': 0, 'instance_id': 0, 'axis': 0, 'value': -0.007812738425855281})>
<Event(1536-JoyAxisMotion {'joy': 0, 'instance_id': 0, 'axis': 0, 'value': -1.000030518509476})>
<Event(1536-JoyAxisMotion {'joy': 0, 'instance_id': 0, 'axis': 0, 'value': -0.007812738425855281})>
#Joystick Right: (again, 4 axis change, only showing axis 0)
<Event(1536-JoyAxisMotion {'joy': 0, 'instance_id': 0, 'axis': 0, 'value': -0.007812738425855281})>
<Event(1536-JoyAxisMotion {'joy': 0, 'instance_id': 0, 'axis': 0, 'value': 1.0})>
<Event(1536-JoyAxisMotion {'joy': 0, 'instance_id': 0, 'axis': 0, 'value': -0.007812738425855281})>`
```
Of note may be the fact that when I test the controller with a different controller test app, using SDL, the A button is button 1, B is button 0, start button6, select button 4.
from pygame-menu.
Hey so I did get it to work, probably not in an ideal fashion, but I just directly edited the controls.py file. Also, for some reason the events from my controller never showed up in any of the examples, although hot plugging the controller itself would show up as an event. May be a controller issue with pygame_menu, but every controller event shows up with no issue is pygame, just not pygame_menu.
from pygame-menu.
Hello, you also can edit default controls (as there are tons of different control mappings out there); check out https://pygame-menu.readthedocs.io/en/4.3.9/_source/advanced_controller.html#configure-controller. For future related issues, the menu cannot guarantee each control mapping. Thus any PR is welcome that addresses this issue.
from pygame-menu.
Related Issues (20)
- Center menu items when scrollbar is shown HOT 5
- Python version limit HOT 2
- typehints (label) - mypy HOT 2
- [BUG] Menu closes for no reason HOT 5
- Resize all submenus HOT 3
- Unable to hide the cursor, due to pygame_menu HOT 3
- Controller has no influence on menu actions HOT 1
- pygame-ce requirement HOT 6
- file selector HOT 5
- How do I limit the size of a label in px? HOT 4
- Mouse-selection bug HOT 4
- Unpacking then repacking any widget misplaces it in the parent frame HOT 1
- Add method to dropselect API that tells if its dropdown is expanded
- Have a _sdl2 mode where make_surface is never called whith alpha=True
- Navigating back from a nested submenu forgets the widget selection in the parent menu HOT 2
- User warning for equal title font color and menu background color when the latter is set to (0, 0, 0) HOT 2
- How check value for text_input? HOT 1
- AttributeError when changing rangeslider value with an USB gamepad
- bug in windows HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pygame-menu.