public void _updateWindowDimensions(int RenderWidthInPixels, int RenderHeightInPixels) { mRenderWidthInPixels = RenderWidthInPixels; mRenderHeightInPixels = RenderHeightInPixels; mPixelCursorDimensions.x = mRelativeCursorDimensions.x; // *mRenderWidthInPixels;// GDZ: Prefiero al cursor en pixels mPixelCursorDimensions.y = mRelativeCursorDimensions.y; // *mRenderHeightInPixels;// GDZ: Prefiero al cursor en pixels mMousePointerContainer.SetDimensions(Mogre.Math.Ceil(mPixelCursorDimensions.x), Mogre.Math.Ceil(mPixelCursorDimensions.y)); mConstraints.x = RenderWidthInPixels; mConstraints.y = RenderHeightInPixels; mPosition.x = mConstraints.x / 2; mPosition.y = mConstraints.y / 2; constrainPosition(); }
public OverlayScene(Vector screenSize) { m_ScreenSize = screenSize; //note we need to load a font if we want to use a font var font = FontManager.Singleton.Create("Arial", ResourceGroupManager.DEFAULT_RESOURCE_GROUP_NAME); font.SetParameter("type", "truetype"); font.SetParameter("source", "Arial.ttf"); font.SetParameter("size", "16"); font.SetParameter("resolution", "96"); font.Load(); m_Container = (OverlayContainer)OverlayManager.Singleton.CreateOverlayElement("Panel", "PanelName"); //note positions and sizes are in relative screen space m_Container.SetPosition(0.35, 0.3); m_Container.SetDimensions(0.3, 0.5); m_Container.MaterialName = "triangle/red"; m_Overlay = OverlayManager.Singleton.Create("bob"); m_Overlay.Add2D(m_Container); m_Overlay.Show(); }
// Create text area for SkyX parameters private void _createTextArea() { // Create a panel OverlayContainer panel = (OverlayContainer)OverlayManager.Singleton.CreateOverlayElement("Panel", "SkyXParametersPanel"); panel.MetricsMode = GuiMetricsMode.GMM_PIXELS; panel.SetPosition(10, 10); panel.SetDimensions(400, 400); // Create a text area _textArea = OverlayManager.Singleton.CreateOverlayElement("TextArea", "SkyXParametersTextArea"); _textArea.MetricsMode = GuiMetricsMode.GMM_PIXELS; _textArea.SetPosition(0, 0); _textArea.SetDimensions(100, 100); // _textArea.Text = "MogreLib SkyX plugin demo"; _textArea._setHeight(16); //_textArea.FontName = "BlueHighway"; // _textArea.ColorBottom = new ColorEx(0.3f, 0.5f, 0.3f); //_textArea.ColorTop = new ColorEx(0.5f, 0.7f, 0.5f); // Create an overlay, and add the panel Overlay overlay = OverlayManager.Singleton.Create("OverlayName"); overlay.Add2D(panel); // Add the text area to the panel panel.AddChild(_textArea); // Show the overlay overlay.Show(); }
// Create text area for SkyX parameters private void CreateTextArea() { // Create a panel OverlayContainer panel = (OverlayContainer)OverlayManager.Singleton.CreateOverlayElement("Panel", "SkyXParametersPanel"); panel.MetricsMode = GuiMetricsMode.GMM_PIXELS; panel.SetPosition(10, 10); panel.SetDimensions(400, 400); // Create a text area textArea = (TextAreaOverlayElement)OverlayManager.Singleton.CreateOverlayElement("TextArea", "SkyXParametersTextArea"); textArea.MetricsMode = GuiMetricsMode.GMM_PIXELS; textArea.SetPosition(0, 0); textArea.SetDimensions(100, 100); textArea.Caption = "SkyX plugin demo"; textArea.CharHeight = 16; textArea.FontName = "BlueHighway"; textArea.ColourBottom = new ColourValue(0.3f, 0.5f, 0.3f); textArea.ColourTop = new ColourValue(0.5f, 0.7f, 0.7f); // Create an overlay, and add the panel Overlay overlay = OverlayManager.Singleton.Create("OverlayName"); overlay.Add2D(panel); // Add the text area to the panel panel.AddChild(textArea); // Show the overlay overlay.Show(); }
public static void AddTextBox(String id, String text, float x, float y, float width, float height, ColourValue colorTop, ColourValue colorBot) { try { OverlayManager overlayMgr = OverlayManager.Singleton; OverlayContainer panel = (OverlayContainer)overlayMgr.CreateOverlayElement("Panel", "_panel_" + id); panel.MetricsMode = GuiMetricsMode.GMM_PIXELS; panel.SetPosition(x, y); panel.SetDimensions(width, height); TextAreaOverlayElement textArea = (TextAreaOverlayElement)overlayMgr.CreateOverlayElement("TextArea", "_area_" + id); textArea.MetricsMode = GuiMetricsMode.GMM_PIXELS; textArea.SetPosition(0, 0); textArea.SetDimensions(width, height); textArea.Caption = text; textArea.CharHeight = 16; textArea.FontName = "Verdana"; textArea.ColourTop = colorTop; textArea.ColourBottom = colorBot; Overlay overlay = overlayMgr.Create("_overlay_" + id); overlay.Add2D(panel); panel.AddChild(textArea); overlay.Show(); } catch (Exception e) { Util.Log("Unable to create text area."); } }
private void ConfigureContainer(OverlayContainer container, OverlayElement element, int width, int height, int posX, int posY) { container.MetricsMode = GuiMetricsMode.GMM_PIXELS; container.SetDimensions(minimapViewport.ActualWidth, minimapViewport.ActualHeight); container.SetPosition(posX, posY); container.AddChild(element); hudOverlay.Add2D(container); container.Show(); }
public OverlayContainer createOverlay(String N, Vector2 P, Vector2 D, String M, String C, bool A, Overlay target) { String t = "Panel"; if (C != "") { t = "TextArea"; } OverlayElement e = OverlayManager.Singleton.CreateOverlayElement(t, N + this.name + DateTime.Now.Ticks); e.MetricsMode = GuiMetricsMode.GMM_PIXELS; e.SetDimensions(D.x, D.y); e.SetPosition(0, 0); //if (M != "") // e.MaterialName = M; if (C != "") { if (A) { e.Top = OVERLAY_TITLE_MARGIN; e.Left = OVERLAY_TITLE_MARGIN; } e.Caption = C; e.SetParameter("font_name", mFont); e.SetParameter("char_height", StringConverter.ToString(mFontSize)); } OverlayContainer c = (OverlayContainer) OverlayManager.Singleton.CreateOverlayElement("Panel", name + "ContainerHack" + (oc++).ToString()); c.MetricsMode = GuiMetricsMode.GMM_PIXELS; c.SetDimensions(D.x, D.y); c.SetPosition(P.x, P.y); if (M != "") { c.MaterialName = M; } c.AddChild(e); if (A) { target.Add2D(c); c.Show(); } return(c); }
public SimpleQuad(String name, String materialName, float left, float top, float width, float height, ColourValue colour) { Panel = OverlayManager.Singleton.CreateOverlayElement("Panel", name) as OverlayContainer; Panel.MetricsMode = GuiMetricsMode.GMM_RELATIVE; Panel.SetDimensions(width, height); Panel.SetPosition(left, top); Panel.MaterialName = materialName; Panel.Colour = colour; }
public void SetRect(Vector4 rect) { bool changedPos = false; if (x != rect.x) { x = rect.x; changedPos = true; } if (y != rect.y) { y = rect.y; changedPos = true; } if (changedPos) { mO.SetPosition(x, y); } bool changedDim = false; if (w != rect.z) { w = rect.z; changedDim = true; } if (h != rect.w) { h = rect.w; changedDim = true; } if (changedDim) { mO.SetDimensions(w, h); } }
private void CreateMessageContainer() { // BetaGUI.GUI gui = new GUI(); // Window w = gui.createWindow(); // w.createStaticImage() backgroundElement.Hide(); iconOverlay = OverlayManager.Singleton.GetByName("Wof/MessageBar"); iconElement = OverlayManager.Singleton.GetOverlayElement("Wof/MessageBarIcon"); iconElement.MetricsMode = GuiMetricsMode.GMM_RELATIVE; iconElement.SetDimensions(radioIconWidth, radioIconWidth); iconElement.Show(); iconOverlay.Hide(); // zewnetrzny kontener ukryje wszystko iconDefaultDimesions.x = Mogre.StringConverter.ParseReal(iconElement.GetParameter("width")); iconDefaultDimesions.y = Mogre.StringConverter.ParseReal(iconElement.GetParameter("height")); messageElement = OverlayManager.Singleton.CreateOverlayElement( "TextArea", "messageElement " + DateTime.Now.Ticks); messageContainer = (OverlayContainer)OverlayManager.Singleton.CreateOverlayElement( "Panel", "messageContainer " + DateTime.Now.Ticks); messageElement.SetDimensions(mainViewport.ActualWidth, mainViewport.ActualHeight); messageElement.MetricsMode = GuiMetricsMode.GMM_PIXELS; messageElement.SetParameter("font_name", FontManager.CurrentFont); messageElement.MetricsMode = GuiMetricsMode.GMM_RELATIVE; messageElement.SetParameter("char_height", StringConverter.ToString(EngineConfig.CurrentFontSize)); messageElement.SetParameter("colour_top", "0.1 0.1 0.1"); messageElement.SetParameter("colour_bottom", "0.5 0.1 0.1"); messageElement.Caption = ""; messageContainer.MetricsMode = GuiMetricsMode.GMM_RELATIVE; messageContainer.SetDimensions(1.0f, 0.05f); // messageContainer.SetPosition(0.055f, 0.015f); messageContainer.AddChild(messageElement); messageOverlay.Add2D(messageContainer); messageContainer.Show(); }
public void Update(int time) { ModelEffectsManager.Instance.UpdateEffect(time, EffectType.BulletTimeEffect); float width = ModelEffectsManager.Instance.GetEffectLevel(EffectType.BulletTimeEffect) * _width; //_barOverConta.SetPosition(_startPoint.X, _startPoint.Y - (_heigth - h)); _barOverConta.SetDimensions(width, _height); _barOverConta.Show(); // todo: timer if (width < _width * _threshold) { thresholdCrossed = true; if (blinkDelay.Milliseconds > 100) { BetaGUI.Window.ChangeContainerColour(_text, _colour2); if (_text.IsVisible) { _text.Hide(); } else { _text.Show(); } blinkDelay.Reset(); } } else { if (thresholdCrossed) { blinkDelay.Reset(); BetaGUI.Window.ChangeContainerColour(_text, _colour1); if (!_text.IsVisible) { _text.Show(); } thresholdCrossed = false; } } }
private void Initalize() { // Create the font resources // add the path to your resources.cfg // for example: // Default | ../../../Media/fonts | ../../../Media/fonts.zip Load("LiberationSans-Regular.ttf", Font.Default, 10); Load("LiberationSans-Bold.ttf", Font.DefaultBold, 15); Load("LiberationSans-Italic.ttf", Font.DefaultItalic, 10); //Load("LiberationMono-Regular.ttf", Font.Console, 26); // Create the overlay panel _OverlayPanel = OverlayManager.Singleton.CreateOverlayElement("Panel", new Guid().ToString()) as OverlayContainer; _OverlayPanel.MetricsMode = GuiMetricsMode.GMM_PIXELS; _OverlayPanel.SetPosition(0, 0); _OverlayPanel.SetDimensions(300, 120); _TextOverlay = OverlayManager.Singleton.Create(new Guid().ToString()); _TextOverlay.Add2D(_OverlayPanel); }
internal MouseCursor(Vector2 dimensions, string material, int RenderWidthInPixels, int RenderHeightInPixels) { instance = this; mMaterial = material; mRelativeCursorDimensions = dimensions; mRenderWidthInPixels = RenderWidthInPixels; mRenderHeightInPixels = RenderHeightInPixels; mVisible = true; mHideWhenOffScreen = true; mOnTopBorder = false; mOnBotBorder = false; mOnLeftBorder = false; mOnRightBorder = false; mPixelCursorDimensions.x = mRelativeCursorDimensions.x; // *RenderWidthInPixels; // GDZ: Prefiero al cursor en pixels mPixelCursorDimensions.y = mRelativeCursorDimensions.y; // *RenderHeightInPixels; // GDZ: Prefiero al cursor en pixels mConstraints.x = RenderWidthInPixels; mConstraints.y = RenderHeightInPixels; mPosition.x = mConstraints.x / 2; mPosition.y = mConstraints.y / 2; // Create Mouse Overlay mMouseOverlay = OverlayManager.Singleton.Create("simpleGUI_Mouse_Overlay"); mMouseOverlay.ZOrder = 649; mMouseOverlay.Show(); // Create Mouse Overlay Container mMousePointerContainer = (OverlayContainer)(OverlayManager.Singleton.CreateOverlayElement("Panel", "simpleGUI_Mouse_Container")); mMousePointerContainer.MetricsMode = GuiMetricsMode.GMM_PIXELS; mMousePointerContainer.SetPosition(mPosition.x, mPosition.y); mMousePointerContainer.SetDimensions(Mogre.Math.Ceil(mPixelCursorDimensions.x), Mogre.Math.Ceil(mPixelCursorDimensions.y)); mMousePointerContainer.MaterialName = mMaterial; mMouseOverlay.Add2D(mMousePointerContainer); mMousePointerContainer.Show(); }
public OverlayGUI() { //setup the colours top = new ColourValue(0.9f, 0.9f, 0.9f); bot = new ColourValue(0.8f, 0.8f, 0.8f); seltop = new ColourValue(0.9f, 0.7f, 0.7f); selbot = new ColourValue(0.8f, 0.6f, 0.6f); //Overlay overlayManager = OverlayManager.Singleton; // Create a panel panel = (OverlayContainer)overlayManager.CreateOverlayElement("Panel", "PanelName"); panel.MetricsMode = GuiMetricsMode.GMM_PIXELS; panel.SetPosition(0, 0); panel.SetDimensions(Program.Instance.rWindow.Width, Program.Instance.rWindow.Height); panel.MaterialName = "fsO/Blank"; // Optional background material // Create a text area messageArea = (TextAreaOverlayElement)overlayManager.CreateOverlayElement("TextArea", "TextArea"); messageArea.MetricsMode = GuiMetricsMode.GMM_PIXELS; messageArea.SetPosition(0, 0); messageArea.SetDimensions(Program.Instance.rWindow.Width, 100); messageArea.CharHeight = 24; messageArea.FontName = "damn"; messageArea.ColourTop = top; messageArea.ColourBottom = bot; messageArea.Caption = ""; // Status text area statArea = (TextAreaOverlayElement)overlayManager.CreateOverlayElement("TextArea", "StatTextArea"); statArea.MetricsMode = GuiMetricsMode.GMM_PIXELS; statArea.SetPosition(0, Program.Instance.rWindow.Height - 50); statArea.SetDimensions(Program.Instance.rWindow.Width, 50); statArea.CharHeight = 24; statArea.FontName = "damn"; statArea.ColourTop = top; statArea.ColourBottom = bot; statArea.Caption = "this is a test" + Environment.NewLine + "This is the test's second line"; //Menus Text Areas titleArea = (TextAreaOverlayElement)overlayManager.CreateOverlayElement("TextArea", "TitleTextArea"); titleArea.MetricsMode = GuiMetricsMode.GMM_PIXELS; titleArea.SetPosition(64, 16); titleArea.SetDimensions(Program.Instance.rWindow.Width, 32); titleArea.CharHeight = 32; titleArea.FontName = "damn"; titleArea.ColourTop = top; titleArea.ColourBottom = bot; titleArea.Caption = "Title"; for (int i = 0; i < 10; i++) { optionAreas[i] = (TextAreaOverlayElement)overlayManager.CreateOverlayElement("TextArea", i+"TextArea"); optionAreas[i].MetricsMode = GuiMetricsMode.GMM_PIXELS; optionAreas[i].SetPosition(32, 64 + (i*26)); optionAreas[i].SetDimensions(Program.Instance.rWindow.Width, 24); optionAreas[i].CharHeight = 24; optionAreas[i].FontName = "damn"; optionAreas[i].ColourTop = top; optionAreas[i].ColourBottom = bot; optionAreas[i].Caption = "Option " + i.ToString(); } maxOptions = 10; // Create an overlay, and add the panel overlay = overlayManager.Create("OverlayName"); overlay.Add2D(panel); // Add the text area to the panel panel.AddChild(messageArea); panel.AddChild(titleArea); panel.AddChild(statArea); for (int i = 0; i < 10; i++) { panel.AddChild(optionAreas[i]); } // Show the overlay overlay.Show(); }
public void SetDimensions(float left, float top, float width, float height) { Panel.SetDimensions(width, height); Panel.SetPosition(left, top); }