Skip to content

Commit

Permalink
fix: jamma rgb-pi controls on crt selectors
Browse files Browse the repository at this point in the history
  • Loading branch information
krahsdevil committed Apr 29, 2020
1 parent d63268b commit 1755771
Showing 1 changed file with 9 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -235,15 +235,15 @@ def get_key(self, p_oKey):
try:
return KEY_CFG[p_oKey]
except:
return CRT_NONE
return None

def get_button(self, p_iDevice, p_iButton):
if self.m_lJoys[p_iDevice]['ok'] == p_iButton:
return CRT_OK
elif self.m_lJoys[p_iDevice]['cancel'] == p_iButton:
return CRT_CANCEL
#logging.info("jb-ign: %i %i" % (p_iDevice, p_iButton))
return CRT_NONE
return None

def get_axis(self, p_iDevice, p_iAxis, p_fValue):
global ABS_CTRL_STATE
Expand Down Expand Up @@ -274,7 +274,7 @@ def get_hat(self, p_lValue):
try:
return HAT_CFG[p_lValue]
except:
return CRT_NONE
return None

def _get_screen_resolution(self):
""" main function to get screen resolution """
Expand All @@ -289,11 +289,14 @@ def event_wait(self):
while True:
for event in pygame.event.get():
if event.type == pygame.KEYDOWN:
return self.get_key(event.key)
input = self.get_key(event.key)
if input: return input
elif event.type == pygame.JOYBUTTONDOWN:
return self.get_button(event.joy, event.button)
input = self.get_button(event.joy, event.button)
if input: return input
elif event.type == pygame.JOYHATMOTION:
return self.get_hat(event.value)
input = self.get_hat(event.value)
if input: return input
elif event.type == pygame.JOYAXISMOTION:
input = self.get_axis(event.joy, event.axis, event.value)
if input: return input
Expand Down

0 comments on commit 1755771

Please sign in to comment.