Browse Source

wiring up the deadzone config scene

master
calexil 4 months ago
parent
commit
870c394892
  1. 42
      fightstick.py
  2. BIN
      theme/deadzone.png

42
fightstick.py

@ -117,6 +117,31 @@ class TryAgainScene: @@ -117,6 +117,31 @@ class TryAgainScene:
self.missing_img.blit(0, 0)
#Deadzone Interface, ?maybe TODO This doesn't work..
class DeadzoneScene:
def __init__(self, window_instance):
self.window = window_instance
self.deadzone_img = pyglet.resource.image("deadzone.png")
@self.window.event
def on_button_press(controller, button):
assert _debug_print(f"Pressed Button: {button}")
pressed_button = button_mapping.get(button, None)
if pressed_button == 'guide':
if config_window.parent is not None:
self.frame.remove(config_window)
else:
self.frame.add(config_window)
def update_trigger_point(slider):
self.triggerpoint = slider.value
deadzone_label = self.frame.get_element_by_name("triggerpoint")
deadzone_label.text = "Analog Trigger Point: {}".format(round(slider.value, 2))
def on_draw():
self.window.clear()
self.deadzone_img.blit(0, 0)
class MainScene:
# The main scene, with all fightstick events wired up.
def __init__(self, window_instance, fightstick):
@ -202,23 +227,6 @@ class MainScene: @@ -202,23 +227,6 @@ class MainScene:
elif value < -self.triggerpoint:
self.rt_spr.visible = False
# #Deadzone Interface, ?maybe TODO This doesn't work you numbskull..
# @self.window.event
# # self.window.push_handlers(self.frame)
# def on_button_press(controller, button):
# assert _debug_print(f"Pressed Button: {button}")
# config_window = self.window("Deadzone Configuration", name="config_window", x=400, y=360, content=config_layout)
# pressed_button = button_mapping.get(button, None)
# if pressed_button == 'guide':
# if config_window.parent is not None:
# self.frame.remove(config_window)
# else:
# self.frame.add(config_window)
# def update_trigger_point(slider):
# self.triggerpoint = slider.value
# deadzone_label = self.frame.get_element_by_name("triggerpoint")
# deadzone_label.text = "Analog Trigger Point: {}".format(round(slider.value, 2))
# Window event to draw everything when necessary.

BIN
theme/deadzone.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Loading…
Cancel
Save