예제 #1
0
        /// <summary>
        /// 尝试恢复
        /// </summary>
        public static void AttemptRecovery()
        {
            try
            {
                //将设备还原为调用 Begin 前的状态。
                //备注
                //此方法不能用于替代 Device 的 EndScene。

                Sprite.End();
                TextSprite.End();
            }
            catch
            {
            }

            try
            {
                //结束通过调用 BeginScene 方法开始的场景。
                //备注
                //每个对 BeginScene 的调用后面最终都应有一个对 EndScene 的调用,然后才能用 Present 更新显示。
                //当 EndScene 成功时,该场景将进入由驱动程序进行呈现的队列中。该方法不是同步的,因此不能保证该方法返回时,场景已完成呈现。

                Device.EndScene();
            }
            catch
            {
            }

            try
            {
                ////获取指定的后台缓冲区
                MainSurface    = Device.GetBackBuffer(0, 0, BackBufferType.Mono);
                CurrentSurface = MainSurface;
                ////为设备设置新的颜色缓冲区。
                Device.SetRenderTarget(0, MainSurface);
            }
            catch
            {
            }
        }
예제 #2
0
 /// <summary>
 ///     Dibujar un texto en la posición indicada, con el color indicado.
 ///     Utilizar la fuente default del Framework.
 /// </summary>
 /// <param name="text">Texto a dibujar</param>
 /// <param name="x">Posición X de la pantalla</param>
 /// <param name="y">Posición Y de la pantalla</param>
 /// <param name="color">Color del texto</param>
 public void drawText(string text, int x, int y, Color color)
 {
     TextSprite.Begin(SpriteFlags.AlphaBlend);
     D3dFont.DrawText(TextSprite, text, x, y, color);
     TextSprite.End();
 }
예제 #3
0
 public void render()
 {
     TextSprite.Begin(SpriteFlags.AlphaBlend);
     D3dFont.DrawText(TextSprite, Text, rectangle, Format, Color);
     TextSprite.End();
 }