示例#1
0
        private void ClipSprite <TSurface, TSource>(string spriteName, string spritesheet, Rectangle spriteBounds, IGraphicsContext <TSurface, TSource> graphicsContext, ISpriteManager <TSource> spriteManager)
        {
            TSurface target = graphicsContext.CreateTarget(spriteBounds.Width, spriteBounds.Height);

            graphicsContext.Draw(spriteManager[spritesheet], target, new Rectangle(0, 0, spriteBounds.Width, spriteBounds.Height), spriteBounds);
            spriteManager[spriteName] = graphicsContext.TargetToSource(target);
        }
示例#2
0
        internal void UpdateLayers(IRenderingUnit renderingUnit)
        {
            this.renderingUnit = renderingUnit;

            foreach (KeyValuePair <string, TSurface> pair in layers)
            {
                GraphicsContext.DisposeSurface(pair.Value);
            }
            layers.Clear();

            foreach (IRenderingLayer layer in renderingUnit.Layers.Values)
            {
                layers.Add(layer.Name, GraphicsContext.CreateTarget(layer.LayerSize.Width, layer.LayerSize.Height));
            }

            /*ScreenResolution.Width = LockedResolutionWidth;
             * ScreenResolution.Height = (int)(newSize.Height / ((float)newSize.Width / LockedResolutionWidth));
             *
             * if (View != null) graphicsContext.DisposeSurface(View);
             * View = graphicsContext.CreateTarget(ScreenResolution.Width + 1, ScreenResolution.Height + 1);*/
        }
示例#3
0
 public TSurface CreateTarget(int width, int height) => GraphicsContext.CreateTarget(width, height);