/// <summary>Function called during resource creation.</summary> /// <param name="context">The current application graphics context.</param> /// <param name="swapChain">The swap chain for presenting the rendered data.</param> protected override void OnCreateResources(IGraphicsContext context, GorgonSwapChain swapChain) { _axisFont = context.FontFactory.GetFont(new GorgonFontInfo("Segoe UI", 12, FontHeightMode.Points, "Segoe UI Bold 12pt - Axis Font") { OutlineColor1 = GorgonColor.Black, OutlineColor2 = GorgonColor.Black, OutlineSize = 3, FontStyle = FontStyle.Bold }); _selectionRect = new MarchingAnts(context.Renderer2D); }
/// <summary>Initializes a new instance of the <see cref="T:Gorgon.Editor.SpriteEditor.SpriteContentRenderer"/> class.</summary> /// <param name="sprite">The sprite view model.</param> /// <param name="graphics">The graphics interface for the application.</param> /// <param name="swapChain">The swap chain for the render area.</param> /// <param name="renderer">The 2D renderer for the application.</param> /// <param name="pickClipper">The sprite picker used to automatically clip sprite data.</param> /// <param name="ants">The marching ants rectangle used to draw selection rectangles.</param> /// <param name="initialZoom">The initial zoom value.</param> public SpritePickRenderer(ISpriteContent sprite, GorgonGraphics graphics, GorgonSwapChain swapChain, Gorgon2D renderer, IPickClipperService pickClipper, IMarchingAnts ants, float initialZoom) : base(sprite, graphics, swapChain, renderer, initialZoom) { _marchAnts = ants; _picker = pickClipper; _picker.PointFromClient = p => { DX.Vector2 pos = FromClient(p); return(new DX.Vector2((int)pos.X, (int)pos.Y)); }; }
/// <summary>Initializes a new instance of the <see cref="T:Gorgon.Editor.SpriteEditor.DefaultSpriteRenderer"/> class.</summary> /// <param name="sprite">The sprite view model.</param> /// <param name="graphics">The graphics interface for the application.</param> /// <param name="swapChain">The swap chain for the render area.</param> /// <param name="renderer">The 2D renderer for the application.</param> /// <param name="ants">The marching ants rectangle used to draw selection rectangles.</param> /// <param name="initialScale">The initial scaling value to apply to the render.</param> public DefaultSpriteRenderer(ISpriteContent sprite, GorgonGraphics graphics, GorgonSwapChain swapChain, Gorgon2D renderer, IMarchingAnts ants, float initialScale) : base(sprite, graphics, swapChain, renderer, initialScale) { _marchAnts = ants; _workingSprite = new GorgonSprite { Texture = sprite.Texture, TextureRegion = sprite.TextureCoordinates, TextureArrayIndex = TextureArrayIndex, Size = sprite.Size, Scale = DX.Vector2.One, Anchor = DX.Vector2.Zero }; for (int i = 0; i < 4; ++i) { _workingSprite.CornerColors[i] = sprite.VertexColors[i]; _workingSprite.CornerOffsets[i] = sprite.VertexOffsets[i]; } UpdateWorkingSprite(); }