fliXNA_xbox.FlxGroup.draw C# (CSharp) Méthode

draw() public méthode

public draw ( ) : void
Résultat void
        public override void draw()
        {
            if (visible)
            {
                if (members.Count != 0)
                {
                    foreach (FlxBasic m in members)
                    {
                        if (m.visible)
                            m.draw();
                    }
                }
            }
        }

Usage Example

Exemple #1
0
        /// <summary>
        /// Override this only if you are familiar with SpriteBatches and Viewports.  Otherwise leave it alone to avoid
        /// any issues with rendering.
        /// </summary>
        public override void draw()
        {
            // first clear the screen with the background color of your choice
            FlxG.graphicsDevice.Clear(FlxG.bgColor);

            // then loop through all the cameras and viewports, and render them to the screen
            int i;
            int l = FlxG.cameras.Count;

            for (i = 0; i < l; i++)                               //(l>1)?1:
            {
                FlxG.graphicsDevice.Viewport = FlxG.viewports[i]; //viewport must be selected BEFORE spritebatch drawing
                FlxG.spriteBatch.Begin(SpriteSortMode.Immediate,
                                       BlendState.AlphaBlend,
                                       SamplerState.PointClamp,       //PointClamp makes sure that the tiles render properly without tearing
                                       null,
                                       null,
                                       null,
                                       FlxG.cameras[i].TransformMatrix);
                base.draw();
                FlxG.spriteBatch.End();
            }

            // switch to the whole screen in order to draw the HUD
            FlxG.graphicsDevice.Viewport = FlxG.defaultWholeScreenViewport;

            // draw the HUD
            FlxG.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend);
            hud.draw();
            FlxG.spriteBatch.End();
        }