Пример #1
0
        public override void Process(Entity entity, DrawComp drawComp, PositionComp posComp, LevelBackgroundComp lbc)
        {
            // update drawpos
            var p = posComp.Position + posComp.PositionModifier;

            drawComp.DrawPosition = activeScreen.ToPixels(p);
            drawComp.LayerDepth   = p.Z;                               // Z position is translated to a layer depth
            lbc.DrawCenter        = activeScreen.ToPixels(lbc.Center); // TODO check

            TTSpriteBatch sb = activeScreen.SpriteBatch;

            // draw sprite
            sb.Draw(lbc.Texture, drawComp.DrawPosition, null, drawComp.DrawColor,
                    drawComp.DrawRotation, lbc.DrawCenter, drawComp.DrawScale, SpriteEffects.None, drawComp.LayerDepth);
        }
Пример #2
0
        public override void Process(Entity entity, ScreenComp screen, DrawComp drawComp)
        {
            // check if present screenComp is the active one in this Draw() round
            if (!screen.IsActive)
            {
                return;
            }

            // in this final round, end the drawing to this screenlet:
            TTSpriteBatch sb = screen.SpriteBatch;

            sb.End();

            // then render the screenbuffer onto the actual screen.
            TTGame.Instance.GraphicsDevice.SetRenderTarget(null);
            sb.Begin(SpriteSortMode.Immediate, BlendState.Opaque);
            sb.Draw(screen.RenderTarget, screen.ScreenRectangle, drawComp.DrawColor);
            sb.End();
        }
Пример #3
0
        /// <summary>Processes the specified entity.</summary>
        /// <param name="entity">The entity.</param>
        public override void Process(Entity entity, SpriteComp spriteComp, PositionComp posComp, DrawComp drawComp)
        {
            if (drawComp.IsVisible)
            {
                ScreenComp screen = drawComp.Screen;

                // if no specific screen...
                if (screen == null)
                {
                    screen = activeScreen;
                }
                // update drawpos
                var p = posComp.Position + posComp.PositionModifier;
                drawComp.DrawPosition = screen.ToPixels(p);
                drawComp.LayerDepth   = p.Z; // Z position is translated to a layer depth
                //spriteComp.DrawCenter = screen.ToPixels(spriteComp.Center); // TODO check

                TTSpriteBatch sb = screen.SpriteBatch;

                // draw sprite
                sb.Draw(spriteComp.Texture, drawComp.DrawPosition, null, drawComp.DrawColor,
                        drawComp.DrawRotation, spriteComp.DrawCenter, drawComp.DrawScale, SpriteEffects.None, drawComp.LayerDepth);
            }
        }