Exemple #1
0
 public BasicGradientBrush(BasicColor color, BasicColor color2, float angle) : base(color)
 {
     Color2 = color2;
     Angle = angle;
     StartPoint = new BasicPoint(0, 0);
     EndPoint = new BasicPoint(0, 0);
 }
Exemple #2
0
 public void HighlightRenderers(Renderer[] renderers, BasicColor color, bool overlay)
 {
     for (int i = 0; i < renderers.Length; i++)
     {
         HighlightRenderer(renderers[i], color, overlay);
     }
 }
Exemple #3
0
 public static void HighlightRenderer(Renderer renderer, BasicColor color, bool overlay, string collectionName)
 {
     if (TryGetCollection(collectionName, out OutlineCollection collection))
     {
         collection.HighlightRenderer(renderer, color, overlay);
     }
 }
Exemple #4
0
 override public void DrawPixel(int x, int y, BasicColor color)
 {
     BasicTypeSerializer.Put(Context, (byte)Command.DrawPixel);
     BasicTypeSerializer.Put(Context, (ushort)x);
     BasicTypeSerializer.Put(Context, (ushort)y);
     BasicTypeSerializer.Put(Context, (ushort)color);
 }
Exemple #5
0
        public SongGridViewTheme()
        {
            //gridViewSongs.Theme.AlbumCoverBackgroundGradient = new BackgroundGradient(System.Drawing.Color.FromArgb(255, 36, 47, 53), System.Drawing.Color.FromArgb(255, 36, 47, 53), LinearGradientMode.Horizontal, System.Drawing.Color.Gray, 0);
            //gridViewSongs.Theme.HeaderHoverTextGradient = new TextGradient(System.Drawing.Color.FromArgb(255, 69, 88, 101), System.Drawing.Color.FromArgb(255, 69, 88, 101), LinearGradientMode.Horizontal, System.Drawing.Color.Gray, 0, fontHeader);
            //gridViewSongs.Theme.HeaderTextGradient = new TextGradient(System.Drawing.Color.FromArgb(255, 69, 88, 101), System.Drawing.Color.FromArgb(255, 69, 88, 101), LinearGradientMode.Horizontal, System.Drawing.Color.Gray, 0, fontHeader);
            //gridViewSongs.Theme.IconNowPlayingGradient = new Gradient(System.Drawing.Color.FromArgb(255, 250, 200, 250), System.Drawing.Color.FromArgb(255, 25, 150, 25), LinearGradientMode.Horizontal);
            //gridViewSongs.Theme.RowNowPlayingTextGradient = new TextGradient(System.Drawing.Color.FromArgb(255, 135, 235, 135), System.Drawing.Color.FromArgb(255, 135, 235, 135), LinearGradientMode.Horizontal, System.Drawing.Color.Gray, 0, fontRow);
            //gridViewSongs.Theme.RowTextGradient = new TextGradient(System.Drawing.Color.White, System.Drawing.Color.White, LinearGradientMode.Horizontal, System.Drawing.Color.Gray, 0, fontRow);

            Padding = 6;
            BackgroundColor = new BasicColor(255, 255, 255);
            SelectedBackgroundColor = new BasicColor(200, 200, 200);
            MouseOverBackgroundColor = new BasicColor(255, 255, 255);
            NowPlayingBackgroundColor = new BasicColor(135, 235, 135);
            NowPlayingIndicatorBackgroundColor = new BasicColor(25, 150, 25);
            AlbumCoverBackgroundColor = new BasicColor(32, 40, 46);

            //HeaderBackgroundColor = new BasicColor(87, 107, 120); //new BasicColor(69, 88, 101);
            HeaderBackgroundColor = new BasicColor(69, 88, 101);
            MouseOverHeaderBackgroundColor = new BasicColor(104, 121, 133);

            TextColor = new BasicColor(0, 0, 0);
            HeaderTextColor = new BasicColor(255, 255, 255);

            FontName = "Roboto";
            FontNameBold = "Roboto Medium";
            FontNameAlbumArtTitle = "Roboto";
            FontNameAlbumArtSubtitle = "Roboto Light";
            FontSize = 11f;
        }
Exemple #6
0
        protected override bool OnAttached()
        {
            var effect = assetsService.Load <Effect>(EvergineContent.Effects.BasicColor);

            if (effect == null)
            {
                return(false);
            }

            var opaqueLayer = assetsService.Load <RenderLayerDescription>(DefaultResourcesIDs.OpaqueRenderLayerID);

            if (opaqueLayer == null)
            {
                return(false);
            }

            this.LightVisualMaterial = new BasicColor(effect)
            {
                LayerDescription = opaqueLayer,
            };

            this.RefreshLightVisual();

            return(base.OnAttached());
        }
Exemple #7
0
 public BasicGradientBrush(BasicColor color, BasicColor color2, BasicPoint startPoint, BasicPoint endPoint)
     : base(color)
 {
     Color2 = color2;
     StartPoint = startPoint;
     EndPoint = endPoint;
 }
 override public void DrawCircleFilled(int xCenter, int yCenter, int radius, BasicColor color) {
     BasicTypeSerializer.Put(Context,(byte)Command.DrawCircleFilled);
     BasicTypeSerializer.Put(Context,(ushort)xCenter);
     BasicTypeSerializer.Put(Context,(ushort)yCenter);
     BasicTypeSerializer.Put(Context,(ushort)radius);
     BasicTypeSerializer.Put(Context,(ushort)color);
 }
Exemple #9
0
 public static void TagRenderers(Renderer[] renderers, BasicColor color, bool overlay, bool flash)
 {
     for (int i = 0; i < renderers.Length; i++)
     {
         TagRenderer(renderers[i], color, overlay, flash);
     }
 }
Exemple #10
0
 public static void TagRenderers(DynamicObject obj, BasicColor color, bool overlay, bool flash)
 {
     if (obj == null)
     {
         return;
     }
     TagRenderers(obj.renderers, color, overlay, flash);
 }
 override public void DrawCornerFilled(int xCenter, int yCenter, int radius, CornerPosition position, BasicColor color) {
     BasicTypeSerializer.Put(Context,(byte)Command.DrawCornerFilled);
     BasicTypeSerializer.Put(Context,(ushort)xCenter);
     BasicTypeSerializer.Put(Context,(ushort)yCenter);
     BasicTypeSerializer.Put(Context,(ushort)radius);
     BasicTypeSerializer.Put(Context,(ushort)position);
     BasicTypeSerializer.Put(Context,(ushort)color);
 }
Exemple #12
0
 public static void HighlightRenderers(DynamicObject obj, BasicColor color, bool overlay, string collection)
 {
     if (obj == null)
     {
         return;
     }
     HighlightRenderers(obj.renderers, color, overlay, collection);
 }
 override public void DrawArrow(int x, int y, int size, DrawingDirection direction, BasicColor color) {
     BasicTypeSerializer.Put(Context,(byte)Command.DrawArrow);
     BasicTypeSerializer.Put(Context,(ushort)x);
     BasicTypeSerializer.Put(Context,(ushort)y);
     BasicTypeSerializer.Put(Context,(ushort)size);
     BasicTypeSerializer.Put(Context,(ushort)direction);
     BasicTypeSerializer.Put(Context,(ushort)color);
 }
 override public void DrawRectangleFilled(int x0, int y0, int x1, int y1, BasicColor color) {
     BasicTypeSerializer.Put(Context,(byte)Command.DrawRectangleFilled);
     BasicTypeSerializer.Put(Context,(ushort)x0);
     BasicTypeSerializer.Put(Context,(ushort)y0);
     BasicTypeSerializer.Put(Context,(ushort)x1);
     BasicTypeSerializer.Put(Context,(ushort)y1);
     BasicTypeSerializer.Put(Context,(ushort)color);
 }
 public void DrawText(string text, BasicPoint point, BasicColor color, string fontFace, float fontSize)
 {
     _context.SetSourceRGB(color.R / 255f, color.G / 255f, color.B / 255f);
     _context.SelectFontFace(fontFace, FontSlant.Normal, FontWeight.Normal);
     _context.SetFontSize(fontSize);
     _context.MoveTo(point.X, point.Y);
     _context.ShowText(text);
 }
Exemple #16
0
 override public void DrawCircleFilled(int xCenter, int yCenter, int radius, BasicColor color)
 {
     BasicTypeSerializer.Put(Context, (byte)Command.DrawCircleFilled);
     BasicTypeSerializer.Put(Context, (ushort)xCenter);
     BasicTypeSerializer.Put(Context, (ushort)yCenter);
     BasicTypeSerializer.Put(Context, (ushort)radius);
     BasicTypeSerializer.Put(Context, (ushort)color);
 }
 private void CreateDrawingResources()
 {
     ColorBackground = new BasicColor(32, 40, 46);
     ColorForeground = new BasicColor(231, 76, 60);
     _brushBackground = new BasicBrush(ColorBackground);
     _brushForeground = new BasicBrush(ColorForeground);
     _penTransparent = new BasicPen();
 }
Exemple #18
0
 override public void DrawIcon16(int x, int y, BasicColor color, ushort[] icon)
 {
     BasicTypeSerializer.Put(Context, (byte)Command.DrawIcon16);
     BasicTypeSerializer.Put(Context, (ushort)x);
     BasicTypeSerializer.Put(Context, (ushort)y);
     BasicTypeSerializer.Put(Context, (ushort)color);
     BasicTypeSerializer.Put(Context, icon);
 }
Exemple #19
0
 override public void DrawString(int x, int y, BasicColor color, FontInfo fontInfo, string text)
 {
     BasicTypeSerializer.Put(Context, (byte)Command.DrawString);
     BasicTypeSerializer.Put(Context, (ushort)x);
     BasicTypeSerializer.Put(Context, (ushort)y);
     BasicTypeSerializer.Put(Context, (ushort)color);
     BasicTypeSerializer.Put(Context, fontInfo.ID);
     BasicTypeSerializer.Put(Context, text, true);
 }
Exemple #20
0
 override protected void DrawCirclePoints(int cx, int cy, int x, int y, BasicColor color)
 {
     BasicTypeSerializer.Put(Context, (byte)Command.DrawCirclePoints);
     BasicTypeSerializer.Put(Context, (ushort)cx);
     BasicTypeSerializer.Put(Context, (ushort)cy);
     BasicTypeSerializer.Put(Context, (ushort)x);
     BasicTypeSerializer.Put(Context, (ushort)y);
     BasicTypeSerializer.Put(Context, (ushort)color);
 }
Exemple #21
0
 override public void DrawRectangle(int x0, int y0, int x1, int y1, BasicColor color)
 {
     BasicTypeSerializer.Put(Context, (byte)Command.DrawRectangle);
     BasicTypeSerializer.Put(Context, (ushort)x0);
     BasicTypeSerializer.Put(Context, (ushort)y0);
     BasicTypeSerializer.Put(Context, (ushort)x1);
     BasicTypeSerializer.Put(Context, (ushort)y1);
     BasicTypeSerializer.Put(Context, (ushort)color);
 }
 private void InitializeTrackBars()
 {
     var backgroundColor = new BasicColor(242, 242, 242);
     trackBufferSize.Theme.BackgroundColor = backgroundColor;
     trackMaximumFolderSize.Theme.BackgroundColor = backgroundColor;
     trackUpdateFrequency_OutputMeter.Theme.BackgroundColor = backgroundColor;
     trackUpdateFrequency_SongPosition.Theme.BackgroundColor = backgroundColor;
     trackUpdatePeriod.Theme.BackgroundColor = backgroundColor;
 }
 override public void DrawLineDotted(int x0, int y0, int x1, int y1, int empty, int solid, BasicColor color) {
     BasicTypeSerializer.Put(Context,(byte)Command.DrawLineDotted);
     BasicTypeSerializer.Put(Context,(ushort)x0);
     BasicTypeSerializer.Put(Context,(ushort)y0);
     BasicTypeSerializer.Put(Context,(ushort)x1);
     BasicTypeSerializer.Put(Context,(ushort)y1);
     BasicTypeSerializer.Put(Context,(ushort)empty);
     BasicTypeSerializer.Put(Context,(ushort)solid);
     BasicTypeSerializer.Put(Context,(ushort)color);
 }
Exemple #24
0
 override public void DrawRectangleRounded(int x0, int y0, int x1, int y1, BasicColor color, int radius, RoundedCornerStyle corners)
 {
     BasicTypeSerializer.Put(Context, (byte)Command.DrawRectangleRounded);
     BasicTypeSerializer.Put(Context, (ushort)x0);
     BasicTypeSerializer.Put(Context, (ushort)y0);
     BasicTypeSerializer.Put(Context, (ushort)x1);
     BasicTypeSerializer.Put(Context, (ushort)y1);
     BasicTypeSerializer.Put(Context, (ushort)color);
     BasicTypeSerializer.Put(Context, (ushort)radius);
     BasicTypeSerializer.Put(Context, (ushort)corners);
 }
Exemple #25
0
 public void HighlightRenderer(Renderer renderer, BasicColor color, bool overlay)
 {
     if (!renderers.Contains(renderer))
     {
         renderers.Add(renderer);
         colors.Add(color);
         overlays.Add(overlay);
     }
     else
     {
         int i = renderers.IndexOf(renderer);
         colors[i]   = color;
         overlays[i] = overlay;
     }
 }
Exemple #26
0
 public static void TagRenderer(Renderer renderer, BasicColor color, bool overlay, bool flash)
 {
     if (!renderers.Contains(renderer))
     {
         renderers.Add(renderer);
         colors.Add(color);
         overlays.Add(overlay);
         flashes.Add(flash);
     }
     else
     {
         int i = renderers.IndexOf(renderer);
         colors[i]   = color;
         overlays[i] = overlay;
         flashes[i]  = flash;
     }
 }
        public static void SetColors(BasicColor[,] layer, Texture2D color, Vector2 pointPosition, Shapes shape, int brushSize)
        {
            switch (shape)
            {
            case Shapes.CIRCLE:
                if (((DrawingScene)GlobalParameters.Scenes["Drawing Scene"]).drawingTool != DrawingTools.ERASER)
                {
                    for (int i = (int)pointPosition.X - (brushSize / 2); i <= pointPosition.X + (brushSize / 2); i++)
                    {
                        for (int j = (int)pointPosition.Y - (brushSize / 2); j <= pointPosition.Y + (brushSize / 2); j++)
                        {
                            float positionX = i;
                            float positionY = j;
                            if (Math.Pow((positionX - pointPosition.X), 2) + Math.Pow((positionY - pointPosition.Y), 2) <= Math.Pow(brushSize / 2, 2))
                            {
                                BasicColor point = new BasicColor(color, new Vector2(positionX, positionY), new Vector2(1, 1));
                                if (positionX - (int)Frame.position.X < 0 || positionY - (int)Frame.position.Y < 0 || positionX >= Frame.width + (int)Frame.position.X || positionY >= Frame.height + (int)Frame.position.Y)
                                {
                                    continue;
                                }
                                layer[(int)positionX - (int)Frame.position.X, (int)positionY - (int)Frame.position.Y] = point;
                            }
                        }
                    }
                }
                break;

            case Shapes.RECTANGLE:
                for (int i = -1 * (brushSize / 2); i < brushSize / 2; i++)
                {
                    for (int j = -1 * (brushSize / 2); j < brushSize / 2; j++)
                    {
                        float      positionX = pointPosition.X + i;
                        float      positionY = pointPosition.Y + j;
                        BasicColor point     = new BasicColor(color, new Vector2(positionX, positionY), new Vector2(1, 1));
                        if (positionX < 0 || positionY < 0 || positionX >= Frame.width || positionY >= Frame.height)
                        {
                            return;
                        }
                        layer[(int)positionX, (int)positionY] = point;
                    }
                }
                break;
            }
        }
Exemple #28
0
 override public void DrawProgressBar(
     int x, int y,
     int width, int height,
     RoundedCornerStyle borderCorners,
     RoundedCornerStyle progressCorners,
     BasicColor borderColor, BasicColor borderFillColor,
     BasicColor progressBorderColor, BasicColor progressFillColor,
     int progress)
 {
     BasicTypeSerializer.Put(Context, (byte)Command.DrawProgressBar);
     BasicTypeSerializer.Put(Context, (ushort)x);
     BasicTypeSerializer.Put(Context, (ushort)y);
     BasicTypeSerializer.Put(Context, (ushort)width);
     BasicTypeSerializer.Put(Context, (ushort)height);
     BasicTypeSerializer.Put(Context, (ushort)borderCorners);
     BasicTypeSerializer.Put(Context, (ushort)progressCorners);
     BasicTypeSerializer.Put(Context, (ushort)borderColor);
     BasicTypeSerializer.Put(Context, (ushort)borderFillColor);
     BasicTypeSerializer.Put(Context, (ushort)progressBorderColor);
     BasicTypeSerializer.Put(Context, (ushort)progressFillColor);
     BasicTypeSerializer.Put(Context, (ushort)progress);
 }
Exemple #29
0
 public override void DrawButton(
     int x, int y,
     int width, int height,
     FontInfo fontInfo,
     int fontHeight,
     BasicColor borderColor,
     BasicColor fillColor,
     BasicColor fontColor,
     string text,
     Canvas.RoundedCornerStyle cornerStyle = RoundedCornerStyle.All)
 {
     BasicTypeSerializer.Put(Context,(byte)Command.DrawButton);
     BasicTypeSerializer.Put(Context,(ushort)x);
     BasicTypeSerializer.Put(Context,(ushort)y);
     BasicTypeSerializer.Put(Context,(ushort)width);
     BasicTypeSerializer.Put(Context,(ushort)height);
     BasicTypeSerializer.Put(Context,fontInfo.ID);
     BasicTypeSerializer.Put(Context,(ushort)fontHeight);
     BasicTypeSerializer.Put(Context,(ushort)borderColor);
     BasicTypeSerializer.Put(Context,(ushort)fillColor);
     BasicTypeSerializer.Put(Context,(ushort)fontColor);
     BasicTypeSerializer.Put(Context,text, true);
     BasicTypeSerializer.Put(Context,(ushort)cornerStyle);
 }
Exemple #30
0
 override public void DrawButton(
     int x, int y,
     int width, int height,
     FontInfo fontInfo,
     int fontHeight,
     BasicColor borderColor,
     BasicColor fillColor,
     BasicColor fontColor,
     string text,
     Canvas.RoundedCornerStyle cornerStyle = RoundedCornerStyle.All)
 {
     BasicTypeSerializer.Put(Context, (byte)Command.DrawButton);
     BasicTypeSerializer.Put(Context, (ushort)x);
     BasicTypeSerializer.Put(Context, (ushort)y);
     BasicTypeSerializer.Put(Context, (ushort)width);
     BasicTypeSerializer.Put(Context, (ushort)height);
     BasicTypeSerializer.Put(Context, fontInfo.ID);
     BasicTypeSerializer.Put(Context, (ushort)fontHeight);
     BasicTypeSerializer.Put(Context, (ushort)borderColor);
     BasicTypeSerializer.Put(Context, (ushort)fillColor);
     BasicTypeSerializer.Put(Context, (ushort)fontColor);
     BasicTypeSerializer.Put(Context, text, true);
     BasicTypeSerializer.Put(Context, (ushort)cornerStyle);
 }
 public void DrawText(string text, BasicRectangle rectangle, BasicColor color, string fontFace, float fontSize)
 {
 }
Exemple #32
0
 public static void TagRenderers(string doKey, BasicColor color, bool overlay, bool flash)
 {
     TagRenderers(DynamicObjectManager.GetDynamicObjectFromKey(doKey), color, overlay, flash);
 }
 public void SetStrokeColor(BasicColor color)
 {
     TryToCreatePaint();
     _currentPaint.Color = GenericControlHelper.ToColor(color);
 }
 override protected void DrawCirclePoints(int cx, int cy, int x, int y, BasicColor color) {
     BasicTypeSerializer.Put(Context,(byte)Command.DrawCirclePoints);
     BasicTypeSerializer.Put(Context,(ushort)cx);
     BasicTypeSerializer.Put(Context,(ushort)cy);
     BasicTypeSerializer.Put(Context,(ushort)x);
     BasicTypeSerializer.Put(Context,(ushort)y);
     BasicTypeSerializer.Put(Context,(ushort)color);
 }
 override public void DrawIcon16(int x, int y, BasicColor color, ushort[] icon) {
     BasicTypeSerializer.Put(Context,(byte)Command.DrawIcon16);
     BasicTypeSerializer.Put(Context,(ushort)x);
     BasicTypeSerializer.Put(Context,(ushort)y);
     BasicTypeSerializer.Put(Context,(ushort)color);
     BasicTypeSerializer.Put(Context,icon);
 }
 override public void DrawProgressBar(
     int x, int y,
     int width, int height,
     RoundedCornerStyle borderCorners,
     RoundedCornerStyle progressCorners,
     BasicColor borderColor, BasicColor borderFillColor,
     BasicColor progressBorderColor, BasicColor progressFillColor,
     int progress) {
     BasicTypeSerializer.Put(Context,(byte)Command.DrawProgressBar);
     BasicTypeSerializer.Put(Context,(ushort)x);
     BasicTypeSerializer.Put(Context,(ushort)y);
     BasicTypeSerializer.Put(Context,(ushort)width);
     BasicTypeSerializer.Put(Context,(ushort)height);
     BasicTypeSerializer.Put(Context,(ushort)borderCorners);
     BasicTypeSerializer.Put(Context,(ushort)progressCorners);
     BasicTypeSerializer.Put(Context,(ushort)borderColor);
     BasicTypeSerializer.Put(Context,(ushort)borderFillColor);
     BasicTypeSerializer.Put(Context,(ushort)progressBorderColor);
     BasicTypeSerializer.Put(Context,(ushort)progressFillColor);
     BasicTypeSerializer.Put(Context,(ushort)progress);
 }
Exemple #37
0
        //TT -- Changed to include height and color
//        void AddWall(int row, int col)
//        {
//            AddWall(row, col, DefaultHeight, BasicColor.White);
//        }

        // Adds a simple cube at a specified location in the maze grid
        void AddWall(int row, int col, float height, BasicColor color)
        {

            // TT Oct-2006 - Add an option to use a sphere instead of a cube
            if (_UseSphere[(byte)color])
            {
                SphereShapeProperties cSphereShape = null;
                SingleShapeEntity sphere = null;
                float radius;

                radius = _state.SphereScale *  height / 2.0f;

                // create simple entity, with a single shape
                cSphereShape = new SphereShapeProperties(
                    // TT -- Change to infinite mass so that the walls
                    // do not "blow apart" if you bump them!
                    // TT Oct 2006 -- Allow user to specify this
                        _WallMasses[(byte)color], // mass in kilograms.
                        new Pose(),     // relative pose
                        radius);    // radius
                cSphereShape.Material = new MaterialProperties("gsphere", 1.0f, 0.01f, 0.01f);
                // Set the color of the sphere according to the bitmap image
                // or the specified color if no bitmap
                if (_WallTextures[(byte)color] == "")
                {
                    // TT - Changed for October CTP because DiffuseColor
                    // is a Vector4, but my WallColors are Vector3
                    //cBoxShape.DiffuseColor = _WallColors[(byte)color];
                    cSphereShape.DiffuseColor.X = (float)(_WallColors[(byte)color].X / 255.0);
                    cSphereShape.DiffuseColor.Y = (float)(_WallColors[(byte)color].Y / 255.0);
                    cSphereShape.DiffuseColor.Z = (float)(_WallColors[(byte)color].Z / 255.0);
                    cSphereShape.DiffuseColor.W = 1.0f;
                }
                else
                    cSphereShape.TextureFileName = _WallTextures[(byte)color];

                sphere = new SingleShapeEntity(new SphereShape(cSphereShape),
                    new Vector3((col * -_state.GridSpacing),
                            radius,
                            -(row * _state.GridSpacing)));

                // Name the entity. All entities must have unique names
                sphere.State.Name = "ball_" + row + "_" + col;

                // Insert entity in simulation.  
                _simEnginePort.Insert(sphere);
            }
            else
            {
                // Dimensions are in meters
                Vector3 dimensions =
                    new Vector3(_state.WallBoxSize * _state.GridSpacing,
                            height * _state.HeightScale,
                            _state.WallBoxSize * _state.GridSpacing);
                BoxShapeProperties cBoxShape = null;
                SingleShapeEntity box = null;

                // create simple immovable entity, with a single shape
                cBoxShape = new BoxShapeProperties(
                    // TT -- Change to infinite mass so that the walls
                    // do not "blow apart" if you bump them!
                    // TT Oct 2006 -- Allow user to specify this
                        _WallMasses[(byte)color], // mass in kilograms.
                        new Pose(),     // relative pose
                        dimensions);    // dimensions
                cBoxShape.Material = new MaterialProperties("gbox", 1.0f, 0.4f, 0.5f);
                // Set the color of the box according to the bitmap image
                // or the specified color if no bitmap
                if (_WallTextures[(byte)color] == "")
                {
                    // TT - Changed for October CTP because DiffuseColor
                    // is a Vector4, but my WallColors are Vector3
                    //cBoxShape.DiffuseColor = _WallColors[(byte)color];
                    cBoxShape.DiffuseColor.X = (float)(_WallColors[(byte)color].X / 255.0);
                    cBoxShape.DiffuseColor.Y = (float)(_WallColors[(byte)color].Y / 255.0);
                    cBoxShape.DiffuseColor.Z = (float)(_WallColors[(byte)color].Z / 255.0);
                    cBoxShape.DiffuseColor.W = 0.5f;
                }
                else
                    cBoxShape.TextureFileName = _WallTextures[(byte)color];

                box = new SingleShapeEntity(new BoxShape(cBoxShape),
                    new Vector3(col * -_state.GridSpacing,
                            height * _state.HeightScale / 2,
                            -(row * _state.GridSpacing)));

                // Name the entity. All entities must have unique names
                box.State.Name = "wall_" + row + "_" + col;

                // Insert entity in simulation.  
                _simEnginePort.Insert(box);
            }

            BlockCounter++;
        }
Exemple #38
0
        // TT -- Changed to add a height and color
//        void AddWall(int startRow, int startCol, int endRow, int endCol)
//        {
//            AddWall(startRow, startCol, endRow, endCol, DefaultHeight);
//        }

        // Adds a long wall in the maze grid
        // Useful for reducing number of elements in simulation for better performance
        // TT -- Note that the existing code used height to refer to the
        // depth of the wall. Therefore the real height is called boxSize.
        void AddWall(int startRow, int startCol, int endRow, int endCol, float boxSize, BasicColor color)
        {
            int width = Math.Abs(endCol - startCol) + 1;
            int height = Math.Abs(endRow - startRow) + 1;

            float realWidth = (width * _state.GridSpacing) - (_state.GridSpacing - _state.WallBoxSize*_state.GridSpacing);
            float realHeight = (height * _state.GridSpacing) - (_state.GridSpacing - _state.WallBoxSize*_state.GridSpacing);

            //because the box is placed relative to the center of mass
            float widthOffset = (Math.Abs(endCol - startCol) * _state.GridSpacing) / 2;
            float heightOffset = -(Math.Abs(endRow - startRow) * _state.GridSpacing) / 2;

            if (_UseSphere[(byte)color])
            {
                // This object is a Sphere
                SphereShapeProperties cSphereShape = null;
                SingleShapeEntity sphere = null;
                float radius;

                radius = (float)(_state.SphereScale * Math.Sqrt(realWidth * realWidth + realHeight * realHeight) / 2.0f);

                // create simple entity, with a single shape
                cSphereShape = new SphereShapeProperties(
                    // TT -- Change to infinite mass so that the walls
                    // do not "blow apart" if you bump them!
                    // TT Oct 2006 -- Allow user to specify this
                    _WallMasses[(byte)color], // mass in kilograms.
                    new Pose(),     // relative pose
                    radius);        // radius
                cSphereShape.Material = new MaterialProperties("gsphere", 0.9f, 0.05f, 0.1f);
                cSphereShape.Material.Advanced = new MaterialAdvancedProperties();
                cSphereShape.Material.Advanced.RestitutionCombineMode = CoefficientsCombineMode.Max;
                cSphereShape.Material.Advanced.FrictionCombineMode = CoefficientsCombineMode.Min;
                cSphereShape.Material.Advanced.Spring = new SpringProperties();
                cSphereShape.Material.Advanced.Spring.SpringCoefficient = 0.9f;
                cSphereShape.Material.Advanced.Spring.DamperCoefficient = 0.1f;
                cSphereShape.Advanced = new ShapeAdvancedProperties();
                cSphereShape.Advanced.PhysicsCalculationPasses = 20.0f;
                //cSphereShape.Advanced.MassSpaceIntertiaTensor = new Vector3(1.0f, 0.0f, 1.0f);
                // TT - These do not seem to have much effect
                //cSphereShape.MassDensity.AngularDamping = 0.0f;
                //cSphereShape.MassDensity.LinearDamping = 0.0f;
                //cSphereShape.MassDensity.Mass = _WallMasses[(byte)color];
                //cSphereShape.MassDensity.Density = 0.1f;

                // Set the color of the sphere according to the bitmap image
                // or the specified color if no bitmap
                if (_WallTextures[(byte)color] == "")
                {
                    // TT - Changed for October CTP because DiffuseColor
                    // is a Vector4, but my WallColors are Vector3
                    //cBoxShape.DiffuseColor = _WallColors[(byte)color];
                    cSphereShape.DiffuseColor.X = (float)(_WallColors[(byte)color].X / 255.0);
                    cSphereShape.DiffuseColor.Y = (float)(_WallColors[(byte)color].Y / 255.0);
                    cSphereShape.DiffuseColor.Z = (float)(_WallColors[(byte)color].Z / 255.0);
                    cSphereShape.DiffuseColor.W = 1.0f;
                }
                else
                    cSphereShape.TextureFileName = _WallTextures[(byte)color];

                sphere = new SingleShapeEntity(new SphereShape(cSphereShape),
                    new Vector3((startCol * -_state.GridSpacing) - widthOffset,
                                radius*2,
                                -(startRow * _state.GridSpacing) + heightOffset)
                    );

                // Name the entity. All entities must have unique names
                sphere.State.Name = "ball_" + startRow + "_" + startCol;

                // Insert entity in simulation.  
                _simEnginePort.Insert(sphere);

                /*
                SphereShapeProperties cSphereShape = null;
                SingleShapeEntity sphere = null;
                float radius;

                radius = (float)(_state.SphereScale * Math.Sqrt(realWidth * realWidth + realHeight * realHeight) / 2.0f);

                // create simple entity, with a single shape
                cSphereShape = new SphereShapeProperties(
                        1.0f,   // mass in kilograms.
                        new Pose(),     // relative pose
                        radius);    // radius
                cSphereShape.Material = new MaterialProperties("gsphere", 1.0f, 0.01f, 0.01f);
                sphere = new SingleShapeEntity(new SphereShape(cSphereShape),
                    new Vector3((startCol * -_state.GridSpacing) - widthOffset,
                                radius,
                                -(startRow * _state.GridSpacing) + heightOffset)
                    );

                // Name the entity. All entities must have unique names
                sphere.State.Name = "ball_" + startRow + "_" + startCol;

                // Insert entity in simulation.  
                _simEnginePort.Insert(sphere);
                 */
            }
            else
            {
                // This object is a wall (stretched cube)
                Vector3 dimensions =
                    new Vector3(realWidth, boxSize * _state.HeightScale, realHeight);
                        // Dimensions are in meters
                BoxShapeProperties cBoxShape = null;
                SingleShapeEntity box = null;

                cBoxShape = new BoxShapeProperties(
                    // TT -- Change to infinite mass so that the walls
                    // do not "blow apart" if you bump them!
                    // TT Oct 2006 -- Allow user to specify this
                        _WallMasses[(byte)color], // mass in kilograms.
                        new Pose(),     // relative pose
                        dimensions);    // dimensions
//                cBoxShape = new BoxShapeProperties(0, new Pose(), dimensions);
                // Walls have the same properties as the ground
                cBoxShape.Material = new MaterialProperties("gbox", 0.8f, 0.5f, 0.8f);
                // Set the color of the box according to the bitmap image
                // or the specified color if no bitmap
                if (_WallTextures[(byte)color] == "")
                {
                    // TT - Changed for October CTP because DiffuseColor
                    // is a Vector4, but my WallColors are Vector3
                    //cBoxShape.DiffuseColor = _WallColors[(byte)color];
                    cBoxShape.DiffuseColor.X = (float)(_WallColors[(byte)color].X / 255.0);
                    cBoxShape.DiffuseColor.Y = (float)(_WallColors[(byte)color].Y / 255.0);
                    cBoxShape.DiffuseColor.Z = (float)(_WallColors[(byte)color].Z / 255.0);
                    cBoxShape.DiffuseColor.W = 0.5f;
                }
                else
                    cBoxShape.TextureFileName = _WallTextures[(byte)color];
                    
                // Raul
                if (color == BasicColor.White)
                {
                    cBoxShape.TextureFileName = "bricks_4.jpg";
                }
                if (color == BasicColor.Red)
                {
                    cBoxShape.TextureFileName = "wood2.jpg";
                }

                box = new SingleShapeEntity(new BoxShape(cBoxShape),
                    new Vector3((startCol * -_state.GridSpacing) - widthOffset,
                                boxSize * _state.HeightScale / 2,
                                -(startRow * _state.GridSpacing) + heightOffset)
                    );
                // Name the entity. All entities must have unique names
                box.State.Name = "wall_" + startRow + "_" + startCol;
                _simEnginePort.Insert(box);
            }

            BlockCounter++;
        }
Exemple #39
0
 override public void DrawTriangleFilled(int x0, int y0, int x1, int y1, int x2, int y2, BasicColor color)
 {
     BasicTypeSerializer.Put(Context, (byte)Command.DrawTriangleFilled);
     BasicTypeSerializer.Put(Context, (ushort)x0);
     BasicTypeSerializer.Put(Context, (ushort)y0);
     BasicTypeSerializer.Put(Context, (ushort)x1);
     BasicTypeSerializer.Put(Context, (ushort)y1);
     BasicTypeSerializer.Put(Context, (ushort)x2);
     BasicTypeSerializer.Put(Context, (ushort)y2);
     BasicTypeSerializer.Put(Context, (ushort)color);
 }
Exemple #40
0
 public static Color ToColor(BasicColor color)
 {
     return Color.Argb(color.A, color.R, color.G, color.B);
 }
Exemple #41
0
 private void CreateDrawingResources()
 {
     ColorBackground = new BasicColor(32, 40, 46);
     ColorForeground = new BasicColor(230, 237, 242);//174, 196, 212);
     ColorBorder = new BasicColor(83, 104, 119);
     _brushBackground = new BasicBrush(ColorBackground);
     _brushForeground = new BasicBrush(ColorForeground);
     _brushBorder = new BasicBrush(ColorBorder);
     _brushTransparent = new BasicBrush(new BasicColor(0, 0, 0, 0));
     _penBorder = new BasicPen(_brushBorder, 2);
     _penForeground = new BasicPen(_brushForeground, 2);
     _penTransparent = new BasicPen();
 }
 public void DrawText(string text, BasicRectangle rectangle, BasicColor color, string fontFace, float fontSize)
 {
     var formattedText = new FormattedText(text, CultureInfo.InvariantCulture, FlowDirection.LeftToRight, new Typeface(fontFace), fontSize, new SolidColorBrush(GenericControlHelper.ToColor(color)));
     if (rectangle.Width > 0)
         formattedText.MaxTextWidth = rectangle.Width;
     if (rectangle.Height > 0)
         formattedText.MaxTextHeight = rectangle.Height;
     formattedText.Trimming = TextTrimming.CharacterEllipsis;            
     _context.DrawText(formattedText, GenericControlHelper.ToPoint(new BasicPoint(rectangle.X, rectangle.Y)));            
 }
 override public void DrawTriangle(int x0, int y0, int x1, int y1, int x2, int y2, BasicColor color) {
     BasicTypeSerializer.Put(Context,(byte)Command.DrawTriangle);
     BasicTypeSerializer.Put(Context,(ushort)x0);
     BasicTypeSerializer.Put(Context,(ushort)y0);
     BasicTypeSerializer.Put(Context,(ushort)x1);
     BasicTypeSerializer.Put(Context,(ushort)y1);
     BasicTypeSerializer.Put(Context,(ushort)x2);
     BasicTypeSerializer.Put(Context,(ushort)y2);
     BasicTypeSerializer.Put(Context,(ushort)color);
 }
 public void DrawText(string text, BasicPoint point, BasicColor color, string fontFace, float fontSize)
 {
     var formattedText = new FormattedText(text, CultureInfo.InvariantCulture, FlowDirection.LeftToRight, new Typeface(fontFace), fontSize, new SolidColorBrush(GenericControlHelper.ToColor(color)));
     _context.DrawText(formattedText, GenericControlHelper.ToPoint(point));
 }
 override public void DrawPixel(int x, int y, BasicColor color) {
     BasicTypeSerializer.Put(Context,(byte)Command.DrawPixel);
     BasicTypeSerializer.Put(Context,(ushort)x);
     BasicTypeSerializer.Put(Context,(ushort)y);
     BasicTypeSerializer.Put(Context,(ushort)color);
 }
Exemple #46
0
 override public void DrawFill(BasicColor color)
 {
     BasicTypeSerializer.Put(Context, (byte)Command.DrawFill);
     BasicTypeSerializer.Put(Context, (ushort)color);
 }
 override public void DrawString(int x, int y, BasicColor color, FontInfo fontInfo, string text) {
     BasicTypeSerializer.Put(Context,(byte)Command.DrawString);
     BasicTypeSerializer.Put(Context,(ushort)x);
     BasicTypeSerializer.Put(Context,(ushort)y);
     BasicTypeSerializer.Put(Context,(ushort)color);
     BasicTypeSerializer.Put(Context,fontInfo.ID);
     BasicTypeSerializer.Put(Context,text, true);
 }
Exemple #48
0
 override public void DrawLineDotted(int x0, int y0, int x1, int y1, int empty, int solid, BasicColor color)
 {
     BasicTypeSerializer.Put(Context, (byte)Command.DrawLineDotted);
     BasicTypeSerializer.Put(Context, (ushort)x0);
     BasicTypeSerializer.Put(Context, (ushort)y0);
     BasicTypeSerializer.Put(Context, (ushort)x1);
     BasicTypeSerializer.Put(Context, (ushort)y1);
     BasicTypeSerializer.Put(Context, (ushort)empty);
     BasicTypeSerializer.Put(Context, (ushort)solid);
     BasicTypeSerializer.Put(Context, (ushort)color);
 }
 override public void DrawFill(BasicColor color) {
     BasicTypeSerializer.Put(Context,(byte)Command.DrawFill);
     BasicTypeSerializer.Put(Context,(ushort)color);
 }
Exemple #50
0
 public Color32 GetColor(BasicColor color)
 {
     return(colors[(int)color]);
 }
 public void DrawText(string text, BasicRectangle rectangle, BasicColor color, string fontFace, float fontSize)
 {
     throw new NotImplementedException();
 }
Exemple #52
0
 override public void DrawCornerFilled(int xCenter, int yCenter, int radius, CornerPosition position, BasicColor color)
 {
     BasicTypeSerializer.Put(Context, (byte)Command.DrawCornerFilled);
     BasicTypeSerializer.Put(Context, (ushort)xCenter);
     BasicTypeSerializer.Put(Context, (ushort)yCenter);
     BasicTypeSerializer.Put(Context, (ushort)radius);
     BasicTypeSerializer.Put(Context, (ushort)position);
     BasicTypeSerializer.Put(Context, (ushort)color);
 }
Exemple #53
0
 public static void HighlightRenderers(string doKey, BasicColor color, bool overlay, string collection)
 {
     HighlightRenderers(DynamicObjectManager.GetDynamicObjectFromKey(doKey), color, overlay, collection);
 }
Exemple #54
0
 override public void DrawArrow(int x, int y, int size, DrawingDirection direction, BasicColor color)
 {
     BasicTypeSerializer.Put(Context, (byte)Command.DrawArrow);
     BasicTypeSerializer.Put(Context, (ushort)x);
     BasicTypeSerializer.Put(Context, (ushort)y);
     BasicTypeSerializer.Put(Context, (ushort)size);
     BasicTypeSerializer.Put(Context, (ushort)direction);
     BasicTypeSerializer.Put(Context, (ushort)color);
 }
 override public void DrawRectangleRounded(int x0, int y0, int x1, int y1, BasicColor color, int radius, RoundedCornerStyle corners) {
     BasicTypeSerializer.Put(Context,(byte)Command.DrawRectangleRounded);
     BasicTypeSerializer.Put(Context,(ushort)x0);
     BasicTypeSerializer.Put(Context,(ushort)y0);
     BasicTypeSerializer.Put(Context,(ushort)x1);
     BasicTypeSerializer.Put(Context,(ushort)y1);
     BasicTypeSerializer.Put(Context,(ushort)color);
     BasicTypeSerializer.Put(Context,(ushort)radius);
     BasicTypeSerializer.Put(Context,(ushort)corners);
 }
Exemple #56
0
		public static UIColor ToColor(BasicColor color)
		{
			return UIColor.FromRGBA(color.R, color.G, color.B, color.A);
		}