Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
I
ingame
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Vladislav
ingame
Commits
e6e8dcde
Commit
e6e8dcde
authored
Apr 24, 2024
by
Georgiy Yankovskiy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Gamepad polling terminate
parent
7fd78120
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
35 additions
and
28 deletions
+35
-28
Gamepad.py
ingame/models/Gamepad.py
+31
-28
qml.qml
qml/qml.qml
+4
-0
No files found.
ingame/models/Gamepad.py
View file @
e6e8dcde
...
...
@@ -34,45 +34,48 @@ class Gamepad:
self
.
thread
.
start
()
def
cycle
(
self
):
while
not
self
.
terminated
:
# pygame.event.pump()
pygame
.
event
.
wait
()
try
:
while
not
self
.
terminated
:
# pygame.event.pump()
pygame
.
event
.
wait
()
lb_button
=
self
.
joystick
.
get_button
(
self
.
LB_BUTTON
)
rb_button
=
self
.
joystick
.
get_button
(
self
.
RB_BUTTON
)
lb_button
=
self
.
joystick
.
get_button
(
self
.
LB_BUTTON
)
rb_button
=
self
.
joystick
.
get_button
(
self
.
RB_BUTTON
)
# LB
# LB
if
lb_button
and
not
self
.
last_lb_clicked
:
self
.
last_lb_clicked
=
not
self
.
last_lb_clicked
self
.
lb_clicked
()
if
lb_button
and
not
self
.
last_lb_clicked
:
self
.
last_lb_clicked
=
not
self
.
last_lb_clicked
self
.
lb_clicked
()
if
not
lb_button
and
self
.
last_lb_clicked
:
self
.
last_lb_clicked
=
not
self
.
last_lb_clicked
if
not
lb_button
and
self
.
last_lb_clicked
:
self
.
last_lb_clicked
=
not
self
.
last_lb_clicked
# RB
# RB
if
rb_button
and
not
self
.
last_rb_clicked
:
self
.
last_rb_clicked
=
not
self
.
last_rb_clicked
self
.
rb_clicked
()
if
rb_button
and
not
self
.
last_rb_clicked
:
self
.
last_rb_clicked
=
not
self
.
last_rb_clicked
self
.
rb_clicked
()
if
not
rb_button
and
self
.
last_rb_clicked
:
self
.
last_rb_clicked
=
not
self
.
last_rb_clicked
if
not
rb_button
and
self
.
last_rb_clicked
:
self
.
last_rb_clicked
=
not
self
.
last_rb_clicked
# print(f"Button {self.LB_BUTTON}: {lb_button}")
# print(f"Button {self.RB_BUTTON}: {rb_button}")
# print(f"Button {self.LB_BUTTON}: {lb_button}")
# print(f"Button {self.RB_BUTTON}: {rb_button}")
# for i in range(self.joystick.get_numaxes()):
# axis = self.joystick.get_axis(i)
# print(f"Axis {i}: {axis}")
#
# for i in range(self.joystick.get_numbuttons()):
# button = self.joystick.get_button(i)
# print(f"Button {i}: {button}")
# for i in range(self.joystick.get_numaxes()):
# axis = self.joystick.get_axis(i)
# print(f"Axis {i}: {axis}")
#
# for i in range(self.joystick.get_numbuttons()):
# button = self.joystick.get_button(i)
# print(f"Button {i}: {button}")
except
pygame
.
error
:
pass
def
terminate
(
self
):
# TODO
# self.thread.
self
.
terminated
=
True
pygame
.
quit
()
pass
pass
qml/qml.qml
View file @
e6e8dcde
...
...
@@ -26,6 +26,10 @@ Window {
}
}
Component.onDestruction
:
{
console
.
log
(
"Desctructing window"
);
}
id
:
window
width
:
640
height
:
480
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment