Skip to content

Commit

Permalink
break it to fix it
Browse files Browse the repository at this point in the history
  • Loading branch information
calexil committed Apr 15, 2017
1 parent 5eb7c18 commit a9884ee
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions fightstick.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import pyglet
from simplui import Theme, Frame, Dialogue, Button, VLayout
from simplui import Theme, Frame, Dialogue,Slider, Button, Label, VLayout
import sys
import json

Expand Down Expand Up @@ -151,6 +151,9 @@ def on_trigger_motion(controller, trigger, value):
frame = Frame(theme=Theme('theme/menutheme'), w=window.width, h=window.height)
window.push_handlers(frame)

# TTD: use this in trigger and stick events above ^^^
TRIGGERPOINT = 0.8

@window.event
def on_key_press(key, modifiers):
# Toggle the menu when pressing the space key.
Expand All @@ -160,13 +163,19 @@ def on_key_press(key, modifiers):
else:
frame.add(config_window)

# TTD use this in trigger and stick events above:
def update_trigger_point(slider):
global TRIGGERPOINT
TRIGGERPOINT = slider.value
deadzone_label = frame.get_element_by_name("triggerpoint")
deadzone_label.text = "Analog Trigger Point: {}".format(round(slider.value, 2))

def remap_buttons(button):
# TTD add code here to remap buttons
pass

config_layout = VLayout(children=[
Label("Analog Trigger Point: {}".format(round(TRIGGERPOINT, 2)), name="triggerpoint"),
Slider(w=200, min=0.0, max=1.0, value=TRIGGERPOINT, action=update_trigger_point),
Button("Remap Buttons", w=2, action=remap_buttons)
])
config_window = Dialogue("Configuration", name="config_window", x=400, y=360, content=config_layout)
Expand Down

0 comments on commit a9884ee

Please sign in to comment.