예제 #1
0
        /// <summary>
        /// See BlWindow3D for details.
        /// </summary>
        /// <param name="timeInfo">Provides a snapshot of timing values.</param>
        protected override void FrameDraw(GameTime timeInfo)
        {
            //
            // Put your periodic code here
            //

            // Handle the standard mouse and keystroke functions. (This is very configurable)
            Graphics.DoDefaultGui();

            //
            // Draw things here using BlSprite.Draw(), graphics.DrawText(), etc.
            //

            Torus.Draw();

            // If torus is in view, draw its text
            var coords = Torus.GetViewCoords();

            if (coords != null)
            {
                // This is how you would draw dynamic text. If the text is constant, you can do it faster by
                // creating a texture of the text (see Graphics.TextToTexture) in Setup, and then drawing that texture here with
                // Graphics.DrawTexture.
                // (You can also make text for the sprite if you add a subsprite that is a 'plane' model, has a texture that
                // is text, has billboard enabled, and maybe has constant size enabled. In that case, the text can be
                // occluded by closer sprites unless depth testing is disabled for that sprite, and the text size will vary
                // with the window size. But that's  more complicated.)
                Graphics.DrawText("This is the model", Font, (Vector2)coords);
            }

            // handle undrawable characters for the specified font (like the infinity symbol)
            try
            {
                var MyHud = $@"
Camera controls:
Dolly  -  Wheel
Zoom   -  Left-CTRL-wheel
Truck  -  Left-drag 
Rotate -  Right-drag
Pan    -  Left-CTRL-left-drag
Reset  -  Esc
Fine control  -  Left-Shift

Eye: {Graphics.Eye}
LookAt: {Graphics.LookAt}
MaxDistance: {Graphics.MaxCamDistance}
MinDistance: {Graphics.MinCamDistance}
ViewAngle: {Graphics.Zoom}
ModelLod: {Torus.LodTarget}
ModelApparentSize: {Torus.ApparentSize}";

                Graphics.DrawText(MyHud, Font, new Vector2(50, 50));
            }
            catch { }
        }
예제 #2
0
        /// <summary>
        /// See BlWindow3D for details.
        /// </summary>
        /// <param name="timeInfo">Provides a snapshot of timing values.</param>
        protected override void FrameDraw(GameTime timeInfo)
        {
            //
            // Draw things here using BlSprite.Draw(), graphics.DrawText(), etc.
            //

            Torus.Draw();

            // If torus is in view, draw its text
            var coords = Torus.GetViewCoords();

            if (coords != null)
            {
                // This is how you would draw dynamic text. If the text is constant, you can do it faster by
                // creating a texture of the text (see Graphics.TextToTexture) in Setup, and then drawing that texture here with
                // Graphics.DrawTexture.
                // (You can also make text for the sprite if you add a subsprite that is a 'plane' model, has a texture that
                // is text, has billboard enabled, and maybe has constant size enabled. In that case, the text can be
                // occluded by closer sprites unless depth testing is disabled for that sprite, and the text size will vary
                // with the window size. But that's  more complicated.)
                Graphics.DrawText("This is the model", Font, (Vector2)coords);
            }

            var MyMenuText = String.Format("{0}\nEye: {1}\nLookAt: {2}\nMaxDistance: {3}\nMinistance: {4}\nViewAngle: {5}\nModelLod: {6}\nModelApparentSize: {7}",
                                           Help,
                                           Graphics.Eye,
                                           Graphics.LookAt,
                                           Graphics.MaxCamDistance,
                                           Graphics.MinCamDistance,
                                           Graphics.Zoom,
                                           Torus.LodTarget,
                                           Torus.ApparentSize
                                           );

            // handle undrawable characters for the specified font(like the infinity symbol)
            try
            {
                Graphics.DrawText(MyMenuText, Font, new Vector2(50, 50));
            }
            catch { }
        }