FSO.LotView.Components.ObjectComponent.Draw C# (CSharp) Method

Draw() public method

public Draw ( GraphicsDevice device, WorldState world ) : void
device GraphicsDevice
world WorldState
return void
        public override void Draw(GraphicsDevice device, WorldState world)
        {
            #if !DEBUG
            if (!Visible || (Position.X < 0 && Position.Y < 0)) return;
            #endif
            if (CutawayHidden) return;
            if (this.DrawGroup != null) dgrp.Draw(world);

            if (Headline != null)
            {
                var headOff = new Vector3(0, 0, 0.66f);
                var headPx = world.WorldSpace.GetScreenFromTile(headOff);

                var item = world._2D.NewSprite(_2DBatchRenderMode.Z_BUFFER);
                item.Pixel = Headline;
                item.Depth = TextureGenerator.GetWallZBuffer(device)[30];

                item.SrcRect = new Rectangle(0, 0, Headline.Width, Headline.Height);
                item.WorldPosition = headOff;
                var off = PosCenterOffsets[(int)world.Zoom - 1];
                item.DestRect = new Rectangle(
                    ((int)headPx.X-Headline.Width/2) + (int)off.X,
                    ((int)headPx.Y-Headline.Height/2)+ (int)off.Y, Headline.Width, Headline.Height);
                world._2D.Draw(item);
            }
        }