void SetupDockSpaces()
 {
     //1. controller
     this.dockspaceController = new DockSpacesController(this, SpaceConcept.NineSpace);
     //2.
     this.dockspaceController.LeftTopSpace.Content     = boxLeftTop = CreateSpaceBox(SpaceName.LeftTop, Color.Red);
     this.dockspaceController.RightTopSpace.Content    = boxRightTop = CreateSpaceBox(SpaceName.RightTop, Color.Red);
     this.dockspaceController.LeftBottomSpace.Content  = boxLeftBottom = CreateSpaceBox(SpaceName.LeftBottom, Color.Red);
     this.dockspaceController.RightBottomSpace.Content = boxRightBottom = CreateSpaceBox(SpaceName.RightBottom, Color.Red);
     //3.
     this.dockspaceController.LeftSpace.Content   = boxLeft = CreateSpaceBox(SpaceName.Left, Color.Blue);
     this.dockspaceController.TopSpace.Content    = boxTop = CreateSpaceBox(SpaceName.Top, Color.Yellow);
     this.dockspaceController.RightSpace.Content  = boxRight = CreateSpaceBox(SpaceName.Right, Color.Green);
     this.dockspaceController.BottomSpace.Content = boxBottom = CreateSpaceBox(SpaceName.Bottom, Color.Yellow);
     //--------------------------------
     //left and right space expansion
     dockspaceController.LeftSpaceVerticalExpansion  = VerticalBoxExpansion.TopBottom;
     dockspaceController.RightSpaceVerticalExpansion = VerticalBoxExpansion.TopBottom;
     dockspaceController.SetRightSpaceWidth(200);
     dockspaceController.SetLeftSpaceWidth(200);
     //------------------------------------------------------------------------------------
     this.ninespaceGrippers               = new NinespaceGrippers(this.dockspaceController);
     this.ninespaceGrippers.LeftGripper   = gripperLeft = CreateGripper(Color.Red, false);
     this.ninespaceGrippers.RightGripper  = gripperRight = CreateGripper(Color.Red, false);
     this.ninespaceGrippers.TopGripper    = gripperTop = CreateGripper(Color.Red, true);
     this.ninespaceGrippers.BottomGripper = gripperBottom = CreateGripper(Color.Red, true);
     this.ninespaceGrippers.UpdateGripperPositions();
     //------------------------------------------------------------------------------------
 }
Esempio n. 2
0
        public override void _Ready()
        {
            var size   = GetViewportRect().Size;
            var length = size.x / 1.25f;
            var d      = new PerlinWaveDrawing()
            {
                Length   = length,
                Position = (size / 2) - new Vector2(length / 2, 0)
            };

            AddChild(d);

            // Top left
            var box = new SimpleBox()
            {
                Position = new Vector2(10, 10)
            };

            AddChild(box);

            // Joint
            var joint = new PerlinMouseJoint()
            {
                Drawing = d
            };

            box.AddChild(joint);
        }
Esempio n. 3
0
        //--------------------//

        #region Dispose
        protected override void OnDispose()
        {
            Log.Info("Disposing engine\nLast framerate: " + Performance.Fps);

            // Dispose scenes and views
            ExtraRender = null;
            foreach (var view in Views)
            {
                view.Scene.Dispose();
            }
            base.OnDispose();

            // Shutdown music
            Music?.Dispose();

            // Dispose cached assets
            Cache?.Dispose();

            // Dispose default meshes
            SimpleSphere?.Dispose();
            SimpleBox?.Dispose();

            // Dispose Direct3D device
            BackBuffer?.Dispose();
            Device?.Dispose();

            // Dispose DirectSound objects
            //_listener?.Dispose();
            AudioDevice?.Dispose();

            _direct3D?.Dispose();

            // Dispose debug window
            _debugForm?.Dispose();
        }
Esempio n. 4
0
        void CreateRBGScrollBarAndSampleColorBox(
            int x, int y,
            out ScrollBar scBar,
            out SimpleBox sampleBox,
            SimpleAction <ScrollBar, SimpleBox> pairAction
            )
        {
            //horizontal scrollbar
            scBar = new LayoutFarm.CustomWidgets.ScrollBar(300, 15);

            //TODO: add mx with layout engine
            scBar.ScrollBarType = CustomWidgets.ScrollBarType.Horizontal;
            scBar.SetLocation(x, y);
            scBar.MinValue    = 0;
            scBar.MaxValue    = 255 * 10;
            scBar.SmallChange = 1;
            //
            scBar.ScrollValue = 0; //init
                                   //
            sampleBox = new SimpleBox(30, 30);
            sampleBox.SetLocation(x + 350, y);
            //
            var n_scBar     = scBar;
            var n_sampleBox = sampleBox;

            scBar.SliderBox.UserScroll += (s, e) => pairAction(n_scBar, n_sampleBox);

            pairAction(n_scBar, n_sampleBox);
        }
        protected override void OnStartDemo(SampleViewport viewport)
        {
            this.viewport = viewport;
            {
                animationBoard           = new SimpleBox(800, 800);
                animationBoard.BackColor = PixelFarm.Drawing.Color.White;
                viewport.AddContent(animationBoard);
            }
            //
            {
                List <PennerAnimationInfo> pennerAnimationList = LoadAllPennerAnimationList();
                ListView easingFuncs_List = new ListView(200, 850);
                easingFuncs_List.SetLocation(600, 20);
                viewport.AddContent(easingFuncs_List);
                easingFuncs_List.ListItemMouseEvent += (s, e) =>
                {
                    //do animation
                    PennerAnimationInfo animation = pennerAnimationList[easingFuncs_List.SelectedIndex];
                    //
                    GenerateAnimation(animation._generatorDelegate);
                };

                //add item
                foreach (PennerAnimationInfo pennerAnimation in pennerAnimationList)
                {
                    ListItem listItem = new ListItem(200, 20);
                    listItem.Text = pennerAnimation._name;
                    listItem.Tag  = pennerAnimation;
                    easingFuncs_List.AddItem(listItem);
                }
            }
        }
Esempio n. 6
0
 void CreateHsvVarBoxes(SampleViewport viewport, int x, int y)
 {
     hsv_varBoxes = new SimpleBox[9];
     for (int i = 0; i < 9; ++i)
     {
         SimpleBox hsv_varBox = new SimpleBox(40, 40);
         hsv_varBox.SetLocation(x + (i * 40), y);
         hsv_varBoxes[i] = hsv_varBox;
         viewport.AddContent(hsv_varBox);
     }
 }
Esempio n. 7
0
 void CreateSwatchBoxes(SampleViewport viewport, int x, int y)
 {
     swatch_Boxes = new SimpleBox[6];
     for (int i = 0; i < 6; ++i)
     {
         SimpleBox swatchBox = new SimpleBox(40, 40);
         swatchBox.SetLocation(x + (i * 40), y);
         swatch_Boxes[i] = swatchBox;
         viewport.AddContent(swatchBox);
     }
 }
Esempio n. 8
0
 void CreateRBGVarBoxes(SampleViewport viewport, int x, int y)
 {
     rgb_varBoxes = new SimpleBox[7];
     for (int i = 0; i < 7; ++i)
     {
         SimpleBox rgb_varBox = new SimpleBox(40, 40);
         rgb_varBox.SetLocation(x + (i * 40), y);
         rgb_varBoxes[i] = rgb_varBox;
         viewport.AddContent(rgb_varBox);
     }
 }
        void GenerateAnimation(PennerAnimationGeneratorDelegate pennerAnimator)
        {
            float startValue       = 0;
            float stopValue        = 300;
            float sec              = 0;
            float completeDuration = 10;

            animationBoard.ClearChildren();

            List <double> calculatedValues = new List <double>();

            while (sec < completeDuration)
            {
                double currentValue = pennerAnimator(sec, startValue, stopValue, completeDuration);
                //step 0.1 sec (100 ms), until complete at 5 sec
                sec += 0.1f;
                calculatedValues.Add(currentValue);
                //System.Console.WriteLine(currentValue.ToString());
            }

            //create image box that present the results
            int j = calculatedValues.Count;

            for (int i = 0; i < j; ++i)
            {
                SimpleBox box = new SimpleBox(5, 5);
                box.SetLocation(5 * i, (int)calculatedValues[i]);
                animationBoard.AddChild(box);
            }

            //-----
            //show animation

            SimpleBox sampleBox1 = new SimpleBox(600, 20);

            animationBoard.AddChild(sampleBox1);
            sampleBox1.BackColor = PixelFarm.Drawing.Color.Red;
            int step = 0;

            UIPlatform.RegisterTimerTask(10, tim =>
            {
                //animate the box
                sampleBox1.SetLocation(10, (int)calculatedValues[step]);
                if (step < j - 1)
                {
                    step++;
                }
                else
                {
                    //unregister and remove the task
                    tim.Remove();
                }
            });
        }
Esempio n. 10
0
    void Start()
    {
        Screen.SetResolution(780, 439, false);

        log  = GameObject.Find("LogText").GetComponent <Text> ();
        host = GameObject.Find("InputHost").GetComponent <InputField> ();
//		host.text = "180.153.140.230"; // 公司公网
//		host.text = "192.168.80.110"; // 公司局域网,左的电脑
//		host.text = "47.96.9.117"; // 金梧阿里云
        host.text = "114.55.230.240";         // 公司阿里云
        simpleBox = GameObject.Find("SimpleBox").GetComponent <SimpleBox> ();
    }
Esempio n. 11
0
        public void BoundingBoxTest()
        {
            string[]           lines  = File.ReadAllLines("Data/points1.txt");
            List <SimplePoint> points = new List <SimplePoint>();

            foreach (string line in lines)
            {
                string[] lp = line.Split('=', ';');
                points.Add(new SimplePoint {
                    X = double.Parse(lp[1]), Y = double.Parse(lp[3])
                });
            }

            SimpleBox box = points.BoundingBox();

            Assert.IsNotNull(box);
        }
Esempio n. 12
0
        public override void _Ready()
        {
            var size = GetViewportRect().Size;

            var box = new SimpleBox()
            {
                Position = size / 2
            };

            AddChild(box);
            box.AddChild(new SimpleMouseJoint());

            var floor = new SimpleWall()
            {
                BodySize = new Vector2(size.x, 100),
                Position = new Vector2(size.x / 2, size.y)
            };

            AddChild(floor);
        }
Esempio n. 13
0
        protected override void OnStartDemo(SampleViewport viewport)
        {
            colorMatch = new ColorMatch();
            colorMatch.VariationsRGB = new RGB[7];
            colorMatch.VariationsHSV = new RGB[9];
            blenderAlgo = colorMatch.Algorithms[0];
            //

            {
                lstvw_blendAlgo = new ListView(200, 400);
                lstvw_blendAlgo.SetLocation(500, 20);
                viewport.AddContent(lstvw_blendAlgo);
                lstvw_blendAlgo.ListItemMouseEvent += (s, e) =>
                {
                    if (lstvw_blendAlgo.SelectedIndex > -1)
                    {
                        blenderAlgo = colorMatch.Algorithms[lstvw_blendAlgo.SelectedIndex];
                        UpdateAllComponents();
                    }
                };

                //add item
                foreach (IAlgorithm algo in colorMatch.Algorithms)
                {
                    ListItem listItem = new ListItem(200, 20);
                    listItem.Text = algo.GetType().Name;
                    listItem.Tag  = algo;
                    lstvw_blendAlgo.AddItem(listItem);
                }
            }

            //start RGB value
            byte r_value = 200;
            byte g_value = 46;
            byte b_value = 49;


            CreateRBGVarBoxes(viewport, 20, 250);
            CreateHsvVarBoxes(viewport, 20, 300);
            CreateSwatchBoxes(viewport, 20, 350);

            {
                pure_rgbBox           = new SimpleBox(50, 50);
                pure_rgbBox.BackColor = new PixelFarm.Drawing.Color(
                    (byte)r_value,
                    (byte)b_value,
                    (byte)g_value);
                pure_rgbBox.SetLocation(0, 0);
                viewport.AddContent(pure_rgbBox);
            }

            //R
            {
                CreateRBGScrollBarAndSampleColorBox(80, 80, out r_sc, out r_sampleBox, (n_scrollBar, n_sampleBox) =>
                {
                    if (_component_ready)
                    {
                        n_sampleBox.BackColor = new PixelFarm.Drawing.Color((byte)(n_scrollBar.ScrollValue / 10), 0, 0);
                        UpdateAllComponents();
                    }
                });
                viewport.AddContent(r_sc);
                viewport.AddContent(r_sampleBox);
            }
            //G
            {
                CreateRBGScrollBarAndSampleColorBox(80, 120, out g_sc, out g_sampleBox, (n_scrollBar, n_sampleBox) =>
                {
                    if (_component_ready)
                    {
                        n_sampleBox.BackColor = new PixelFarm.Drawing.Color(0, (byte)(n_scrollBar.ScrollValue / 10), 0);
                        UpdateAllComponents();
                    }
                });
                viewport.AddContent(g_sc);
                viewport.AddContent(g_sampleBox);
            }
            //B
            {
                CreateRBGScrollBarAndSampleColorBox(80, 160, out b_sc, out b_sampleBox, (n_scrollBar, n_sampleBox) =>
                {
                    if (_component_ready)
                    {
                        n_sampleBox.BackColor = new PixelFarm.Drawing.Color(0, 0, (byte)(n_scrollBar.ScrollValue / 10));
                        UpdateAllComponents();
                    }
                });
                viewport.AddContent(b_sc);
                viewport.AddContent(b_sampleBox);
            }
            _component_ready = true;
        }