当前位置: 首页>>代码示例>>C#>>正文


C# Label.Draw方法代码示例

本文整理汇总了C#中Label.Draw方法的典型用法代码示例。如果您正苦于以下问题:C# Label.Draw方法的具体用法?C# Label.Draw怎么用?C# Label.Draw使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Label的用法示例。


在下文中一共展示了Label.Draw方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Draw

        /// <summary>
        /// This is called when the game should draw itself.
        /// </summary>
        /// <param name="gameTime">Provides a snapshot of timing values.</param>
        protected override void Draw(GameTime gameTime)
        {
            Point[] joints;
            lock (iKinect.KinectJoints)
            {
                joints = iKinect.KinectJoints.ToArray();
            }

            GraphicsDevice.Clear(iBackground);

            GraphicsDevice.SetRenderTarget(colorRenderTarget);

            spriteBatch.Begin();
            spriteBatch.Draw(room, new Rectangle(0, 0, depthWidth, depthHeight), Color.White);
            if (iKinect.KinectRGBVideo != null)
            {
                spriteBatch.Draw(iKinect.KinectRGBVideo, new Rectangle(0, 0, depthWidth, depthHeight), Color.White);
            }

            foreach (GermBase germ in germs)
            {
                germ.Draw(spriteBatch);
            }

            if (joints != null)
            {
                foreach (var J in joints)
                {
                    spriteBatch.Draw(cloth, new Rectangle(J.X - 15, J.Y - 15, 30, 30), Color.White);
                }
            }

            ScoreLabel lab2 = new ScoreLabel("Time Left: " + (int)(millisecondsLeftOfGame / 1000), "label", depthWidth - 300, 5, 0);
            lab2.Load(Content);
            lab2.Draw(spriteBatch);

            if (millisecondsLeftOfGame <= 0)
            {
                var RestartLabel = new Label("Restart?", string.Empty, depthWidth - 100, 5, 0);
                var FinalScoreLabel = new BigLabel(String.Format("Score: {0}", score), string.Empty, depthWidth / 3, depthHeight / 3, 0);
                FinalScoreLabel.Load(Content);
                FinalScoreLabel.Draw(spriteBatch);
                RestartLabel.Load(Content);
                RestartLabel.Draw(spriteBatch);
            }
            else
            {
                Label lab1 = new Label("Score: " + score, "label", 5, 5, 0);
                lab1.Load(Content);
                lab1.Draw(spriteBatch);
            }

            if (!spriteBatch.IsDisposed)
                spriteBatch.End();

            // Reset the device to the back buffer
            GraphicsDevice.SetRenderTarget(null);

            spriteBatch.Begin();

            //entityManager.Draw(gameTime,spriteBatch);
            //Drawing the video feed if we have one available.
            spriteBatch.Draw(colorRenderTarget, new Rectangle(0, 0, screenWidth, screenHeight), Color.White);

            //No longer displaying the connection status on the screen because we have the title bar now >=]
            //Now we draw whatever scene is currently in the game!
            //iSceneManager.DrawScene(gameTime, spriteBatch);
            spriteBatch.End();
            base.Draw(gameTime);
        }
开发者ID:Sheepzez,项目名称:yorkhill-kinect,代码行数:74,代码来源:Game1.cs


注:本文中的Label.Draw方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。