public void ResetCursor() { if ( currentCursor != CursorType.Grip && Manager != null && ( (Manager.GetLeftHandEvent() == InteractionManager.HandEventType.Grip && Manager.IsLeftHandPrimary()) || (Manager.GetRightHandEvent() == InteractionManager.HandEventType.Grip && !Manager.IsLeftHandPrimary())) ) { Cursor.SetCursor(gripCursor, hotSpot, curMode); currentCursor = CursorType.Grip; } else if ((Manager.GetLeftHandEvent() != InteractionManager.HandEventType.Grip && Manager.IsLeftHandPrimary()) || (Manager.GetRightHandEvent() != InteractionManager.HandEventType.Grip && !Manager.IsLeftHandPrimary())) { Cursor.SetCursor(handCusor, hotSpot, curMode); currentCursor = CursorType.Hand; } }
//////////////////////////////////////////////////////////////////////////////////////////////// /*--------------------------------------------------------------------------------------------*/ public static Finger.FingerType? GetFingerType(CursorType pCursorType) { switch ( pCursorType ) { case CursorType.LeftThumb: case CursorType.RightThumb: return Finger.FingerType.TYPE_THUMB; case CursorType.LeftIndex: case CursorType.RightIndex: return Finger.FingerType.TYPE_INDEX; case CursorType.LeftMiddle: case CursorType.RightMiddle: return Finger.FingerType.TYPE_MIDDLE; case CursorType.LeftRing: case CursorType.RightRing: return Finger.FingerType.TYPE_RING; case CursorType.LeftPinky: case CursorType.RightPinky: return Finger.FingerType.TYPE_PINKY; case CursorType.LeftPalm: case CursorType.RightPalm: return null; } throw new Exception("Unhandled CursorType: "+pCursorType); }
internal static Cursor FromEnum (CursorType type) { switch (type){ case CursorType.Arrow: return Arrow; case CursorType.Eraser: return Eraser; case CursorType.Hand: return Hand; case CursorType.IBeam: return IBeam; case CursorType.None: return None; case CursorType.SizeNS: return SizeNS; case CursorType.SizeWE: return SizeWE; case CursorType.Stylus: return Stylus; case CursorType.Wait: return Wait; case CursorType.SizeNESW: return SizeNESW; case CursorType.SizeNWSE: return SizeNWSE; case CursorType.Default: default: return null; } }
/*--------------------------------------------------------------------------------------------*/ public float GetHighlightProgress(CursorType pCursorType) { if ( !vHighlightProgressMap.ContainsKey(pCursorType) ) { return 0; } return vHighlightProgressMap[pCursorType]; }
public void ChangeCursor(CursorType type) { if (_status == CursorGestureStatus.Capturing) { // If we're capturing a gesture, we want to keep the current icon on screen // so we'll save a copy of what it SHOULD be if we weren't capturing to // apply later. _backUpCursorType = type; } else { // The normal type hand should use the top left as the mouse location // while the others should use the middle of the icon. if (type != CursorType.Normal) _offset = _cursorDimensions * .25f; else _offset = new Vector2(10, 10); _activeCursorType = type; _cursorRect = new Rect( _cursorTileDimensions.x * (int)_activeCursorType, _cursorTileDimensions.y * (int)_status, _cursorTileDimensions.x, _cursorTileDimensions.y); } }
//////////////////////////////////////////////////////////////////////////////////////////////// /*--------------------------------------------------------------------------------------------*/ private Bundle GetBundle(CursorType pType, Func<bool> pShowFunc) { var bundle = new Bundle(); bundle.CursorType = pType; bundle.ShowFunc = pShowFunc; return bundle; }
/*--------------------------------------------------------------------------------------------*/ private HoverItemHighlightState FindNearestItemToCursor(CursorType pCursorType, out HoverItemHighlightState.Highlight? pNearestHigh) { float minDist = float.MaxValue; HoverItemHighlightState nearestItem = null; pNearestHigh = null; for ( int i = 0 ; i < vHighStates.Count ; i++ ) { HoverItemHighlightState item = vHighStates[i]; if ( !item.gameObject.activeInHierarchy || item.IsHighlightPrevented ) { continue; } HoverItemHighlightState.Highlight? high = item.GetHighlight(pCursorType); if ( high == null || high.Value.Distance >= minDist ) { continue; } minDist = high.Value.Distance; nearestItem = item; pNearestHigh = high; } return nearestItem; }
/// <summary> /// <para>Create a new cursor, based on a pre-defined cursor type.</para> /// </summary> /// /// <param name="type"> /// <para>The pre-defined cursor type to use.</para> /// </param> public Cursor(CursorType type) { this.type = type; this.source = null; this.mask = null; this.cursor = XCursor.Zero; }
public static void SetCursor(CursorType type, Form ParentForm) { if (ParentForm != null) { switch (type) { case CursorType.WaitCursor: ParentForm.Cursor = Cursors.WaitCursor; break; case CursorType.Default: ParentForm.Cursor = Cursors.Default; break; case CursorType.Hand: ParentForm.Cursor = Cursors.Hand; break; case CursorType.SizeWE: ParentForm.Cursor = Cursors.SizeWE; break; case CursorType.Cross: ParentForm.Cursor = Cursors.Cross; break; case CursorType.VSplit: ParentForm.Cursor = Cursors.VSplit; break; } CurrentCursor = type; } }
public UIContainer(Color Colour, Color HighlightColour, Texture2D Texture = null, Vector2 Position = new Vector2(), Rectangle? SrcRect = null, int Width = UI_AUTO, int Height = UI_AUTO, bool IsActive = true, bool IsDraggable = false, CursorType CursorType = UI.CURSOR_DEFAULT, float MarginLeft = UI_AUTO, float MarginRight = UI_AUTO, float MarginTop = UI_AUTO, float MarginBottom = UI_AUTO, float opacity = UI_INHERIT, float layerDepth = UI_INHERIT, bool CentreHorizontal = false, bool CentreVertical = false, DragAndDropType DragAndDropType = DragAndDropType.None, object[] DataBinding = null) : base(Colour, HighlightColour, Texture, Position, SrcRect, Width, Height, IsActive, IsDraggable, CursorType, MarginLeft, MarginRight, MarginTop, MarginBottom, opacity, layerDepth) { Children = new List<UIElement>(); this.CentreHorizontal = CentreHorizontal; this.CentreVertical = CentreVertical; this._dragAndDropType = DragAndDropType; if (_dragAndDropType == DragAndDropType.DropElement) { this.OnLeftReleased = OnLeftReleasedHandler; } this.DataBinding = DataBinding; if (this.DataBinding == null) this.DataBinding = new object[0]; }
//////////////////////////////////////////////////////////////////////////////////////////////// /*--------------------------------------------------------------------------------------------*/ public float GetHighlightDistance(CursorType pCursorType) { if ( !vHighlightDistanceMap.ContainsKey(pCursorType) ) { return float.MaxValue; } return vHighlightDistanceMap[pCursorType]; }
/*--------------------------------------------------------------------------------------------*/ public override IInputCursor GetCursor(CursorType pType) { if ( pType != CursorType.Look ) { throw new Exception("The "+typeof(HovercursorLookInput)+" component does not support "+ "the use of "+typeof(CursorType)+"."+pType+"."); } return vCursor; }
/*--------------------------------------------------------------------------------------------*/ public IHoverCursorDataForInput GetCursorDataForInput(CursorType pType) { if ( !HasCursorData(pType) ) { throw new Exception("No '"+pType+"' cursor was found."); } return vCursorMap[pType]; }
public void SetCusorHand1() { currentCursor = CursorType.Hand1; Cursor.SetCursor ( handCusor1, hotSpot, curMode); }
//////////////////////////////////////////////////////////////////////////////////////////////// /*--------------------------------------------------------------------------------------------*/ public void Awake() { vSetup = gameObject.GetComponent<HovercursorSetup>(); vFakeItem = new FakeItemState(); vFakeItem.ItemAutoId = 123; ActiveCursorTypes = new CursorType[0]; }
/*--------------------------------------------------------------------------------------------*/ public static bool Contains(IList<CursorType> pList, CursorType pType) { for ( int i = 0 ; i < pList.Count ; i++ ) { if ( pList[i] == pType ) { return true; } } return false; }
//////////////////////////////////////////////////////////////////////////////////////////////// /*--------------------------------------------------------------------------------------------*/ public bool HasCursorData(CursorType pType) { if ( vCursorMap.Count == 0 ) { Update(); //Debug.Log("Early cursor request. Found "+vCursorMap.Count+" cursor(s)."); } return vCursorMap.ContainsKey(pType); }
/*--------------------------------------------------------------------------------------------*/ public static bool IsPalm(CursorType pCursorType) { switch ( pCursorType ) { case CursorType.LeftPalm: case CursorType.RightPalm: return true; } return false; }
public InventoryElement(Texture2D Texture = null, Vector2 Position = new Vector2(), Item Item = null, bool IsActive = true, CursorType CursorType = UI.CURSOR_DEFAULT, float opacity = UI_INHERIT) : base(Color.White, Color.Orange, Texture, Position, null, UI_INHERIT, UI_INHERIT, IsActive, true, CursorType, opacity: opacity) { this.Item = Item; this.Texture = Texture; }
/// <summary> /// Constructor for Standard Cursors, needn't be public as Stock Cursors /// are exposed in Cursors clas. /// </summary> /// <param name="cursorType"></param> internal Cursor(CursorType cursorType) { if (IsValidCursorType(cursorType)) { LoadCursorHelper(cursorType); } else { throw new ArgumentException(SR.Get(SRID.InvalidCursorType, cursorType)); } }
public void SetCursor(CursorType type) { if (type == CurrentCursor) { return; } if (m_CursorMap.ContainsKey(type)) { CurrentCursor = type; Form winForm = (Form)Form.FromHandle(this.Window.Handle); winForm.Cursor = m_CursorMap[type]; } }
public void SetCursor(CursorType type = CursorType.Main) { if (!cursorChangePossible) return; var texture = getTexture(type); if (texture) { HotSpot = new Vector2(texture.width / 2f, texture.height / 2f); Cursor.SetCursor(texture, HotSpot, CursorMode); } }
public void changeCursorType(CursorType newType) { switch (newType) { case CursorType.Camera: this.currentCursor = this.defaultCursor; break; case CursorType.Regular: this.currentCursor = this.cameraCursor; break; } }
public InventoryContainer(Texture2D Texture = null, Vector2 Position = new Vector2(), Rectangle? SrcRect = null, int Width = UI_AUTO, int Height = UI_AUTO, bool IsActive = true, bool IsDraggable = false, CursorType CursorType = UI.CURSOR_DEFAULT, int GridColumns = UI_AUTO, int GridRows = UI_AUTO, int RowHeight = UI_AUTO, int ColWidth = UI_AUTO, float MarginLeft = UI_AUTO, float MarginRight = UI_AUTO, float MarginTop = UI_AUTO, float MarginBottom = UI_AUTO, float opacity = UI_INHERIT, float layerDepth = UI_INHERIT, DragAndDropType DragAndDropType = DragAndDropType.None, object[] DataBinding = null) : base(Texture, Position, SrcRect, Width, Height, IsActive, IsDraggable, CursorType, GridColumns, GridRows, RowHeight, ColWidth, MarginLeft, MarginRight, MarginTop, MarginBottom, opacity, layerDepth, DragAndDropType, DataBinding) { }
static Cursor GetCursor (CursorType type, Generator generator = null) { var cache = generator.Cache<CursorType, Cursor> (cursorCache); Cursor cursor; lock (cache) { if (!cache.TryGetValue (type, out cursor)) { cursor = new Cursor (generator, type); cache [type] = cursor; } } return cursor; }
static Cursor GetCursor(CursorType type) { var cache = Platform.Instance.Cache<CursorType, Cursor> (cursorCache); Cursor cursor; lock (cache) { if (!cache.TryGetValue (type, out cursor)) { cursor = new Cursor(type); cache [type] = cursor; } } return cursor; }
public static void Intialize() { CursorEntity.cursorType = CursorType.Normal; CursorEntity.IsShooting = false; CursorEntity.rotationSpeed = 5f; CursorEntity.scaleSpeed = 0.1f; menuCursorImage = new Image(OGE.Content.Load<Texture2D>(@"Graphics\Entities\Cursor\menuCursor")); ingameCursorImage = new Image(OGE.Content.Load<Texture2D>(@"Graphics\Entities\Cursor\ingameCursor")); ingameCursorImage.CenterOrigin(); ingameCursorImage.Scale = 0.5f; }
public UISlider(Color Colour, Color HighlightColour, Texture2D SliderPieceTexture, Texture2D Texture = null, Vector2 Position = new Vector2(), Rectangle? SrcRect = null, int Width = UI_AUTO, int Height = UI_AUTO, bool IsActive = true, CursorType CursorType = UI.CURSOR_DEFAULT, float MarginLeft = UI_AUTO, float MarginRight = UI_AUTO, float MarginTop = UI_AUTO, float MarginBottom = UI_AUTO, float opacity = UI_INHERIT, float layerDepth = UI_INHERIT) : base(Colour, HighlightColour, Texture, Position, SrcRect, Width, Height, IsActive, false, CursorType, MarginLeft, MarginRight, MarginTop, MarginBottom, opacity, layerDepth, true, true, DragAndDropType.DropElement) { var sliderPiece = new UISliderPiece(SliderPieceTexture, Colour, HighlightColour, IsDraggable: true, CursorType: CursorType.Cursor); AddElement(sliderPiece); SliderPosition = 0; OnSliderChanged += UpdateSliderPosition; }
public static void SetCursor(CursorType type) { Control ctrl = System.Windows.Forms.Control.FromHandle(GameConst.GameWindow.Handle); if (ctrl != null && curcursor != cursors[(int)type]) { //Cursor myCursor = new Cursor(chandle); //IntPtr colorCursorHandle = LoadCursorFromFile(cursors[(int)type]); //myCursor.GetType().InvokeMember("handle", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.SetField, null, myCursor, // new object[] { colorCursorHandle }); ctrl.Cursor = cursors[(int)type]; curcursor = cursors[(int)type]; } }
/*--------------------------------------------------------------------------------------------*/ public override IInputCursor GetCursor(CursorType pType) { if ( pType == CursorType.Look ) { throw new Exception("The "+typeof(HovercursorLeapInput)+" component does not support "+ "the use of "+typeof(CursorType)+"."+pType+"."); } if ( !vCursorMap.ContainsKey(pType) ) { vCursorMap.Add(pType, new InputCursor(pType)); vSideMap.Add(pType, CursorTypeUtil.IsLeft(pType)); } return vCursorMap[pType]; }
void IRenderWebBrowser.OnCursorChange(IntPtr cursor, CursorType type, CursorInfo customCursorInfo) { target.Cursor = new Cursor(cursor); }
internal static extern GlfwCursor glfwCreateStandardCursor(CursorType shape);
public Cursor(CursorType type) : this(GLFW.GLFW.CreateStandardCursor(type)) { }
/// <summary> /// Sets the cursor by the standard <see cref="CursorType"/>. /// </summary> /// <param name="type">The cursor type.</param> public static void SetCursor(CursorType type) { Game.Game.Window.SetCursor(new Cursor(type)); }
public void Create(CursorType cursor) { Control = new Gdk.Cursor(cursor.ToGdk()); }
void IWidgetBackend.SetCursor(CursorType cursorType) { Cursor = cursorType; }
// constructors /// <summary> /// Initializes a new instance of the <see cref="FindOptionsBase"/> class. /// </summary> public FindOptionsBase() { _cursorType = CursorType.NonTailable; }
/*--------------------------------------------------------------------------------------------*/ public ICursorData GetCursorData(CursorType pType) { return(GetCursorDataForInput(pType)); }
public override void Update(UpdateState state) { base.Update(state); if (!vm.Ready || vm.Context.Architecture == null) { return; } //handling smooth scaled zoom if (FSOEnvironment.Enable3D) { var s3d = ((WorldStateRC)World.State); s3d.Zoom3D += ((9.75f - (TargetZoom - 0.25f) * 10) - s3d.Zoom3D) / 10; } else { float BaseScale; WorldZoom targetZoom; if (TargetZoom < 0.5f) { targetZoom = WorldZoom.Far; BaseScale = 0.25f; } else if (TargetZoom < 1f) { targetZoom = WorldZoom.Medium; BaseScale = 0.5f; } else { targetZoom = WorldZoom.Near; BaseScale = 1f; } World.BackbufferScale = TargetZoom / BaseScale; if (World.State.Zoom != targetZoom) { World.State.Zoom = targetZoom; } WorldConfig.Current.SmoothZoom = false; } if (ActiveEntity == null || ActiveEntity.Dead || ActiveEntity.PersistID != SelectedSimID) { ActiveEntity = vm.Entities.FirstOrDefault(x => x is VMAvatar && x.PersistID == SelectedSimID); //try and hook onto a sim if we have none selected. //if (ActiveEntity == null) ActiveEntity = vm.Entities.FirstOrDefault(x => x is VMAvatar); if (!FoundMe && ActiveEntity != null) { vm.Context.World.State.CenterTile = new Vector2(ActiveEntity.VisualPosition.X, ActiveEntity.VisualPosition.Y); vm.Context.World.State.ScrollAnchor = null; FoundMe = true; } Queue.QueueOwner = ActiveEntity; } if (GotoObject == null) { GotoObject = vm.Context.CreateObjectInstance(GOTO_GUID, LotTilePos.OUT_OF_WORLD, Direction.NORTH, true).Objects[0]; } //update plumbbob var plumb = Content.Get().RCMeshes.Get("arrow.fsom"); foreach (VMAvatar avatar in vm.Context.ObjectQueries.Avatars) { if (avatar.Avatar == null) { continue; } var isActive = (avatar == ActiveEntity); if ((avatar.Avatar.HeadObject == plumb) != isActive) { avatar.Avatar.HeadObject = (avatar == ActiveEntity) ? plumb : null; avatar.Avatar.HeadObjectSpeedyVel = 0.2f; } avatar.Avatar.HeadObjectRotation += 3f / FSOEnvironment.RefreshRate; if (isActive) { avatar.Avatar.HeadObjectRotation += avatar.Avatar.HeadObjectSpeedyVel; avatar.Avatar.HeadObjectSpeedyVel *= 0.98f; } else if (avatar.GetValue(FSO.SimAntics.Model.VMStackObjectVariable.Category) == 87) { avatar.Avatar.HeadObject = Content.Get().RCMeshes.Get("star.fsom"); } } /* * if (ActiveEntity != null && BlockingDialog != null) * { * //are we still waiting on a blocking dialog? if not, cancel. * if (ActiveEntity.Thread != null && (ActiveEntity.Thread.BlockingState == null || !(ActiveEntity.Thread.BlockingState is VMDialogResult))) * { * BlockingDialog.Close(); * LastDialogID = 0; * BlockingDialog = null; * } * }*/ if (Visible) { if (ShowTooltip) { state.UIState.TooltipProperties.UpdateDead = false; } bool scrolled = false; if (RMBScroll) { World.State.ScrollAnchor = null; Vector2 scrollBy = new Vector2(); if (state.TouchMode) { scrollBy = new Vector2(RMBScrollX - state.MouseState.X, RMBScrollY - state.MouseState.Y); RMBScrollX = state.MouseState.X; RMBScrollY = state.MouseState.Y; scrollBy /= 128f; scrollBy /= FSOEnvironment.DPIScaleFactor; } else { scrollBy = new Vector2(state.MouseState.X - RMBScrollX, state.MouseState.Y - RMBScrollY); scrollBy *= 0.0005f; var angle = (Math.Atan2(state.MouseState.X - RMBScrollX, (RMBScrollY - state.MouseState.Y) * 2) / Math.PI) * 4; angle += 8; angle %= 8; CursorType type = CursorType.ArrowUp; switch ((int)Math.Round(angle)) { case 0: type = CursorType.ArrowUp; break; case 1: type = CursorType.ArrowUpRight; break; case 2: type = CursorType.ArrowRight; break; case 3: type = CursorType.ArrowDownRight; break; case 4: type = CursorType.ArrowDown; break; case 5: type = CursorType.ArrowDownLeft; break; case 6: type = CursorType.ArrowLeft; break; case 7: type = CursorType.ArrowUpLeft; break; } GameFacade.Cursor.SetCursor(type); } World.Scroll(scrollBy * (60f / FSOEnvironment.RefreshRate)); scrolled = true; } if (MouseIsOn) { if (state.MouseState.RightButton == ButtonState.Pressed) { if (RMBScroll == false) { RMBScroll = true; RMBScrollX = state.MouseState.X; RMBScrollY = state.MouseState.Y; } } else { if (!scrolled && GlobalSettings.Default.EdgeScroll && !state.TouchMode) { scrolled = World.TestScroll(state); } } } if (state.MouseState.RightButton != ButtonState.Pressed) { if (RMBScroll) { GameFacade.Cursor.SetCursor(CursorType.Normal); } RMBScroll = false; } if (!LiveMode && PieMenu != null) { PieMenu.RemoveSimScene(); this.Remove(PieMenu); PieMenu = null; } if (state.NewKeys.Contains(Keys.F8)) { UIMobileAlert alert = null; alert = new UIMobileAlert(new UIAlertOptions() { Title = "Debug Lot Thumbnail", Message = "Arch Value: " + VMArchitectureStats.GetArchValue(vm.Context.Architecture), Buttons = UIAlertButton.Ok((btn) => UIScreen.RemoveDialog(alert)) }); Texture2D roofless = null; var thumb = World.GetLotThumb(GameFacade.GraphicsDevice, (tex) => roofless = FSO.Common.Utils.TextureUtils.Decimate(tex, GameFacade.GraphicsDevice, 2, false)); thumb = FSO.Common.Utils.TextureUtils.Decimate(thumb, GameFacade.GraphicsDevice, 2, false); alert.SetIcon(thumb, thumb.Width, thumb.Height); UIScreen.GlobalShowDialog(alert, true); } if (LiveMode) { LiveModeUpdate(state, scrolled); } else if (CustomControl != null) { if (FSOEnvironment.SoftwareKeyboard) { CustomControl.MousePosition = new Point(UIScreen.Current.ScreenWidth / 2, UIScreen.Current.ScreenHeight / 2); } else { CustomControl.Modifiers = 0; if (state.CtrlDown) { CustomControl.Modifiers |= UILotControlModifiers.CTRL; } if (state.ShiftDown) { CustomControl.Modifiers |= UILotControlModifiers.SHIFT; } CustomControl.MousePosition = state.MouseState.Position; } CustomControl.Update(state, scrolled); } else { ObjectHolder.Update(state, scrolled); } //set cutaway around mouse UpdateCutaway(state); if (RMBScrollX == int.MinValue) { Dummy(); //cannon fodder for mono AOT compilation: never called but gives these constructors a meaning in life } } }
public CursorChangeEventArgs(IntPtr cursor, CursorType type, CursorInfo customCursorInfo) { Cursor = cursor; Type = type; CustomCursorInfo = customCursorInfo; }
public void OnCursorChange(IntPtr cursor, CursorType type, CursorInfo customCursorInfo) { CursorChange?.Invoke(this, new CursorChangeEventArgs(cursor, type, customCursorInfo)); }
protected virtual void OnCursorChange(IntPtr cursor, CursorType type, CursorInfo customCursorInfo) { RenderHandler?.OnCursorChange(cursor, type, customCursorInfo); }
/// <summary> /// Set the cursor (the mouse pointer image) to one of the pre-defined types /// </summary> /// <param name="cursorType">The type of the cursor to set.</param> public void SetCursor(CursorType cursorType) { CanvasImplementor.SetCursor(cursorType); }
public void SetActiveCursorType(CursorType cursorType) { SetActiveCursorAnimation(GetCursorAnimation(cursorType)); }
/// <summary> /// Set cursor style. /// </summary> /// <param name="type">What type of cursor to show.</param> public void SetCursor(CursorType type) { DataTypes.CursorTextureData data = Resources.CursorsData[(int)type]; SetCursor(Resources.Cursors[type], data.DrawWidth, new Point(data.OffsetX, data.OffsetY)); }
/// <summary> /// Called when the browser's cursor has changed. /// </summary> /// <param name="chromiumWebBrowser">the ChromiumWebBrowser control</param> /// <param name="browser">the browser object</param> /// <param name="cursor">If type is Custom then customCursorInfo will be populated with the custom cursor information</param> /// <param name="type">cursor type</param> /// <param name="customCursorInfo">custom cursor Information</param> /// <returns>Return true if the cursor change was handled or false for default handling.</returns> protected virtual bool OnCursorChange(IWebBrowser chromiumWebBrowser, IBrowser browser, IntPtr cursor, CursorType type, CursorInfo customCursorInfo) { return(false); }
public void Create(CursorType cursor) { Control = new Gdk.Cursor(Generator.Convert(cursor)); }
public void Update(UpdateState state, bool scrolled) { LastState = state; if (ShowTooltip) { state.UIState.TooltipProperties.UpdateDead = false; } MouseClicked = (MouseIsDown && (!MouseWasDown)); CursorType cur = CursorType.SimsMove; if (Holding != null) { if (Roommate) { cur = CursorType.SimsPlace; } if (state.KeyboardState.IsKeyDown(Keys.Delete)) { SellBack(null); } else if (state.KeyboardState.IsKeyDown(Keys.Escape)) { OnDelete(Holding, null); ClearSelected(); } } if (Holding != null && Roommate) { if (MouseClicked) { Holding.Clicked = true; } if (MouseIsDown && Holding.Clicked) { bool updatePos = MouseClicked; int xDiff = state.MouseState.X - MouseDownX; int yDiff = state.MouseState.Y - MouseDownY; cur = CursorType.SimsRotate; if (Math.Sqrt(xDiff * xDiff + yDiff * yDiff) > 64) { var from = World.EstTileAtPosWithScroll(new Vector2(MouseDownX, MouseDownY)); var target = World.EstTileAtPosWithScroll(state.MouseState.Position.ToVector2()); var vec = target - from; var dir = Math.Atan2(vec.Y, vec.X); dir += Math.PI / 2; if (dir < 0) { dir += Math.PI * 2; } var newDir = (Direction)(1 << (((int)Math.Round(dir / (Math.PI / 2)) % 4) * 2)); if (newDir != Holding.Dir || MouseClicked) { updatePos = true; HITVM.Get().PlaySoundEvent(UISounds.ObjectRotate); Holding.Dir = newDir; DirChanged = true; } } if (updatePos) { MoveSelected(Holding.TilePos, Holding.Level); if (!Holding.IsBought && Holding.CanPlace == VMPlacementError.Success && ParentControl.ActiveEntity != null && ParentControl.ActiveEntity.TSOState.Budget.Value < Holding.Price) { Holding.CanPlace = VMPlacementError.InsufficientFunds; } if (Holding.CanPlace != VMPlacementError.Success) { state.UIState.TooltipProperties.Show = true; state.UIState.TooltipProperties.Color = Color.Black; state.UIState.TooltipProperties.Opacity = 1; state.UIState.TooltipProperties.Position = new Vector2(MouseDownX, MouseDownY); state.UIState.Tooltip = GameFacade.Strings.GetString("137", "kPErr" + Holding.CanPlace.ToString() + ((Holding.CanPlace == VMPlacementError.CannotPlaceComputerOnEndTable) ? "," : "")); // comma added to curcumvent problem with language file. We should probably just index these with numbers? state.UIState.TooltipProperties.UpdateDead = false; ShowTooltip = true; HITVM.Get().PlaySoundEvent(UISounds.Error); } else { state.UIState.TooltipProperties.Show = false; state.UIState.TooltipProperties.Opacity = 0; ShowTooltip = false; } } } else { var scaled = GetScaledPoint(state.MouseState.Position); var tilePos = World.EstTileAtPosWithScroll(new Vector2(scaled.X, scaled.Y) / FSOEnvironment.DPIScaleFactor) + Holding.TilePosOffset; MoveSelected(tilePos, 1); } } else if (MouseClicked) { //not holding an object, but one can be selected var newHover = World.GetObjectIDAtScreenPos(state.MouseState.X, state.MouseState.Y, GameFacade.GraphicsDevice); if (MouseClicked && (newHover != 0) && (vm.GetObjectById(newHover) is VMGameObject)) { var objGroup = vm.GetObjectById(newHover).MultitileGroup; var objBasePos = objGroup.BaseObject.Position; var success = (Roommate || objGroup.SalePrice > -1)?objGroup.BaseObject.IsUserMovable(vm.Context, false): VMPlacementError.ObjectNotOwnedByYou; if (GameFacade.EnableMod) { success = VMPlacementError.Success; } if (objBasePos.Level != World.State.Level) { success = VMPlacementError.CantEffectFirstLevelFromSecondLevel; } if (success == VMPlacementError.Success) { var ghostGroup = vm.Context.GhostCopyGroup(objGroup); var canDelete = GameFacade.EnableMod || (objGroup.BaseObject.IsUserMovable(vm.Context, true)) == VMPlacementError.Success; SetSelected(ghostGroup); Holding.RealEnt = objGroup.BaseObject; Holding.CanDelete = canDelete; Holding.MoveTarget = newHover; Holding.TilePosOffset = new Vector2(objBasePos.x / 16f, objBasePos.y / 16f) - World.EstTileAtPosWithScroll(new Vector2(state.MouseState.X, state.MouseState.Y) / FSOEnvironment.DPIScaleFactor); if (OnPickup != null) { OnPickup(Holding, state); } //ExecuteEntryPoint(12); //User Pickup } else { ShowErrorAtMouse(state, success); } } } if (ParentControl.MouseIsOn && !ParentControl.RMBScroll) { GameFacade.Cursor.SetCursor(cur); } MouseWasDown = MouseIsDown; }
/// <summary> /// Called when the browser's cursor has changed. /// </summary> /// <param name="cursor">If type is Custom then customCursorInfo will be populated with the custom cursor information</param> /// <param name="type">cursor type</param> /// <param name="customCursorInfo">custom cursor Information</param> public virtual void OnCursorChange(IntPtr cursor, CursorType type, CursorInfo customCursorInfo) { }
public void SetCursor(CursorType cursor) { AllocEventBox(); CurrentCursor = cursor; Gdk.Cursor gc; if (!gtkCursors.TryGetValue(cursor, out gc)) { Gdk.CursorType ctype; if (cursor == CursorType.Arrow) { ctype = Gdk.CursorType.LeftPtr; } else if (cursor == CursorType.Crosshair) { ctype = Gdk.CursorType.Crosshair; } else if (cursor == CursorType.Hand) { ctype = Gdk.CursorType.Hand1; } else if (cursor == CursorType.IBeam) { ctype = Gdk.CursorType.Xterm; } else if (cursor == CursorType.ResizeDown) { ctype = Gdk.CursorType.BottomSide; } else if (cursor == CursorType.ResizeUp) { ctype = Gdk.CursorType.TopSide; } else if (cursor == CursorType.ResizeLeft) { ctype = Gdk.CursorType.LeftSide; } else if (cursor == CursorType.ResizeRight) { ctype = Gdk.CursorType.RightSide; } else if (cursor == CursorType.ResizeLeftRight) { ctype = Gdk.CursorType.SbHDoubleArrow; } else if (cursor == CursorType.ResizeUpDown) { ctype = Gdk.CursorType.SbVDoubleArrow; } else { ctype = Gdk.CursorType.Arrow; } gtkCursors [cursor] = gc = new Gdk.Cursor(ctype); } gdkCursor = gc; if (EventsRootWidget.GdkWindow == null) { SubscribeRealizedEvent(); } else { EventsRootWidget.GdkWindow.Cursor = gc; } }
/// <summary> /// Sets the cursor type. /// </summary> /// <param name="cursorType">The cursor type.</param> public void SetCursorType(CursorType cursorType) { }
void IRenderHandler.OnCursorChange(IntPtr cursor, CursorType type, CursorInfo customCursorInfo) { }
/// <summary> /// Called when the browser's cursor has changed. . /// </summary> /// <param name="cursor">If type is Custom then customCursorInfo will be populated with the custom cursor information</param> /// <param name="type">cursor type</param> /// <param name="customCursorInfo">custom cursor Information</param> void IRenderWebBrowser.OnCursorChange(IntPtr cursor, CursorType type, CursorInfo customCursorInfo) { RenderHandler?.OnCursorChange(cursor, type, customCursorInfo); }
public void CreateCommand_should_return_expected_result_when_cursor_is_tailableAwait(CursorType value, string awaitJson) { var subject = new FindCommandOperation <BsonDocument>(_collectionNamespace, BsonDocumentSerializer.Instance, _messageEncoderSettings); subject.CursorType = value; var reflector = new Reflector(subject); var serverDescription = CreateServerDescription(); var result = reflector.CreateCommand(serverDescription, null); result.Should().Be($"{{ find : '{_collectionNamespace.CollectionName}', tailable : true{awaitJson} }}"); }
private void SetCursor(CursorType type) { CursorMapping mapping = GetCursorMapping(type); Cursor.SetCursor(mapping.texture, mapping.hotspot, CursorMode.Auto); }
/// <inheritdoc/> bool IDisplayHandler.OnCursorChange(IWebBrowser chromiumWebBrowser, IBrowser browser, IntPtr cursor, CursorType type, CursorInfo customCursorInfo) { return(OnCursorChange(chromiumWebBrowser, browser, cursor, type, customCursorInfo)); }