public void MouseMoveSurface(MouseInfo info, ITextSurface surface) { Brush.Position = info.ConsoleLocation; Brush.IsVisible = true; if (info.LeftButtonDown) { var cell = surface.GetCell(info.ConsoleLocation.X, info.ConsoleLocation.Y); if (!settingsPanel.IgnoreForeground) cell.Foreground = CharacterPickPanel.SharedInstance.SettingForeground; if (!settingsPanel.IgnoreBackground) cell.Background = CharacterPickPanel.SharedInstance.SettingBackground; } else if (info.RightButtonDown) { var cell = surface.GetCell(info.ConsoleLocation.X, info.ConsoleLocation.Y); if (!settingsPanel.IgnoreForeground) CharacterPickPanel.SharedInstance.SettingForeground = cell.Foreground; if (!settingsPanel.IgnoreBackground) CharacterPickPanel.SharedInstance.SettingBackground = cell.Background; } }
public override bool ProcessMouse(SadConsole.Input.MouseInfo info) { base.ProcessMouse(info); if (_isMouseOver) { if (info.ScrollWheelValueChange != 0) { EditorConsoleManager.Instance.ScrollToolbox(info.ScrollWheelValueChange); return(true); } foreach (var item in _hotSpots) { if (item.Item2 == info.ConsoleLocation.Y) { if (info.LeftClicked) { item.Item1.IsCollapsed = !item.Item1.IsCollapsed; RefreshControls(); return(true); } } } } return(false); }
public override bool ProcessMouse(MouseInfo info) { base.ProcessMouse(info); if (info.RightClicked) Hide(); return true; }
public override bool ProcessMouse(MouseInfo info) { // Check the scroll bar for mouse info first. If mouse not handled by scroll bar, then.. if (!controlsContainer.ProcessMouse(info)) { // Process this console normally. return base.ProcessMouse(info); } // If we get here, then the mouse was over the scroll bar. return true; }
public void MouseMoveSurface(MouseInfo info, ITextSurface surface) { if (info.LeftClicked) { EditorConsoleManager.AllowKeyboardToMoveConsole = false; writing = true; tempConsole.TextSurface = (ITextSurfaceRendered)surface; tempConsole.VirtualCursor.Position = Brush.Position = info.ConsoleLocation; Brush.IsVisible = true; } }
public override bool ProcessMouse(MouseInfo info) { Print(0, 0, " "); Print(0, 1, " "); Print(0, 2, " "); //SadConsole.Engine.DeviceManager.PreferredBackBufferWidth = 320; //SadConsole.Engine.DeviceManager.ApplyChanges(); //SadConsole.Engine.Device.Viewport = new Microsoft.Xna.Framework.Graphics.Viewport(0, 0, 1280, 400); Print(0, 0, $"mouse:{info.ScreenLocation} adapter:{SadConsole.Engine.Device.Adapter.CurrentDisplayMode.Width},{SadConsole.Engine.Device.Adapter.CurrentDisplayMode.Height} window:{SadConsole.Engine.MonoGameInstance.Window.ClientBounds}", Color.White, Color.Black); Print(0, 1, $"pref:{SadConsole.Engine.DeviceManager.PreferredBackBufferWidth},{SadConsole.Engine.DeviceManager.PreferredBackBufferHeight} view:{SadConsole.Engine.Device.Viewport}", Color.White, Color.Black); Print(0, 2, $"bounds:{SadConsole.Engine.Device.Viewport.Bounds} scale:{SadConsole.Engine.RenderScale} renderrect:{SadConsole.Engine.RenderRect}", Color.White, Color.Black); return base.ProcessMouse(info); }
public void MouseMoveSurface(MouseInfo info, ITextSurface surface) { Brush.Position = info.ConsoleLocation; Brush.IsVisible = true; if (info.LeftClicked) { var cell = surface.GetCell(info.ConsoleLocation.X, info.ConsoleLocation.Y); var editor = EditorConsoleManager.ActiveEditor as Editors.GameObjectEditor; if (editor != null) { editor.SetAnimationCenter(new Point(info.ConsoleLocation.X, info.ConsoleLocation.Y)); } } }
public bool HandlerMouse(IConsole console, MouseInfo info) { if (console.IsVisible && console.CanUseMouse) { info.Fill(console); bool doDrag = (info.LeftButtonDown && CanMoveWithLeftButton) || (info.RightButtonDown && CanMoveWithRightButton); if (info.Console == console && doDrag) { // Mouse just went down on us. if (!_mouseDown) { _mouseDown = true; _mouseLastLocation = new Point(info.ConsoleLocation.X, info.ConsoleLocation.Y); console.ExclusiveFocus = true; } else { // Mouse has been down, still is Point currentLocation = new Point(info.ConsoleLocation.X, info.ConsoleLocation.Y); if (currentLocation != _mouseLastLocation) { Rectangle viewport = console.ViewArea; viewport.X += _mouseLastLocation.X - currentLocation.X; viewport.Y += _mouseLastLocation.Y - currentLocation.Y; _mouseLastLocation = currentLocation; console.ViewArea = viewport; } } return true; } if (!doDrag && _mouseDown) { console.ExclusiveFocus = false; _mouseDown = false; } } return false; }
public MouseEventArgs(MouseInfo info) { this.Console = info.Console; this.Cell = info.Cell; this.ConsoleLocation = info.ConsoleLocation; this.ScreenLocation = info.ScreenLocation; this.WorldLocation = info.WorldLocation; this.LeftButtonDown = info.LeftButtonDown; this.RightButtonDown = info.RightButtonDown; this.LeftButtonClicked = info.LeftClicked; this.RightButtonClicked = info.RightClicked; this.LeftButtonDoubleClicked = info.LeftDoubleClicked; this.RightButtonDoubleClicked = info.RightDoubleClicked; this.ScrollWheelValue = info.ScrollWheelValue; this.ScrollWheelValueChange = info.ScrollWheelValueChange; }
public void MouseMoveSurface(MouseInfo info, ITextSurface surface) { Brush.IsVisible = true; Brush.Position = info.ConsoleLocation; if (info.LeftButtonDown) { var cell = surface.GetCell(info.ConsoleLocation.X, info.ConsoleLocation.Y); cell.GlyphIndex = CharacterPickPanel.SharedInstance.SettingCharacter; cell.Foreground = CharacterPickPanel.SharedInstance.SettingForeground; cell.Background = CharacterPickPanel.SharedInstance.SettingBackground; cell.SpriteEffect = CharacterPickPanel.SharedInstance.SettingMirrorEffect; } if (info.RightButtonDown) { var cell = surface.GetCell(info.ConsoleLocation.X, info.ConsoleLocation.Y); CharacterPickPanel.SharedInstance.SettingCharacter = cell.GlyphIndex; CharacterPickPanel.SharedInstance.SettingForeground = cell.Foreground; CharacterPickPanel.SharedInstance.SettingBackground = cell.Background; CharacterPickPanel.SharedInstance.SettingMirrorEffect = cell.SpriteEffect; } }
protected virtual void OnMouseExit(MouseInfo info) { // Force mouse off just incase _isMouseOver = false; if (MouseExit != null) MouseExit(this, new MouseEventArgs(info)); }
/// <summary> /// Returns a clone of this object. /// </summary> /// <returns>The clone.</returns> public virtual MouseInfo Clone() { var returnValue = new MouseInfo(); returnValue.Cell = this.Cell; returnValue.Console = this.Console; returnValue.ConsoleLocation = this.ConsoleLocation; returnValue.LeftButtonDown = this.LeftButtonDown; returnValue.LeftClicked = this.LeftClicked; returnValue.RightButtonDown = this.RightButtonDown; returnValue.RightClicked = this.RightClicked; returnValue.ScreenLocation = this.ScreenLocation; returnValue.WorldLocation = this.WorldLocation; return returnValue; }
public static bool ProcessMouse(MouseInfo info) { //if (ActiveEditor != null && info.Console != ToolsPane && info.Console != ToolsPaneScroller) //{ // ActiveEditor.RenderedConsole.process //} return false; }
public override bool ProcessMouse(MouseInfo info) { return base.ProcessMouse(info); //return EditorConsoleManager.ProcessMouse(info); }
public void ProcessMouse(MouseInfo info, ITextSurface surface) { if (EditorConsoleManager.ToolsPane.IsMouseOver) { Brush.IsVisible = false; return; } else Brush.IsVisible = true; _previousSurface = surface; if (_panel.State == SelectionToolPanel.CloneState.Clone || _panel.State == SelectionToolPanel.CloneState.Move) { Brush.Position = info.ConsoleLocation; } if (info.RightClicked) { _panel.State = SelectionToolPanel.CloneState.SelectingPoint1; } if (info.LeftClicked) { if (_panel.State == SelectionToolPanel.CloneState.Clone) { StampBrush(info.ConsoleLocation.X, info.ConsoleLocation.Y, surface); } else if (_panel.State == SelectionToolPanel.CloneState.Move) { StampBrush(info.ConsoleLocation.X, info.ConsoleLocation.Y, surface); _panel.State = SelectionToolPanel.CloneState.SelectingPoint1; } } }
public void MouseMoveSurface(MouseInfo info, ITextSurface surface) { Brush.IsVisible = true; //_entity.SyncLayers(); if (info.LeftClicked) { if (_panel.State == SelectionToolPanel.CloneState.SelectingPoint1) { _panel.State = SelectionToolPanel.CloneState.SelectingPoint2; Brush.Animation.Tint = new Color(0f, 0f, 0f, 0.5f); } else if (_panel.State == SelectionToolPanel.CloneState.SelectingPoint2) { _secondPoint = new Point(info.ConsoleLocation.X, info.ConsoleLocation.Y); _panel.State = SelectionToolPanel.CloneState.Selected; // Copy data to new animation AnimatedTextSurface cloneAnimation = new AnimatedTextSurface("clone", Brush.Width, Brush.Height, Settings.Config.ScreenFont); var frame = cloneAnimation.CreateFrame(); Point topLeftPoint = new Point(Math.Min(_firstPoint.Value.X, _secondPoint.Value.X), Math.Min(_firstPoint.Value.Y, _secondPoint.Value.Y)); surface.Copy(topLeftPoint.X, topLeftPoint.Y, cloneAnimation.Width, cloneAnimation.Height, frame, 0, 0); if (_altPanel.SkipEmptyCells && _altPanel.UseAltEmptyColor) { foreach (var cell in frame.Cells) { if (cell.GlyphIndex == 0 && cell.Background == _altPanel.AltEmptyColor) cell.Background = Color.Transparent; } } cloneAnimation.Center = Brush.Animation.Center; Brush.SelectedSurface.Animation = cloneAnimation; //Brush.Animations[cloneAnimation.Name] = cloneAnimation; //Brush.Animation = cloneAnimation; //Brush.Animation.Tint = new Color(0f, 0f, 0f, 0f); //// Display the rect //var topLayer = new GameObject(Settings.Config.ScreenFont); //Brush.UnderAnimation = topLayer; //topLayer.Animations[_tempAnimation.Name] = _tempAnimation; //topLayer.Animation = _tempAnimation; //topLayer.Animation.Tint = new Color(0f, 0f, 0f, 0.35f); //topLayer.Position = Brush.Position; ////_entity.SyncLayers(); } else if (_panel.State == SelectionToolPanel.CloneState.Selected) { } else if (_panel.State == SelectionToolPanel.CloneState.Clone) { //StampBrush(info.ConsoleLocation.X, info.ConsoleLocation.Y, surface); } else if (_panel.State == SelectionToolPanel.CloneState.Clear) { // Erase selected area } else if (_panel.State == SelectionToolPanel.CloneState.Move) { // Move the selected cells } } else { if (_panel.State == SelectionToolPanel.CloneState.SelectingPoint1) { Brush.Position = info.ConsoleLocation; _firstPoint = Brush.Position; // State was reset and we didn't know about it if (_previousState != _panel.State || Brush.Animation.Name != AnimationSingle) { Brush.Animation = Brush.Animations[AnimationSingle]; Brush.Animation.Tint = new Color(0f, 0f, 0f, 0f); } } if (_panel.State == SelectionToolPanel.CloneState.SelectingPoint2) { int width = Math.Max(_firstPoint.Value.X, info.ConsoleLocation.X) - Math.Min(_firstPoint.Value.X, info.ConsoleLocation.X) + 1; int height = Math.Max(_firstPoint.Value.Y, info.ConsoleLocation.Y) - Math.Min(_firstPoint.Value.Y, info.ConsoleLocation.Y) + 1; Point p1; if (_firstPoint.Value.X > info.ConsoleLocation.X) { if (_firstPoint.Value.Y > info.ConsoleLocation.Y) p1 = new Point(width - 1, height - 1); else p1 = new Point(width - 1, 0); } else { if (_firstPoint.Value.Y > info.ConsoleLocation.Y) p1 = new Point(0, height - 1); else p1 = new Point(0, 0); } MakeBoxAnimation(width, height, p1); } } _previousState = _panel.State; }
public void MouseEnterSurface(MouseInfo info, ITextSurface surface) { Brush.IsVisible = true; }
public void MouseMoveSurface(MouseInfo info, ITextSurface surface) { }
/// <summary> /// Mouse handler passed on by the tools pane. /// </summary> /// <param name="info">Mouse data</param> public abstract void ProcessMouse(MouseInfo info);
public void ProcessMouse(MouseInfo info, ITextSurface surface) { }
protected virtual void OnMouseEnter(MouseInfo info) { if (MouseEnter != null) MouseEnter(this, new MouseEventArgs(info)); }
public void MouseMoveSurface(MouseInfo info, ITextSurface surface) { Brush.IsVisible = true; if (!firstPoint.HasValue) { Brush.Position = info.ConsoleLocation; settingsPanel.CircleWidth = 0; settingsPanel.CircleHeight = 0; } else { AnimatedTextSurface animation; // Draw the line (erase old) to where the mouse is // create the animation frame animation = new AnimatedTextSurface("line", Math.Max(firstPoint.Value.X, info.ConsoleLocation.X) - Math.Min(firstPoint.Value.X, info.ConsoleLocation.X) + 1, Math.Max(firstPoint.Value.Y, info.ConsoleLocation.Y) - Math.Min(firstPoint.Value.Y, info.ConsoleLocation.Y) + 1, Settings.Config.ScreenFont); var frame = animation.CreateFrame(); Point p1; if (firstPoint.Value.X > info.ConsoleLocation.X) { if (firstPoint.Value.Y > info.ConsoleLocation.Y) p1 = new Point(frame.Width - 1, frame.Height - 1); else p1 = new Point(frame.Width - 1, 0); } else { if (firstPoint.Value.Y > info.ConsoleLocation.Y) p1 = new Point(0, frame.Height - 1); else p1 = new Point(0, 0); } settingsPanel.CircleWidth = frame.Width; settingsPanel.CircleHeight = frame.Height; animation.Center = p1; Settings.QuickEditor.TextSurface = frame; ellipseShape = new SadConsole.Shapes.Ellipse(); ellipseShape.BorderAppearance = borderAppearance; ellipseShape.EndingPoint = new Point(frame.Width - 1, frame.Height - 1); ellipseShape.Draw(Settings.QuickEditor); Brush.Animation = animation; } // TODO: Make this work. They push DOWN on the mouse, start the line from there, if they "Click" then go to mode where they click a second time // If they don't click and hold it down longer than click, pretend a second click happened and draw the line. if (info.LeftClicked) { if (!firstPoint.HasValue) { firstPoint = new Point(info.ConsoleLocation.X, info.ConsoleLocation.Y); RefreshTool(); } else { secondPoint = new Point(info.ConsoleLocation.X, info.ConsoleLocation.Y); Point p1 = new Point(Math.Min(firstPoint.Value.X, secondPoint.Value.X), Math.Min(firstPoint.Value.Y, secondPoint.Value.Y)); Point p2 = new Point(Math.Max(firstPoint.Value.X, secondPoint.Value.X), Math.Max(firstPoint.Value.Y, secondPoint.Value.Y)); Settings.QuickEditor.TextSurface = surface; ellipseShape.StartingPoint = p1; ellipseShape.EndingPoint = p2; ellipseShape.Draw(Settings.QuickEditor); Brush.Animation = Brush.Animations["single"]; Brush.Position = secondPoint.Value; firstPoint = null; secondPoint = null; //surface.ResyncAllCellEffects(); } } else if (info.RightClicked) { if (firstPoint.HasValue && !secondPoint.HasValue) { firstPoint = null; secondPoint = null; settingsPanel.CircleWidth = 0; settingsPanel.CircleHeight = 0; Brush.Animation = Brush.Animations["single"]; Brush.Position = new Point(info.ConsoleLocation.X, info.ConsoleLocation.Y); } } }
public void MouseExitSurface(MouseInfo info, ITextSurface surface) { if (!firstPoint.HasValue) Brush.IsVisible = false; }
public void MouseMoveSurface(MouseInfo info, ITextSurface surface) { Brush.IsVisible = true; if (!firstPoint.HasValue) { Brush.Position = info.ConsoleLocation; } else { SetAnimationLine(info.ConsoleLocation); } // TODO: Make this work. They push DOWN on the mouse, start the line from there, if they "Click" then go to mode where they click a second time // If they don't click and hold it down longer than click, pretend a second click happened and draw the line. if (info.LeftClicked) { if (!firstPoint.HasValue) { firstPoint = new Point(info.ConsoleLocation.X, info.ConsoleLocation.Y); } else { secondPoint = new Point(info.ConsoleLocation.X, info.ConsoleLocation.Y); lineShape.StartingLocation = firstPoint.Value; lineShape.EndingLocation = secondPoint.Value; lineShape.Draw(new SurfaceEditor(surface)); firstPoint = null; secondPoint = null; lineShape = null; Brush.Animation = Brush.Animations["single"]; //surface.ResyncAllCellEffects(); settingsPanel.LineLength = 0; } } else if (info.RightClicked) { if (firstPoint.HasValue && !secondPoint.HasValue) { ResetLine(); } } }
protected virtual void OnMouseIn(MouseInfo info) { if (MouseMove != null) MouseMove(this, new MouseEventArgs(info)); }
public void ProcessMouse(MouseInfo info, ITextSurface surface) { if (EditorConsoleManager.ToolsPane.IsMouseOver) { Brush.IsVisible = false; return; } else Brush.IsVisible = true; if (!firstPoint.HasValue) { Brush.Position = info.ConsoleLocation; } else { // Draw the line (erase old) to where the mouse is // create the animation frame AnimatedTextSurface animation = new AnimatedTextSurface("line", Math.Max(firstPoint.Value.X, info.ConsoleLocation.X) - Math.Min(firstPoint.Value.X, info.ConsoleLocation.X) + 1, Math.Max(firstPoint.Value.Y, info.ConsoleLocation.Y) - Math.Min(firstPoint.Value.Y, info.ConsoleLocation.Y) + 1, Settings.Config.ScreenFont); var frame = animation.CreateFrame(); Point p1; if (firstPoint.Value.X > info.ConsoleLocation.X) { if (firstPoint.Value.Y > info.ConsoleLocation.Y) p1 = new Point(frame.Width - 1, frame.Height - 1); else p1 = new Point(frame.Width - 1, 0); } else { if (firstPoint.Value.Y > info.ConsoleLocation.Y) p1 = new Point(0, frame.Height - 1); else p1 = new Point(0, 0); } animation.Center = p1; boxShape = SadConsole.Shapes.Box.GetDefaultBox(); if (_settingsPanel.UseCharacterBorder) boxShape.LeftSideCharacter = boxShape.RightSideCharacter = boxShape.TopLeftCharacter = boxShape.TopRightCharacter = boxShape.TopSideCharacter = boxShape.BottomLeftCharacter = boxShape.BottomRightCharacter = boxShape.BottomSideCharacter = _settingsPanel.BorderCharacter; boxShape.Foreground = _settingsPanel.LineForeColor; boxShape.FillColor = _settingsPanel.FillColor; boxShape.Fill = _settingsPanel.UseFill; boxShape.BorderBackground = _settingsPanel.LineBackColor; boxShape.Location = new Point(0, 0); boxShape.Width = frame.Width; boxShape.Height = frame.Height; boxShape.Draw(new SurfaceEditor(frame)); Brush.Animation = animation; } // TODO: Make this work. They push DOWN on the mouse, start the line from there, if they "Click" then go to mode where they click a second time // If they don't click and hold it down longer than click, pretend a second click happened and draw the line. if (info.LeftClicked) { if (!firstPoint.HasValue) { firstPoint = new Point(info.ConsoleLocation.X, info.ConsoleLocation.Y); } else { secondPoint = new Point(info.ConsoleLocation.X, info.ConsoleLocation.Y); Point p1 = new Point(Math.Min(firstPoint.Value.X, secondPoint.Value.X), Math.Min(firstPoint.Value.Y, secondPoint.Value.Y)); //Point p2 = new Point(Math.Max(_firstPoint.Value.X, _secondPoint.Value.X), Math.Max(_firstPoint.Value.Y, _secondPoint.Value.Y)); boxShape.Location = p1; boxShape.Draw(new SurfaceEditor(surface)); firstPoint = null; secondPoint = null; Brush.Animation = Brush.Animations["single"]; //surface.ResyncAllCellEffects(); } } else if (info.RightClicked) { if (firstPoint.HasValue && !secondPoint.HasValue) { firstPoint = null; secondPoint = null; Brush.Animation = Brush.Animations["single"]; } } }
protected virtual void OnRightMouseClicked(MouseInfo info) { if (MouseButtonClicked != null) MouseButtonClicked(this, new MouseEventArgs(info)); }
public void MouseExitSurface(MouseInfo info, ITextSurface surface) { Brush.IsVisible = false; }
/// <summary> /// Processes the mouse. /// </summary> /// <param name="info"></param> /// <returns>True when the mouse is over this console.</returns> public virtual bool ProcessMouse(MouseInfo info) { var handlerResult = MouseHandler == null ? false : MouseHandler(this, info); if (!handlerResult) { if (this.IsVisible && this.CanUseMouse) { info.Fill(this); if (info.Console == this) { if (this.CanFocus && this.MouseCanFocus && info.LeftClicked) { IsFocused = true; if (IsFocused && this.MoveToFrontOnMouseFocus && this.Parent != null && this.Parent.IndexOf(this) != this.Parent.Count - 1) this.Parent.MoveToTop(this); } if (_isMouseOver != true) { _isMouseOver = true; OnMouseEnter(info); } OnMouseIn(info); if (info.LeftClicked) OnMouseLeftClicked(info); if (info.RightClicked) OnRightMouseClicked(info); return true; } else { if (_isMouseOver) { _isMouseOver = false; OnMouseExit(info); } } } } return handlerResult; }
public override void ProcessMouse(MouseInfo info) { }
public void MouseExitSurface(MouseInfo info, ITextSurface surface) { if (_panel.State == SelectionToolPanel.CloneState.SelectingPoint1 || _panel.State == SelectionToolPanel.CloneState.SelectingPoint2) { Brush.IsVisible = false; //_entity.SyncLayers(); } }