// return a reference to the hotkey in PlayerOptions based on enum option public KeyCode returnHotkey(hotkeys hotkeyToReturn) { switch (hotkeyToReturn) { case hotkeys.interact: return(PlayerOptions.configData.interact); //return "test1"; case hotkeys.moveDown: return(PlayerOptions.configData.moveDown); //return "test2"; case hotkeys.moveUp: return(PlayerOptions.configData.moveUp); //return "test3"; case hotkeys.moveRight: return(PlayerOptions.configData.moveRight); //return "test4"; case hotkeys.moveLeft: return(PlayerOptions.configData.moveLeft); //return "test5"; case hotkeys.pause: return(PlayerOptions.configData.pause); //return "test6"; } return(KeyCode.A); }
// function that is called to change the hotkey // uses the enum to find which key is being changed then changes it public void changeHotkey(hotkeys toChange, KeyCode newHotkey) { switch (toChange) { case hotkeys.interact: PlayerOptions.configData.interact = newHotkey; break; case hotkeys.moveDown: PlayerOptions.configData.moveDown = newHotkey; break; case hotkeys.moveUp: PlayerOptions.configData.moveUp = newHotkey; break; case hotkeys.moveRight: PlayerOptions.configData.moveRight = newHotkey; break; case hotkeys.moveLeft: PlayerOptions.configData.moveLeft = newHotkey; break; case hotkeys.pause: PlayerOptions.configData.pause = newHotkey; break; } }
void ComponentDispatcher_ThreadPreprocessMessage(ref MSG msg, ref bool handled) { if (msg.message == WM_HOTKEY && enableHotkeys.Checked) { int D = (((int)msg.lParam >> 16) & 0xFFFF); int F = (((int)msg.lParam >> 16) & 0xFFFF); hotkeys key = (hotkeys)F; ModifierKeys modifier = (ModifierKeys)((int)msg.lParam & 0xFFFF); if (key == hotkeys._1) { toolsWindow.hideInkCheckBox.IsChecked = !toolsWindow.hideInkCheckBox.IsChecked; } else if (key == hotkeys._2) { toolsWindow.cursorButton_Click(new object(), new RoutedEventArgs()); ClickThrough = true; } else if (key == hotkeys._3) { toolsWindow.penButton_Click(new object(), new RoutedEventArgs()); ClickThrough = false; } else if (key == hotkeys._4) { toolsWindow.highlighterButton_Click(new object(), new RoutedEventArgs()); ClickThrough = false; } else if (key == hotkeys._5) { toolsWindow.eraserButton_Click(new object(), new RoutedEventArgs()); ClickThrough = false; } else if (key == hotkeys._6) { toolsWindow.eraseAllButton_Click(new object(), new RoutedEventArgs()); } } }
void ComponentDispatcher_ThreadPreprocessMessage(ref MSG msg, ref bool handled) { if (msg.message == WM_HOTKEY && enableHotkeys.Checked) { int D = (((int)msg.lParam >> 16) & 0xFFFF); int F = (((int)msg.lParam >> 16) & 0xFFFF); hotkeys key = (hotkeys)F; ModifierKeys modifier = (ModifierKeys)((int)msg.lParam & 0xFFFF); if (key == hotkeys._1) { toolsWindow.hideInkCheckBox.IsChecked = !toolsWindow.hideInkCheckBox.IsChecked; } else if (key == hotkeys._2) { toolsWindow.cursorButton_Click(new object(), new RoutedEventArgs()); ClickThrough = true; } else if (key == hotkeys._3) { toolsWindow.penButton_Click(new object(), new RoutedEventArgs()); ClickThrough = false; } else if (key == hotkeys._4) { toolsWindow.highlighterButton_Click(new object(), new RoutedEventArgs()); ClickThrough = false; } else if (key == hotkeys._5) { toolsWindow.eraserButton_Click(new object(), new RoutedEventArgs()); ClickThrough = false; } else if (key == hotkeys._6) { toolsWindow.eraseAllButton_Click(new object(), new RoutedEventArgs()); } else if (key == hotkeys._R) { Border border = new Border(); border.Background = Brushes.Red; toolsWindow.Border_MouseDown(border, new MouseButtonEventArgs(InputManager.Current.PrimaryMouseDevice, TimeStamp.Current, MouseButton.Left)); } else if (key == hotkeys._G) { Border border = new Border(); border.Background = Brushes.Green; toolsWindow.Border_MouseDown(border, new MouseButtonEventArgs(InputManager.Current.PrimaryMouseDevice, TimeStamp.Current, MouseButton.Left)); } else if (key == hotkeys._B) { Border border = new Border(); border.Background = Brushes.Blue; toolsWindow.Border_MouseDown(border, new MouseButtonEventArgs(InputManager.Current.PrimaryMouseDevice, TimeStamp.Current, MouseButton.Left)); } /* * else if (key == hotkeys._PageUp) * { * toolsWindow.hideInkCheckBox.IsChecked = !toolsWindow.hideInkCheckBox.IsChecked; * ClickThrough = true; * } * else if (key == hotkeys._PageDown) * { * toolsWindow.hideInkCheckBox.IsChecked = !toolsWindow.hideInkCheckBox.IsChecked; * ClickThrough = true; * } * */ } }