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


C# DrawMode.HasFlag方法代码示例

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


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

示例1: Draw

 public static void Draw(DrawMode drawMode, SpriteBatch spriteBatch, Vector2 position, float baseScale)
 {
     bool coop = RetroGame.NUM_PLAYERS == 2;
     spriteBatch.DrawString(RetroGame.FONT_PIXEL_LARGE, TITLE_TEXT, position, Color.Black, 0, Vector2.Zero, TITLE_SCALE * baseScale, SpriteEffects.None, 0);
     position.Y += 42;
     if (drawMode.HasFlag(DrawMode.Solo))
     {
         spriteBatch.DrawString(RetroGame.FONT_PIXEL_LARGE, SOLO_TEXT, position, Color.Black, 0, Vector2.Zero, SUBTITLE_SCALE * baseScale, SpriteEffects.None, 0);
         position.Y += SUBTITLE_GAP;
         spriteBatch.Draw(RetroGame.PIXEL, new Rectangle((int)position.X, (int)position.Y, (int)(CHART_WIDTH * baseScale), (int)(CHART_LINE_HEIGHT * baseScale)), Color.Black);
         position.Y += GAP_BEFORE_SOLO * baseScale;
         for (int i = 0; i < HIGHSCORE_COUNT; i++)
         {
             spriteBatch.DrawString(RetroGame.FONT_PIXEL_SMALL, "#" + highscoresSolo[i].id.ToString("0000") + " " + highscoresSolo[i].name, position, highscoresSolo[i].color.darkenIfTooLight(NAME_LUMINOSITY_LIMIT), 0, NAME_ORIGIN, 0.75f * baseScale, SpriteEffects.None, 0);
             string scoreString = highscoresSolo[i].score.ToString(SCORE_FORMAT);
             Vector2 scoreDims = RetroGame.FONT_PIXEL_SMALL.MeasureString(scoreString);
             Color scoreColor = (!coop && currentHighscorePosition == i) ? currentHighscoreColor : Color.Black;
             spriteBatch.DrawString(RetroGame.FONT_PIXEL_SMALL, highscoresSolo[i].score.ToString(SCORE_FORMAT), new Vector2(position.X + (CHART_WIDTH * baseScale), position.Y), scoreColor, 0, scoreDims * new Vector2(1, 0.5f), SCORE_SCALE * baseScale, SpriteEffects.None, 0);
             position.Y += SCORE_GAP;
         }
         position.Y -= SCORE_GAP;
         position.Y += GAP_TO_COOP * baseScale;
     }
     if (drawMode.HasFlag(DrawMode.Coop))
     {
         spriteBatch.DrawString(RetroGame.FONT_PIXEL_LARGE, COOP_TEXT, position, Color.Black, 0, Vector2.Zero, SUBTITLE_SCALE * baseScale, SpriteEffects.None, 0);
         position.Y += SUBTITLE_GAP;
         spriteBatch.Draw(RetroGame.PIXEL, new Rectangle((int)position.X, (int)position.Y, (int)(CHART_WIDTH * baseScale), (int)(CHART_LINE_HEIGHT * baseScale)), Color.Black);
         position.Y += GAP_BEFORE_COOP * baseScale;
         for (int i = 0; i < HIGHSCORE_COUNT; i++)
         {
             spriteBatch.DrawString(RetroGame.FONT_PIXEL_SMALL, "#" + highscoresCoop[i].id1.ToString("0000") + " " + highscoresCoop[i].name1, position + (OFFSET_P1 * baseScale), highscoresCoop[i].color1.darkenIfTooLight(NAME_LUMINOSITY_LIMIT), 0, NAME_ORIGIN, NAME_SCALE_COOP * baseScale, SpriteEffects.None, 0);
             spriteBatch.DrawString(RetroGame.FONT_PIXEL_SMALL, "#" + highscoresCoop[i].id2.ToString("0000") + " " + highscoresCoop[i].name2, position + (OFFSET_P2 * baseScale), highscoresCoop[i].color2.darkenIfTooLight(NAME_LUMINOSITY_LIMIT), 0, NAME_ORIGIN, NAME_SCALE_COOP * baseScale, SpriteEffects.None, 0);
             string scoreString = highscoresCoop[i].score.ToString(SCORE_FORMAT);
             Vector2 scoreDims = RetroGame.FONT_PIXEL_SMALL.MeasureString(scoreString);
             Color scoreColor = (coop && currentHighscorePosition == i) ? currentHighscoreColor : Color.Black;
             spriteBatch.DrawString(RetroGame.FONT_PIXEL_SMALL, highscoresCoop[i].score.ToString(SCORE_FORMAT), new Vector2(position.X + (CHART_WIDTH * baseScale), position.Y), scoreColor, 0, scoreDims * new Vector2(1, 0.5f), SCORE_SCALE * baseScale, SpriteEffects.None, 0);
             position.Y += SCORE_GAP;
         }
     }
 }
开发者ID:foolmoron,项目名称:Retroverse,代码行数:41,代码来源:Highscores.cs


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