Custom Controller Callbacks¶
This library is usually used by overwriting the button and Joystick callbacks
Note
The joysticks are called L3 and R3 based on PS4 own convention.
Note
Analog Button Events are those Joystick moving, L2 press, R2 press events.
Setup¶
Overwriting usually uses the concept of inheritance. For example, this is a valid way of setting up:
1 2 3 4 5 6 | |
Overwriting Digital Button Events¶
You probably want your program to do more than that. For example, you want your program to print Hello world and Goodbye World when the X button is pressed and released respectively. The code look like this:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | |
Note
The Joysticks are Buttons. You can press them and invoke some certain events.
For Example, you are making an object move in your UI with the direction keys you can make it work like this:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | |
Note
The arrow buttons comes in pairs when it is untriggered it is unable to be differentiated. So the callbacks are on_up_down_arrow_release and on_left_right_arrow_release respectively.
List of Digital Button Events¶
on_x_presson_x_releaseon_triangle_presson_triangle_releaseon_circle_presson_circle_releaseon_square_presson_square_releaseon_L1_presson_L1_releaseon_L2_releaseon_R1_presson_R1_releaseon_R2_releaseon_up_arrow_presson_up_down_arrow_releaseon_down_arrow_presson_left_arrow_presson_left_right_arrow_releaseon_right_arrow_presson_L3_x_at_reston_L3_y_at_reston_L3_presson_L3_releaseon_R3_x_at_reston_R3_y_at_reston_R3_presson_R3_releaseon_options_presson_options_releaseon_share_presson_share_releaseon_playstation_button_presson_playstation_button_release
Overwriting Analog Events¶
Overwriting Analog events is similar to how Digital Button Events. They just need an extra argument. For example:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | |
List of analog events¶
on_L2_presson_R2_presson_L3_upon_L3_downon_L3_lefton_L3_righton_R3_upon_R3_downon_R3_lefton_R3_right
Created: September 28, 2023