public SemanticButton register_semantic_button(String name, ButtonInputSet defaults) { SemanticButton button = new SemanticButton(name, defaults); if (button_dict.ContainsKey(name)) throw new Exception("The operation \"" + name + "\" has already been registered as a semantic button."); button_dict[name] = button; return button; }
public SemanticButton(String description, ButtonInputSet defaults) { _name = description; input = default_input = defaults; _down = _pressed = _released = _locked = false; ticks_held = 0; }
protected virtual void initialize_buttons() { dir = new DirectionalButtons(); action = new VERGEActions(); ButtonInputSet set; dir = new DirectionalButtons(); set = new ButtonInputSet(); set.keys.Add(Keys.Left); set.gamepad_buttons.Add(Buttons.DPadLeft); set.gamepad_buttons.Add(Buttons.LeftThumbstickLeft); dir.left = input.register_semantic_button("Left", set); set = new ButtonInputSet(); set.keys.Add(Keys.Right); set.gamepad_buttons.Add(Buttons.DPadRight); set.gamepad_buttons.Add(Buttons.LeftThumbstickRight); dir.right = input.register_semantic_button("Right", set); set = new ButtonInputSet(); set.keys.Add(Keys.Up); set.gamepad_buttons.Add(Buttons.DPadUp); set.gamepad_buttons.Add(Buttons.LeftThumbstickUp); dir.up = input.register_semantic_button("Up", set); set = new ButtonInputSet(); set.keys.Add(Keys.Down); set.gamepad_buttons.Add(Buttons.DPadDown); set.gamepad_buttons.Add(Buttons.LeftThumbstickDown); dir.down = input.register_semantic_button("Down", set); set = new ButtonInputSet(); set.keys.Add(Keys.Enter); set.keys.Add(Keys.Z); set.keys.Add(Keys.Space); set.gamepad_buttons.Add(Buttons.A); action.confirm = input.register_semantic_button("Confirm", set); set = new ButtonInputSet(); set.keys.Add(Keys.LeftAlt); set.keys.Add(Keys.RightAlt); set.keys.Add(Keys.X); set.gamepad_buttons.Add(Buttons.B); action.cancel = input.register_semantic_button("Cancel", set); set = new ButtonInputSet(); set.keys.Add(Keys.Escape); set.gamepad_buttons.Add(Buttons.Y); action.menu = input.register_semantic_button("Menu", set); }