/// <summary> /// Sets one DeviceKeys key with a specific color on the bitmap /// </summary> /// <param name="key">DeviceKey to be set</param> /// <param name="color">Color to be used</param> private void SetOneKey(Devices.DeviceKeys key, Color color) { Bitmaping keymaping = Effects.GetBitmappingFromDeviceKey(key); if (keymaping.Equals(new Bitmaping(0, 0, 0, 0)) && key == Devices.DeviceKeys.Peripheral) { peripheral = color; } else { if (keymaping.topleft_y < 0 || keymaping.bottomright_y > Effects.canvas_height || keymaping.topleft_x < 0 || keymaping.bottomright_x > Effects.canvas_width) { Global.logger.LogLine("Coudln't set key color " + key.ToString(), Logging_Level.Warning); return; } else { using (Graphics g = Graphics.FromImage(colormap)) { Rectangle keyarea = new Rectangle(keymaping.topleft_x, keymaping.topleft_y, keymaping.bottomright_x - keymaping.topleft_x, keymaping.bottomright_y - keymaping.topleft_y); g.FillRectangle(new SolidBrush(color), keyarea); needsRender = true; } } } }
public Control_ColorizedKeycapBlank(KeyboardKey key, string image_path) { InitializeComponent(); associatedKey = key.tag; this.Width = key.width; this.Height = key.height; //Keycap adjustments if (string.IsNullOrWhiteSpace(key.image)) { keyBorder.BorderThickness = new Thickness(1.5); } else { keyBorder.BorderThickness = new Thickness(0.0); } keyBorder.IsEnabled = key.enabled; if (!key.enabled) { ToolTipService.SetShowOnDisabled(keyBorder, true); keyBorder.ToolTip = new ToolTip { Content = "Changes to this key are not supported" }; } if (string.IsNullOrWhiteSpace(key.image)) { keyCap.Text = key.visualName; keyCap.Tag = key.tag; keyCap.FontSize = key.font_size; } else { keyCap.Visibility = System.Windows.Visibility.Hidden; if (System.IO.File.Exists(image_path)) { var memStream = new System.IO.MemoryStream(System.IO.File.ReadAllBytes(image_path)); BitmapImage image = new BitmapImage(); image.BeginInit(); image.StreamSource = memStream; image.EndInit(); if (key.tag == DeviceKeys.NONE) { keyBorder.Background = new ImageBrush(image); } else { keyBorder.Background = new SolidColorBrush(System.Windows.Media.Color.FromArgb(255, 0, 0, 0)); keyBorder.OpacityMask = new ImageBrush(image); } isImage = true; } } }
/// <summary> /// Draws a percent effect on the layer bitmap using DeviceKeys keys and a ColorSpectrum. /// </summary> /// <param name="spectrum">The ColorSpectrum to be used as a "Progress bar"</param> /// <param name="keys">The array of keys that the percent effect will be drawn on</param> /// <param name="value">The current progress value</param> /// <param name="total">The maxiumum progress value</param> /// <param name="percentEffectType">The percent effect type</param> /// <returns>Itself</returns> public EffectLayer PercentEffect(ColorSpectrum spectrum, Devices.DeviceKeys[] keys, double value, double total, PercentEffectType percentEffectType = PercentEffectType.Progressive, double flash_past = 0.0, bool flash_reversed = false) { double progress_total = value / total; if (progress_total < 0.0) { progress_total = 0.0; } else if (progress_total > 1.0) { progress_total = 1.0; } double progress = progress_total * keys.Count(); double flash_amount = 1.0; if (flash_past > 0.0) { if ((flash_reversed && progress_total >= flash_past) || (!flash_reversed && progress_total <= flash_past)) { flash_amount = Math.Sin((Utils.Time.GetMillisecondsSinceEpoch() % 1000.0D) / 1000.0D * Math.PI); } } for (int i = 0; i < keys.Count(); i++) { Devices.DeviceKeys current_key = keys[i]; switch (percentEffectType) { case (PercentEffectType.AllAtOnce): SetOneKey(current_key, spectrum.GetColorAt((float)progress_total, 1.0f, flash_amount)); break; case (PercentEffectType.Progressive_Gradual): if (i == (int)progress) { double percent = (double)progress - i; SetOneKey(current_key, Utils.ColorUtils.MultiplyColorByScalar(spectrum.GetColorAt((float)i / (float)(keys.Count() - 1), 1.0f, flash_amount), percent) ); } else if (i < (int)progress) { SetOneKey(current_key, spectrum.GetColorAt((float)i / (float)(keys.Count() - 1), 1.0f, flash_amount)); } break; default: if (i < (int)progress) { SetOneKey(current_key, spectrum.GetColorAt((float)i / (float)(keys.Count() - 1), 1.0f, flash_amount)); } break; } } return(this); }
/// <summary> /// Retrieves a color of the specified DeviceKeys key from the bitmap /// </summary> /// <param name="key">Key</param> /// <returns>Color of the Key</returns> public Color Get(Devices.DeviceKeys key) { try { BitmapRectangle keymaping = Effects.GetBitmappingFromDeviceKey(key); if (keymaping.IsEmpty && key == Devices.DeviceKeys.Peripheral) { return(peripheral); } else { if (keymaping.IsEmpty) { return(Color.FromArgb(0, 0, 0)); } return(Utils.BitmapUtils.GetRegionColor(colormap, keymaping.Rectangle)); } } catch (Exception exc) { Global.logger.LogLine("EffectLayer.Get() Exception: " + exc, Logging_Level.Error); return(Color.FromArgb(0, 0, 0)); } }
public KeyEffect(Devices.DeviceKeys key, Color color, long duration, long interval) { this.key = key; this.color = color; this.duration = duration; this.interval = interval; this.timeStarted = Utils.Time.GetMillisecondsSinceEpoch(); }
public input_item(Devices.DeviceKeys key, float progress, AnimationMix animation) { this.key = key; this.progress = progress; this.animation = animation; type = input_type.AnimationMix; }
public input_item(Devices.DeviceKeys key, float progress, ColorSpectrum spectrum) { this.key = key; this.progress = progress; this.spectrum = spectrum; type = input_type.Spectrum; }
private void SetExtraKey(Devices.DeviceKeys key, Color color) { if (!extra_keys.ContainsKey(key)) { extra_keys.Add(key, color); } else { extra_keys[key] = color; } }
private Color GetOneKey(Devices.DeviceKeys key) { Color ret = Color.Black; if (keyColors.ContainsKey(key)) { ret = keyColors[key]; } return(ret); }
/// <summary> /// Draws a percent effect on the layer bitmap using an array of DeviceKeys keys and solid colors. /// </summary> /// <param name="foregroundColor">The foreground color, used as a "Progress bar color"</param> /// <param name="backgroundColor">The background color</param> /// <param name="keys">The array of keys that the percent effect will be drawn on</param> /// <param name="value">The current progress value</param> /// <param name="total">The maxiumum progress value</param> /// <param name="percentEffectType">The percent effect type</param> public void PercentEffect(Color foregroundColor, Color backgroundColor, Devices.DeviceKeys[] keys, double value, double total, PercentEffectType percentEffectType = PercentEffectType.Progressive) { double progress_total = value / total; if (progress_total < 0.0) { progress_total = 0.0; } else if (progress_total > 1.0) { progress_total = 1.0; } double progress = progress_total * keys.Count(); for (int i = 0; i < keys.Count(); i++) { Devices.DeviceKeys current_key = keys[i]; switch (percentEffectType) { case (PercentEffectType.AllAtOnce): SetOneKey(current_key, Utils.ColorUtils.BlendColors(backgroundColor, foregroundColor, progress_total)); break; case (PercentEffectType.Progressive_Gradual): if (i == (int)progress) { double percent = (double)progress - i; SetOneKey(current_key, Utils.ColorUtils.BlendColors(backgroundColor, foregroundColor, percent)); } else if (i < (int)progress) { SetOneKey(current_key, foregroundColor); } else { SetOneKey(current_key, backgroundColor); } break; default: if (i < (int)progress) { SetOneKey(current_key, foregroundColor); } else { SetOneKey(current_key, backgroundColor); } break; } } }
public KeyboardKey(String text, Devices.DeviceKeys tag, bool linebreak = false, double fontsize = 12, double margin_left = 7, double margin_top = 0, double width = 30, double height = 30) { this.visualName = text; this.tag = tag; this.line_break = linebreak; this.width = width; this.height = height; this.font_size = fontsize; this.margin_left = margin_left; this.margin_top = margin_top; }
public KeyboardKey(String text, Devices.DeviceKeys tag, bool enabled = true, bool linebreak = false, double fontsize = 12, double margin_left = 7, double margin_top = 0, double width = 30, double height = 30) { this.visualName = text; this.tag = tag; this.line_break = linebreak; this.width = width; this.height = height; this.font_size = fontsize; this.margin_left = margin_left; this.margin_top = margin_top; this.enabled = enabled; }
private void virtualkeyboard_key_selected(Devices.DeviceKeys key) { if (key != DeviceKeys.NONE) { if (Global.key_recorder.HasRecorded(key)) { Global.key_recorder.RemoveKey(key); } else { Global.key_recorder.AddKey(key); } } }
/// <summary> /// Draws a percent effect on the layer bitmap using DeviceKeys keys and a ColorSpectrum. /// </summary> /// <param name="spectrum">The ColorSpectrum to be used as a "Progress bar"</param> /// <param name="keys">The array of keys that the percent effect will be drawn on</param> /// <param name="value">The current progress value</param> /// <param name="total">The maxiumum progress value</param> /// <param name="percentEffectType">The percent effect type</param> public void PercentEffect(ColorSpectrum spectrum, Devices.DeviceKeys[] keys, double value, double total, PercentEffectType percentEffectType = PercentEffectType.Progressive) { double progress_total = value / total; if (progress_total < 0.0) { progress_total = 0.0; } else if (progress_total > 1.0) { progress_total = 1.0; } double progress = progress_total * keys.Count(); for (int i = 0; i < keys.Count(); i++) { Devices.DeviceKeys current_key = keys[i]; switch (percentEffectType) { case (PercentEffectType.AllAtOnce): SetOneKey(current_key, spectrum.GetColorAt((float)progress_total)); break; case (PercentEffectType.Progressive_Gradual): if (i == (int)progress) { double percent = (double)progress - i; SetOneKey(current_key, Utils.ColorUtils.MultiplyColorByScalar(spectrum.GetColorAt((float)i / (float)keys.Count()), percent)); } else if (i < (int)progress) { SetOneKey(current_key, spectrum.GetColorAt((float)i / (float)keys.Count())); } break; default: if (i < (int)progress) { SetOneKey(current_key, spectrum.GetColorAt((float)i / (float)keys.Count())); } break; } } }
private void GlobalHookMouseClick(object sender, MouseEventArgs e) { if (!(Global.Configuration.desktop_profile.Settings as DesktopSettings).interactive_effects_mouse_clicking) { return; } Devices.DeviceKeys device_key = Devices.DeviceKeys.Peripheral; if (device_key != Devices.DeviceKeys.NONE && (Global.Configuration.desktop_profile.Settings as DesktopSettings).interactive_effects_enabled) { EffectPoint pt = Effects.GetBitmappingFromDeviceKey(device_key).GetCenter(); if (pt != new EffectPoint(0, 0)) { input_list.Add(CreateInputItem(device_key, pt)); } } }
public override EffectLayer Render(IGameState state) { EffectLayer abilities_layer = new EffectLayer("Dota 2 - Abilities"); if (state is GameState_Dota2) { GameState_Dota2 dota2state = state as GameState_Dota2; if (Properties.AbilityKeys.Count >= 6) { for (int index = 0; index < dota2state.Abilities.Count; index++) { Ability ability = dota2state.Abilities[index]; if (ability.Name.Contains("seasonal") || ability.Name.Contains("high_five")) { continue; } Devices.DeviceKeys key = Properties.AbilityKeys[index]; if (ability.IsUltimate) { key = Properties.AbilityKeys[5]; } if (ability.CanCast && ability.Cooldown == 0 && ability.Level > 0) { abilities_layer.Set(key, Properties.CanCastAbilityColor); } else if (ability.Cooldown <= 5 && ability.Level > 0) { abilities_layer.Set(key, Utils.ColorUtils.BlendColors(Properties.CanCastAbilityColor, Properties.CanNotCastAbilityColor, (double)ability.Cooldown / 5.0)); } else { abilities_layer.Set(key, Properties.CanNotCastAbilityColor); } } } } return(abilities_layer); }
private void InputEventsKeyDown(object sender, KeyboardInputEventArgs e) { if (Utils.Time.GetMillisecondsSinceEpoch() - previoustime > 1000L) { return; //This event wasn't used for at least 1 second } if (previous_key == e.Key) { return; } long?currentTime = null; Devices.DeviceKeys device_key = e.GetDeviceKey(); lock (TimeOfLastPress) { if (TimeOfLastPress.ContainsKey(device_key)) { if ((currentTime = Utils.Time.GetMillisecondsSinceEpoch()) - TimeOfLastPress[device_key] < pressBuffer) { return; } else { TimeOfLastPress.Remove(device_key); } } } if (device_key != Devices.DeviceKeys.NONE && !Properties.Sequence.keys.Contains(device_key)) { PointF pt = Effects.GetBitmappingFromDeviceKey(device_key).Center; if (pt != new PointF(0, 0)) { lock (TimeOfLastPress) TimeOfLastPress.Add(device_key, currentTime ?? Utils.Time.GetMillisecondsSinceEpoch()); _input_list.Add(CreateInputItem(device_key, pt)); previous_key = e.Key; } } }
/// <summary> /// Sets one DeviceKeys key with a specific color on the bitmap /// </summary> /// <param name="key">DeviceKey to be set</param> /// <param name="color">Color to be used</param> /// <returns>Itself</returns> private EffectLayer SetOneKey(Devices.DeviceKeys key, Color color) { BitmapRectangle keymaping = Effects.GetBitmappingFromDeviceKey(key); if (key == Devices.DeviceKeys.Peripheral) { peripheral = color; using (Graphics g = Graphics.FromImage(colormap)) { foreach (Devices.DeviceKeys peri_key in possible_peripheral_keys) { BitmapRectangle peri_keymaping = Effects.GetBitmappingFromDeviceKey(peri_key); if (peri_keymaping.IsValid) { g.FillRectangle(new SolidBrush(color), peri_keymaping.Rectangle); } } needsRender = true; } } else { if (keymaping.Top < 0 || keymaping.Bottom > Effects.canvas_height || keymaping.Left < 0 || keymaping.Right > Effects.canvas_width) { Global.logger.LogLine("Coudln't set key color " + key.ToString(), Logging_Level.Warning); return(this);; } else { using (Graphics g = Graphics.FromImage(colormap)) { g.FillRectangle(new SolidBrush(color), keymaping.Rectangle); needsRender = true; } } } return(this); }
private void Input_subscriptions_KeyDown(object sender, System.Windows.Forms.KeyEventArgs e) { if (Utils.Time.GetMillisecondsSinceEpoch() - previoustime > 1000L) { return; //This event wasn't used for at least 1 second } if (previous_key == e.KeyCode) { return; } Devices.DeviceKeys device_key = Utils.KeyUtils.GetDeviceKey(e.KeyCode); if (device_key != Devices.DeviceKeys.NONE) { PointF pt = Effects.GetBitmappingFromDeviceKey(device_key).Center; if (pt != new PointF(0, 0)) { _input_list.Add(CreateInputItem(device_key, pt)); previous_key = e.KeyCode; } } }
private void InputEventsKeyUp(object sender, KeyboardInputEventArgs e) { if (Utils.Time.GetMillisecondsSinceEpoch() - previoustime > 1000L) { return; //This event wasn't used for at least 1 second } Devices.DeviceKeys deviceKey = e.GetDeviceKey(); if (deviceKey != Devices.DeviceKeys.NONE) { foreach (var input in _input_list.ToArray()) { if (input.waitOnKeyUp && input.key == deviceKey) { input.waitOnKeyUp = false; } } } if (previous_key == e.Key) { previous_key = Keys.None; } }
private void GlobalHookKeyDown(object sender, KeyEventArgs e) { if (Utils.Time.GetMillisecondsSinceEpoch() - previoustime > 1000L) { return; //This event wasn't used for at least 1 second } if (previous_key == e.KeyCode) { return; } Devices.DeviceKeys device_key = Utils.KeyUtils.GetDeviceKey(e.KeyCode); if (device_key != Devices.DeviceKeys.NONE && (Global.Configuration.desktop_profile.Settings as DesktopSettings).interactive_effects_enabled) { EffectPoint pt = Effects.GetBitmappingFromDeviceKey(device_key).GetCenter(); if (pt != new EffectPoint(0, 0)) { input_list.Add(CreateInputItem(device_key, pt)); previous_key = e.KeyCode; } } }
public override void SetGameState(IGameState gamestate) { if (!(gamestate is GameState_Wrapper)) { return; } GameState_Wrapper ngw_state = (gamestate as GameState_Wrapper); if (ngw_state.Sent_Bitmap.Length != 0) { bitmap = ngw_state.Sent_Bitmap; } SetExtraKey(Devices.DeviceKeys.LOGO, ngw_state.Extra_Keys.logo); SetExtraKey(Devices.DeviceKeys.LOGO2, ngw_state.Extra_Keys.badge); SetExtraKey(Devices.DeviceKeys.Peripheral, ngw_state.Extra_Keys.peripheral); SetExtraKey(Devices.DeviceKeys.G1, ngw_state.Extra_Keys.G1); SetExtraKey(Devices.DeviceKeys.G2, ngw_state.Extra_Keys.G2); SetExtraKey(Devices.DeviceKeys.G3, ngw_state.Extra_Keys.G3); SetExtraKey(Devices.DeviceKeys.G4, ngw_state.Extra_Keys.G4); SetExtraKey(Devices.DeviceKeys.G5, ngw_state.Extra_Keys.G5); SetExtraKey(Devices.DeviceKeys.G6, ngw_state.Extra_Keys.G6); SetExtraKey(Devices.DeviceKeys.G7, ngw_state.Extra_Keys.G7); SetExtraKey(Devices.DeviceKeys.G8, ngw_state.Extra_Keys.G8); SetExtraKey(Devices.DeviceKeys.G9, ngw_state.Extra_Keys.G9); SetExtraKey(Devices.DeviceKeys.G10, ngw_state.Extra_Keys.G10); SetExtraKey(Devices.DeviceKeys.G11, ngw_state.Extra_Keys.G11); SetExtraKey(Devices.DeviceKeys.G12, ngw_state.Extra_Keys.G12); SetExtraKey(Devices.DeviceKeys.G13, ngw_state.Extra_Keys.G13); SetExtraKey(Devices.DeviceKeys.G14, ngw_state.Extra_Keys.G14); SetExtraKey(Devices.DeviceKeys.G15, ngw_state.Extra_Keys.G15); SetExtraKey(Devices.DeviceKeys.G16, ngw_state.Extra_Keys.G16); SetExtraKey(Devices.DeviceKeys.G17, ngw_state.Extra_Keys.G17); SetExtraKey(Devices.DeviceKeys.G18, ngw_state.Extra_Keys.G18); SetExtraKey(Devices.DeviceKeys.G19, ngw_state.Extra_Keys.G19); SetExtraKey(Devices.DeviceKeys.G20, ngw_state.Extra_Keys.G20); if (ngw_state.Command.Equals("SetLighting")) { Color newfill = Color.FromArgb(ngw_state.Command_Data.red_start, ngw_state.Command_Data.green_start, ngw_state.Command_Data.blue_start); if (!last_fill_color.Equals(newfill)) { last_fill_color = newfill; for (int i = 0; i < bitmap.Length; i++) { bitmap[i] = (int)(((int)ngw_state.Command_Data.red_start << 16) | ((int)ngw_state.Command_Data.green_start << 8) | ((int)ngw_state.Command_Data.blue_start)); } } } else if (ngw_state.Command.Equals("SetLightingForKeyWithKeyName") || ngw_state.Command.Equals("SetLightingForKeyWithScanCode")) { var bitmap_key = Devices.Logitech.LogitechDevice.ToLogitechBitmap((LedCSharp.keyboardNames)(ngw_state.Command_Data.key)); if (bitmap_key != Devices.Logitech.Logitech_keyboardBitmapKeys.UNKNOWN) { bitmap[(int)bitmap_key / 4] = (int)(((int)ngw_state.Command_Data.red_start << 16) | ((int)ngw_state.Command_Data.green_start << 8) | ((int)ngw_state.Command_Data.blue_start)); } } else if (ngw_state.Command.Equals("FlashSingleKey")) { Devices.DeviceKeys dev_key = Devices.Logitech.LogitechDevice.ToDeviceKey((LedCSharp.keyboardNames)(ngw_state.Command_Data.key)); LogiFlashSingleKey neweffect = new LogiFlashSingleKey(dev_key, Color.FromArgb(ngw_state.Command_Data.red_start, ngw_state.Command_Data.green_start, ngw_state.Command_Data.blue_start), ngw_state.Command_Data.duration, ngw_state.Command_Data.interval ); if (key_effects.ContainsKey(dev_key)) { key_effects[dev_key] = neweffect; } else { key_effects.Add(dev_key, neweffect); } } else if (ngw_state.Command.Equals("PulseSingleKey")) { Devices.DeviceKeys dev_key = Devices.Logitech.LogitechDevice.ToDeviceKey((LedCSharp.keyboardNames)(ngw_state.Command_Data.key)); long duration = ngw_state.Command_Data.interval == 0 ? 0 : ngw_state.Command_Data.duration; LogiPulseSingleKey neweffect = new LogiPulseSingleKey(dev_key, Color.FromArgb(ngw_state.Command_Data.red_start, ngw_state.Command_Data.green_start, ngw_state.Command_Data.blue_start), Color.FromArgb(ngw_state.Command_Data.red_end, ngw_state.Command_Data.green_end, ngw_state.Command_Data.blue_end), duration ); if (key_effects.ContainsKey(dev_key)) { key_effects[dev_key] = neweffect; } else { key_effects.Add(dev_key, neweffect); } } else if (ngw_state.Command.Equals("PulseLighting")) { current_effect = new LogiPulseLighting( Color.FromArgb(ngw_state.Command_Data.red_start, ngw_state.Command_Data.green_start, ngw_state.Command_Data.blue_start), ngw_state.Command_Data.duration, ngw_state.Command_Data.interval ); } else if (ngw_state.Command.Equals("FlashLighting")) { current_effect = new LogiFlashLighting( Color.FromArgb(ngw_state.Command_Data.red_start, ngw_state.Command_Data.green_start, ngw_state.Command_Data.blue_start), ngw_state.Command_Data.duration, ngw_state.Command_Data.interval ); } else if (ngw_state.Command.Equals("StopEffects")) { key_effects.Clear(); current_effect = null; } else if (ngw_state.Command.Equals("SetLightingFromBitmap")) { } //LightFX else if (ngw_state.Command.Equals("LFX_GetNumDevices")) { //Retain previous lighting int fill_color_int = Utils.ColorUtils.GetIntFromColor(last_fill_color); for (int i = 0; i < bitmap.Length; i++) { bitmap[i] = fill_color_int; } foreach (var extra_key in extra_keys.Keys.ToArray()) { extra_keys[extra_key] = last_fill_color; } } else if (ngw_state.Command.Equals("LFX_Light")) { //Retain previous lighting int fill_color_int = Utils.ColorUtils.GetIntFromColor(last_fill_color); for (int i = 0; i < bitmap.Length; i++) { bitmap[i] = fill_color_int; } foreach (var extra_key in extra_keys.Keys.ToArray()) { extra_keys[extra_key] = last_fill_color; } } else if (ngw_state.Command.Equals("LFX_SetLightColor")) { //Retain previous lighting int fill_color_int = Utils.ColorUtils.GetIntFromColor(last_fill_color); for (int i = 0; i < bitmap.Length; i++) { bitmap[i] = fill_color_int; } foreach (var extra_key in extra_keys.Keys.ToArray()) { extra_keys[extra_key] = last_fill_color; } } else if (ngw_state.Command.Equals("LFX_Update")) { Color newfill = Color.FromArgb(ngw_state.Command_Data.red_start, ngw_state.Command_Data.green_start, ngw_state.Command_Data.blue_start); if (!last_fill_color.Equals(newfill)) { last_fill_color = newfill; for (int i = 0; i < bitmap.Length; i++) { bitmap[i] = (int)(((int)ngw_state.Command_Data.red_start << 16) | ((int)ngw_state.Command_Data.green_start << 8) | ((int)ngw_state.Command_Data.blue_start)); } } foreach (var extra_key in extra_keys.Keys.ToArray()) { extra_keys[extra_key] = newfill; } } else if (ngw_state.Command.Equals("LFX_SetLightActionColor") || ngw_state.Command.Equals("LFX_ActionColor")) { Color primary = Color.Transparent; Color secondary = Color.FromArgb(ngw_state.Command_Data.red_start, ngw_state.Command_Data.green_start, ngw_state.Command_Data.blue_start); if (current_effect != null) { primary = current_effect.GetCurrentColor(Utils.Time.GetMillisecondsSinceEpoch() - current_effect.timeStarted); } switch (ngw_state.Command_Data.effect_type) { case "LFX_ACTION_COLOR": current_effect = new LFX_Color(primary); break; case "LFX_ACTION_PULSE": current_effect = new LFX_Pulse(primary, secondary, ngw_state.Command_Data.duration); break; case "LFX_ACTION_MORPH": current_effect = new LFX_Morph(primary, secondary, ngw_state.Command_Data.duration); break; default: current_effect = null; break; } } else if (ngw_state.Command.Equals("LFX_SetLightActionColorEx") || ngw_state.Command.Equals("LFX_ActionColorEx")) { Color primary = Color.FromArgb(ngw_state.Command_Data.red_start, ngw_state.Command_Data.green_start, ngw_state.Command_Data.blue_start); Color secondary = Color.FromArgb(ngw_state.Command_Data.red_end, ngw_state.Command_Data.green_end, ngw_state.Command_Data.blue_end); switch (ngw_state.Command_Data.effect_type) { case "LFX_ACTION_COLOR": current_effect = new LFX_Color(primary); break; case "LFX_ACTION_PULSE": current_effect = new LFX_Pulse(primary, secondary, ngw_state.Command_Data.duration); break; case "LFX_ACTION_MORPH": current_effect = new LFX_Morph(primary, secondary, ngw_state.Command_Data.duration); break; default: current_effect = null; break; } } else if (ngw_state.Command.Equals("LFX_Reset")) { current_effect = null; } //Razer else if (ngw_state.Command.Equals("CreateMouseEffect")) { } else if (ngw_state.Command.Equals("CreateKeyboardEffect")) { Color primary = Color.Red; Color secondary = Color.Blue; if (ngw_state.Command_Data.red_start >= 0 && ngw_state.Command_Data.green_start >= 0 && ngw_state.Command_Data.blue_start >= 0 ) { primary = Color.FromArgb(ngw_state.Command_Data.red_start, ngw_state.Command_Data.green_start, ngw_state.Command_Data.blue_start); } if (ngw_state.Command_Data.red_end >= 0 && ngw_state.Command_Data.green_end >= 0 && ngw_state.Command_Data.blue_end >= 0 ) { secondary = Color.FromArgb(ngw_state.Command_Data.red_end, ngw_state.Command_Data.green_end, ngw_state.Command_Data.blue_end); } switch (ngw_state.Command_Data.effect_type) { case "CHROMA_BREATHING": current_effect = new CHROMA_BREATHING(primary, secondary, ngw_state.Command_Data.effect_config); break; default: current_effect = null; break; } } else { Global.logger.Info("Unknown Wrapper Command: " + ngw_state.Command); } }
private input_item CreateInputItem(Devices.DeviceKeys key, EffectPoint origin) { Color primary_c = (Global.Configuration.desktop_profile.Settings as DesktopSettings).interactive_effect_primary_color; Color secondary_c = (Global.Configuration.desktop_profile.Settings as DesktopSettings).interactive_effect_secondary_color; if ((Global.Configuration.desktop_profile.Settings as DesktopSettings).interactive_effects_random_primary_color) { primary_c = Utils.ColorUtils.GenerateRandomColor(primary_c); } if ((Global.Configuration.desktop_profile.Settings as DesktopSettings).interactive_effects_random_secondary_color) { secondary_c = Utils.ColorUtils.GenerateRandomColor(secondary_c); } AnimationMix anim_mix = new AnimationMix(); if ((Global.Configuration.desktop_profile.Settings as DesktopSettings).interactive_effect_type == InteractiveEffects.Wave) { AnimationTrack wave = new AnimationTrack("Wave effect", 1.0f); wave.SetFrame(0.0f, new AnimationCircle(origin.ToPointF(), 0, primary_c, (Global.Configuration.desktop_profile.Settings as DesktopSettings).interactive_effect_width) ); wave.SetFrame(0.80f, new AnimationCircle(origin.ToPointF(), Effects.canvas_width * 0.80f, secondary_c, (Global.Configuration.desktop_profile.Settings as DesktopSettings).interactive_effect_width) ); wave.SetFrame(1.00f, new AnimationCircle(origin.ToPointF(), Effects.canvas_width, Color.FromArgb(0, secondary_c), (Global.Configuration.desktop_profile.Settings as DesktopSettings).interactive_effect_width) ); anim_mix.AddTrack(wave); } else if ((Global.Configuration.desktop_profile.Settings as DesktopSettings).interactive_effect_type == InteractiveEffects.Wave_Filled) { AnimationTrack wave = new AnimationTrack("Filled Wave effect", 1.0f); wave.SetFrame(0.0f, new AnimationFilledCircle(origin.ToPointF(), 0, primary_c, (Global.Configuration.desktop_profile.Settings as DesktopSettings).interactive_effect_width) ); wave.SetFrame(0.80f, new AnimationFilledCircle(origin.ToPointF(), Effects.canvas_width * 0.80f, secondary_c, (Global.Configuration.desktop_profile.Settings as DesktopSettings).interactive_effect_width) ); wave.SetFrame(1.00f, new AnimationFilledCircle(origin.ToPointF(), Effects.canvas_width, Color.FromArgb(0, secondary_c), (Global.Configuration.desktop_profile.Settings as DesktopSettings).interactive_effect_width) ); anim_mix.AddTrack(wave); } else if ((Global.Configuration.desktop_profile.Settings as DesktopSettings).interactive_effect_type == InteractiveEffects.KeyPress) { ColorSpectrum spec = new ColorSpectrum(primary_c, secondary_c); if ((Global.Configuration.desktop_profile.Settings as DesktopSettings).interactive_effect_type == InteractiveEffects.KeyPress) { spec = new ColorSpectrum(primary_c, Color.FromArgb(0, secondary_c)); spec.SetColorAt(0.80f, secondary_c); } return(new input_item(key, 0.0f, spec)); } else if ((Global.Configuration.desktop_profile.Settings as DesktopSettings).interactive_effect_type == InteractiveEffects.ArrowFlow) { PointF starting_pt = origin.ToPointF(); AnimationTrack arrow = new AnimationTrack("Arrow Flow effect", 1.0f); arrow.SetFrame(0.0f, new AnimationLines( new AnimationLine[] { new AnimationLine(starting_pt, starting_pt, primary_c, (Global.Configuration.desktop_profile.Settings as DesktopSettings).interactive_effect_width), new AnimationLine(starting_pt, starting_pt, primary_c, (Global.Configuration.desktop_profile.Settings as DesktopSettings).interactive_effect_width) } ) ); arrow.SetFrame(0.33f, new AnimationLines( new AnimationLine[] { new AnimationLine(starting_pt, new PointF(starting_pt.X + Effects.canvas_width * 0.33f, starting_pt.Y), Utils.ColorUtils.BlendColors(primary_c, secondary_c, 0.33D), (Global.Configuration.desktop_profile.Settings as DesktopSettings).interactive_effect_width), new AnimationLine(starting_pt, new PointF(starting_pt.X - Effects.canvas_width * 0.33f, starting_pt.Y), Utils.ColorUtils.BlendColors(primary_c, secondary_c, 0.33D), (Global.Configuration.desktop_profile.Settings as DesktopSettings).interactive_effect_width) } ) ); arrow.SetFrame(0.66f, new AnimationLines( new AnimationLine[] { new AnimationLine(new PointF(starting_pt.X + Effects.canvas_width * 0.33f, starting_pt.Y), new PointF(starting_pt.X + Effects.canvas_width * 0.66f, starting_pt.Y), secondary_c, (Global.Configuration.desktop_profile.Settings as DesktopSettings).interactive_effect_width), new AnimationLine(new PointF(starting_pt.X - Effects.canvas_width * 0.33f, starting_pt.Y), new PointF(starting_pt.X - Effects.canvas_width * 0.66f, starting_pt.Y), secondary_c, (Global.Configuration.desktop_profile.Settings as DesktopSettings).interactive_effect_width) } ) ); arrow.SetFrame(1.0f, new AnimationLines( new AnimationLine[] { new AnimationLine(new PointF(starting_pt.X + Effects.canvas_width * 0.66f, starting_pt.Y), new PointF(starting_pt.X + Effects.canvas_width, starting_pt.Y), Color.FromArgb(0, secondary_c), (Global.Configuration.desktop_profile.Settings as DesktopSettings).interactive_effect_width), new AnimationLine(new PointF(starting_pt.X - Effects.canvas_width * 0.66f, starting_pt.Y), new PointF(starting_pt.X - Effects.canvas_width, starting_pt.Y), Color.FromArgb(0, secondary_c), (Global.Configuration.desktop_profile.Settings as DesktopSettings).interactive_effect_width) } ) ); anim_mix.AddTrack(arrow); } return(new input_item(key, 0.0f, anim_mix)); }
private input_item CreateInputItem(Devices.DeviceKeys key, PointF origin) { Color primary_c = Properties.RandomPrimaryColor ? Utils.ColorUtils.GenerateRandomColor() : Properties.PrimaryColor; Color secondary_c = Properties.RandomSecondaryColor ? Utils.ColorUtils.GenerateRandomColor() : Properties.SecondaryColor; AnimationMix anim_mix = new AnimationMix(); if (Properties.InteractiveEffect == InteractiveEffects.Wave) { AnimationTrack wave = new AnimationTrack("Wave effect", 1.0f); wave.SetFrame(0.0f, new AnimationCircle(origin, 0, primary_c, Properties.EffectWidth) ); wave.SetFrame(0.80f, new AnimationCircle(origin, Effects.canvas_width * 0.80f, secondary_c, Properties.EffectWidth) ); wave.SetFrame(1.00f, new AnimationCircle(origin, Effects.canvas_width, Color.FromArgb(0, secondary_c), Properties.EffectWidth) ); anim_mix.AddTrack(wave); } else if (Properties.InteractiveEffect == InteractiveEffects.Wave_Rainbow) { float dT = (float)(Math.Sqrt((double)Properties.EffectWidth - 0.7) * Math.Sqrt(12.0)) * 0.0065f; AnimationTrack wave_red = new AnimationTrack("Wave effect (red)", 1.00f - dT * 6); AnimationTrack wave_orange = new AnimationTrack("Wave effect (orange)", 1.00f - dT * 5); AnimationTrack wave_yellow = new AnimationTrack("Wave effect (yellow)", 1.00f - dT * 4); AnimationTrack wave_green = new AnimationTrack("Wave effect (green)", 1.00f - dT * 3); AnimationTrack wave_lightblue = new AnimationTrack("Wave effect (light blue)", 1.00f - dT * 2); AnimationTrack wave_blue = new AnimationTrack("Wave effect (blue)", 1.00f - dT * 1); AnimationTrack wave_purple = new AnimationTrack("Wave effect (purple)", 1.00f); wave_red.SetFrame(0.0f, new AnimationCircle(origin, 0, Color.Red, Properties.EffectWidth) ); wave_red.SetFrame(1.00f - dT * 6, new AnimationCircle(origin, Effects.canvas_width, Color.Red, Properties.EffectWidth) ); wave_orange.SetFrame(0.0f, new AnimationCircle(origin, 0, Color.Orange, Properties.EffectWidth) ); wave_orange.SetFrame(0.0f + dT, new AnimationCircle(origin, 0, Color.Orange, Properties.EffectWidth) ); wave_orange.SetFrame(1.00f - dT * 5, new AnimationCircle(origin, Effects.canvas_width, Color.Orange, Properties.EffectWidth) ); wave_yellow.SetFrame(0.0f, new AnimationCircle(origin, 0, Color.Yellow, Properties.EffectWidth) ); wave_yellow.SetFrame(0.0f + dT * 2, new AnimationCircle(origin, 0, Color.Yellow, Properties.EffectWidth) ); wave_yellow.SetFrame(1.00f - dT * 4, new AnimationCircle(origin, Effects.canvas_width, Color.Yellow, Properties.EffectWidth) ); wave_green.SetFrame(0.0f, new AnimationCircle(origin, 0, Color.Green, Properties.EffectWidth) ); wave_green.SetFrame(0.0f + dT * 3, new AnimationCircle(origin, 0, Color.Green, Properties.EffectWidth) ); wave_green.SetFrame(1.00f - dT * 3, new AnimationCircle(origin, Effects.canvas_width, Color.Green, Properties.EffectWidth) ); wave_lightblue.SetFrame(0.0f, new AnimationCircle(origin, 0, Color.Blue, Properties.EffectWidth) ); wave_lightblue.SetFrame(0.0f + dT * 4, new AnimationCircle(origin, 0, Color.Blue, Properties.EffectWidth) ); wave_lightblue.SetFrame(1.00f - dT * 2, new AnimationCircle(origin, Effects.canvas_width, Color.Blue, Properties.EffectWidth) ); wave_blue.SetFrame(0.0f, new AnimationCircle(origin, 0, Color.DarkBlue, Properties.EffectWidth) ); wave_blue.SetFrame(0.0f + dT * 5, new AnimationCircle(origin, 0, Color.DarkBlue, Properties.EffectWidth) ); wave_blue.SetFrame(1.00f - dT, new AnimationCircle(origin, Effects.canvas_width, Color.DarkBlue, Properties.EffectWidth) ); wave_purple.SetFrame(0.0f, new AnimationCircle(origin, 0, Color.Purple, Properties.EffectWidth) ); wave_purple.SetFrame(0.0f + dT * 6, new AnimationCircle(origin, 0, Color.Purple, Properties.EffectWidth) ); wave_purple.SetFrame(1.00f, new AnimationCircle(origin, Effects.canvas_width, Color.Purple, Properties.EffectWidth) ); anim_mix.AddTrack(wave_red); anim_mix.AddTrack(wave_orange); anim_mix.AddTrack(wave_yellow); anim_mix.AddTrack(wave_green); anim_mix.AddTrack(wave_lightblue); anim_mix.AddTrack(wave_blue); anim_mix.AddTrack(wave_purple); } else if (Properties.InteractiveEffect == InteractiveEffects.Wave_Filled) { AnimationTrack wave = new AnimationTrack("Filled Wave effect", 1.0f); wave.SetFrame(0.0f, new AnimationFilledCircle(origin, 0, primary_c, Properties.EffectWidth) ); wave.SetFrame(0.80f, new AnimationFilledCircle(origin, Effects.canvas_width * 0.80f, secondary_c, Properties.EffectWidth) ); wave.SetFrame(1.00f, new AnimationFilledCircle(origin, Effects.canvas_width, Color.FromArgb(0, secondary_c), Properties.EffectWidth) ); anim_mix.AddTrack(wave); } else if (Properties.InteractiveEffect == InteractiveEffects.KeyPress) { ColorSpectrum spec = new ColorSpectrum(primary_c, secondary_c); spec = new ColorSpectrum(primary_c, Color.FromArgb(0, secondary_c)); spec.SetColorAt(0.80f, secondary_c); return(new input_item(key, 0.0f, spec)); } else if (Properties.InteractiveEffect == InteractiveEffects.ArrowFlow) { AnimationTrack arrow = new AnimationTrack("Arrow Flow effect", 1.0f); arrow.SetFrame(0.0f, new AnimationLines( new AnimationLine[] { new AnimationLine(origin, origin, primary_c, Properties.EffectWidth), new AnimationLine(origin, origin, primary_c, Properties.EffectWidth) } ) ); arrow.SetFrame(0.33f, new AnimationLines( new AnimationLine[] { new AnimationLine(origin, new PointF(origin.X + Effects.canvas_width * 0.33f, origin.Y), Utils.ColorUtils.BlendColors(primary_c, secondary_c, 0.33D), Properties.EffectWidth), new AnimationLine(origin, new PointF(origin.X - Effects.canvas_width * 0.33f, origin.Y), Utils.ColorUtils.BlendColors(primary_c, secondary_c, 0.33D), Properties.EffectWidth) } ) ); arrow.SetFrame(0.66f, new AnimationLines( new AnimationLine[] { new AnimationLine(new PointF(origin.X + Effects.canvas_width * 0.33f, origin.Y), new PointF(origin.X + Effects.canvas_width * 0.66f, origin.Y), secondary_c, Properties.EffectWidth), new AnimationLine(new PointF(origin.X - Effects.canvas_width * 0.33f, origin.Y), new PointF(origin.X - Effects.canvas_width * 0.66f, origin.Y), secondary_c, Properties.EffectWidth) } ) ); arrow.SetFrame(1.0f, new AnimationLines( new AnimationLine[] { new AnimationLine(new PointF(origin.X + Effects.canvas_width * 0.66f, origin.Y), new PointF(origin.X + Effects.canvas_width, origin.Y), Color.FromArgb(0, secondary_c), Properties.EffectWidth), new AnimationLine(new PointF(origin.X - Effects.canvas_width * 0.66f, origin.Y), new PointF(origin.X - Effects.canvas_width, origin.Y), Color.FromArgb(0, secondary_c), Properties.EffectWidth) } ) ); anim_mix.AddTrack(arrow); } return(new input_item(key, 0.0f, anim_mix)); }
private input_item CreateInputItem(Devices.DeviceKeys key, PointF origin) { Color primary_c = Properties.RandomPrimaryColor ? Utils.ColorUtils.GenerateRandomColor() : Properties.PrimaryColor; Color secondary_c = Properties.RandomSecondaryColor ? Utils.ColorUtils.GenerateRandomColor() : Properties.SecondaryColor; AnimationMix anim_mix = new AnimationMix(); if (Properties.InteractiveEffect == InteractiveEffects.Wave) { AnimationTrack wave = new AnimationTrack("Wave effect", 1.0f); wave.SetFrame(0.0f, new AnimationCircle(origin, 0, primary_c, Properties.EffectWidth) ); wave.SetFrame(0.80f, new AnimationCircle(origin, Effects.canvas_width * 0.80f, secondary_c, Properties.EffectWidth) ); wave.SetFrame(1.00f, new AnimationCircle(origin, Effects.canvas_width + (Properties.EffectWidth / 2), Color.FromArgb(0, secondary_c), Properties.EffectWidth) ); anim_mix.AddTrack(wave); } else if (Properties.InteractiveEffect == InteractiveEffects.Wave_Rainbow) { AnimationTrack rainbowWave = new AnimationTrack("Rainbow Wave", 1.0f); rainbowWave.SetFrame(0.0f, new AnimationGradientCircle(origin, 0, new EffectBrush(new ColorSpectrum(ColorSpectrum.Rainbow).Flip()).SetBrushType(EffectBrush.BrushType.Radial), Properties.EffectWidth)); rainbowWave.SetFrame(1.0f, new AnimationGradientCircle(origin, Effects.canvas_width + (Properties.EffectWidth / 2), new EffectBrush(new ColorSpectrum(ColorSpectrum.Rainbow).Flip()).SetBrushType(EffectBrush.BrushType.Radial), Properties.EffectWidth)); anim_mix.AddTrack(rainbowWave); } else if (Properties.InteractiveEffect == InteractiveEffects.Wave_Filled) { AnimationTrack wave = new AnimationTrack("Filled Wave effect", 1.0f); wave.SetFrame(0.0f, new AnimationFilledCircle(origin, 0, primary_c, Properties.EffectWidth) ); wave.SetFrame(0.80f, new AnimationFilledCircle(origin, Effects.canvas_width * 0.80f, secondary_c, Properties.EffectWidth) ); wave.SetFrame(1.00f, new AnimationFilledCircle(origin, Effects.canvas_width + (Properties.EffectWidth / 2), Color.FromArgb(0, secondary_c), Properties.EffectWidth) ); anim_mix.AddTrack(wave); } else if (Properties.InteractiveEffect == InteractiveEffects.KeyPress) { ColorSpectrum spec = new ColorSpectrum(primary_c, secondary_c); spec = new ColorSpectrum(primary_c, Color.FromArgb(0, secondary_c)); spec.SetColorAt(0.80f, secondary_c); return(new input_item(key, 0.0f, Properties.WaitOnKeyUp, spec)); } else if (Properties.InteractiveEffect == InteractiveEffects.ArrowFlow) { AnimationTrack arrow = new AnimationTrack("Arrow Flow effect", 1.0f); arrow.SetFrame(0.0f, new AnimationLines( new AnimationLine[] { new AnimationLine(origin, origin, primary_c, Properties.EffectWidth), new AnimationLine(origin, origin, primary_c, Properties.EffectWidth) } ) ); arrow.SetFrame(0.33f, new AnimationLines( new AnimationLine[] { new AnimationLine(origin, new PointF(origin.X + Effects.canvas_width * 0.33f, origin.Y), Utils.ColorUtils.BlendColors(primary_c, secondary_c, 0.33D), Properties.EffectWidth), new AnimationLine(origin, new PointF(origin.X - Effects.canvas_width * 0.33f, origin.Y), Utils.ColorUtils.BlendColors(primary_c, secondary_c, 0.33D), Properties.EffectWidth) } ) ); arrow.SetFrame(0.66f, new AnimationLines( new AnimationLine[] { new AnimationLine(new PointF(origin.X + Effects.canvas_width * 0.33f, origin.Y), new PointF(origin.X + Effects.canvas_width * 0.66f, origin.Y), secondary_c, Properties.EffectWidth), new AnimationLine(new PointF(origin.X - Effects.canvas_width * 0.33f, origin.Y), new PointF(origin.X - Effects.canvas_width * 0.66f, origin.Y), secondary_c, Properties.EffectWidth) } ) ); arrow.SetFrame(1.0f, new AnimationLines( new AnimationLine[] { new AnimationLine(new PointF(origin.X + Effects.canvas_width * 0.66f, origin.Y), new PointF(origin.X + Effects.canvas_width, origin.Y), Color.FromArgb(0, secondary_c), Properties.EffectWidth), new AnimationLine(new PointF(origin.X - Effects.canvas_width * 0.66f, origin.Y), new PointF(origin.X - Effects.canvas_width, origin.Y), Color.FromArgb(0, secondary_c), Properties.EffectWidth) } ) ); anim_mix.AddTrack(arrow); } return(new input_item(key, 0.0f, Properties.WaitOnKeyUp, anim_mix)); }
public LogiPulseSingleKey(Devices.DeviceKeys key, Color color, Color color_end, long duration) : base(key, color, duration, 1) { this.color_end = color_end; }
public LogiFlashSingleKey(Devices.DeviceKeys key, Color color, long duration, long interval) : base(key, color, duration, interval) { }
public override void UpdateLights(EffectFrame frame) { previoustime = currenttime; currenttime = Utils.Time.GetMillisecondsSinceEpoch(); Queue <EffectLayer> layers = new Queue <EffectLayer>(); EffectLayer layer; effect_cfg.speed = Global.Configuration.idle_speed; switch (Global.Configuration.idle_type) { case IdleEffects.Dim: layer = new EffectLayer("Idle - Dim"); layer.Fill(Color.FromArgb(125, 0, 0, 0)); layers.Enqueue(layer); break; case IdleEffects.ColorBreathing: layer = new EffectLayer("Idle - Color Breathing"); Color breathe_bg_color = Global.Configuration.idle_effect_secondary_color; layer.Fill(breathe_bg_color); float sine = (float)Math.Pow(Math.Sin((double)((currenttime % 10000L) / 10000.0f) * 2 * Math.PI * Global.Configuration.idle_speed), 2); layer.Fill(Color.FromArgb((byte)(sine * 255), Global.Configuration.idle_effect_primary_color)); layers.Enqueue(layer); break; case IdleEffects.RainbowShift_Horizontal: layer = new EffectLayer("Idle - Rainbow Shift (Horizontal)", LayerEffects.RainbowShift_Horizontal, effect_cfg); layers.Enqueue(layer); break; case IdleEffects.RainbowShift_Vertical: layer = new EffectLayer("Idle - Rainbow Shift (Vertical)", LayerEffects.RainbowShift_Vertical, effect_cfg); layers.Enqueue(layer); break; case IdleEffects.StarFall: layer = new EffectLayer("Idle - Starfall"); if (nextstarset < currenttime) { for (int x = 0; x < Global.Configuration.idle_amount; x++) { Devices.DeviceKeys star = allKeys[randomizer.Next(allKeys.Length)]; if (stars.ContainsKey(star)) { stars[star] = 1.0f; } else { stars.Add(star, 1.0f); } } nextstarset = currenttime + (long)(1000L * Global.Configuration.idle_frequency); } layer.Fill(Global.Configuration.idle_effect_secondary_color); Devices.DeviceKeys[] stars_keys = stars.Keys.ToArray(); foreach (Devices.DeviceKeys star in stars_keys) { layer.Set(star, Utils.ColorUtils.MultiplyColorByScalar(Global.Configuration.idle_effect_primary_color, stars[star])); stars[star] -= getDeltaTime() * 0.05f * Global.Configuration.idle_speed; } layers.Enqueue(layer); break; case IdleEffects.RainFall: layer = new EffectLayer("Idle - Rainfall"); if (nextstarset < currenttime) { for (int x = 0; x < Global.Configuration.idle_amount; x++) { Devices.DeviceKeys star = allKeys[randomizer.Next(allKeys.Length)]; if (raindrops.ContainsKey(star)) { raindrops[star] = 1.0f; } else { raindrops.Add(star, 1.0f); } } nextstarset = currenttime + (long)(1000L * Global.Configuration.idle_frequency); } layer.Fill(Global.Configuration.idle_effect_secondary_color); Devices.DeviceKeys[] raindrops_keys = raindrops.Keys.ToArray(); ColorSpectrum drop_spec = new ColorSpectrum(Global.Configuration.idle_effect_primary_color, Color.FromArgb(0, Global.Configuration.idle_effect_primary_color)); foreach (Devices.DeviceKeys raindrop in raindrops_keys) { PointF pt = Effects.GetBitmappingFromDeviceKey(raindrop).Center; float transition_value = 1.0f - raindrops[raindrop]; float radius = transition_value * Effects.canvas_biggest; layer.GetGraphics().DrawEllipse(new Pen(drop_spec.GetColorAt(transition_value), 2), pt.X - radius, pt.Y - radius, 2 * radius, 2 * radius); raindrops[raindrop] -= getDeltaTime() * 0.05f * Global.Configuration.idle_speed; } layers.Enqueue(layer); break; case IdleEffects.Blackout: layer = new EffectLayer("Idle - Blackout"); layer.Fill(Color.Black); layers.Enqueue(layer); break; case IdleEffects.Matrix: layer = new EffectLayer("Idle - Matrix"); if (nextstarset < currenttime) { Color darker_primary = Utils.ColorUtils.MultiplyColorByScalar(Global.Configuration.idle_effect_primary_color, 0.50); for (int x = 0; x < Global.Configuration.idle_amount; x++) { int width_start = randomizer.Next(Effects.canvas_width); float delay = randomizer.Next(550) / 100.0f; int random_id = randomizer.Next(125536789); //Create animation AnimationTrack matrix_line = new AnimationTrack("Matrix Line (Head) " + random_id, 0.0f).SetFrame( 0.0f * 1.0f / (0.05f * Global.Configuration.idle_speed), new AnimationLine(width_start, -3, width_start, 0, Global.Configuration.idle_effect_primary_color, 3)).SetFrame( 0.5f * 1.0f / (0.05f * Global.Configuration.idle_speed), new AnimationLine(width_start, Effects.canvas_height, width_start, Effects.canvas_height + 3, Global.Configuration.idle_effect_primary_color, 3)).SetShift( (currenttime % 1000000L) / 1000.0f + delay ); AnimationTrack matrix_line_trail = new AnimationTrack("Matrix Line (Trail) " + random_id, 0.0f).SetFrame( 0.0f * 1.0f / (0.05f * Global.Configuration.idle_speed), new AnimationLine(width_start, -12, width_start, -3, darker_primary, 3)).SetFrame( 0.5f * 1.0f / (0.05f * Global.Configuration.idle_speed), new AnimationLine(width_start, Effects.canvas_height - 12, width_start, Effects.canvas_height, darker_primary, 3)).SetFrame( 0.75f * 1.0f / (0.05f * Global.Configuration.idle_speed), new AnimationLine(width_start, Effects.canvas_height, width_start, Effects.canvas_height, darker_primary, 3)).SetShift( (currenttime % 1000000L) / 1000.0f + delay ); matrix_lines.AddTrack(matrix_line); matrix_lines.AddTrack(matrix_line_trail); } nextstarset = currenttime + (long)(1000L * Global.Configuration.idle_frequency); } layer.Fill(Global.Configuration.idle_effect_secondary_color); using (Graphics g = layer.GetGraphics()) { matrix_lines.Draw(g, (currenttime % 1000000L) / 1000.0f); } layers.Enqueue(layer); break; default: break; } frame.AddOverlayLayers(layers.ToArray()); }
public override void UpdateLights(EffectFrame frame) { previoustime = currenttime; currenttime = Utils.Time.GetMillisecondsSinceEpoch(); Queue <EffectLayer> layers = new Queue <EffectLayer>(); EffectLayer layer; effect_cfg.speed = Global.Configuration.idle_speed; switch (Global.Configuration.idle_type) { case IdleEffects.Dim: layer = new EffectLayer("Idle - Dim"); layer.Fill(Color.FromArgb(125, 0, 0, 0)); layers.Enqueue(layer); break; case IdleEffects.ColorBreathing: layer = new EffectLayer("Idle - Color Breathing"); Color breathe_bg_color = Global.Configuration.idle_effect_secondary_color; layer.Fill(breathe_bg_color); float sine = (float)Math.Pow(Math.Sin((double)((currenttime % 10000L) / 10000.0f) * 2 * Math.PI * Global.Configuration.idle_speed), 2); layer.Fill(Color.FromArgb((byte)(sine * 255), Global.Configuration.idle_effect_primary_color)); layers.Enqueue(layer); break; case IdleEffects.RainbowShift_Horizontal: layer = new EffectLayer("Idle - Rainbow Shift (Horizontal)", LayerEffects.RainbowShift_Horizontal, effect_cfg); layers.Enqueue(layer); break; case IdleEffects.RainbowShift_Vertical: layer = new EffectLayer("Idle - Rainbow Shift (Vertical)", LayerEffects.RainbowShift_Vertical, effect_cfg); layers.Enqueue(layer); break; case IdleEffects.StarFall: layer = new EffectLayer("Idle - Starfall"); if (nextstarset < currenttime) { for (int x = 0; x < Global.Configuration.idle_amount; x++) { Devices.DeviceKeys star = allKeys[randomizer.Next(allKeys.Length)]; if (stars.ContainsKey(star)) { stars[star] = 1.0f; } else { stars.Add(star, 1.0f); } } nextstarset = currenttime + (long)(1000L * Global.Configuration.idle_frequency); } layer.Fill(Global.Configuration.idle_effect_secondary_color); Devices.DeviceKeys[] stars_keys = stars.Keys.ToArray(); foreach (Devices.DeviceKeys star in stars_keys) { layer.Set(star, Utils.ColorUtils.MultiplyColorByScalar(Global.Configuration.idle_effect_primary_color, stars[star])); stars[star] -= getDeltaTime() * 0.05f * Global.Configuration.idle_speed; } layers.Enqueue(layer); break; case IdleEffects.RainFall: layer = new EffectLayer("Idle - Rainfall"); if (nextstarset < currenttime) { for (int x = 0; x < Global.Configuration.idle_amount; x++) { Devices.DeviceKeys star = allKeys[randomizer.Next(allKeys.Length)]; if (raindrops.ContainsKey(star)) { raindrops[star] = 1.0f; } else { raindrops.Add(star, 1.0f); } } nextstarset = currenttime + (long)(1000L * Global.Configuration.idle_frequency); } layer.Fill(Global.Configuration.idle_effect_secondary_color); Devices.DeviceKeys[] raindrops_keys = raindrops.Keys.ToArray(); ColorSpectrum drop_spec = new ColorSpectrum(Global.Configuration.idle_effect_primary_color, Color.FromArgb(0, Global.Configuration.idle_effect_primary_color)); foreach (Devices.DeviceKeys raindrop in raindrops_keys) { PointF pt = Effects.GetBitmappingFromDeviceKey(raindrop).Center; float transition_value = 1.0f - raindrops[raindrop]; float radius = transition_value * Effects.canvas_biggest; layer.GetGraphics().DrawEllipse(new Pen(drop_spec.GetColorAt(transition_value), 2), pt.X - radius, pt.Y - radius, 2 * radius, 2 * radius); raindrops[raindrop] -= getDeltaTime() * 0.05f * Global.Configuration.idle_speed; } layers.Enqueue(layer); break; case IdleEffects.Blackout: layer = new EffectLayer("Idle - Blackout"); layer.Fill(Color.Black); layers.Enqueue(layer); break; case IdleEffects.Matrix: layer = new EffectLayer("Idle - Matrix"); if (nextstarset < currenttime) { Color darker_primary = Utils.ColorUtils.MultiplyColorByScalar(Global.Configuration.idle_effect_primary_color, 0.50); for (int x = 0; x < Global.Configuration.idle_amount; x++) { int width_start = randomizer.Next(Effects.canvas_width); float delay = randomizer.Next(550) / 100.0f; int random_id = randomizer.Next(125536789); //Create animation AnimationTrack matrix_line = new AnimationTrack("Matrix Line (Head) " + random_id, 0.0f).SetFrame( 0.0f * 1.0f / (0.05f * Global.Configuration.idle_speed), new AnimationLine(width_start, -3, width_start, 0, Global.Configuration.idle_effect_primary_color, 3)).SetFrame( 0.5f * 1.0f / (0.05f * Global.Configuration.idle_speed), new AnimationLine(width_start, Effects.canvas_height, width_start, Effects.canvas_height + 3, Global.Configuration.idle_effect_primary_color, 3)).SetShift( (currenttime % 1000000L) / 1000.0f + delay ); AnimationTrack matrix_line_trail = new AnimationTrack("Matrix Line (Trail) " + random_id, 0.0f).SetFrame( 0.0f * 1.0f / (0.05f * Global.Configuration.idle_speed), new AnimationLine(width_start, -12, width_start, -3, darker_primary, 3)).SetFrame( 0.5f * 1.0f / (0.05f * Global.Configuration.idle_speed), new AnimationLine(width_start, Effects.canvas_height - 12, width_start, Effects.canvas_height, darker_primary, 3)).SetFrame( 0.75f * 1.0f / (0.05f * Global.Configuration.idle_speed), new AnimationLine(width_start, Effects.canvas_height, width_start, Effects.canvas_height, darker_primary, 3)).SetShift( (currenttime % 1000000L) / 1000.0f + delay ); matrix_lines.AddTrack(matrix_line); matrix_lines.AddTrack(matrix_line_trail); } nextstarset = currenttime + (long)(1000L * Global.Configuration.idle_frequency); } layer.Fill(Global.Configuration.idle_effect_secondary_color); using (Graphics g = layer.GetGraphics()) { matrix_lines.Draw(g, (currenttime % 1000000L) / 1000.0f); } layers.Enqueue(layer); break; case IdleEffects.RainFallSmooth: layer = new EffectLayer("Idle - RainfallSmooth"); if (nextstarset < currenttime) { for (int x = 0; x < Global.Configuration.idle_amount; x++) { Devices.DeviceKeys star = allKeys[randomizer.Next(allKeys.Length)]; if (raindrops.ContainsKey(star)) { raindrops[star] = 1.0f; } else { raindrops.Add(star, 1.0f); } } nextstarset = currenttime + (long)(1000L * Global.Configuration.idle_frequency); } layer.Fill(Global.Configuration.idle_effect_secondary_color); ColorSpectrum drop_spec2 = new ColorSpectrum( Global.Configuration.idle_effect_primary_color, Color.FromArgb(0, Global.Configuration.idle_effect_primary_color)); var drops = raindrops.Keys.ToArray().Select(d => { PointF pt = Effects.GetBitmappingFromDeviceKey(d).Center; float transitionValue = 1.0f - raindrops[d]; float radius = transitionValue * Effects.canvas_biggest; raindrops[d] -= getDeltaTime() * 0.05f * Global.Configuration.idle_speed; return(new Tuple <Devices.DeviceKeys, PointF, float, float>(d, pt, transitionValue, radius)); }).Where(d => d.Item3 <= 1.5).ToArray(); float circleHalfThickness = 1f; foreach (var key in allKeys) { var keyInfo = Effects.GetBitmappingFromDeviceKey(key); // For easy calculation every button considered as circle with this radius var btnRadius = ((keyInfo.Width + keyInfo.Height) / 4f); if (btnRadius <= 0) { continue; } foreach (var raindrop in drops) { float circleInEdge = (raindrop.Item4 - circleHalfThickness); float circleOutEdge = (raindrop.Item4 + circleHalfThickness); circleInEdge *= circleInEdge; circleOutEdge *= circleOutEdge; float xKey = Math.Abs(keyInfo.Center.X - raindrop.Item2.X); float yKey = Math.Abs(keyInfo.Center.Y - raindrop.Item2.Y); float xKeyInEdge = xKey - btnRadius; float xKeyOutEdge = xKey + btnRadius; float yKeyInEdge = yKey - btnRadius; float yKeyOutEdge = yKey + btnRadius; float keyInEdge = xKeyInEdge * xKeyInEdge + yKeyInEdge * yKeyInEdge; float keyOutEdge = xKeyOutEdge * xKeyOutEdge + yKeyOutEdge * yKeyOutEdge; var btnDiameter = keyOutEdge - keyInEdge; var inEdgePercent = (circleOutEdge - keyInEdge) / btnDiameter; var outEdgePercent = (keyOutEdge - circleInEdge) / btnDiameter; var percent = Math.Min(1, Math.Max(0, inEdgePercent)) + Math.Min(1, Math.Max(0, outEdgePercent)) - 1f; if (percent > 0) { layer.Set(key, (Color)EffectColor.BlendColors( new EffectColor(layer.Get(key)), new EffectColor(drop_spec2.GetColorAt(raindrop.Item3)), percent)); } } } layers.Enqueue(layer); break; default: break; } frame.AddOverlayLayers(layers.ToArray()); }
internal virtual void UpdateWrapperLights(IGameState new_game_state) { if (new_game_state is GameState_Wrapper) { _game_state = new_game_state; GameState_Wrapper ngw_state = (new_game_state as GameState_Wrapper); bitmap = ngw_state.Sent_Bitmap; logo = ngw_state.Extra_Keys.logo; g1 = ngw_state.Extra_Keys.G1; g2 = ngw_state.Extra_Keys.G2; g3 = ngw_state.Extra_Keys.G3; g4 = ngw_state.Extra_Keys.G4; g5 = ngw_state.Extra_Keys.G5; peripheral = ngw_state.Extra_Keys.peripheral; if (ngw_state.Command.Equals("SetLighting")) { Color newfill = Color.FromArgb(ngw_state.Command_Data.red_start, ngw_state.Command_Data.green_start, ngw_state.Command_Data.blue_start); if (!last_fill_color.Equals(newfill)) { last_fill_color = newfill; for (int i = 0; i < bitmap.Length; i += 4) { bitmap[i] = (byte)ngw_state.Command_Data.blue_start; bitmap[i + 1] = (byte)ngw_state.Command_Data.green_start; bitmap[i + 2] = (byte)ngw_state.Command_Data.red_start; bitmap[i + 3] = (byte)255; } } } else if (ngw_state.Command.Equals("SetLightingForKeyWithKeyName") || ngw_state.Command.Equals("SetLightingForKeyWithScanCode")) { var bitmap_key = Devices.Logitech.LogitechDevice.ToLogitechBitmap((LedCSharp.keyboardNames)(ngw_state.Command_Data.key)); if (bitmap_key != Devices.Logitech.Logitech_keyboardBitmapKeys.UNKNOWN) { bitmap[(int)bitmap_key] = (byte)ngw_state.Command_Data.blue_start; bitmap[(int)bitmap_key + 1] = (byte)ngw_state.Command_Data.green_start; bitmap[(int)bitmap_key + 2] = (byte)ngw_state.Command_Data.red_start; bitmap[(int)bitmap_key + 3] = (byte)255; } } else if (ngw_state.Command.Equals("FlashSingleKey")) { Devices.DeviceKeys dev_key = Devices.Logitech.LogitechDevice.ToDeviceKey((LedCSharp.keyboardNames)(ngw_state.Command_Data.key)); LogiFlashSingleKey neweffect = new LogiFlashSingleKey(dev_key, Color.FromArgb(ngw_state.Command_Data.red_start, ngw_state.Command_Data.green_start, ngw_state.Command_Data.blue_start), ngw_state.Command_Data.duration, ngw_state.Command_Data.interval ); if (key_effects.ContainsKey(dev_key)) { key_effects[dev_key] = neweffect; } else { key_effects.Add(dev_key, neweffect); } } else if (ngw_state.Command.Equals("PulseSingleKey")) { Devices.DeviceKeys dev_key = Devices.Logitech.LogitechDevice.ToDeviceKey((LedCSharp.keyboardNames)(ngw_state.Command_Data.key)); long duration = ngw_state.Command_Data.interval == 0 ? 0 : ngw_state.Command_Data.duration; LogiPulseSingleKey neweffect = new LogiPulseSingleKey(dev_key, Color.FromArgb(ngw_state.Command_Data.red_start, ngw_state.Command_Data.green_start, ngw_state.Command_Data.blue_start), Color.FromArgb(ngw_state.Command_Data.red_end, ngw_state.Command_Data.green_end, ngw_state.Command_Data.blue_end), duration ); if (key_effects.ContainsKey(dev_key)) { key_effects[dev_key] = neweffect; } else { key_effects.Add(dev_key, neweffect); } } else if (ngw_state.Command.Equals("PulseLighting")) { current_effect = new LogiPulseLighting( Color.FromArgb(ngw_state.Command_Data.red_start, ngw_state.Command_Data.green_start, ngw_state.Command_Data.blue_start), ngw_state.Command_Data.duration, ngw_state.Command_Data.interval ); } else if (ngw_state.Command.Equals("FlashLighting")) { current_effect = new LogiFlashLighting( Color.FromArgb(ngw_state.Command_Data.red_start, ngw_state.Command_Data.green_start, ngw_state.Command_Data.blue_start), ngw_state.Command_Data.duration, ngw_state.Command_Data.interval ); } else if (ngw_state.Command.Equals("StopEffects")) { key_effects.Clear(); current_effect = null; } else if (ngw_state.Command.Equals("SetLightingFromBitmap")) { } //LightFX else if (ngw_state.Command.Equals("LFX_GetNumDevices")) { } else if (ngw_state.Command.Equals("LFX_Light")) { } else if (ngw_state.Command.Equals("LFX_SetLightColor")) { } else if (ngw_state.Command.Equals("LFX_Update")) { Color newfill = Color.FromArgb(ngw_state.Command_Data.red_start, ngw_state.Command_Data.green_start, ngw_state.Command_Data.blue_start); if (!last_fill_color.Equals(newfill)) { last_fill_color = newfill; for (int i = 0; i < bitmap.Length; i++) { bitmap[i] = (int)(((int)ngw_state.Command_Data.red_start << 16) | ((int)ngw_state.Command_Data.green_start << 8) | ((int)ngw_state.Command_Data.blue_start)); } logo = Color.FromArgb(ngw_state.Command_Data.red_start, ngw_state.Command_Data.green_start, ngw_state.Command_Data.blue_start); peripheral = Color.FromArgb(ngw_state.Command_Data.red_start, ngw_state.Command_Data.green_start, ngw_state.Command_Data.blue_start); } } else if (ngw_state.Command.Equals("LFX_SetLightActionColor") || ngw_state.Command.Equals("LFX_ActionColor")) { Color primary = Color.Transparent; Color secondary = Color.FromArgb(ngw_state.Command_Data.red_start, ngw_state.Command_Data.green_start, ngw_state.Command_Data.blue_start); if (current_effect != null) { primary = current_effect.GetCurrentColor(Utils.Time.GetMillisecondsSinceEpoch() - current_effect.timeStarted); } switch (ngw_state.Command_Data.effect_type) { case "LFX_ACTION_COLOR": current_effect = new LFX_Color(primary); break; case "LFX_ACTION_PULSE": current_effect = new LFX_Pulse(primary, secondary, ngw_state.Command_Data.duration); break; case "LFX_ACTION_MORPH": current_effect = new LFX_Morph(primary, secondary, ngw_state.Command_Data.duration); break; default: current_effect = null; break; } } else if (ngw_state.Command.Equals("LFX_SetLightActionColorEx") || ngw_state.Command.Equals("LFX_ActionColorEx")) { Color primary = Color.FromArgb(ngw_state.Command_Data.red_start, ngw_state.Command_Data.green_start, ngw_state.Command_Data.blue_start); Color secondary = Color.FromArgb(ngw_state.Command_Data.red_end, ngw_state.Command_Data.green_end, ngw_state.Command_Data.blue_end); switch (ngw_state.Command_Data.effect_type) { case "LFX_ACTION_COLOR": current_effect = new LFX_Color(primary); break; case "LFX_ACTION_PULSE": current_effect = new LFX_Pulse(primary, secondary, ngw_state.Command_Data.duration); break; case "LFX_ACTION_MORPH": current_effect = new LFX_Morph(primary, secondary, ngw_state.Command_Data.duration); break; default: current_effect = null; break; } } else if (ngw_state.Command.Equals("LFX_Reset")) { current_effect = null; } //Razer else if (ngw_state.Command.Equals("CreateMouseEffect")) { } else if (ngw_state.Command.Equals("CreateKeyboardEffect")) { Color primary = Color.Red; Color secondary = Color.Blue; if (ngw_state.Command_Data.red_start >= 0 && ngw_state.Command_Data.green_start >= 0 && ngw_state.Command_Data.blue_start >= 0 ) { primary = Color.FromArgb(ngw_state.Command_Data.red_start, ngw_state.Command_Data.green_start, ngw_state.Command_Data.blue_start); } if (ngw_state.Command_Data.red_end >= 0 && ngw_state.Command_Data.green_end >= 0 && ngw_state.Command_Data.blue_end >= 0 ) { secondary = Color.FromArgb(ngw_state.Command_Data.red_end, ngw_state.Command_Data.green_end, ngw_state.Command_Data.blue_end); } switch (ngw_state.Command_Data.effect_type) { case "CHROMA_BREATHING": current_effect = new CHROMA_BREATHING(primary, secondary, ngw_state.Command_Data.effect_config); break; default: current_effect = null; break; } } else { Global.logger.LogLine("Unknown Wrapper Command: " + ngw_state.Command, Logging_Level.Info, false); } } }
/// <summary> /// Converts Devices.DeviceKeys to Forms.Keys /// </summary> /// <param name="deviceKeys">The Forms.Key to be converted</param> /// <returns>The resulting Devices.DeviceKeys</returns> public static Keys GetFormsKey(Devices.DeviceKeys deviceKeys) { switch (deviceKeys) { case (DeviceKeys.ESC): return(Keys.Escape); case (DeviceKeys.BACKSPACE): return(Keys.Back); case (DeviceKeys.TAB): return(Keys.Tab); case (DeviceKeys.NUM_ENTER): return(Keys.Enter); case (DeviceKeys.ENTER): return(Keys.Enter); case (DeviceKeys.LEFT_SHIFT): return(Keys.LShiftKey); case (DeviceKeys.LEFT_CONTROL): return(Keys.LControlKey); case (DeviceKeys.LEFT_ALT): return(Keys.LMenu); case (DeviceKeys.JPN_MUHENKAN): return(Keys.IMENonconvert); case (DeviceKeys.JPN_HENKAN): return(Keys.IMEConvert); case (DeviceKeys.JPN_HIRAGANA_KATAKANA): return(Keys.IMEModeChange); case (DeviceKeys.RIGHT_SHIFT): return(Keys.RShiftKey); case (DeviceKeys.RIGHT_CONTROL): return(Keys.RControlKey); case (DeviceKeys.RIGHT_ALT): return(Keys.RMenu); case (DeviceKeys.PAUSE_BREAK): return(Keys.Pause); case (DeviceKeys.CAPS_LOCK): return(Keys.CapsLock); case (DeviceKeys.SPACE): return(Keys.Space); case (DeviceKeys.PAGE_UP): return(Keys.PageUp); case (DeviceKeys.PAGE_DOWN): return(Keys.PageDown); case (DeviceKeys.END): return(Keys.End); case (DeviceKeys.HOME): return(Keys.Home); case (DeviceKeys.ARROW_LEFT): return(Keys.Left); case (DeviceKeys.ARROW_UP): return(Keys.Up); case (DeviceKeys.ARROW_RIGHT): return(Keys.Right); case (DeviceKeys.ARROW_DOWN): return(Keys.Down); case (DeviceKeys.PRINT_SCREEN): return(Keys.PrintScreen); case (DeviceKeys.INSERT): return(Keys.Insert); case (DeviceKeys.DELETE): return(Keys.Delete); case (DeviceKeys.ZERO): return(Keys.D0); case (DeviceKeys.ONE): return(Keys.D1); case (DeviceKeys.TWO): return(Keys.D2); case (DeviceKeys.THREE): return(Keys.D3); case (DeviceKeys.FOUR): return(Keys.D4); case (DeviceKeys.FIVE): return(Keys.D5); case (DeviceKeys.SIX): return(Keys.D6); case (DeviceKeys.SEVEN): return(Keys.D7); case (DeviceKeys.EIGHT): return(Keys.D8); case (DeviceKeys.NINE): return(Keys.D9); case (DeviceKeys.A): return(Keys.A); case (DeviceKeys.B): return(Keys.B); case (DeviceKeys.C): return(Keys.C); case (DeviceKeys.D): return(Keys.D); case (DeviceKeys.E): return(Keys.E); case (DeviceKeys.F): return(Keys.F); case (DeviceKeys.G): return(Keys.G); case (DeviceKeys.H): return(Keys.H); case (DeviceKeys.I): return(Keys.I); case (DeviceKeys.J): return(Keys.J); case (DeviceKeys.K): return(Keys.K); case (DeviceKeys.L): return(Keys.L); case (DeviceKeys.M): return(Keys.M); case (DeviceKeys.N): return(Keys.N); case (DeviceKeys.O): return(Keys.O); case (DeviceKeys.P): return(Keys.P); case (DeviceKeys.Q): return(Keys.Q); case (DeviceKeys.R): return(Keys.R); case (DeviceKeys.S): return(Keys.S); case (DeviceKeys.T): return(Keys.T); case (DeviceKeys.U): return(Keys.U); case (DeviceKeys.V): return(Keys.V); case (DeviceKeys.W): return(Keys.W); case (DeviceKeys.X): return(Keys.X); case (DeviceKeys.Y): return(Keys.Y); case (DeviceKeys.Z): return(Keys.Z); case (DeviceKeys.LEFT_WINDOWS): return(Keys.LWin); case (DeviceKeys.RIGHT_WINDOWS): return(Keys.RWin); case (DeviceKeys.APPLICATION_SELECT): return(Keys.Apps); case (DeviceKeys.NUM_ZERO): return(Keys.NumPad0); case (DeviceKeys.NUM_ONE): return(Keys.NumPad1); case (DeviceKeys.NUM_TWO): return(Keys.NumPad2); case (DeviceKeys.NUM_THREE): return(Keys.NumPad3); case (DeviceKeys.NUM_FOUR): return(Keys.NumPad4); case (DeviceKeys.NUM_FIVE): return(Keys.NumPad5); case (DeviceKeys.NUM_SIX): return(Keys.NumPad6); case (DeviceKeys.NUM_SEVEN): return(Keys.NumPad7); case (DeviceKeys.NUM_EIGHT): return(Keys.NumPad8); case (DeviceKeys.NUM_NINE): return(Keys.NumPad9); case (DeviceKeys.NUM_ASTERISK): return(Keys.Multiply); case (DeviceKeys.NUM_PLUS): return(Keys.Add); case (DeviceKeys.NUM_MINUS): return(Keys.Subtract); case (DeviceKeys.NUM_PERIOD): return(Keys.Decimal); case (DeviceKeys.NUM_SLASH): return(Keys.Divide); case (DeviceKeys.F1): return(Keys.F1); case (DeviceKeys.F2): return(Keys.F2); case (DeviceKeys.F3): return(Keys.F3); case (DeviceKeys.F4): return(Keys.F4); case (DeviceKeys.F5): return(Keys.F5); case (DeviceKeys.F6): return(Keys.F6); case (DeviceKeys.F7): return(Keys.F7); case (DeviceKeys.F8): return(Keys.F8); case (DeviceKeys.F9): return(Keys.F9); case (DeviceKeys.F10): return(Keys.F10); case (DeviceKeys.F11): return(Keys.F11); case (DeviceKeys.F12): return(Keys.F12); case (DeviceKeys.NUM_LOCK): return(Keys.NumLock); case (DeviceKeys.SCROLL_LOCK): return(Keys.Scroll); case (DeviceKeys.VOLUME_MUTE): return(Keys.VolumeMute); case (DeviceKeys.VOLUME_DOWN): return(Keys.VolumeDown); case (DeviceKeys.VOLUME_UP): return(Keys.VolumeUp); case (DeviceKeys.MEDIA_NEXT): return(Keys.MediaNextTrack); case (DeviceKeys.MEDIA_PREVIOUS): return(Keys.MediaPreviousTrack); case (DeviceKeys.MEDIA_STOP): return(Keys.MediaStop); case (DeviceKeys.MEDIA_PLAY_PAUSE): return(Keys.MediaPlayPause); case (DeviceKeys.SEMICOLON): /*if (Global.kbLayout.Loaded_Localization == Settings.PreferredKeyboardLocalization.nordic) * return DeviceKeys.CLOSE_BRACKET; * else*/ return(Keys.OemSemicolon); case (DeviceKeys.EQUALS): /*if (Global.kbLayout.Loaded_Localization == Settings.PreferredKeyboardLocalization.de) * return DeviceKeys.CLOSE_BRACKET; * else if (Global.kbLayout.Loaded_Localization == Settings.PreferredKeyboardLocalization.nordic) * return DeviceKeys.MINUS; * else*/ return(Keys.Oemplus); case (DeviceKeys.COMMA): return(Keys.Oemcomma); case (DeviceKeys.MINUS): /*if (Global.kbLayout.Loaded_Localization == Settings.PreferredKeyboardLocalization.de) * return DeviceKeys.FORWARD_SLASH; * else if (Global.kbLayout.Loaded_Localization == Settings.PreferredKeyboardLocalization.nordic) * return DeviceKeys.FORWARD_SLASH; * else*/ return(Keys.OemMinus); case (DeviceKeys.PERIOD): return(Keys.OemPeriod); case (DeviceKeys.FORWARD_SLASH): /*if (Global.kbLayout.Loaded_Localization == Settings.PreferredKeyboardLocalization.de) * return DeviceKeys.HASHTAG; * else if (Global.kbLayout.Loaded_Localization == Settings.PreferredKeyboardLocalization.nordic) * return DeviceKeys.HASHTAG; * else*/ return(Keys.OemQuestion); case (DeviceKeys.JPN_HALFFULLWIDTH): return(Keys.ProcessKey); case (DeviceKeys.TILDE): /*if (Global.kbLayout.Loaded_Localization == Settings.PreferredKeyboardLocalization.uk) * return DeviceKeys.APOSTROPHE; * else if (Global.kbLayout.Loaded_Localization == Settings.PreferredKeyboardLocalization.nordic) * return DeviceKeys.SEMICOLON; * else*/ return(Keys.Oemtilde); case (DeviceKeys.OPEN_BRACKET): /*if (Global.kbLayout.Loaded_Localization == Settings.PreferredKeyboardLocalization.de) * return DeviceKeys.MINUS; * else if (Global.kbLayout.Loaded_Localization == Settings.PreferredKeyboardLocalization.nordic) * return DeviceKeys.EQUALS; * else*/ return(Keys.OemOpenBrackets); case (DeviceKeys.BACKSLASH): /*if (Global.kbLayout.Loaded_Localization == Settings.PreferredKeyboardLocalization.uk) * return DeviceKeys.BACKSLASH_UK; * if (Global.kbLayout.Loaded_Localization == Settings.PreferredKeyboardLocalization.nordic) * return DeviceKeys.TILDE; * else*/ return(Keys.OemPipe); case (DeviceKeys.CLOSE_BRACKET): /*if (Global.kbLayout.Loaded_Localization == Settings.PreferredKeyboardLocalization.de) * return DeviceKeys.EQUALS; * if (Global.kbLayout.Loaded_Localization == Settings.PreferredKeyboardLocalization.nordic) * return DeviceKeys.OPEN_BRACKET; * else*/ return(Keys.OemCloseBrackets); case (DeviceKeys.APOSTROPHE): /*if (Global.kbLayout.Loaded_Localization == Settings.PreferredKeyboardLocalization.uk) * return DeviceKeys.HASHTAG; * else*/ return(Keys.OemQuotes); case (DeviceKeys.BACKSLASH_UK): return(Keys.OemBackslash); case (DeviceKeys.OEM8): /*if (Global.kbLayout.Loaded_Localization == Settings.PreferredKeyboardLocalization.uk) * return DeviceKeys.TILDE; * else*/ return(Keys.Oem8); case (DeviceKeys.MEDIA_PLAY): return(Keys.Play); default: return(Keys.None); } }