public void Init(string name, Mogre.RenderWindow window, InputContext inputContext, UIListener listener) { Name = name; this.window = window; this.inputContext = inputContext; this.listener = listener; cursorWasVisible = false; OverlayManager om = Mogre.OverlayManager.Singleton; string nameBase = Name + "/"; cursorLayer = om.Create(nameBase + "CursorLayer"); cursorLayer.ZOrder = 1; // make backdrop and cursor overlay containers cursor = (Mogre.OverlayContainer)om.CreateOverlayElementFromTemplate("SdkTrays/Cursor", "Panel", nameBase + "Cursor"); cursorLayer.Add2D(cursor); cursorLayer.ZOrder = 400; ShowCursor(); gameCursor = new GameCursor(); }
public SdkTrayManager(string name) { Name = name; string nameBase = Name + "/"; nameBase = nameBase.Replace(" ", "_"); for (var i = 0; i < _widgets.Length; i++) { _widgets[i] = new List <Widget>(); } OverlayManager om = OverlayManager.Singleton; _backdropLayer = om.Create(nameBase + "BackdropLayer"); _traysLayer = om.Create(nameBase + "WidgetsLayer"); _priorityLayer = om.Create(nameBase + "PriorityLayer"); _cursorLayer = om.Create(nameBase + "CursorLayer"); _backdropLayer.ZOrder = 100;; _traysLayer.ZOrder = 200; _priorityLayer.ZOrder = 300; _cursorLayer.ZOrder = 400; // make backdrop and cursor overlay containers _cursor = (OverlayContainer)om.CreateOverlayElementFromTemplate("SdkTrays/Cursor", "Panel", nameBase + "Cursor"); _cursorLayer.Add2D(_cursor); _backdrop = (OverlayContainer)om.CreateOverlayElement("Panel", nameBase + "Backdrop"); _backdropLayer.Add2D(_backdrop); _dialogShade = (OverlayContainer)om.CreateOverlayElement("Panel", nameBase + "DialogShade"); _dialogShade.MaterialName = "SdkTrays/Shade"; _dialogShade.Hide(); _priorityLayer.Add2D(_dialogShade); string[] trayNames = new[] { "TopLeft", "Top", "TopRight", "Left", "Center", "Right", "BottomLeft", "Bottom", "BottomRight" }; for (var i = 0; i < 9; i++) // make the real trays { _trays[i] = (OverlayContainer)om.CreateOverlayElementFromTemplate ("SdkTrays/Tray", "BorderPanel", nameBase + trayNames[i] + "Tray"); _traysLayer.Add2D(_trays[i]); _trayWidgetAlign[i] = GuiHorizontalAlignment.GHA_CENTER; // align trays based on location if (i == (int)TrayLocation.Top || i == (int)TrayLocation.Center || i == (int)TrayLocation.Bottom) { _trays[i].HorizontalAlignment = GuiHorizontalAlignment.GHA_CENTER; } if (i == (int)TrayLocation.Left || i == (int)TrayLocation.Center || i == (int)TrayLocation.Right) { _trays[i].VerticalAlignment = GuiVerticalAlignment.GVA_CENTER; } if (i == (int)TrayLocation.TopRight || i == (int)TrayLocation.Right || i == (int)TrayLocation.BottomRight) { _trays[i].HorizontalAlignment = GuiHorizontalAlignment.GHA_RIGHT; } if (i == (int)TrayLocation.BottomLeft || i == (int)TrayLocation.Bottom || i == (int)TrayLocation.BottomRight) { _trays[i].VerticalAlignment = GuiVerticalAlignment.GVA_BOTTOM; } } // create the null tray for free-floating widgets _trays[9] = (OverlayContainer)om.CreateOverlayElement("Panel", nameBase + "NullTray"); _trayWidgetAlign[9] = GuiHorizontalAlignment.GHA_LEFT; _traysLayer.Add2D(_trays[9]); AdjustTrays(); ShowTrays(); ShowCursor(); }