Example #1
1
        public static void Draw(ISpriteBatch sb, Vector2 source, Vector2 dest, Color color)
        {
            var dist = Vector2.Distance(source, dest);
            var angle = GetAngle(source, dest);

            // Get the length of the segments
            var segLen = dist / 6;
            if (segLen < 5.0f)
                segLen = 5.0f;
            if (segLen > 25.0f)
                segLen = 25.0f;

            // Primary line
            var tailLen = dist - (segLen / 2);
            var pDest = source + (new Vector2((float)Math.Cos(angle), (float)Math.Sin(angle)) * tailLen);
            RenderLine.Draw(sb, source, pDest, color);

            // Arrow segment 1
            var ang1 = angle - MathHelper.PiOver4;
            var seg1 = dest - (new Vector2((float)Math.Cos(ang1), (float)Math.Sin(ang1)) * segLen);
            RenderLine.Draw(sb, dest, seg1, color);

            // Arrow segment 2
            var ang2 = angle + MathHelper.PiOver4;
            var seg2 = dest - (new Vector2((float)Math.Cos(ang2), (float)Math.Sin(ang2)) * segLen);
            RenderLine.Draw(sb, dest, seg2, color);

            // Arrow segment 3
            RenderLine.Draw(sb, seg1, seg2, color);
        }
Example #2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="LineInfo" /> struct.
 /// </summary>
 /// <param name="text">The text.</param>
 /// <param name="color">The color.</param>
 /// <param name="size">The size.</param>
 /// <param name="offsetX">offset X alignment.</param>
 public LineInfo(string text, Color color, Vector2 size, float offsetX)
 {
     this.SubTextList = new List<SubTextInfo>();
     this.Size = Vector2.Zero;
     this.AlignmentOffsetX = offsetX;
     this.AddText(text, color, size);
 }
 public ClassWithMultipleCtorArguments(Color color, string name, int age, DateTime day)
 {
     _color = color;
     _name = name;
     _age = age;
     _day = day;
 }
Example #4
0
        public void Color_IsConstructedProperly_FromInt32RGBA()
        {
            var result = new Color(12, 34, 56, 78);

            TheResultingValue(result)
                .ShouldHaveArgbComponents(78, 12, 34, 56);
        }
Example #5
0
 public Game CreateGame(Color color)
 {
     // Отправляется запрос к серверу на создание в базе
     // новой записи Party/Game с исходными значениями
     // некоторых полей (FirstPlayerId и color)
     return new Game(this, 0000);
 }
Example #6
0
        /// <summary>
        /// Updates the light color like a torch
        /// </summary>
        /// <param name="gameTime">Time of the game </param>
        protected override void Update(TimeSpan gameTime)
        {
            if (!this.initialized)
            {
                this.RefColor = light.Color.ToVector3();
                this.initialized = true;
            }

            ellapsedGameTime += gameTime;

            if (this.ellapsedGameTime > this.nextColorTime)
            {
                light.Color = this.NextColor;

                float r = ((float)WaveServices.Random.NextDouble() * 0.15f + 0.85f);
                float att = ((float)WaveServices.Random.NextDouble() * 0.3f + 0.7f);
                this.period = ((float)WaveServices.Random.NextDouble() * 0.2f + 0.05f);

                this.PrevColor = this.NextColor;
                this.NextColor = new Color(
                    this.RefColor.X * ((float)WaveServices.Random.NextDouble() * 0.05f + 0.95f),
                    this.RefColor.Y * r,
                    this.RefColor.Z * r) * att;
                this.startColorTime = this.ellapsedGameTime;
                this.nextColorTime = this.ellapsedGameTime + TimeSpan.FromSeconds(this.period);
            }
            else
            {
                float lerp = (float)(this.ellapsedGameTime - this.startColorTime).TotalSeconds / this.period;

                this.light.Color = this.PrevColor * (1 - lerp) + this.NextColor * (lerp);
            }
        }
Example #7
0
        protected override bool Run(SimDescription me, bool singleSelection)
        {
            if (!ApplyAll)
            {
                List<PreferenceColor.Item> allOptions = new List<PreferenceColor.Item>();

                foreach (CASCharacter.NameColorPair color in CASCharacter.kColors)
                {
                    allOptions.Add(new PreferenceColor.Item(color.mColor, (me.FavoriteColor == color.mColor) ? 1 : 0));
                }

                PreferenceColor.Item choice = new CommonSelection<PreferenceColor.Item>(Name, me.FullName, allOptions).SelectSingle();
                if (choice == null) return false;

                mFavoriteColor = choice.Value;
            }

            me.FavoriteColor = mFavoriteColor;

            if (PlumbBob.SelectedActor == me.CreatedSim)
            {
                (Sims3.Gameplay.UI.Responder.Instance.HudModel as HudModel).OnSimFavoritesChanged(me.CreatedSim.ObjectId);
            }

            return true;
        }
Example #8
0
        public static bool CreateShadows()
        {

            Image img = spriteSheet.Texture.CopyToImage();

            for (uint k = 0; k < img.Size.X; k++)
                for (uint j = 0; j < img.Size.Y; j++)
                {
                    Color c = img.GetPixel(k, j);
                    if (c.A == 255)
                    {
                        Color d = new Color();
                        d.A = 40;
                        d.R = d.G = d.B = 0;
                        img.SetPixel(k, j, d);
                    }
                }

            Texture tex = new Texture(img);
            Sprite tempsprite = new Sprite();
            tempsprite.Texture = tex;

            shadowSpriteSheet = new RenderTexture(textureSize, textureSize);
            shadowSpriteSheet.Draw(tempsprite);
            shadowSpriteSheet.Display();

            shadowSprite.Texture = shadowSpriteSheet.Texture;

            img.Dispose();
            tempsprite.Dispose();
            tex.Dispose();

            return true;
        }
Example #9
0
 public Face()
 {
     for (int i = 0; i < 3; i++)
     {
         Colors[i] = new Color(1.0f, 1.0f, 1.0f, 1.0f);
     }
 }
 private static void Dfs(Vertex vertex, Color currentColor, Color[] colors)
 {
     switch (colors[vertex.Number])
     {
         case Color.noColor:
         {
             colors[vertex.Number] = currentColor;
             break;
         }
         default:
         {
             if (colors[vertex.Number] != currentColor)
             {
                 for (var i = 0; i < colors.Length; ++i)
                 {
                     colors[i] = Color.firstColor;
                 }
             }
             return;
         }
     }
     foreach (var nextVertex in vertex.Connections)
     {
         Dfs(nextVertex, changeColor(currentColor), colors);
     }
 }
Example #11
0
        private void SetupGrid(Vector2u mapSize)
        {
            const int gridSize = 16;
            _gridTexture = new RenderTexture(2000, 2000);
            var col = new Color(120, 120, 120);
            var verticies = new List<Vertex>();
            for (int x = 0; x < mapSize.X; x += gridSize)
            {
                verticies.Add(new Vertex(new Vector2f(x, 0), col));
                verticies.Add(new Vertex(new Vector2f(x, mapSize.Y), col));
            }
            for (int y = 0; y < mapSize.Y; y += gridSize)
            {
                verticies.Add(new Vertex(new Vector2f(0, y), col));
                verticies.Add(new Vertex(new Vector2f(mapSize.X, y), col));
            }
            _gridlines = verticies.ToArray();

            _gridTexture.Clear(new Color(190, 190, 190));
            //_view = new View(new FloatRect(0,0,displaySize.X, displaySize.Y));
            _view = new View(new FloatRect(0, 0, DisplayView.Size.X, DisplayView.Size.Y));
            DisplayView = _view;
            //_gridTexture.SetView(_view);
            _gridTexture.Draw(_gridlines, PrimitiveType.Lines);
            _gridTexture.Display();

            _grid = new Sprite(_gridTexture.Texture);
            AddItemToDraw(_grid, 0);
        }
        Texture2D Circle(GraphicsDevice graphics, int radius)
        {
            int aDiameter = radius * 2;
            Vector2 aCenter = new Vector2(radius, radius);

            Texture2D aCircle = new Texture2D(graphics, aDiameter, aDiameter, false, SurfaceFormat.Color);
            Color[] aColors = new Color[aDiameter * aDiameter];

            for (int i = 0; i < aColors.Length; i++)
            {
                int x = (i + 1) % aDiameter;
                int y = (i + 1) / aDiameter;

                Vector2 aDistance = new Vector2(Math.Abs(aCenter.X - x), Math.Abs(aCenter.Y - y));


                if (Math.Sqrt((aDistance.X * aDistance.X) + (aDistance.Y * aDistance.Y)) > radius)
                {
                    aColors[i] = Color.Transparent;
                }
                else
                {
                    aColors[i] = Color.White;
                }
            }

            aCircle.SetData<Color>(aColors);

            return aCircle;
        }
        public static ToolbarDialog CreateToolbar(Point toolbar_pos, Point toolbar_size, Color toolbar_color)
        {
            var t = new ToolbarDialog
            {
                Color = toolbar_color,
                Size = toolbar_size
            };

            t.Control = new IHTMLDiv();
            t.Drag = new DragHelper(t.Control);
            t.Drag.Position = toolbar_pos;

            //t.ControlForm.BackColor = System.Drawing.Color.Green;
            t.ControlForm.MoveTo(t.Drag.Position.X, t.Drag.Position.Y);
            //t.ControlForm.SizeTo(toolbar_size.X + 16, toolbar_size.Y + 32);



            t.Control.style.SetLocation(t.Drag.Position.X, t.Drag.Position.Y, toolbar_size.X, toolbar_size.Y);

            t.Control.SetDialogColor(toolbar_color);
            t.Drag.Enabled = true;
            t.Drag.DragMove += t.ApplyPosition;

            t.Grow();

            return t;
        }
 public CoverCaption(CoverManager coverManager, string font_name, Color color)
     : base(coverManager, font_name, color)
 {
     CoverManager.NewCurrentCover += HandleNewCurrentCover;
     CoverManager.TargetIndexChanged += HandleTargetIndexChanged;
     CoverManager.CoversChanged += HandleCoversChanged;
 }
Example #15
0
		public void Set ( float x, float y, float dx, float dy, float w, float h, float sin, float cos, Color color, Vector2 texCoordTL, Vector2 texCoordBR )
		{
            // TODO, Should we be just assigning the Depth Value to Z?
            // According to http://blogs.msdn.com/b/shawnhar/archive/2011/01/12/spritebatch-billboards-in-a-3d-world.aspx
            // We do.
			vertexTL.Position.X = x+dx*cos-dy*sin;
            vertexTL.Position.Y = y+dx*sin+dy*cos;
            vertexTL.Position.Z = Depth;
            vertexTL.Color = color;
            vertexTL.TextureCoordinate.X = texCoordTL.X;
            vertexTL.TextureCoordinate.Y = texCoordTL.Y;

			vertexTR.Position.X = x+(dx+w)*cos-dy*sin;
            vertexTR.Position.Y = y+(dx+w)*sin+dy*cos;
            vertexTR.Position.Z = Depth;
            vertexTR.Color = color;
            vertexTR.TextureCoordinate.X = texCoordBR.X;
            vertexTR.TextureCoordinate.Y = texCoordTL.Y;

			vertexBL.Position.X = x+dx*cos-(dy+h)*sin;
            vertexBL.Position.Y = y+dx*sin+(dy+h)*cos;
            vertexBL.Position.Z = Depth;
            vertexBL.Color = color;
            vertexBL.TextureCoordinate.X = texCoordTL.X;
            vertexBL.TextureCoordinate.Y = texCoordBR.Y;

			vertexBR.Position.X = x+(dx+w)*cos-(dy+h)*sin;
            vertexBR.Position.Y = y+(dx+w)*sin+(dy+h)*cos;
            vertexBR.Position.Z = Depth;
            vertexBR.Color = color;
            vertexBR.TextureCoordinate.X = texCoordBR.X;
            vertexBR.TextureCoordinate.Y = texCoordBR.Y;
		}
Example #16
0
        public Message(
			Guid id,
			string name,
			string description,
			Color backgroundColor,
			IEnumerable<IMessagePart> parts,
			EventHandlerCollection eventHandlerCollection = null)
        {
            name.ThrowIfNull("name");
            description.ThrowIfNull("description");
            parts.ThrowIfNull("parts");

            parts = parts.ToArray();

            IMessagePart question = parts.SingleOrDefault(arg => arg is MessageMananger);

            if (question != null && parts.Last() != question)
            {
                throw new ArgumentException("When a MessageQuestion is present, it must be the last part.", "parts");
            }

            _id = id;
            Name = name;
            Description = description;
            _backgroundColor = backgroundColor;
            _parts = parts;
            _eventHandlerCollection = eventHandlerCollection;
        }
        public Color[,] compressLine_schemaC(int input_compression)
        {
            compression = input_compression;
            Color tempColor = new Color();

            for (int y = 0; y < pixelY; y++)
            {
                for (int x = 0; x < pixelX; x++)
                {
                    tempColor = input_array[y, x];
                    output_array_2D[y, x].a = tempColor.a;
                }
            }

            for (int y = 0; y<pixelY; y+ input_compression)
            {
                for(int x = 0; x<pixelX; x+input_compression)
                {
                    tempColor = input_array[y, x];
                    output_array_2D[y, x].b = tempColor.b;
                    output_array_2D[y, x].c = tempColor.c;
                }
            }

            return output_array_2D;
        }
        public override void DebugDraw(ref Vector3D translation, ref Color materialColor)
        {
            Shape.DebugDraw(ref translation, materialColor);
            VRageRender.MyRenderProxy.DebugDrawText3D(Shape.Center() + translation, "layered", Color.White, 1f, false);

            m_oreDeposits.DebugDraw(ref translation, ref materialColor);
        }
Example #19
0
 //constructors
 public Task(string name, string category = "to-do", Color color = Color.Magenta,
     Priority priority = Priority.Medium, string location = "", string comment = "")
     : base(name, color, priority, comment)
 {
     this.Location = location;
     this.CategoryType = category;
 }
Example #20
0
 public GUIColorPacket(Color pmNormal, Color pmDisabled, Color pmHovered, Color pmPressed)
 {
     normal=	pmNormal;
     disabled=	pmDisabled;
     hovered=	pmHovered;
     pressed=	pmPressed;
 }
Example #21
0
 // Token: 0x0600251D RID: 9501
 // RVA: 0x000DFC34 File Offset: 0x000DDE34
 public void Draw(List<Class880> list_1, Class880 class880_0, float float_1, Color color_3, Color color_4)
 {
     BaseGLControl.smethod_5(1u, 771u);
     base.Draw(list_1, float_1 * 58f / 64f, color_4, 0f, "StandardBorder", true);
     BaseGLControl.smethod_5(770u, 771u);
     base.Draw(list_1, float_1 * 51f / 64f, new Color(color_3.get_R(), color_3.get_G(), color_3.get_B(), 255), 0f, "StandardNoRect", true);
 }
        /// <summary>
        /// Get the RGB associated to the color.
        /// </summary>
        /// <returns>The Color value.</returns>
        public Color GetColor()
        {
            if (m_Color == null)
                m_Color = CreateColor();

            return m_Color;
        }
Example #23
0
 public Tile(Color color, Vector2f position, bool walkable, Vector2f size)
 {
     shape = new RectangleShape(size);
     shape.FillColor = color;
     shape.Position = position;
     Walkable = walkable;
 }
Example #24
0
 /// <param name="sectionIndex">-1 for all the mesh</param>
 /// <param name="thickness">Zero or negative remove the outline</param>
 internal static void HandleHighlight(uint ID, int sectionIndex, Color? outlineColor, float thickness, ulong pulseTimeInFrames)
 {
     if (thickness > 0)
         Add(ID, sectionIndex, outlineColor.Value, thickness, pulseTimeInFrames);
     else
         Remove(ID);
 }
Example #25
0
        public virtual Particle AddParticle(Vector2f position, Vector2f initialVelocity, Vector2f gravity, float lifeTime, Color color)
        {
            var particle = new Particle(position, initialVelocity, gravity, this, lifeTime, color);
            AddParticle(particle);

            return particle;
        }
		/// <summary>
		/// Fills the whole WriteableBitmap with a color.
		/// </summary>
		/// <param name="bmp">The WriteableBitmap.</param>
		/// <param name="color">The color used for filling.</param>
		public static void Clear( this WriteableBitmap bmp, Color color )
		{
			var col = ConvertColor( color );
			using( var context = bmp.GetBitmapContext() )
			{
				var pixels = context.Pixels;
				var w = context.Width;
				var h = context.Height;
				var len = w * SizeOfArgb;

				// Fill first line
				for( var x = 0; x < w; x++ )
				{
					//pixels[x] = col;
					Marshal.WriteInt32( pixels.Add<Int32>( x ), col );
				}

				// Copy first line
				var blockHeight = 1;
				var y = 1;
				while( y < h )
				{
					BitmapContext.BlockCopy( context, 0, context, y * len, blockHeight * len );
					y += blockHeight;
					blockHeight = Math.Min( 2 * blockHeight, h - y );
				}
			}
		}
Example #27
0
 public static Stream GenerateSolidColorBitmap(Color color, int width = 1024, int height = 1024)
 {
     Stream stream = new MemoryStream();
     GenerateSolidColorBitmap(stream, color, width, height);
     stream.Seek(0, SeekOrigin.Begin);
     return stream;
 }
Example #28
0
		public void Set ( float x, float y, float w, float h, Color color, Vector2 texCoordTL, Vector2 texCoordBR )
		{
			vertexTL.Position.X = x;
            vertexTL.Position.Y = y;
            vertexTL.Position.Z = Depth;
            vertexTL.Color = color;
            vertexTL.TextureCoordinate.X = texCoordTL.X;
            vertexTL.TextureCoordinate.Y = texCoordTL.Y;            

			vertexTR.Position.X = x+w;
            vertexTR.Position.Y = y;
            vertexTR.Position.Z = Depth;
            vertexTR.Color = color;
            vertexTR.TextureCoordinate.X = texCoordBR.X;
            vertexTR.TextureCoordinate.Y = texCoordTL.Y;

			vertexBL.Position.X = x;
            vertexBL.Position.Y = y+h;
            vertexBL.Position.Z = Depth;
            vertexBL.Color = color;
			vertexBL.TextureCoordinate.X = texCoordTL.X;
            vertexBL.TextureCoordinate.Y = texCoordBR.Y;

			vertexBR.Position.X = x+w;
            vertexBR.Position.Y = y+h;
            vertexBR.Position.Z = Depth;
            vertexBR.Color = color;
			vertexBR.TextureCoordinate.X = texCoordBR.X;
            vertexBR.TextureCoordinate.Y = texCoordBR.Y;
		}
Example #29
0
        /// <summary>
        /// Initialize this instance.
        /// </summary>
        public override void Initialize()
        {
            this.game = new NormalMap.Game();
            this.game.Initialize(this);

            #region WAVE SOFTWARE LICENSE AGREEMENT
            this.backgroundSplashColor = new Color("#ebebeb");
            this.spriteBatch = new SpriteBatch(WaveServices.GraphicsDevice);

            var resourceNames = System.Reflection.Assembly.GetExecutingAssembly().GetManifestResourceNames();
            string name = string.Empty;

            foreach (string item in resourceNames)
            {
                if (item.Contains("SplashScreen.wpk"))
                {
                    name = item;
                    break;
                }
            }

            if (string.IsNullOrWhiteSpace(name))
            {
                throw new InvalidProgramException("License terms not agreed.");
            }

            using (Stream stream = System.Reflection.Assembly.GetExecutingAssembly().GetManifestResourceStream(name))
            {
                this.splashScreen = WaveServices.Assets.Global.LoadAsset<Texture2D>(name, stream);
            }
            #endregion
        }
        // https://sites.google.com/a/jsc-solutions.net/work/knowledge-base/15-dualvr/20150812/cssstereo

        // https://zproxy.wordpress.com/2012/11/13/dos-warcraft/
        // https://zproxy.wordpress.com/2015/07/14/warcraft-360/

        // jsc should do correctly uri escapes
        // \kennedy.greg%40gmail.com\warcraft\dungeon1.png



        public static void SetDialogColor(IHTMLDiv toolbar, Color toolbar_color, bool up)
        {


            if (up)
            {
                toolbar.style.backgroundColor = toolbar_color;

                var toolbar_color_light = toolbar_color.AddLum(+20);
                var toolbar_color_shadow = toolbar_color.AddLum(-20);

                toolbar.style.borderLeft = "1px solid " + toolbar_color_light;
                toolbar.style.borderTop = "1px solid " + toolbar_color_light;
                toolbar.style.borderRight = "1px solid " + toolbar_color_shadow;
                toolbar.style.borderBottom = "1px solid " + toolbar_color_shadow;
                toolbar.style.backgroundPosition = "0px 0px";
            }
            else
            {
                toolbar.style.backgroundColor = toolbar_color.AddLum(+15);

                var toolbar_color_light = toolbar_color.AddLum(+20 + 15);
                var toolbar_color_shadow = toolbar_color.AddLum(-20 + 15);

                toolbar.style.borderLeft = "1px solid " + toolbar_color_shadow;
                toolbar.style.borderTop = "1px solid " + toolbar_color_shadow;
                toolbar.style.borderRight = "1px solid " + toolbar_color_light;
                toolbar.style.borderBottom = "1px solid " + toolbar_color_light;
                toolbar.style.backgroundPosition = "1px 1px";
            }

        }