public override void Draw(double deltaTime, GraphicsDevice graphics, SpriteBatch spriteBatch) { graphics.Clear(Color.CornflowerBlue); GameMain.TitleScreen.DrawLoadingText = false; GameMain.TitleScreen.Draw(spriteBatch, graphics, (float)deltaTime); //Game1.GameScreen.DrawMap(graphics, spriteBatch); spriteBatch.Begin(SpriteSortMode.Immediate, null, null, null, GameMain.ScissorTestEnable); buttonsTab.Draw(spriteBatch); if (selectedTab > 0) { menuTabs[(int)selectedTab].Draw(spriteBatch); } GUI.Draw((float)deltaTime, spriteBatch, null); #if DEBUG GUI.Font.DrawString(spriteBatch, "Barotrauma v" + GameMain.Version + " (debug build)", new Vector2(10, GameMain.GraphicsHeight - 20), Color.White); #else GUI.Font.DrawString(spriteBatch, "Barotrauma v" + GameMain.Version, new Vector2(10, GameMain.GraphicsHeight - 20), Color.White); #endif spriteBatch.End(); }
public static void Draw(SpriteBatch spriteBatch) { if (!isOpen) { return; } frame.Draw(spriteBatch); }
public static void DrawHud(SpriteBatch spriteBatch, Item item, Character character) { if (frame == null) { return; } frame.Draw(spriteBatch); }
private void EditLimb(SpriteBatch spriteBatch) { if (editingLimb == null) { return; } limbPanel.Draw(spriteBatch); }
public void Draw(SpriteBatch spriteBatch) { if (commander.IsOpen) { commander.Draw(spriteBatch); } else { guiFrame.Draw(spriteBatch); } }
public override void Draw(double deltaTime, GraphicsDevice graphics, SpriteBatch spriteBatch) { graphics.Clear(Color.CornflowerBlue); GameMain.TitleScreen.DrawLoadingText = false; GameMain.TitleScreen.Draw(spriteBatch, graphics, (float)deltaTime); spriteBatch.Begin(SpriteSortMode.Immediate, null, null, null, GameMain.ScissorTestEnable); menu.Draw(spriteBatch); GUI.Draw((float)deltaTime, spriteBatch, null); spriteBatch.End(); }
public override void Draw(SpriteBatch spriteBatch) { if (!Visible) { return; } frame.Draw(spriteBatch); if (!scrollBarHidden) { scrollBar.Draw(spriteBatch); } Rectangle prevScissorRect = spriteBatch.GraphicsDevice.ScissorRectangle; spriteBatch.GraphicsDevice.ScissorRectangle = Rectangle.Intersect(prevScissorRect, frame.Rect); int lastVisible = 0; for (int i = 0; i < children.Count; i++) { GUIComponent child = children[i]; if (child == frame || !child.Visible) { continue; } if (!IsChildVisible(child)) { if (lastVisible > 0) { break; } continue; } lastVisible = i; child.Draw(spriteBatch); } spriteBatch.GraphicsDevice.ScissorRectangle = prevScissorRect; }
public void Draw(SpriteBatch spriteBatch) { if (GUI.DisableHUD) { return; } infoButton.Draw(spriteBatch); if (GameMode != null) { GameMode.Draw(spriteBatch); } if (infoFrame != null) { infoFrame.Draw(spriteBatch); } }
public override void Draw(double deltaTime, GraphicsDevice graphics, SpriteBatch spriteBatch) { /*if (characterList.CountChildren != CrewManager.CharacterInfos.Count) * { * UpdateCharacterLists(); * }*/ graphics.Clear(Color.Black); spriteBatch.Begin(SpriteSortMode.Immediate, null, null, null, GameMain.ScissorTestEnable); Sprite backGround = GameMain.GameSession.Map.CurrentLocation.Type.Background; spriteBatch.Draw(backGround.Texture, Vector2.Zero, null, Color.White, 0.0f, Vector2.Zero, Math.Max((float)GameMain.GraphicsWidth / backGround.SourceRect.Width, (float)GameMain.GraphicsHeight / backGround.SourceRect.Height), SpriteEffects.None, 0.0f); topPanel.Draw(spriteBatch); bottomPanel.Draw(spriteBatch); campaignUI.Draw(spriteBatch); /* if (selectedRightPanel == (int)PanelTab.Map) * { * GameMain.GameSession.Map.Draw(spriteBatch, new Rectangle( * bottomPanel[selectedRightPanel].Rect.X + 20, * bottomPanel[selectedRightPanel].Rect.Y + 20, * bottomPanel[selectedRightPanel].Rect.Width - 310, * bottomPanel[selectedRightPanel].Rect.Height - 40), mapZoom); * } * * if (topPanel.UserData as Location != GameMain.GameSession.Map.CurrentLocation) * { * UpdateLocationTab(GameMain.GameSession.Map.CurrentLocation); * }*/ GUI.Draw((float)deltaTime, spriteBatch, null); spriteBatch.End(); }
public static void Draw(float deltaTime, SpriteBatch spriteBatch, Camera cam) { if (ScreenOverlayColor.A > 0.0f) { DrawRectangle( spriteBatch, new Rectangle(0, 0, GameMain.GraphicsWidth, GameMain.GraphicsHeight), ScreenOverlayColor, true); } if (GameMain.ShowFPS || GameMain.DebugDraw) { DrawString(spriteBatch, new Vector2(10, 10), "FPS: " + (int)GameMain.FrameCounter.AverageFramesPerSecond, Color.White, Color.Black * 0.5f, 0, SmallFont); } if (GameMain.DebugDraw) { DrawString(spriteBatch, new Vector2(10, 25), "Physics: " + GameMain.World.UpdateTime, Color.White, Color.Black * 0.5f, 0, SmallFont); DrawString(spriteBatch, new Vector2(10, 40), "Bodies: " + GameMain.World.BodyList.Count + " (" + GameMain.World.BodyList.FindAll(b => b.Awake && b.Enabled).Count + " awake)", Color.White, Color.Black * 0.5f, 0, SmallFont); if (Screen.Selected.Cam != null) { DrawString(spriteBatch, new Vector2(10, 55), "Camera pos: " + Screen.Selected.Cam.Position.ToPoint() + ", zoom: " + Screen.Selected.Cam.Zoom, Color.White, Color.Black * 0.5f, 0, SmallFont); } if (Submarine.MainSub != null) { DrawString(spriteBatch, new Vector2(10, 70), "Sub pos: " + Submarine.MainSub.Position.ToPoint(), Color.White, Color.Black * 0.5f, 0, SmallFont); } for (int i = 1; i < Sounds.SoundManager.DefaultSourceCount; i++) { Color clr = Color.White; string soundStr = i + ": "; var playingSound = Sounds.SoundManager.GetPlayingSound(i); if (playingSound == null) { soundStr += "none"; clr *= 0.5f; } else { soundStr += System.IO.Path.GetFileNameWithoutExtension(playingSound.FilePath); if (Sounds.SoundManager.IsLooping(i)) { soundStr += " (looping)"; clr = Color.Yellow; } } GUI.DrawString(spriteBatch, new Vector2(300, i * 15), soundStr, clr, Color.Black * 0.5f, 0, GUI.SmallFont); } } if (GameMain.NetworkMember != null) { GameMain.NetworkMember.Draw(spriteBatch); } DrawMessages(spriteBatch, (float)deltaTime); if (GUIMessageBox.VisibleBox != null) { GUIMessageBox.VisibleBox.Draw(spriteBatch); } if (pauseMenuOpen) { pauseMenu.Draw(spriteBatch); } if (settingsMenuOpen) { GameMain.Config.SettingsFrame.Draw(spriteBatch); } DebugConsole.Draw(spriteBatch); if (GUIComponent.MouseOn != null && !string.IsNullOrWhiteSpace(GUIComponent.MouseOn.ToolTip)) { GUIComponent.MouseOn.DrawToolTip(spriteBatch); } if (!GUI.DisableHUD) { cursor.Draw(spriteBatch, PlayerInput.LatestMousePosition); } }
/// <summary> /// This is called when the game should draw itself. /// </summary> public override void Draw(double deltaTime, GraphicsDevice graphics, SpriteBatch spriteBatch) { cam.UpdateTransform(); spriteBatch.Begin(SpriteSortMode.BackToFront, BlendState.AlphaBlend, null, null, null, null, cam.Transform); graphics.Clear(new Color(0.051f, 0.149f, 0.271f, 1.0f)); if (GameMain.DebugDraw) { GUI.DrawLine(spriteBatch, new Vector2(Submarine.MainSub.HiddenSubPosition.X, -cam.WorldView.Y), new Vector2(Submarine.MainSub.HiddenSubPosition.X, -(cam.WorldView.Y - cam.WorldView.Height)), Color.White * 0.5f, 1.0f, (int)(2.0f / cam.Zoom)); GUI.DrawLine(spriteBatch, new Vector2(cam.WorldView.X, -Submarine.MainSub.HiddenSubPosition.Y), new Vector2(cam.WorldView.Right, -Submarine.MainSub.HiddenSubPosition.Y), Color.White * 0.5f, 1.0f, (int)(2.0f / cam.Zoom)); } Submarine.Draw(spriteBatch, true); if (!characterMode && !wiringMode) { if (MapEntityPrefab.Selected != null) { MapEntityPrefab.Selected.DrawPlacing(spriteBatch, cam); } MapEntity.DrawSelecting(spriteBatch, cam); } spriteBatch.End(); //-------------------- HUD ----------------------------- spriteBatch.Begin(SpriteSortMode.Immediate, null, null, null, GameMain.ScissorTestEnable); if (Submarine.MainSub != null) { DrawSubmarineIndicator(spriteBatch, Submarine.MainSub, Color.LightBlue * 0.5f); } leftPanel.Draw(spriteBatch); topPanel.Draw(spriteBatch); //EntityPrefab.DrawList(spriteBatch, new Vector2(20,50)); if ((characterMode || wiringMode) && dummyCharacter != null) { if (dummyCharacter.SelectedConstruction != null) { dummyCharacter.SelectedConstruction.DrawHUD(spriteBatch, cam, dummyCharacter); } dummyCharacter.DrawHUD(spriteBatch, cam); if (wiringMode) { wiringToolPanel.Draw(spriteBatch); } } else { if (loadFrame != null) { loadFrame.Draw(spriteBatch); } else if (saveFrame != null) { saveFrame.Draw(spriteBatch); } else if (selectedTab > -1) { GUItabs[selectedTab].Draw(spriteBatch); } MapEntity.DrawEditor(spriteBatch, cam); } if (tutorial != null) { tutorial.Draw(spriteBatch); } GUI.Draw((float)deltaTime, spriteBatch, cam); if (!PlayerInput.LeftButtonHeld()) { Inventory.draggingItem = null; } spriteBatch.End(); }