當前位置: 首頁>>代碼示例>>C#>>正文


C# GameTimerEventArgs.ToString方法代碼示例

本文整理匯總了C#中Microsoft.Xna.Framework.GameTimerEventArgs.ToString方法的典型用法代碼示例。如果您正苦於以下問題:C# GameTimerEventArgs.ToString方法的具體用法?C# GameTimerEventArgs.ToString怎麽用?C# GameTimerEventArgs.ToString使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Microsoft.Xna.Framework.GameTimerEventArgs的用法示例。


在下文中一共展示了GameTimerEventArgs.ToString方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: OnDraw

        /// <summary>
        /// Allows the page to draw itself.
        /// </summary>
        private void OnDraw(object sender, GameTimerEventArgs e)
        {
            // Crop the XNA viewport to avoid drawing under the AppBar
            SharedGraphicsDeviceManager.Current.GraphicsDevice.Viewport = new Viewport(0, 0, getVisibleWidth(), getVisibleHeight());

            try
            {
                SharedGraphicsDeviceManager.Current.GraphicsDevice.Clear(Color.Black);

                //Rendering Silverlight content into the UIElementRenderer object and the rendering its texture using the SpriteBatch object
                elementRenderer.Render();
            }
            catch (Exception)
            { }

            if (VertexActiveIndex > 3)
            {

                lock (this)
                {
                    try
                    {

                        int ActiveIndex = whichPolygonArrayActive;

                        // Draw textured box
                        SharedGraphicsDeviceManager.Current.GraphicsDevice.RasterizerState = RasterizerState.CullNone;  // vertex order doesn't matter
                        //SharedGraphicsDeviceManager.Current.GraphicsDevice.BlendState = BlendState.NonPremultiplied;    // use alpha blending
                        SharedGraphicsDeviceManager.Current.GraphicsDevice.DepthStencilState = DepthStencilState.None;  // don't bother with the depth/stencil buffer

                        foreach (EffectPass pass in basicEffect.CurrentTechnique.Passes)
                        {
                            pass.Apply();
                            SharedGraphicsDeviceManager.Current.GraphicsDevice.DrawUserPrimitives<VertexPositionColor>(PrimitiveType.TriangleList, filledPathPolygons[ActiveIndex], 0, VertexActiveIndex / 3);
                        }

                        try
                        {
                            spriteBatch.Begin();
                        }
                        catch (InvalidOperationException)
                        {
                            if (exc_count2 < 10)
                            {
                                exc_count2++;
                                Logger.log(e.ToString());
                            }

                            spriteBatch.End();
                            spriteBatch.Begin();
                        }

                        for (int i = 0; i < bitmapActiveIndex; i++)
                        {
                            Texture2D bitmap = bitmaps[ActiveIndex][i];
                            string[] xandy = ((string)(bitmap.Tag)).Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
                            int x = int.Parse(xandy[0]);
                            int y = int.Parse(xandy[1]);
                            spriteBatch.Draw(bitmap, new Microsoft.Xna.Framework.Rectangle(x, y, bitmap.Width, bitmap.Height), Color.Azure);
                        }

                        for (int i = 0; i < textStringActiveIndex; i++)
                        {
                            TextString textString = textStrings[ActiveIndex][i];
                            // Find the center of the string
                            Vector2 FontOrigin = new Vector2(0, textString.size + 5);

                            int x = textString.x;
                            int y = textString.y;

                            // Draw the string
                            try
                            {
                                spriteBatch.DrawString(Fonts[textString.size], textString.text, new Vector2(x, y), textString.color, MathHelper.ToRadians(textString.angle), FontOrigin,
                                    1.0f, SpriteEffects.None, 0);
                            }
                            catch (ArgumentException)
                            {
                                // Sometimes the C code sends illegal chars - just ignore them
                            }
                        }
                        spriteBatch.End();
                    }
                    catch (Exception)
                    {
                        if (exc_count < 10)
                        {
                            exc_count++;
                            Logger.log(e.ToString());
                        }
                    }
                }
            }

            try
            {
                // Using the texture from the UIElementRenderer, draw the SL content to the screen
//.........這裏部分代碼省略.........
開發者ID:thesourcerer,項目名稱:WazeWP7,代碼行數:101,代碼來源:GamePage.xaml.cs


注:本文中的Microsoft.Xna.Framework.GameTimerEventArgs.ToString方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。