示例#1
0
        public override void OnRender()
        {
            base.OnRender();
            if (Sprite != null)
            {
                // check if using custom shader
                if (shader != null)
                {
                    Draw.SpriteBatch.End();
                    Draw.Begin();
                    shader.ApplyShader();
                }

                if (pTransform == null)
                {
                    pTransform = Parent.GetComponent <Transform>();
                }
                // draw the sprite
                var tpos = VectorUtil.Floor(pTransform.Position);

                Draw.SpriteBatch.Draw(Sprite, (overridePos.HasValue ? overridePos.Value : tpos), SourceRect, Color.White, MathHelper.ToRadians(pTransform.rotation), Offset, pTransform.scale, SpriteEffects.None, 1);

                if (shader != null)
                {
                    Draw.SpriteBatch.End();
                    Draw.Begin();
                    ResourceManager.GetEffect("Default").CurrentTechnique.Passes[0].Apply();
                }
            }
        }
示例#2
0
 public virtual void RenderBegin()
 {
     //if (outlineTarget == null)
     //    outlineTarget = new RenderTarget2D(gd, gameWidth / ratio, gameHeight / ratio, false, gd.PresentationParameters.BackBufferFormat, DepthFormat.Depth16);
     //// Draw to render target
     //gd.SetRenderTarget(outlineTarget);
     //gd.Clear(Color.Transparent);
     //
     //g.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, SamplerState.PointClamp);
     //ResourceManager.GetEffect("Default").CurrentTechnique.Passes[0].Apply();
     Draw.Begin();
 }