public void DrawUI(SpriteBatch spr, LayoutUserInterface ui) { CurrentScreen?.DrawUI(spr, ui); // Draw fade thing. ui.IMGUI.GlobalTint = new Color(1, 1, 1, 1f - fadeLerp); }
public override void DrawUI(SpriteBatch sb, LayoutUserInterface ui) { int sw = Screen.Width; int sh = Screen.Height; ui.FontSize = 128; var size = ui.MeasureString("Raze"); ui.IMGUI.Label(new Point((sw - size.X) / 2, 40), "Raze", Color.Black, out Rectangle titleBounds); ui.FontSize = ui.DefaultFontSize; int w = 400; int h = 500; ui.PanelContext(new Rectangle((sw - w) / 2, Math.Max((sh - h) / 2, titleBounds.Bottom + 10), w, h)); if (ui.Button("Play")) { OnHostClicked(); } if (ui.Button("Join Multiplayer")) { OnConnectClicked(); } var panel = ui.GetContextInnerBounds(); int height = ui.IMGUI.ApplyScale(50); if (ui.IMGUI.Button(new Rectangle(panel.X, panel.Bottom - height, panel.Width, height), "Quit")) { OnExitClicked(); } ui.EndContext(); }
public override void DrawUI(SpriteBatch sb, LayoutUserInterface ui) { if (Main.LoadingIconSprite != null) { sb.Draw(Main.MissingTextureSprite, new Vector2(Screen.Width * 0.5f, Screen.Height * 0.5f), Color.White, 0f); } }
private void DrawInputUI(LayoutUserInterface ui) { int sw = ui.IMGUI.ScreenProvider.GetWidth(); int sh = ui.IMGUI.ScreenProvider.GetHeight(); int w = 350; int h = 350; var sb = new Rectangle((sw - w) / 2, (sh - h) / 2, w, h); ui.PanelContext(sb, PanelType.Default); var panel = ui.GetContextInnerBounds(); ui.TextBox(ipInput, new Point(panel.Width, 40)); ui.TextBox(portInput, new Point(panel.Width, 40)); ui.TextBox(passwordInput, new Point(panel.Width, 40)); ui.FlatSeparator(); if (ui.Button("Connect")) { OnConnectClicked(); } ui.ActiveTint = Color.Red; if (ui.IMGUI.Button(new Rectangle(panel.X, panel.Bottom - 32, panel.Width, 32), "Cancel")) { OnExitClicked(); } ui.ActiveTint = Color.White; ui.EndContext(); }
private void DrawInternalUI(SpriteBatch sb, LayoutUserInterface ui) { if (Input.IsKeyDown(Keys.Tab)) { sb.Draw(compass, new Vector2(30, 30), Color.White); //sb.Draw(Main.SpriteAtlas.Texture, Vector2.Zero, Color.White); } }
public override void DrawUI(SpriteBatch _, LayoutUserInterface ui) { if (isConnecting) { DrawConnectingUI(ui); } else { DrawInputUI(ui); } }
internal static void DrawAllUI(SpriteBatch spr, LayoutUserInterface ui) { foreach (var entity in activeEntities) { if (entity.IsDestroyed) { continue; } // TODO catch exceptions and handle. entity.DrawUI(spr, ui); } }
protected override void Initialize() { Thread.CurrentThread.Name = "Monogame Thread"; Main.GlobalGraphicsDevice = base.GraphicsDevice; // Create camera. Camera = new Camera(); Camera.Zoom = 0.5f; // Find content directory... ContentDirectory = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Content"); // Create content manager. ContentManager = new RazeContentManager(this.GraphicsDevice, ContentDirectory); // Create the UI layout object. LayoutUI = new LayoutUserInterface(new UserInterface(GraphicsDevice, new MonoGameMouseProvider(), new MonoGameKeyboardProvider(Window), new MonoGameScreenProvider(GraphicsDevice), new RazeContentProvider(ContentManager))); LayoutUI.DrawUI += (ui) => { ScreenManager.DrawUI(SpriteBatch, ui); }; // Create screen manager. ScreenManager = new ScreenManager(); // Register some screens. ScreenManager.Register(new SplashScreen()); ScreenManager.Register(new PlayScreen()); ScreenManager.Register(new MainMenuScreen()); ScreenManager.Register(new ConnectScreen()); ScreenManager.Init(ScreenManager.GetScreen <SplashScreen>()); // Init debug. Debug.Init(); base.Initialize(); }
private void DrawConnectingUI(LayoutUserInterface ui) { int sw = ui.IMGUI.ScreenProvider.GetWidth(); int sh = ui.IMGUI.ScreenProvider.GetHeight(); int w = 450; int h = 250; var sb = new Rectangle((sw - w) / 2, (sh - h) / 2, w, h); ui.PanelContext(sb); ui.Anchor = Anchor.Centered; ui.Paragraph(connectionStatus, TextAlignment.Centered, Color.White); ui.Anchor = Anchor.Vertical; ui.FlatSeparator(); if (ui.Button("Cancel")) { OnCancelConnectClicked(); } ui.EndContext(); }
internal void InternalDraw(LayoutUserInterface ui) { var bounds = ScreenBounds; MarginData?margins = null; int closeButtonHeight = 0; if (DrawCloseButton) { closeButtonHeight = ui.IMGUI.ApplyScale(ui.DefaultFontSize + 3); margins = new MarginData(10, 10, 10, 20 + closeButtonHeight); } ui.PanelContext(bounds, PanelType, margins); if (!string.IsNullOrWhiteSpace(Title)) { ui.Anchor = Anchor.Centered; ui.FontSize = 56; ui.Label(Title, Color.LightSkyBlue); ui.FontSize = ui.DefaultFontSize; ui.Anchor = Anchor.Vertical; } Draw(ui); if (DrawCloseButton) { var exteriorBounds = ui.GetContextBounds(); // Should be same as Window.ScreenBounds. var mar = ui.GetContextMargins(); if (ui.IMGUI.Button(new Rectangle(exteriorBounds.X + mar.Left, exteriorBounds.Bottom - 10 - closeButtonHeight, exteriorBounds.Width - mar.Left - mar.Right, closeButtonHeight), "Close")) { Close(); } } ui.EndContext(); }
public virtual void DrawUI(SpriteBatch sb, LayoutUserInterface ui) { }
public override void Draw(LayoutUserInterface ui) { ui.Paragraph(Text, Color.White); }
public override void DrawUI(SpriteBatch sb, LayoutUserInterface ui) { Entity.DrawAllUI(sb, ui); DrawInternalUI(sb, ui); }
/// <summary> /// Called once per frame to draw UI. This can be used to draw any kind of UI, but in-world UI is preferred /// since the draw order of this is basically random. /// </summary> /// <param name="sb">The SpriteBatch to draw with. Positions and sizes will be in screen-space.</param> protected virtual void DrawUI(SpriteBatch sb, LayoutUserInterface ui) { }
public abstract void Draw(LayoutUserInterface ui);