当前位置: 首页>>代码示例>>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;未经允许,请勿转载。