示例#1
0
        public FpsController(Game game) : base(game)
        {
            var layer = new Layer("FpsLayer");

            layer.AddDrawable(new FpsCounter("Fonts\\Courier New", new Vector2(20, 20)));
            Layers.Add(layer);
        }
        /// <summary>
        /// Allows to perform custom drawing.
        /// </summary>
        /// <param name="gameTime">The elapsed game time.</param>
        /// <remarks>
        /// This method will only be called if all the following points are true:
        /// <list type="bullet">
        /// <item>
        /// <description>The entity passes a frustrum culling test.</description>
        /// </item>
        /// <item>
        /// <description>The parent of the owner <see cref="T:WaveEngine.Framework.Entity" /> of the <see cref="T:WaveEngine.Framework.Drawable" /> cascades its visibility to its children and it is visible.</description>
        /// </item>
        /// <item>
        /// <description>The <see cref="T:WaveEngine.Framework.Drawable" /> is active.</description>
        /// </item>
        /// <item>
        /// <description>The owner <see cref="T:WaveEngine.Framework.Entity" /> of the <see cref="T:WaveEngine.Framework.Drawable" /> is active and visible.</description>
        /// </item>
        /// </list>
        /// </remarks>
        public override void Draw(TimeSpan gameTime)
        {
            Layer layer = RenderManager.FindLayer(DefaultLayers.Opaque);

            layer.AddDrawable(0, this, this.SortId);

            this.Material.DefaultMaterial.Matrices.World = Transform3D.LocalWorld;
        }