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


C# SharpDX.Color类代码示例

本文整理汇总了C#中SharpDX.Color的典型用法代码示例。如果您正苦于以下问题:C# Color类的具体用法?C# Color怎么用?C# Color使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Color类属于SharpDX命名空间,在下文中一共展示了Color类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: DrawTextCentered

 public static void DrawTextCentered(this Font font,
     string text,
     Vector2 position,
     Color color,
     bool outline = false)
 {
     var measure = GetMeasured(font, text);
     if (outline)
     {
         font.DrawText(
             null, text, (int) (position.X + 1 - measure.Width * 0.5f),
             (int) (position.Y + 1 - measure.Height * 0.5f), Color.Black);
         font.DrawText(
             null, text, (int) (position.X - 1 - measure.Width * 0.5f),
             (int) (position.Y - 1 - measure.Height * 0.5f), Color.Black);
         font.DrawText(
             null, text, (int) (position.X + 1 - measure.Width * 0.5f),
             (int) (position.Y - measure.Height * 0.5f), Color.Black);
         font.DrawText(
             null, text, (int) (position.X - 1 - measure.Width * 0.5f),
             (int) (position.Y - measure.Height * 0.5f), Color.Black);
     }
     font.DrawText(
         null, text, (int) (position.X - measure.Width * 0.5f), (int) (position.Y - measure.Height * 0.5f), color);
 }
开发者ID:juan2202,项目名称:LeagueSharp-Standalones,代码行数:25,代码来源:FontExtension.cs

示例2: VertexPositionColorTextureNormal

 public VertexPositionColorTextureNormal( Vector3 position, Color color, Vector2 texture, Vector3 normal )
 {
     Position = position;
     Color = color;
     Texture = texture;
     Normal = normal;
 }
开发者ID:adamxi,项目名称:SharpDXFramework,代码行数:7,代码来源:VertexPositionColorNormalTexture.cs

示例3: Paint

        public void Paint(Color color, int highlightIndex = 0, bool cursor = false)
        {
            float fsize = 1.4f;
            var w = LContent.GraphicsDevice.BackBuffer.Width;
            var u = w/60;
            LContent.DrawString("Hall of Fame", new Vector2(w*0.5f, u*2), fsize*2, 0.5f, color);

            for (var i = 0; i < 10; i++)
            {
                var entry = LContent.HallOfFame.Entries[i];
                var y = u*(7 + i*2);
                var sz = fsize;
                if (i == 0)
                {
                    y -= u/2;
                    sz *= 1.2f;
                }
                var name = entry.Name;
                if (i==highlightIndex && cursor)
                    name += "_";
                LContent.DrawString("{0}.".Fmt(i + 1), new Vector2(u*5, y), sz, 1, color);
                LContent.DrawString("{0:0}".Fmt(entry.Score), new Vector2(u*14, y), sz, 1, color);
                LContent.DrawString(name, new Vector2(u*17, y), sz, 0, color);
                LContent.DrawString(entry.When.ToShortDateString(), new Vector2(u*57, y), sz, 1, color);
            }
        }
开发者ID:danbystrom,项目名称:VisionQuest,代码行数:26,代码来源:HofPainter.cs

示例4: GradientStop

 public GradientStop(double offset, Color color)
 {
   Init();
   Color = color;
   Offset = offset;
   Attach();
 }
开发者ID:BigGranu,项目名称:MediaPortal-2,代码行数:7,代码来源:GradientStop.cs

示例5: UpdateVertexArray

        public Vector2I UpdateVertexArray(string text, ref VertexDefinition.PositionTextureColor[] vertices, ref Buffer vertexBuffer, Color defaultColor, List<TexturedRectangle> icons, int positionX = 0, int positionY = 0)
        {
            icons.Clear();
            Color color = defaultColor;
            int width = 0;
            int maxWidth = 0;
            int height = Characters.First().Value.height;
            int maxHeight = height;
            for (int i = 0; i < text.Length; i++)
            {
                char letter = text[i];
                if (letter == '\n')
                {
                    maxWidth = Math.Max(maxWidth, width);
                    width = 0;
                    positionX = 0;
                    positionY += height;
                    maxHeight += height;
                    continue;
                }
                if (letter == '[')
                {
                    if (text[i + 1] == '[')
                        continue;
                    string token = text.Substring(i + 1, text.IndexOf(']', i + 1) - (i + 1));
                    if (!ColorParser.TryParse(token, out color))
                    {
                        if (token == "-")
                            color = defaultColor;
                        else if (token == "gold")
                        {
                            icons.Add(new TexturedRectangle(_context,
                                _context.TextureManager.Create("gold.png", "Data/UI/Icons/"), new Vector2I(height, height)));
                            positionX += height + 1;
                            width += height + 1;
                        }
                        else
                            throw new InvalidOperationException("Unexpected token : " + token);
                    }
                    i = text.IndexOf(']', i + 1);
                    continue;
                }
                Character c = Characters[letter];
                Vector4 colorAsVector = color.ToVector4();
                vertices[i * 4] = new VertexDefinition.PositionTextureColor { position = new Vector3(positionX, positionY, 0.0f), texture = new Vector2(c.uLeft, c.vTop), color = colorAsVector }; //Top left
                vertices[i * 4 + 1] = new VertexDefinition.PositionTextureColor { position = new Vector3(positionX + c.width, positionY + c.height, 0.0f), texture = new Vector2(c.uRight, c.vBottom), color = colorAsVector }; //Right bottom
                vertices[i * 4 + 2] = new VertexDefinition.PositionTextureColor { position = new Vector3(positionX, positionY + c.height, 0.0f), texture = new Vector2(c.uLeft, c.vBottom), color = colorAsVector }; //Left bottom
                vertices[i * 4 + 3] = new VertexDefinition.PositionTextureColor { position = new Vector3(positionX + c.width, positionY, 0.0f), texture = new Vector2(c.uRight, c.vTop), color = colorAsVector }; //Top right

                positionX += c.width + 1;
                width += c.width + 1;
            }
            DataStream mappedResource;
            _context.DirectX.Device.ImmediateContext.MapSubresource(vertexBuffer, MapMode.WriteDiscard, SharpDX.Direct3D11.MapFlags.None,
                out mappedResource);
            mappedResource.WriteRange(vertices);
            _context.DirectX.Device.ImmediateContext.UnmapSubresource(vertexBuffer, 0);
            return  new Vector2I(Math.Max(maxWidth, width), maxHeight);
        }
开发者ID:ndech,项目名称:Alpha,代码行数:59,代码来源:Font.cs

示例6: SetColor

        public override void SetColor(Color color)
        {
            if (color == lastColor)
                return;

            lastColor = color;
            solidColorBrush.Color = new Color4(color.PackedArgb);
        }
开发者ID:lilinghui,项目名称:DeltaEngine,代码行数:8,代码来源:SharpDXDrawing.cs

示例7: NotificationModel

 public NotificationModel(float time, float v1, float v2, string v3, Color deepSkyBlue)
 {
     _time = time;
     _v1 = v1;
     _v2 = v2;
     _v3 = v3;
     _deepSkyBlue = deepSkyBlue;
 }
开发者ID:chienhao10,项目名称:Elobuddy-10,代码行数:8,代码来源:NotificationModel.cs

示例8: NotificationModel

 public NotificationModel(float time, float v1, float v2, string v3, Color deepSkyBlue)
 {
     this.time = time;
     this.v1 = v1;
     this.v2 = v2;
     this.v3 = v3;
     this.deepSkyBlue = deepSkyBlue;
 }
开发者ID:JokerArtLoL,项目名称:EloBuddyAddons,代码行数:8,代码来源:NotificationModel.cs

示例9: DrawBorder

 public void DrawBorder(PrimitiveBatch<VertexPositionColor> primitiveBatch, Color color)
 {
     VertexPositionColor p1 = new VertexPositionColor(new Vector3(X, Y + Height, 1.0f), color);
     VertexPositionColor p2 = new VertexPositionColor(new Vector3(X, Y, 1.0f), color);
     VertexPositionColor p3 = new VertexPositionColor(new Vector3(X + Width, Y, 1.0f), color);
     VertexPositionColor p4 = new VertexPositionColor(new Vector3(X + Width, Y + Height, 1.0f), color);
     primitiveBatch.DrawQuad(p1, p2, p3, p4);
 }
开发者ID:akimoto-akira,项目名称:Pulse,代码行数:8,代码来源:DxRectangle.cs

示例10: DrawText

		public static void DrawText(Font font, string text, int posX, int posY, Color color)
		{
			Rectangle rec = font.MeasureText(null, text, FontDrawFlags.Center);
			font.DrawText(null, text, posX + 1 + rec.X, posY + 1, Color.Black);
			font.DrawText(null, text, posX + rec.X, posY + 1, Color.Black);
			font.DrawText(null, text, posX - 1 + rec.X, posY - 1, Color.Black);
			font.DrawText(null, text, posX + rec.X, posY - 1, Color.Black);
			font.DrawText(null, text, posX + rec.X, posY, color);
		}
开发者ID:MeteTR,项目名称:LeagueSharp2,代码行数:9,代码来源:Helper.cs

示例11: Ambient

 public Color Ambient()
 {
     var ambient = new Color();
     foreach (var light in _lights)
     {
         ambient += Shader.Ambient(light, 1);
     }
     return ambient;
 }
开发者ID:rikkit,项目名称:raytracer-winrt,代码行数:9,代码来源:Scene.cs

示例12: TSOConfig

 public TSOConfig()
 {
     this.ClientSize = new Size(800, 600);
     screen_color = SharpDX.Color.LightGray;
     this.Position = new Vector3(0.0f, +10.0f, +44.0f);
     this.Fov = 30.0f;
     this.Znear = 1.0f;
     this.Zfar = 1000.0f;
 }
开发者ID:3dcustom,项目名称:tsoview-dx,代码行数:9,代码来源:TSOConfig.cs

示例13: ZombieCharacter

 public ZombieCharacter(Game game, Vector3 translation, Color color)
     : this(game)
 {
     this.Color = color;
     this.Translation = translation;
     this.bodyGraphics = new OrientedCircle(game, translation, this.Color, this.Radius);
     this.viewTriangleGraphics = new OrientedTriangle(game, GeometryHelper.GetViewTriangle(Vector3.Zero, Settings.DefaultOrientationVector, this.ViewDistance, this.ViewAngle));
     this.smellingGraphics = new Circle(game, translation, Color.Gray, this.SmellingRadius);
 }
开发者ID:Dani88,项目名称:Zombies,代码行数:9,代码来源:ZombieCharacter.cs

示例14: LightClass

 public LightClass(LightType Type, Vector3 Position, Color Ambiant, Color Diffuse, Color Specular, float Range)
 {
     this.Type = Type;
     this.Position = Position;
     this.Ambiant = Ambiant;
     this.Diffuse = Diffuse;
     this.Specular = Specular;
     this.Range = Range;
 }
开发者ID:Arys02,项目名称:Underground,代码行数:9,代码来源:LightClass.cs

示例15: GUISkin

    /// <summary>
    /// Constructor of this class
    /// </summary>
    /// <param id="textures">GUITexture of the style</param>
    /// <param id="font">Font of the style</param>
    /// <param id="fontColor">Color of the font of this style</param>
    /// <param id="shadeText">Sets whether the newText is shaded</param>
    /// <param id="centeredText">Sets whether the newText is centered</param>
    public GUISkin(GUITexture textures, SpriteFont font, Color fontColor, bool shadeText, bool centeredText)
    {
      this.Textures = textures;
      this.Font = font;
      this.CenteredText = centeredText;
      this.ShadedText = shadeText;

      this.FontColor = fontColor;
    }
开发者ID:arcticnw,项目名称:Wildmen,代码行数:17,代码来源:DataStructures.cs


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