mirror of
https://github.com/cyberboy666/r_e_c_u_r.git
synced 2025-12-11 10:50:03 +01:00
added mouse input
This commit is contained in:
@@ -101,5 +101,13 @@
|
|||||||
"s": {
|
"s": {
|
||||||
"DEFAULT": ["load_slot_9_into_next_player","confirm_shutdown"],
|
"DEFAULT": ["load_slot_9_into_next_player","confirm_shutdown"],
|
||||||
"PLAY_SHADER": ["play_shader_9","confirm_shutdown"]
|
"PLAY_SHADER": ["play_shader_9","confirm_shutdown"]
|
||||||
}
|
},
|
||||||
|
"x_m": {
|
||||||
|
"DEFAULT": ["set_the_shader_param_0_layer_offset_0_continuous"],
|
||||||
|
"NAV_DETOUR": ["set_detour_mix_continuous"]
|
||||||
|
},
|
||||||
|
"y_m": {
|
||||||
|
"DEFAULT": ["set_the_shader_param_1_layer_offset_0_continuous"],
|
||||||
|
"NAV_DETOUR": ["set_detour_speed_position_continuous"]
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -141,6 +141,14 @@
|
|||||||
"options": [],
|
"options": [],
|
||||||
"value": null
|
"value": null
|
||||||
},
|
},
|
||||||
|
"MOUSE_INPUT": {
|
||||||
|
"action": null,
|
||||||
|
"options": [
|
||||||
|
"enabled",
|
||||||
|
"disabled"
|
||||||
|
],
|
||||||
|
"value": "disabled"
|
||||||
|
},
|
||||||
"ANALOG_INPUT": {
|
"ANALOG_INPUT": {
|
||||||
"action": null,
|
"action": null,
|
||||||
"options": [
|
"options": [
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ class NumpadInput(object):
|
|||||||
def bind_actions(self):
|
def bind_actions(self):
|
||||||
self.display.display_text.bind("<KeyPress>", self.on_key_press)
|
self.display.display_text.bind("<KeyPress>", self.on_key_press)
|
||||||
self.display.display_text.bind("<KeyRelease>", self.on_key_release)
|
self.display.display_text.bind("<KeyRelease>", self.on_key_release)
|
||||||
|
self.display.display_text.bind("<Motion>", self.on_mouse_move)
|
||||||
|
|
||||||
def on_key_press(self, event):
|
def on_key_press(self, event):
|
||||||
numpad = list(string.ascii_lowercase[0:19])
|
numpad = list(string.ascii_lowercase[0:19])
|
||||||
@@ -34,7 +35,19 @@ class NumpadInput(object):
|
|||||||
if event.char in numpad:
|
if event.char in numpad:
|
||||||
self.check_key_release_settings(event.char)
|
self.check_key_release_settings(event.char)
|
||||||
|
|
||||||
def run_action_for_mapped_key(self, key):
|
def on_mouse_move(self, event):
|
||||||
|
if self.data.settings['user_input']['MOUSE_INPUT']['value'] != 'enabled':
|
||||||
|
return
|
||||||
|
if event.x > 480 or event.y > 320:
|
||||||
|
return
|
||||||
|
width = 480
|
||||||
|
height = 320 # hard coded since display is fixed , and reading screen is more work
|
||||||
|
|
||||||
|
self.root.after(0, self.run_action_for_mapped_key, 'x_m', event.x / width)
|
||||||
|
self.root.after(0, self.run_action_for_mapped_key, 'y_m', event.y / height)
|
||||||
|
#self.run_action_for_mapped_key(event.char)
|
||||||
|
|
||||||
|
def run_action_for_mapped_key(self, key, value=-1):
|
||||||
this_mapping = self.key_mappings[key]
|
this_mapping = self.key_mappings[key]
|
||||||
if self.data.control_mode in this_mapping:
|
if self.data.control_mode in this_mapping:
|
||||||
mode = self.data.control_mode
|
mode = self.data.control_mode
|
||||||
@@ -42,15 +55,21 @@ class NumpadInput(object):
|
|||||||
mode = 'DEFAULT'
|
mode = 'DEFAULT'
|
||||||
|
|
||||||
if self.data.function_on and len(this_mapping[mode]) > 1:
|
if self.data.function_on and len(this_mapping[mode]) > 1:
|
||||||
print('the action being called is {}'.format(this_mapping[mode][1]))
|
is_function = 1
|
||||||
getattr(self.actions, this_mapping[mode][1])()
|
|
||||||
if self.data.settings['sampler']['FUNC_GATED']['value'] == 'off':
|
|
||||||
self.data.function_on = False
|
|
||||||
else:
|
else:
|
||||||
print('the action being called is {}'.format(this_mapping[mode][0]))
|
is_function = 0
|
||||||
getattr(self.actions, this_mapping[mode][0])()
|
|
||||||
|
print('the action being called is {}'.format(this_mapping[mode][is_function]))
|
||||||
self.display.refresh_display()
|
if value != -1:
|
||||||
|
getattr(self.actions, this_mapping[mode][is_function])(value)
|
||||||
|
else:
|
||||||
|
getattr(self.actions, this_mapping[mode][is_function])()
|
||||||
|
|
||||||
|
if is_function and self.data.settings['sampler']['FUNC_GATED']['value'] == 'off':
|
||||||
|
self.data.function_on = False
|
||||||
|
|
||||||
|
if not value:
|
||||||
|
self.display.refresh_display()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user