Exemple #1
0
        public IActionResult Post([FromBody] DrawRequest request)
        {
            try
            {
                // ツモ
                request.Attach();
                request.Position = RoomManager.Get(request.RoomKey).NextPosition;
                var response = DiProvider.GetContainer().GetInstance <DrawReceiver>().Receive(request);

                // ツモで上がれるかの判定
                var analyzeRequest = DiProvider.GetContainer().GetInstance <DrawWinnableAnalyzeRequest>();
                analyzeRequest.ShallowImport(request);
                analyzeRequest.DrawTile = response.Tile;
                analyzeRequest.Attach();
                var drawWinnableInfo = DiProvider.GetContainer().GetInstance <DrawWinnableAnalyzeReceiver>().Receive(analyzeRequest);
                response.DrawWinnableInfo = drawWinnableInfo;

                RoomManager.Get(request.RoomKey).NextPosition = response.NextPosition;
                response.Detach(request.RoomKey);

                // 通知
                this.NotifyRoomContext(request.RoomKey);

                return(Ok(response));
            }
            catch (Exception ex)
            {
                FileHelper.WriteLine(ex.ToString());
                throw ex;
            }
        }
        /// <summary>
        /// Draws the control.
        /// </summary>
        protected override void Draw()
        {
            GraphicsDevice.Clear(Color.Black);
            if (_background != null)
            {
                float       scaledWidth       = this.Width / (float)_background.Width;
                float       scaledHeight      = this.Height / (float)_background.Height;
                DrawRequest backgroundRequest = new DrawRequest(_background, Vector2.Zero,
                                                                null, 0, new Vector2(scaledWidth, scaledHeight), Vector2.Zero, false, Color.White, false, false, null);
                DrawingManager.DrawOnLayer(backgroundRequest, 10, DrawingBlendingType.Alpha);
            }
            _ppAnim.Update(1 / 60f);
            _parent = Parent as PostProcessAnimationEditor;
            // if the animation was paused externally, pause it in the GUI
            if (_ppAnim.IsPaused == true && _parent.toolStripButtonPause.Enabled == true)
            {
                _parent.toolStripButtonPause_Click(null, EventArgs.Empty);
            }
            // if the animation was stopped externally, stop it in the GUI
            if (_ppAnim.IsStopped == true && _parent.toolStripButtonStop.Enabled == true)
            {
                _parent.toolStripButtonStop_Click(null, EventArgs.Empty);
            }
            int oldLayer = _ppAnim.Layer;

            _ppAnim.Draw(1 / 60f);
            _ppAnim.Layer = oldLayer;
            DrawingManager.ViewPortSize = new Point(this.Width, this.Height);
            MilkshakeForm.SwapCameraAndRenderScene(ParentEditor.ZoomBox.Camera);
            ((PostProcessAnimationEditor)this.Parent).Update(1 / 60f);
        }
        /// <summary>
        /// Draws the control.
        /// </summary>
        protected override void Draw()
        {
            ParentEditor.ZoomBox.Camera.Update(1 / 60f);
            if (particleEffect.Position != updatedPosition)
            {
                particleEffect.Position = updatedPosition;
            }
            particleEffect.Update(1 / 60f);
            _parent = Parent as ParticleEffectEditor;
            // if the animation was paused externally, pause it in the GUI
            if (particleEffect.Emitter.IsPaused == true && _parent.toolStripButtonPause.Enabled == true)
            {
                _parent.toolStripButtonPause_Click(null, EventArgs.Empty);
            }
            // if the animation was stopped externally, stop it in the GUI
            if (particleEffect.Emitter.IsStopped == true && _parent.toolStripButtonStop.Enabled == true)
            {
                _parent.toolStripButtonStop_Click(null, EventArgs.Empty);
            }
            if (background != null)
            {
                DrawRequest backgroundRequest = new DrawRequest(background, Vector2.Zero, false,
                                                                null, 0, Vector2.One, new Vector2(0.5f), true, Color.White, false, false, null);
                DrawingManager.DrawOnLayer(backgroundRequest, 10, DrawingBlendingType.Alpha);
            }
            particleEffect.Draw(1f);
            GraphicsDevice.Clear(backgroundColor);

            DrawingManager.ViewPortSize = new Point(this.Width, this.Height);
            SquidEditorForm.SwapCameraAndRenderScene(ParentEditor.ZoomBox.Camera);
            ParentEditor.Update(1 / 60f);
        }
Exemple #4
0
        /// <inheritdoc />
        public async Task <IEnumerable <OpenDraw> > GetOpenDraws(DrawRequest request)
        {
            var draws = await _openDrawsRepository.PostAsync(request);

            ValidateResponse(draws);
            return(draws.Draws);
        }
 protected void DrawTiles()
 {
     if (_highlightedTile > -1)
     {
         Point pos         = GetPosOfTile(_highlightedTile);
         int   halfPadding = _padding / 2;
         pos.X -= halfPadding - this.AutoScrollPosition.X;
         pos.Y -= halfPadding - this.AutoScrollPosition.Y;
         DrawingManager.DrawFilledRectangle(ParentGrid.Layer, new Vector2(pos.X, pos.Y),
                                            new Vector2(ParentGrid.TileSize.X + _padding, ParentGrid.TileSize.Y + _padding),
                                            Color.DarkGray, ParentGrid.BlendingType);
     }
     if (TileGridEditor.Instance.SelectedBrushTile > -1)
     {
         Point pos         = GetPosOfTile(TileGridEditor.Instance.SelectedBrushTile);
         int   halfPadding = _padding / 2;
         pos.X -= halfPadding - this.AutoScrollPosition.X;
         pos.Y -= halfPadding - this.AutoScrollPosition.Y;
         DrawingManager.DrawFilledRectangle(ParentGrid.Layer, new Vector2(pos.X, pos.Y),
                                            new Vector2(ParentGrid.TileSize.X + _padding, ParentGrid.TileSize.Y + _padding),
                                            Color.White, ParentGrid.BlendingType);
     }
     for (int i = 0; i < _rowsCountOnTexture * ParentGrid.ColumnsCountOnTexture; i++)
     {
         DrawRequest drawRequest = default(DrawRequest);
         drawRequest.scaleRatio = Vector2.One;
         drawRequest.tint       = Color.White;
         drawRequest.texture    = ParentGrid.Material.Texture;
         Point pos = GetPosOfTile(i);
         drawRequest.position.X      = pos.X + this.AutoScrollPosition.X;
         drawRequest.position.Y      = pos.Y + this.AutoScrollPosition.Y;
         drawRequest.sourceRectangle = ParentGrid.GetSourceRectOfTile(i);
         DrawingManager.DrawOnLayer(drawRequest, 1, DrawingBlendingType.Alpha);
     }
 }
Exemple #6
0
 public void Clean(DrawRequest request)
 {
     if (request?.sprite is ICharSprite s)
     {
         s.Draw(CleanerRenderer, (int)request.X, (int)request.Y);
     }
 }
Exemple #7
0
        /// <inheritdoc />
        public async Task <IEnumerable <CurrentDraw> > GetCurrentDraws(DrawRequest request)
        {
            var draws = await _currentDrawRepository.PostAsync(request);

            ValidateResponse(draws);
            return(draws.CurrentDraws);
        }
Exemple #8
0
        public void Drawing_ValidatingInput_CatchNullDrawStage()
        {
            var messenger          = Substitute.For <IFrameworkMessenger>();
            var renderStageManager = Substitute.For <IRenderStageManager>();
            var renderStageVisitor = Substitute.For <IRenderStageVisitor>();
            var fontManager        = Substitute.For <IFontManager>();
            var gpuSurfaceManager  = Substitute.For <IGpuSurfaceManager>();

            IDrawing drawing = new Drawing(messenger,
                                           renderStageManager,
                                           renderStageVisitor,
                                           fontManager,
                                           gpuSurfaceManager);

            IDrawStage stage = null;

            var request = new DrawRequest
            {
                Colour          = Colour.White,
                CoordinateSpace = CoordinateSpace.Screen,
                Depth           = 0.0f,
                FillType        = FillType.Coloured,
                Indices         = new int[] { 0, 1, 2 },
                Layer           = 0,
                Texture0        = new TextureReference(1UL),
                Texture1        = new TextureReference(2UL),
                TextureWrap0    = TextureCoordinateMode.Mirror,
                TextureWrap1    = TextureCoordinateMode.Mirror,
                Vertices        = new Vertex2D[] { new Vertex2D(), new Vertex2D(), new Vertex2D() }
            };

            Assert.Throws <Yak2DException>(() => { drawing.Draw(stage, ref request, false); });
        }
Exemple #9
0
        public void Draw(ulong stage,
                         CoordinateSpace target,
                         FillType type,
                         Vertex2D[] vertices,
                         int[] indices,
                         Colour colour,
                         ulong texture0,
                         ulong texture1,
                         TextureCoordinateMode texWrap0,
                         TextureCoordinateMode texWrap1,
                         float depth,
                         int layer,
                         bool validate = false)
        {
            var request = new DrawRequest
            {
                CoordinateSpace = target,
                FillType        = type,
                Vertices        = vertices,
                Indices         = indices,
                Colour          = colour,
                Texture0        = WrapTextureId(texture0),
                Texture1        = WrapTextureId(texture1),
                TextureWrap0    = texWrap0,
                TextureWrap1    = texWrap1,
                Depth           = depth,
                Layer           = layer
            };

            Draw(stage, ref request, validate);
        }
        /// <summary>
        /// Sets up the open draws repository to return the required information for a specific test
        /// </summary>
        private void ConfigureOpenRepository(OpenDrawResponse openDrawResponse, DrawRequest request = null)
        {
            Mock <OpenDrawsRepository> openRepoMock = new Mock <OpenDrawsRepository>();

            openRepoMock.Setup(x => x.PostAsync(request ?? It.IsAny <DrawRequest>()))
            .Returns(Task.FromResult(openDrawResponse));
        }
        public async Task <ObjectResult> Open([FromBody] DrawRequest request)
        {
            IEnumerable <OpenDraw> response = null;

            try
            {
                // If the basic request has not been supplied properly, exit straight away
                if (!request.IsValid())
                {
                    return(BadRequestResult());
                }

                response = await _lottoDrawService.GetOpenDraws(request);
            }
            catch (InvalidDataException ide)
            {
                return(BadRequest($"Invalid Request: {ide.Message}"));
            }
            catch (Exception ex) // In the case of an internal server error, return a general 500 (generally would log this).
            {
                Console.WriteLine(ex.Message);
                return(StatusCode(500, response));
            }

            return(new OkObjectResult(response));
        }
Exemple #12
0
        /// <summary>
        ///     Creates a new draw by copying the supplied pixel data over
        ///     to the Display's TextureData.
        /// </summary>
        /// <param name="pixelData"></param>
        /// <param name="x"></param>
        /// <param name="y"></param>
        /// <param name="width"></param>
        /// <param name="height"></param>
        /// <param name="layer"></param>
        /// <param name="flipH">
        ///     This is an optional argument which accepts a bool. The default value is set to false but passing in true flips
        ///     the pixel data horizontally.
        /// </param>
        /// <param name="flipV">
        ///     This is an optional argument which accepts a bool. The default value is set to false but passing in true flips
        ///     the pixel data vertically.
        /// </param>
        /// <param name="colorOffset"></param>
        /// <param name="layerOrder"></param>
        public void NewDrawCall(int[] pixelData, int x, int y, int width, int height, int layer = 0, bool flipH = false, bool flipV = false, int colorOffset = 0)
        {
            if (layer >= layers)
            {
                // This can happen as the old system wasn't very strict.
                // TODO: Handle "out of bounds" layer accesses properly!
                var sizeOld = layers;
                Array.Resize(ref drawRequestLayers, layer + 1);
                for (var i = layers - 1; i >= sizeOld; i--)
                {
                    drawRequestLayers[i] = new List <DrawRequest>();
                }
            }

            draw             = NextDrawRequest();
            draw.x           = x;
            draw.y           = y;
            draw.width       = width;
            draw.height      = height;
            draw.pixelData   = pixelData;
            draw.flipH       = flipH;
            draw.flipV       = flipV;
            draw.colorOffset = colorOffset;
            drawRequestLayers[layer].Add(draw);
        }
Exemple #13
0
        public void Draw(float elapsed)
        {
            if (this.Parent.Material == null)
            {
                return;
            }
            DrawRequest _drawRequest = new DrawRequest();

            _drawRequest.texture    = this.Parent.Material.Texture;
            _drawRequest.position   = this.Parent.Position;
            _drawRequest.rotation   = this.Parent.Rotation;
            _drawRequest.scaleRatio = this.Parent.Scale;
            if (this.AnimationFrames != null && this.AnimationFrames.Count > _currentFrameIndex &&
                this.Parent.Material.Areas.ContainsKey(this.AnimationFrames[_currentFrameIndex].Area))
            {
                _drawRequest.sourceRectangle = this.Parent.Material.
                                               Areas[this.AnimationFrames[_currentFrameIndex].Area];
            }
            else
            {
                _drawRequest.sourceRectangle = null;
            }
            _drawRequest.pivot           = this.Parent.Pivot;
            _drawRequest.isPivotRelative = this.Parent.IsPivotRelative;
            _drawRequest.tint            = this.Parent.Tint;
            _drawRequest.hFlip           = this.Parent.FlipHorizontal;
            _drawRequest.vFlip           = this.Parent.FlipVertical;
            DrawingManager.DrawOnLayer(_drawRequest, this.Parent.Layer, this.Parent.BlendingType);
        }
Exemple #14
0
        public void LoadTexture(string path)
        {
            System.IO.FileStream fs = new System.IO.FileStream(path, System.IO.FileMode.Open);
            _texture = Texture2D.FromStream(GraphicsDevice, fs);
            fs.Close();

            _drawRequest = new DrawRequest(_texture, Vector2.Zero, false, null, 0, Vector2.One, Vector2.Zero, false, Color.White, false, false, null);
        }
        public double CalculateDefaultScale(DrawRequest request)
        {
            var bmp    = request.Image.Bmp;
            var scaleX = request.PictureWidth / bmp.Width;
            var scaleY = request.PictureHeight / bmp.Height;

            return(Math.Min(scaleX, scaleY));
        }
Exemple #16
0
        public void Draw(IDrawStage stage, ref DrawRequest request, bool validate = false)
        {
            if (stage == null)
            {
                throw new Yak2DException("Draw request failed. Null Draw Stage");
            }

            Draw(stage.Id, ref request, validate);
        }
Exemple #17
0
        public override void Draw(float elapsed)
        {
            if (!this.Visible)
            {
                return;
            }

            // Draw in reverse order from the list
            for (int i = TileLayers.Count - 1; i >= 0; i--)
            {
                TileLayer layer = TileLayers[i];
                if (!layer.Visible)
                {
                    continue;
                }
                for (int y = _visibleTiles.Top; y < _visibleTiles.Bottom; y++)
                {
                    for (int x = _visibleTiles.Left; x < _visibleTiles.Right; x++)
                    {
                        Tile tile = layer.Tiles[x][y];
                        if (tile.Index != -1)
                        {
                            Vector2 drawPos = _scaledTilePivot;
                            drawPos.X += (float)x * _scaledTileSize.X;
                            drawPos.Y += (float)y * _scaledTileSize.Y;
                            if (this.Rotation != 0)
                            {
                                drawPos = Vector2.Transform(drawPos, _rotationMatrix);
                            }
                            drawPos -= _scaledPivot;

                            DrawRequest _drawRequest = new DrawRequest();
                            _drawRequest.texture         = this.Material.Texture;
                            _drawRequest.position        = this.Position + drawPos;
                            _drawRequest.rotation        = tile.Rotation * MathHelper.PiOver2 + this.Rotation;
                            _drawRequest.pivot           = _tilePivot;
                            _drawRequest.isPivotRelative = false;
                            _drawRequest.hFlip           = tile.HFlip;
                            _drawRequest.vFlip           = tile.VFlip;
                            _drawRequest.sourceRectangle = GetSourceRectOfTile(tile.Index);

                            if (tile.Rotation == 1 || tile.Rotation == 3)
                            {
                                _drawRequest.scaleRatio = _rotatedScale;
                            }
                            else
                            {
                                _drawRequest.scaleRatio = Scale;
                            }
                            _drawRequest.tint = this.Tint;
                            DrawingManager.DrawOnLayer(_drawRequest, this.Layer, this.BlendingType);
                        }
                    }
                }
            }
        }
 public override Bitmap Paint(Bitmap bitmap, DrawRequest request)
 {
     if (request.AnalyzeResults != null && request.AnalyzeResults.ImageResults.ContainsKey(request.Image.Index))
     {
         var result   = request.AnalyzeResults.ImageResults[request.Image.Index];
         var vertexes = ColorHelper.CalculateStrainColorsXY(request.Max, request.Min, result.Vertexes);
         return(Paint(bitmap, vertexes));
     }
     return(bitmap);
 }
 /// <summary>
 ///     Creates a new draw by copying the supplied pixel data over
 ///     to the Display's TextureData.
 /// </summary>
 /// <param name="pixelData"></param>
 /// <param name="x"></param>
 /// <param name="y"></param>
 /// <param name="width"></param>
 /// <param name="height"></param>
 /// <param name="layer"></param>
 /// <param name="colorOffset"></param>
 /// <param name="layerOrder"></param>
 public void NewDrawCall(int[] pixelData, int x, int y, int width, int height, int layer = 0, int colorOffset = 0)
 {
     draw             = NextDrawRequest();
     draw.x           = x;
     draw.y           = y;
     draw.width       = width;
     draw.height      = height;
     draw.pixelData   = pixelData;
     draw.layer       = layer;
     draw.colorOffset = colorOffset;
     drawRequests.Add(draw);
 }
Exemple #20
0
 public void DrawSprite(DrawRequest request)
 {
     if (request?.sprite is ICharSprite s)
     {
         request.TranslateTransform(Width / 2, Heigth / 2, 0);
         DynamicRenderer.Reset();
         foreach (var filter in request.Filters)
         {
             filter.Apply(DynamicRenderer);
         }
         s.Draw(DynamicRenderer, (int)request.X, (int)request.Y);
     }
 }
        public void draw(object sender, PaintEventArgs e)
        {
            IntPtr      dc    = e.Graphics.GetHdc();
            DrawRequest drawR = new DrawRequest();

            drawR.hdc    = dc;
            drawR.left   = 0;
            drawR.right  = renderingPanel.Width;
            drawR.top    = 0;
            drawR.bottom = renderingPanel.Height;
            renderer.draw(drawR);
            e.Graphics.ReleaseHdc(dc);
        }
 public Bitmap Paint(Bitmap bitmap, DrawRequest request)
 {
     if (request.AnalyzeResults != null && request.AnalyzeResults.ImageResults.ContainsKey(request.Image.Index))
     {
         var result = request.AnalyzeResults.ImageResults[request.Image.Index];
         var g      = Graphics.FromImage(bitmap);
         foreach (var point in result.Vertexes)
         {
             g.DrawRectangle(_rectanglePen, new Rectangle(point.X - request.SubsetDelta, point.Y - request.SubsetDelta, request.SubsetDelta * 2, request.SubsetDelta * 2));
             g.DrawEllipse(_elipsePen, new Rectangle(point.X, point.Y, 1, 1));
         }
     }
     return(bitmap);
 }
Exemple #23
0
 public Sprite()
     : base()
 {
     _blendingType            = DrawingBlendingType.Alpha;
     _drawRequest             = default(DrawRequest);
     _drawRequest.tint        = Color.White;
     _drawRequest.scaleRatio  = Vector2.One;
     this.MaterialArea        = "";
     _useTilingSafeBorders    = false;
     this.AutoScroll          = false;
     this.AutoScrollSpeed     = 0;
     this.AutoScrollArea      = 0;
     this.AutoScrollVertical  = false;
     this.AutoScrollMirroring = false;
 }
Exemple #24
0
        public DrawRequest NextDrawRequest()
        {
            var request = new DrawRequest();

            if (drawRequestPixelDataPool.Count > 0)
            {
                request.pixelData = drawRequestPixelDataPool.Pop();
            }
            else
            {
                request.pixelData = new int[0];
            }

            return(request);
        }
Exemple #25
0
        public DrawRequest NextDrawRequest()
        {
            DrawRequest request;

            if (drawRequestPool.Count > 0)
            {
                request = drawRequestPool[0];
                drawRequestPool.Remove(request);
            }
            else
            {
                request = new DrawRequest();
            }

            return(request);
        }
Exemple #26
0
 public Bitmap Paint(Bitmap bitmap, DrawRequest request)
 {
     if (request.AnalyzeResults != null && request.AnalyzeResults.ImageResults.ContainsKey(request.Image.Index))
     {
         var result         = request.AnalyzeResults.ImageResults[request.Image.Index];
         var startingPoints = request.AnalyzeResults.StartingVertexes;
         var g = Graphics.FromImage(bitmap);
         foreach (var(endpoint, index) in result.Vertexes.WithIndex())
         {
             _arrowPen.StartCap = LineCap.Flat;
             _arrowPen.EndCap   = LineCap.ArrowAnchor;
             g.DrawLine(_arrowPen, startingPoints[index].Point, endpoint.Point);
         }
     }
     return(bitmap);
 }
Exemple #27
0
        public void DrawTilemap(int x = 0, int y = 0, int columns = 0, int rows = 0)
        {
            // Set the draw flag to true
            drawTilemapFlag = true;

            if (tilemapDrawRequest == null)
            {
                tilemapDrawRequest = new DrawRequest();
            }

            // Convert tile width and height to pixel width and height
            tilemapDrawRequest.width  = columns <= 0 ? width - overscanXPixels : columns * tilemapChip.tileWidth;
            tilemapDrawRequest.height = rows <= 0 ? height - overscanYPixels : rows * tilemapChip.tileHeight;

            // save the starting x,y position to render the map on the screen
            tilemapDrawRequest.x = x;
            tilemapDrawRequest.y = y;
        }
Exemple #28
0
        /// <summary>
        ///     This clears the display. It will write a background color from the
        ///     <see cref="ScreenBufferChip" /> into the internal
        ///     screenBufferData or us 0 if no <see cref="ScreenBufferChip" /> is
        ///     found.
        /// </summary>
        /// <summary>
        ///     This triggers the renderer to clear an area of the display.
        /// </summary>
        public void ClearArea(int x = 0, int y = 0, int blockWidth = 0, int blockHeight = 0)
        {
            // Create new clear draw request instance
            if (clearDrawRequest == null)
            {
                clearDrawRequest = new DrawRequest();
            }

            // Configure the clear draw request
            clearDrawRequest.x      = x;
            clearDrawRequest.y      = y;
            clearDrawRequest.width  = blockWidth <= 0 ? width - overscanXPixels : blockWidth;
            clearDrawRequest.height = blockHeight <= 0 ? height - overscanYPixels : blockHeight;

            clearDrawRequest.transparent = backgroundColor;

            clearFlag = true;
        }
 public async Task <Bitmap> DrawImage(DrawRequest request, Bitmap bmp)
 {
     if (request.Image != null)
     {
         return(await Task.Run(() =>
         {
             lock (_painterLock)
             {
                 _resultPainter = ChooseResultPainter(request.Type);
                 _resultPainter.Paint(bmp, request);
                 DrawPoints(bmp, request.Square.CalculateStartingPoints(request.PointsinX, request.PointsinY), request.ShowCropBox);
                 DrawRectagleNoScale(bmp, request);
                 return bmp;
             }
         }));
     }
     return(await Task.FromResult <Bitmap>(null));
 }
Exemple #30
0
        public override void Draw(float elapsed)
        {
            if (!this.Visible)
            {
                return;
            }
            if (this.Shadow == true)
            {
                DrawRequest _drawRequestShadow = new DrawRequest();
                //_drawRequest.font = this.Material.Texture;
                _drawRequestShadow.position   = this.Position + new Vector2(3, 2);
                _drawRequestShadow.rotation   = this.Rotation;
                _drawRequestShadow.scaleRatio = this.Scale;
                Color shadowColor = Color.Black;
                shadowColor.A                      = _opacity;
                _drawRequestShadow.tint            = shadowColor;
                _drawRequestShadow.font            = _font.Font;
                _drawRequestShadow.text            = Text;
                _drawRequestShadow.isFont          = true;
                _drawRequestShadow.textSize        = this.BoundingRectSize;
                _drawRequestShadow.pivot           = Pivot;
                _drawRequestShadow.isPivotRelative = this.IsPivotRelative;
                DrawingManager.DrawOnLayer(_drawRequestShadow, this.Layer, _blendingType);
            }
            //_drawRequest.font = this.Material.Texture;
            _drawRequest.position   = this.Position;
            _drawRequest.rotation   = this.Rotation;
            _drawRequest.scaleRatio = this.Scale;
            if (_font == null)
            {
                _font = SceneManager.GetEmbeddedFont("DefaultFont");
            }
            _drawRequest.font            = _font.Font;
            _drawRequest.isFont          = true;
            _drawRequest.textSize        = this.BoundingRectSize;
            _drawRequest.text            = this.Text;
            _drawRequest.isPivotRelative = this.IsPivotRelative;
            _drawRequest.pivot           = this.Pivot;
            DrawingManager.DrawOnLayer(_drawRequest, this.Layer, _blendingType);

            base.Draw(elapsed);
        }
Exemple #31
0
 public Sprite()
     : base()
 {
     _blendingType = DrawingBlendingType.Alpha;           
     _drawRequest = default(DrawRequest);
     _drawRequest.tint = Color.White;
     _drawRequest.scaleRatio = Vector2.One;
     this.MaterialArea = "";
     _useTilingSafeBorders = false;
     this.AutoScroll = false;
     this.AutoScrollSpeed = 0;
     this.AutoScrollArea = 0;
     this.AutoScrollVertical = false;
     this.AutoScrollMirroring = false;
 }
Exemple #32
0
 public void Draw(float elapsed)
 {
     if (this.Parent.Material == null)
     {
         return;
     }
     DrawRequest _drawRequest = new DrawRequest();
     _drawRequest.texture = this.Parent.Material.Texture;
     _drawRequest.position = this.Parent.Position;
     _drawRequest.rotation = this.Parent.Rotation;
     _drawRequest.scaleRatio = this.Parent.Scale;
     if (this.AnimationFrames != null && this.AnimationFrames.Count > _currentFrameIndex &&
         this.Parent.Material.Areas.ContainsKey(this.AnimationFrames[_currentFrameIndex].Area))
     {
         _drawRequest.sourceRectangle = this.Parent.Material.
             Areas[this.AnimationFrames[_currentFrameIndex].Area];
     }
     else
     {
         _drawRequest.sourceRectangle = null;
     }
     _drawRequest.pivot = this.Parent.Pivot;
     _drawRequest.isPivotRelative = this.Parent.IsPivotRelative;
     _drawRequest.tint = this.Parent.Tint;
     _drawRequest.hFlip = this.Parent.FlipHorizontal;
     _drawRequest.vFlip = this.Parent.FlipVertical;
     DrawingManager.DrawOnLayer(_drawRequest, this.Parent.Layer, this.Parent.BlendingType);
 }