public void testGridSnappingMove(ISpriteEditorObject spriteToTest) { if ((mAxes.CursorPushedOnAxis || spriteToTest != null) && GameData.EditorProperties.SnapToGrid) { double x = (spriteToTest).X; double y = (spriteToTest).Y; double z = (spriteToTest).Z; spriteToTest.X = ((int)(x / GameData.EditorProperties.SnappingGridSize)) * GameData.EditorProperties.SnappingGridSize; spriteToTest.Y = ((int)(y / GameData.EditorProperties.SnappingGridSize)) * GameData.EditorProperties.SnappingGridSize; spriteToTest.Z = ((int)(z / GameData.EditorProperties.SnappingGridSize)) * GameData.EditorProperties.SnappingGridSize; } }
/// <summary> /// Sets the Stored values to the Sprite's actual values and adds the Sprite and its Texture2D to the ListWindow /// </summary> /// <param name="spriteToSetAndAdd"></param> /// <param name="pixelSize"></param> public static void SetStoredAddToSE(ISpriteEditorObject spriteToSetAndAdd, float pixelSize) { if (pixelSize > 0) { spriteToSetAndAdd.PixelSize = pixelSize; } // if the Sprite references a null texture, we don't want to try to add that null texture to the texture box if (spriteToSetAndAdd is Sprite) { if (((Sprite)spriteToSetAndAdd).Texture != null) { GuiData.ListWindow.Add(((Sprite)spriteToSetAndAdd).Texture); } mScene.Sprites.Add((Sprite)spriteToSetAndAdd); UndoManager.AddToThisFramesUndo(new AddSpriteUndo(spriteToSetAndAdd as Sprite)); } ListUnlistedAnimationChains(); }