Permalink
Browse files

raw key codes

  • Loading branch information...
cflavio committed Oct 11, 2018
1 parent c9113e1 commit 4f3ea73278838ccf1848e9ffa21cf557f586ca27
Showing with 33 additions and 33 deletions.
  1. +17 −17 menu/inputpage.py
  2. +2 −2 project.py
  3. +13 −13 yorg/yorg.py
  4. +1 −1 yyagl
View
@@ -53,7 +53,7 @@ def build(self):
(_('Respawn'), 'respawn' + suff, -.38)]
for btn_data in buttons_data:
widgets += [self._add_lab(btn_data[0], btn_data[2])]
widgets += [self._add_btn(self.keys[btn_data[1]], btn_data[2])]
widgets += [self._add_btn(self.eng.event.key2desc(self.keys[btn_data[1]]), btn_data[2])]
l_a = menu_args.label_args.copy()
l_a['scale'] = .065
self.hint_lab = Label(
@@ -91,12 +91,12 @@ def _on_back(self):
suff = str(self.joyp_idx + 1)
dct = {}
dct['keys'] = {
'forward' + suff: self.mediator.gui.ibuttons[0]['text'],
'rear' + suff: self.mediator.gui.ibuttons[1]['text'],
'left' + suff: self.mediator.gui.ibuttons[2]['text'],
'right' + suff: self.mediator.gui.ibuttons[3]['text'],
'fire' + suff: self.mediator.gui.ibuttons[4]['text'],
'respawn' + suff: self.mediator.gui.ibuttons[5]['text']}
'forward' + suff: self.eng.event.desc2key(self.mediator.gui.ibuttons[0]['text']),
'rear' + suff: self.eng.event.desc2key(self.mediator.gui.ibuttons[1]['text']),
'left' + suff: self.eng.event.desc2key(self.mediator.gui.ibuttons[2]['text']),
'right' + suff: self.eng.event.desc2key(self.mediator.gui.ibuttons[3]['text']),
'fire' + suff: self.eng.event.desc2key(self.mediator.gui.ibuttons[4]['text']),
'respawn' + suff: self.eng.event.desc2key(self.mediator.gui.ibuttons[5]['text'])}
dct['joystick' + suff] = self.mediator.gui.joypad_cb['indicatorValue']
self.notify('on_back', 'input_page2', [dct])
@@ -114,9 +114,9 @@ def on_already_dlg(self): self.dial = self.dial.destroy()
def already_used(self, val):
labels = ['forward', 'rear', 'left', 'right', 'fire', 'respawn', 'pause']
for i, btn in enumerate(self.mediator.gui.ibuttons):
if btn['text'] == val: return '1', labels[i]
if self.eng.event.desc2key(btn['text']) == val: return '1', labels[i]
for lab in labels[:-1]:
if self.keys[lab + '2'] == val: return '2', lab
if self.eng.event.key2desc(self.keys[lab + '2']) == val: return '2', lab
class InputPageGui1(InputPageGui2):
@@ -130,7 +130,7 @@ def build(self):
**self.menu_args.btn_args)
self.add_widgets([p2_btn])
self.add_widgets([self._add_lab(_('Pause'), -.56)])
self.add_widgets([self._add_btn(self.keys['pause'], -.56)])
self.add_widgets([self._add_btn(self.eng.event.key2desc(self.keys['pause']), -.56)])
InputPageGui2.build(self)
def on_player2(self):
@@ -141,13 +141,13 @@ def _on_back(self):
suff = str(self.joyp_idx + 1)
dct = {}
dct['keys'] = {
'forward' + suff: self.mediator.gui.ibuttons[0]['text'],
'rear' + suff: self.mediator.gui.ibuttons[1]['text'],
'left' + suff: self.mediator.gui.ibuttons[2]['text'],
'right' + suff: self.mediator.gui.ibuttons[3]['text'],
'fire' + suff: self.mediator.gui.ibuttons[4]['text'],
'respawn' + suff: self.mediator.gui.ibuttons[5]['text'],
'pause': self.mediator.gui.ibuttons[6]['text']}
'forward' + suff: self.eng.event.desc2key(self.mediator.gui.ibuttons[0]['text']),
'rear' + suff: self.eng.event.desc2key(self.mediator.gui.ibuttons[1]['text']),
'left' + suff: self.eng.event.desc2key(self.mediator.gui.ibuttons[2]['text']),
'right' + suff: self.eng.event.desc2key(self.mediator.gui.ibuttons[3]['text']),
'fire' + suff: self.eng.event.desc2key(self.mediator.gui.ibuttons[4]['text']),
'respawn' + suff: self.eng.event.desc2key(self.mediator.gui.ibuttons[5]['text']),
'pause': self.eng.event.desc2key(self.mediator.gui.ibuttons[6]['text'])}
dct['joystick' + suff] = self.mediator.gui.joypad_cb['indicatorValue']
self.notify('on_back', 'input_page1', [dct])
View
@@ -4,8 +4,8 @@
# TODO LIST =====
# 0.11 (local multiplayer)
# use raw keys as default ones
# supporting up to four players
# supporting up to four players (options/input)
# supporting up to four players (ingame)
# WAITING =====
View
@@ -51,19 +51,19 @@ def __init__(self):
'antialiasing': 0,
'cars_number': 7,
'keys': {
'forward1': 'arrow_up',
'rear1': 'arrow_down',
'left1': 'arrow_left',
'right1': 'arrow_right',
'fire1': 'm',
'respawn1': 'n',
'forward2': 'w',
'rear2': 's',
'left2': 'a',
'right2': 'd',
'fire2': 't',
'respawn2': 'r',
'pause': 'p'},
'forward1': 'raw-arrow_up',
'rear1': 'raw-arrow_down',
'left1': 'raw-arrow_left',
'right1': 'raw-arrow_right',
'fire1': 'raw-rcontrol',
'respawn1': 'raw-rshift',
'forward2': 'raw-w',
'rear2': 'raw-s',
'left2': 'raw-a',
'right2': 'raw-d',
'fire2': 'raw-c',
'respawn2': 'raw-v',
'pause': 'raw-p'},
'joystick1': 0,
'joystick2': 0,
'last_version': '0.7.0-x',

0 comments on commit 4f3ea73

Please sign in to comment.