Example #1
0
        void KeyboardKeyDown1(object sender, OpenTK.Input.KeyboardKeyEventArgs e)
        {
            if (e.Key == OpenTK.Input.Key.Escape)
            {
                Quit(null, null);
                return;
            }
            else if (e.Key == OpenTK.Input.Key.F1)
            {
                TestList.Add("new string");
                NotifyValueChanged("TestList", TestList);
                return;
            }
            else if (e.Key == OpenTK.Input.Key.F4)
            {
                GraphicObject w = CrowInterface.LoadInterface("Interfaces/Divers/testWindow.goml");
                w.DataSource = this;
                return;
            }
            else if (e.Key == OpenTK.Input.Key.F5)
            {
                GraphicObject w = CrowInterface.LoadInterface("Interfaces/Divers/testWindow2.goml");
                w.DataSource = this;
                return;
            }
            else if (e.Key == OpenTK.Input.Key.F6)
            {
                GraphicObject w = CrowInterface.LoadInterface("Interfaces/Divers/imlEditor.crow");
                w.DataSource = this;
                return;
            }
            else if (e.Key == OpenTK.Input.Key.F2)
            {
                idx--;
            }
            else if (e.Key == OpenTK.Input.Key.F3)
            {
                idx++;
            }
            else
            {
                return;
            }

            CrowInterface.ClearInterface();

            if (idx == testFiles.Length)
            {
                idx = 0;
            }
            else if (idx < 0)
            {
                idx = testFiles.Length - 1;
            }

            this.Title = testFiles [idx] + ". Press <F3> to cycle examples.";
            GraphicObject obj = CrowInterface.LoadInterface(testFiles[idx]);

            obj.DataSource = this;
        }
Example #2
0
 public override void initGL()
 {
     quad = new Crow.vaoMesh(0, 0, 0, 1, 1, 1, -1);
     //ifaceModelMat = Matrix4.CreateRotationX(MathHelper.PiOver2) * Matrix4.CreateTranslation(Vector3.UnitY);
     CrowInterface.ProcessResize(iRect);
     createContext();
     //CrowInterface.ProcessResize (iRect);
 }
Example #3
0
        void closeWindow(string path)
        {
            GraphicObject g = CrowInterface.FindByName(path);

            if (g != null)
            {
                CrowInterface.DeleteWidget(g);
            }
        }
Example #4
0
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);

            CrowInterface.AddWidget(
                new Window()
            {
                Title = "Hello World"
            }
                );
        }
Example #5
0
        void onAddTabButClick(object sender, MouseButtonEventArgs e)
        {
            TabView tv = CrowInterface.FindByName("tabview1") as TabView;

            if (tv == null)
            {
                return;
            }
            tv.AddChild(new TabItem()
            {
                Caption = "NewTab"
            });
        }
Example #6
0
        void onImlSourceChanged(Object sender, TextChangeEventArgs e)
        {
            Instantiator i;

            try {
                i = Instantiator.CreateFromImlFragment(e.Text);
            } catch (Exception ex) {
                Debug.WriteLine(ex);
                return;
            }
            lock (CrowInterface.UpdateMutex) {
                (CrowInterface.FindByName("crowContainer") as Container).SetChild
                    (i.CreateInstance(CrowInterface));
            }
        }
Example #7
0
 void loadWindow(string path)
 {
     try {
         GraphicObject g = CrowInterface.FindByName(path);
         if (g != null)
         {
             return;
         }
         g            = CrowInterface.LoadInterface(path);
         g.Name       = path;
         g.DataSource = imlVE;
     } catch (Exception ex) {
         System.Diagnostics.Debug.WriteLine(ex.ToString());
     }
 }
Example #8
0
        public override bool ProcessMouseMove(int x, int y)
        {
            Matrix4 mv        = ifaceModelMat * modelview;
            Vector3 vMouse    = UnProject(ref projection, ref mv, viewport, new Vector2(x, y)).Xyz;
            Vector3 vE        = vEyePosition.Transform(ifaceModelMat.Inverted());
            Vector3 vMouseRay = Vector3.Normalize(vMouse - vE);
            float   a         = vE.Z / vMouseRay.Z;

            vMouse = vE - vMouseRay * a;
            //vMouse = vMouse.Transform (interfaceModelView.Inverted());
            localMousePos = new Point((int)Math.Truncate((vMouse.X + 0.5f) * iRect.Width),
                                      iRect.Height - (int)Math.Truncate((vMouse.Y + 0.5f) * iRect.Height));
            mouseIsInInterface = localMousePos.X.IsInBetween(0, iRect.Width) & localMousePos.Y.IsInBetween(0, iRect.Height);

            return(mouseIsInInterface ? CrowInterface.ProcessMouseMove(localMousePos.X, localMousePos.Y) : false);
        }
Example #9
0
        void initInterface()
        {
            this.MouseButtonUp     += Mouse_ButtonUp;
            this.MouseButtonDown   += Mouse_ButtonDown;
            this.MouseWheelChanged += Mouse_WheelChanged;
            this.MouseMove         += Mouse_Move;
            this.KeyDown           += Ottd3DWindow_KeyDown;

            //LoadInterface("#Ottd3D.ui.menu.goml").DataSource = this;


            CrowInterface.LoadInterface("#Ottd3D.ui.menu.crow").DataSource = this;

            viewedTexture = terrain.gridDepthTex;

            Crow.CompilerServices.ResolveBindings(this.Bindings);
        }
Example #10
0
        void Tv_SelectedItemChanged(object sender, SelectionChangeEventArgs e)
        {
            FileInfo fi = e.NewValue as FileInfo;

            if (fi == null)
            {
                return;
            }
            if (fi.Extension == ".crow" || fi.Extension == ".goml")
            {
                Instantiator i = new Instantiator(fi.FullName);
                lock (CrowInterface.UpdateMutex) {
                    (CrowInterface.FindByName("crowContainer") as Container).SetChild
                        (i.CreateInstance(CrowInterface));
                    CurSources = i.GetImlSourcesCode();
                }
            }
        }
Example #11
0
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);

            this.KeyDown += KeyboardKeyDown1;

            testFiles = new string [] { @"Interfaces/Divers/welcome.crow" };
            testFiles = testFiles.Concat(Directory.GetFiles(@"Interfaces/GraphicObject", "*.crow")).ToArray();
            testFiles = testFiles.Concat(Directory.GetFiles(@"Interfaces/Container", "*.crow")).ToArray();
            testFiles = testFiles.Concat(Directory.GetFiles(@"Interfaces/Group", "*.crow")).ToArray();
            testFiles = testFiles.Concat(Directory.GetFiles(@"Interfaces/Stack", "*.crow")).ToArray();
            testFiles = testFiles.Concat(Directory.GetFiles(@"Interfaces/Wrapper", "*.crow")).ToArray();
            testFiles = testFiles.Concat(Directory.GetFiles(@"Interfaces/Splitter", "*.crow")).ToArray();
            testFiles = testFiles.Concat(Directory.GetFiles(@"Interfaces/Expandable", "*.crow")).ToArray();
            testFiles = testFiles.Concat(Directory.GetFiles(@"Interfaces/Divers", "*.crow")).ToArray();

            this.Title = testFiles [idx] + ". Press <F3> to switch example.";
            CrowInterface.LoadInterface(testFiles[idx]).DataSource = this;
        }
Example #12
0
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);

            CrowInterface.AddWidget(new Label("Hello World"));
        }
Example #13
0
        void KeyboardKeyDown1(object sender, OpenTK.Input.KeyboardKeyEventArgs e)
        {
            if (e.Key == OpenTK.Input.Key.Escape)
            {
                Quit(null, null);
                return;
            }
            else if (e.Key == OpenTK.Input.Key.F1)
            {
                TestList.Add("new string");
                NotifyValueChanged("TestList", TestList);
                return;
            }
            else if (e.Key == OpenTK.Input.Key.F4)
            {
                GraphicObject w = CrowInterface.LoadInterface("Interfaces/TemplatedContainer/testWindow.goml");
                w.DataSource = this;
                return;
            }
            else if (e.Key == OpenTK.Input.Key.F5)
            {
                GraphicObject w = CrowInterface.LoadInterface("Interfaces/TemplatedContainer/testWindow2.goml");
                w.DataSource = this;
                return;
            }
            else if (e.Key == OpenTK.Input.Key.F6)
            {
                GraphicObject w = CrowInterface.LoadInterface("Interfaces/Divers/0.crow");
                w.DataSource = this;
                return;
            }
            else if (e.Key == OpenTK.Input.Key.F2)
            {
                idx--;
            }
            else if (e.Key == OpenTK.Input.Key.F3)
            {
                idx++;
            }
            else
            {
                return;
            }

            CrowInterface.ClearInterface();

            if (idx == testFiles.Length)
            {
                idx = 0;
            }
            else if (idx < 0)
            {
                idx = testFiles.Length - 1;
            }

            this.Title = testFiles [idx] + ". Press <F3> to cycle examples.";
            try {
                GraphicObject obj = CrowInterface.LoadInterface(testFiles[idx]);
                obj.DataSource = this;
            } catch (Exception ex) {
                Debug.WriteLine(ex.Message + ex.InnerException);
            }
        }
Example #14
0
        void onShowWindow(object sender, EventArgs e)
        {
            string   path          = "";
            object   data          = this;
            bool     twoWayBinding = false;
            CheckBox g             = sender as CheckBox;

            switch (g.Name)
            {
            case "checkImgViewer":
                path                     = "#Ottd3D.ui.imgView.crow";
                twoWayBinding            = true;
                queryTextureViewerUpdate = true;
                break;

            case "checkSplatting":
                terrain.CurrentState = Terrain.State.GroundTexturing;
                twoWayBinding        = true;
                path = "#Ottd3D.ui.SpattingMenu.goml";
                data = terrain;
                break;

            case "checkHeightMap":
                terrain.CurrentState = Terrain.State.HMEdition;
                twoWayBinding        = true;
                path = "#Ottd3D.ui.heightEditionMenu.goml";
                data = terrain;
                break;

            case "checkFps":
                path = "#Ottd3D.ui.fps.crow";
                break;

            case "checkShaderEditor":
                path          = "#Ottd3D.ui.ShaderEditor.crow";
                twoWayBinding = true;
                break;
            }
            Window win = CrowInterface.LoadInterface(path) as Window;

            g.Tag = win;
            if (g.Name == "checkSplatting")
            {
                win.Focused += splatWin_Focused;
            }
            else if (g.Name == "checkHeightMap")
            {
                win.Focused += hmWin_Focused;
            }


            win.Tag      = g;
            win.Closing += (object winsender, EventArgs wine) => {
                CheckBox cb = (winsender as Window).Tag as CheckBox;
                cb.Tag       = null;
                cb.IsChecked = false;
            };
            if (g.Name == "checkShaderEditor")
            {
                data = win;
            }
            win.DataSource = data;
            if (twoWayBinding)
            {
                Crow.CompilerServices.ResolveBindings((data as IBindable).Bindings);
            }
        }