Beispiel #1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="rw"></param>
        public override void WindowResized(RenderWindow rw)
        {
            if (this.TrayManager == null)
            {
                return;
            }

            OverlayElementContainer center = this.TrayManager.TrayContainer[(int)TrayLocation.Center];
            OverlayElementContainer left   = this.TrayManager.TrayContainer[(int)TrayLocation.Left];

            if (center.IsVisible && rw.Width < 1280 - center.Width)
            {
                while (center.IsVisible)
                {
                    this.TrayManager.MoveWidgetToTray(this.TrayManager.GetWidget(TrayLocation.Center, 0), TrayLocation.Left);
                }
            }
            else if (left.IsVisible && rw.Width >= 1280 - left.Width)
            {
                while (left.IsVisible)
                {
                    this.TrayManager.MoveWidgetToTray(this.TrayManager.GetWidget(TrayLocation.Left, 0), TrayLocation.Center);
                }
            }
            base.WindowResized(rw);
        }
        public void CreateScene()
        {
            TextureUtil.CreateDynamicTextureAndMaterial(
                "OBDynamicTexture",
                "OBDynamicMaterial",
                _browserWidth,
                _browserHeight,
                out _texture,
                out _material);



            _panel = (OverlayElementContainer)OverlayManager.Instance.Elements.CreateElement("Panel", "Panels");
            _panel.SetPosition(1, 1);
            _panel.SetDimensions(_browserWidth, _browserHeight);
            _panel.MaterialName = "OBDynamicMaterial";


            _overlay = OverlayManager.Instance.Create("OverlayBrowser");
            _overlay.AddElement(_panel);
            _overlay.Show();

            Core.BrowserManager.BrowserRenderEvent += BrowserManager_BrowserRenderEvent;
            _browserId = Core.BrowserManager.CreateBrowser("http://www.google.com.au", _browserWidth, _browserHeight);
        }
Beispiel #3
0
        /// <summary>
        /// Static utility method to recursively delete an overlay element plus<para></para>
        /// all of its children from the system.
        /// </summary>
        /// <param name="element"></param>
        public static void NukeOverlayElement(OverlayElement element)
        {
            var container = element as OverlayElementContainer;

            if (container != null)
            {
                var toDelete = new List <OverlayElement>();
                foreach (OverlayElement child in container.Children.Values)
                {
                    toDelete.Add(child);
                }

                for (int i = 0; i < toDelete.Count; i++)
                {
                    NukeOverlayElement(toDelete[i]);
                }
            }
            if (element != null)
            {
                OverlayElementContainer parent = element.Parent;
                if (parent != null)
                {
                    parent.RemoveChild(element.Name);
                }
                OverlayManager.Instance.Elements.DestroyElement(element.Name);
            }
        }
Beispiel #4
0
        public GuiComponent(OverlayElement element)
        {
            this.element = element;
            OverlayElement          child  = element;
            OverlayElementContainer parent = element.Parent;

            this.Width  = element.Width;
            this.Height = element.Height;

            do
            {
                this.Left += child.Left;
                this.Top  += child.Top;
                if (parent == null)
                {
                    if (child.HorizontalAlignment == HorizontalAlignment.Right)
                    {
                        this.Left += GuiBase.Resolution.x;
                    }
                    else if (child.HorizontalAlignment == HorizontalAlignment.Center)
                    {
                        this.Left += (GuiBase.Resolution.x / 2);
                    }
                    if (child.VerticalAlignment == VerticalAlignment.Bottom)
                    {
                        this.Top += GuiBase.Resolution.y;
                    }
                    else if (child.VerticalAlignment == VerticalAlignment.Center)
                    {
                        this.Left += (GuiBase.Resolution.y / 2);
                    }
                    break;
                }
                if (child.HorizontalAlignment == HorizontalAlignment.Right)
                {
                    this.Left += parent.Width;
                }
                else if (child.HorizontalAlignment == HorizontalAlignment.Center)
                {
                    this.Left += (parent.Width / 2);
                }
                if (child.VerticalAlignment == VerticalAlignment.Bottom)
                {
                    this.Top += parent.Height;
                }
                else if (child.VerticalAlignment == VerticalAlignment.Center)
                {
                    this.Left += (parent.Height / 2);
                }
                child  = parent;
                parent = parent.Parent;
            }while (true);
        }
Beispiel #5
0
        public ObjectTextDisplay(MovableObject p, Camera c, string shapeName)
        {
            this.parent  = p;
            this.camera  = c;
            this.enabled = false;
            this.text    = "";

            // create an overlay that we can use for later

            // = Ogre.OverlayManager.getSingleton().create("shapeName");
            this.parentOverlay = (Overlay)OverlayManager.Instance.Create("shapeName");

            // (Ogre.OverlayContainer)(Ogre.OverlayManager.getSingleton().createOverlayElement("Panel", "container1"));
            this.parentContainer =
                (OverlayElementContainer)(OverlayElementManager.Instance.CreateElement("Panel", "container1", false));

            //parentOverlay.add2D(parentContainer);
            this.parentOverlay.AddElement(this.parentContainer);

            //parentText = Ogre.OverlayManager.getSingleton().createOverlayElement("TextArea", "shapeNameText");
            this.parentText = OverlayElementManager.Instance.CreateElement("TextArea", shapeName, false);

            this.parentText.SetDimensions(1.0f, 1.0f);

            //parentText.setMetricsMode(Ogre.GMM_PIXELS);
            this.parentText.MetricsMode = MetricsMode.Pixels;


            this.parentText.SetPosition(1.0f, 1.0f);


            this.parentText.SetParam("font_name", "Arial");
            this.parentText.SetParam("char_height", "25");
            this.parentText.SetParam("horz_align", "center");
            this.parentText.Color = new ColorEx(1.0f, 1.0f, 1.0f);
            //parentText.setColour(Ogre.ColourValue(1.0, 1.0, 1.0));


            this.parentContainer.AddChild(this.parentText);

            this.parentOverlay.Show();
        }