diff --git a/Launcher2/Launcher.csproj b/Launcher2/Launcher.csproj
index 13ffdc7ed..0149641f5 100644
--- a/Launcher2/Launcher.csproj
+++ b/Launcher2/Launcher.csproj
@@ -14,6 +14,8 @@
Windows
+ v4.5
+
x86
@@ -24,6 +26,7 @@
DEBUG;TRACE;WINDOWS
prompt
4
+ false
x86
@@ -33,6 +36,7 @@
TRACE;WINDOWS
prompt
4
+ false
Icon.ico
@@ -68,6 +72,7 @@
+
diff --git a/Launcher2/LauncherMain.cs b/Launcher2/LauncherMain.cs
index 7f0ed0e5b..41c25d3a5 100644
--- a/Launcher2/LauncherMain.cs
+++ b/Launcher2/LauncherMain.cs
@@ -31,7 +31,7 @@ namespace Launcher2
private List supportedModes;
- private GUIDropDown resolutionDD, contentPackageDD;
+ private GUIDropDown resolutionDD, contentPackageDD, displayModeDD;
private GUITextBlock updateInfoText;
private GUIListBox updateInfoBox;
@@ -40,11 +40,11 @@ namespace Launcher2
GUIButton launchButton;
- public bool FullScreenEnabled
- {
- get { return settings.FullScreenEnabled; }
- set { settings.FullScreenEnabled = value; }
- }
+ //public bool FullScreenEnabled
+ //{
+ // get { return settings.FullScreenEnabled; }
+ // set { settings.FullScreenEnabled = value; }
+ //}
public bool AutoCheckUpdates
{
@@ -160,9 +160,19 @@ namespace Launcher2
//new GUIButton(new Rectangle(x,y+120,150,20), "Package Manager", GUI.Style, guiRoot);
- var fullScreenTick = new GUITickBox(new Rectangle(x,y+150,20,20), "Fullscreen", Alignment.TopLeft, guiRoot);
- fullScreenTick.OnSelected = ToggleFullScreen;
- fullScreenTick.Selected = settings.FullScreenEnabled;
+ new GUITextBlock(new Rectangle(x, y + 130, 20, 20), "Display mode", GUI.Style, Alignment.TopLeft, Alignment.TopLeft, guiRoot);
+ displayModeDD = new GUIDropDown(new Rectangle(x, y + 150, 200, 20), "", GUI.Style, guiRoot);
+ displayModeDD.AddItem("Fullscreen", WindowMode.Fullscreen);
+ displayModeDD.AddItem("Windowed", WindowMode.Windowed);
+ displayModeDD.AddItem("Borderless windowed", WindowMode.BorderlessWindowed);
+
+ displayModeDD.SelectItem(settings.WindowMode);
+
+ displayModeDD.OnSelected = (guiComponent) => { settings.WindowMode = (WindowMode)guiComponent.UserData; return true; };
+
+ //var fullScreenTick = new GUITickBox(new Rectangle(x,y+150,20,20), "Fullscreen", Alignment.TopLeft, guiRoot);
+ //fullScreenTick.OnSelected = ToggleFullScreen;
+ //fullScreenTick.Selected = settings.FullScreenEnabled;
if (settings.AutoCheckUpdates)
{
@@ -243,11 +253,11 @@ namespace Launcher2
return true;
}
- private bool ToggleFullScreen(GUITickBox tickBox)
- {
- settings.FullScreenEnabled = !settings.FullScreenEnabled;
- return true;
- }
+ //private bool ToggleFullScreen(GUITickBox tickBox)
+ //{
+ // settings.FullScreenEnabled = !settings.FullScreenEnabled;
+ // return true;
+ //}
private bool LaunchClick(GUIButton button, object obj)
{
diff --git a/Subsurface/Source/DebugConsole.cs b/Subsurface/Source/DebugConsole.cs
index d746326b0..a898743ca 100644
--- a/Subsurface/Source/DebugConsole.cs
+++ b/Subsurface/Source/DebugConsole.cs
@@ -509,7 +509,7 @@ namespace Barotrauma
GameMain.Config.GraphicsWidth = 0;
GameMain.Config.GraphicsHeight = 0;
- GameMain.Config.FullScreenEnabled = true;
+ GameMain.Config.WindowMode = WindowMode.Fullscreen;
DebugConsole.NewMessage("Resolution set to 0 x 0 (screen resolution will be used)", Color.Green);
DebugConsole.NewMessage("Fullscreen enabled", Color.Green);
diff --git a/Subsurface/Source/GUI/GUI.cs b/Subsurface/Source/GUI/GUI.cs
index 4c63d2726..8e2dee86c 100644
--- a/Subsurface/Source/GUI/GUI.cs
+++ b/Subsurface/Source/GUI/GUI.cs
@@ -40,7 +40,7 @@ namespace Barotrauma
private static Sound[] sounds;
- private static bool pauseMenuOpen;
+ private static bool pauseMenuOpen, settingsMenuOpen;
private static GUIFrame pauseMenu;
public static Color ScreenOverlayColor;
@@ -77,6 +77,11 @@ namespace Barotrauma
get { return pauseMenuOpen; }
}
+ public static bool SettingsMenuOpen
+ {
+ get { return settingsMenuOpen; }
+ }
+
public static void LoadContent(GraphicsDevice graphics, bool loadSounds = true)
{
graphicsDevice = graphics;
@@ -110,6 +115,8 @@ namespace Barotrauma
{
if (Screen.Selected == GameMain.MainMenuScreen) return;
+ settingsMenuOpen = false;
+
TogglePauseMenu(null, null);
if (pauseMenuOpen)
@@ -120,6 +127,18 @@ namespace Barotrauma
var button = new GUIButton(new Rectangle(0, y, 0, 30), "Resume", Alignment.CenterX, Style, pauseMenu);
button.OnClicked = TogglePauseMenu;
+ y += 60;
+
+ button = new GUIButton(new Rectangle(0, y, 0, 30), "Settings", Alignment.CenterX, Style, pauseMenu);
+ button.OnClicked = (btn, userData) =>
+ {
+ TogglePauseMenu();
+ settingsMenuOpen = !settingsMenuOpen;
+
+ return true;
+ };
+
+
y += 60;
if (Screen.Selected == GameMain.GameScreen && GameMain.GameSession != null)
@@ -415,9 +434,15 @@ namespace Barotrauma
if (pauseMenuOpen)
{
- pauseMenu.Update(1.0f);
+ pauseMenu.Update(0.016f);
pauseMenu.Draw(spriteBatch);
}
+
+ if (settingsMenuOpen)
+ {
+ GameMain.Config.SettingsFrame.Update(0.016f);
+ GameMain.Config.SettingsFrame.Draw(spriteBatch);
+ }
DebugConsole.Draw(spriteBatch);
diff --git a/Subsurface/Source/GUI/GUIListBox.cs b/Subsurface/Source/GUI/GUIListBox.cs
index baf8b9de8..2cf559999 100644
--- a/Subsurface/Source/GUI/GUIListBox.cs
+++ b/Subsurface/Source/GUI/GUIListBox.cs
@@ -162,7 +162,7 @@ namespace Barotrauma
{
for (int i = 0; i < children.Count; i++)
{
- if (children[i].UserData != selection) continue;
+ if (!children[i].UserData.Equals(selection)) continue;
Select(i, force);
diff --git a/Subsurface/Source/GameMain.cs b/Subsurface/Source/GameMain.cs
index a5491c403..03b42edca 100644
--- a/Subsurface/Source/GameMain.cs
+++ b/Subsurface/Source/GameMain.cs
@@ -121,7 +121,9 @@ namespace Barotrauma
graphicsWidth = Config.GraphicsWidth;
graphicsHeight = Config.GraphicsHeight;
- Graphics.IsFullScreen = Config.FullScreenEnabled;
+ Graphics.HardwareModeSwitch = Config.WindowMode != WindowMode.BorderlessWindowed;
+
+ Graphics.IsFullScreen = Config.WindowMode == WindowMode.Fullscreen || Config.WindowMode == WindowMode.BorderlessWindowed;
Graphics.PreferredBackBufferWidth = graphicsWidth;
Graphics.PreferredBackBufferHeight = graphicsHeight;
Content.RootDirectory = "Content";
@@ -293,7 +295,7 @@ namespace Barotrauma
DebugConsole.Update(this, (float)deltaTime);
- paused = (DebugConsole.IsOpen || GUI.PauseMenuOpen) &&
+ paused = (DebugConsole.IsOpen || GUI.PauseMenuOpen || GUI.SettingsMenuOpen) &&
(NetworkMember == null || !NetworkMember.GameStarted);
if (!paused) Screen.Selected.Update(deltaTime);
diff --git a/Subsurface/Source/GameSession/GameSession.cs b/Subsurface/Source/GameSession/GameSession.cs
index 6f07ebbe3..8a8e40cef 100644
--- a/Subsurface/Source/GameSession/GameSession.cs
+++ b/Subsurface/Source/GameSession/GameSession.cs
@@ -257,7 +257,7 @@ namespace Barotrauma
{
if (Mission == null)
{
- new GUITextBlock(new Rectangle(0,0,0,400), "No mission", GUI.Style, infoFrame, true);
+ new GUITextBlock(new Rectangle(0,0,0,50), "No mission", GUI.Style, infoFrame, true);
return;
}
@@ -274,12 +274,10 @@ namespace Barotrauma
TaskManager.Update(deltaTime);
//guiRoot.Update(deltaTime);
-
infoButton.Update(deltaTime);
if (gameMode != null) gameMode.Update(deltaTime);
if (Mission != null) Mission.Update(deltaTime);
- if (infoFrame != null) infoFrame.Update(deltaTime);
}
public void Draw(SpriteBatch spriteBatch)
@@ -288,7 +286,11 @@ namespace Barotrauma
infoButton.Draw(spriteBatch);
if (gameMode != null) gameMode.Draw(spriteBatch);
- if (infoFrame != null) infoFrame.Draw(spriteBatch);
+ if (infoFrame != null)
+ {
+ infoFrame.Update(0.016f);
+ infoFrame.Draw(spriteBatch);
+ }
}
public void Save(string filePath)
diff --git a/Subsurface/Source/GameSettings.cs b/Subsurface/Source/GameSettings.cs
index 073db5e17..b55abd8a9 100644
--- a/Subsurface/Source/GameSettings.cs
+++ b/Subsurface/Source/GameSettings.cs
@@ -9,6 +9,11 @@ using System.Xml.Linq;
namespace Barotrauma
{
+ public enum WindowMode
+ {
+ Windowed, Fullscreen, BorderlessWindowed
+ }
+
public class GameSettings
{
private GUIFrame settingsFrame;
@@ -16,6 +21,8 @@ namespace Barotrauma
private float soundVolume, musicVolume;
+ private WindowMode windowMode;
+
private KeyOrMouse[] keyMapping;
@@ -39,7 +46,13 @@ namespace Barotrauma
public int GraphicsWidth { get; set; }
public int GraphicsHeight { get; set; }
- public bool FullScreenEnabled { get; set; }
+ //public bool FullScreenEnabled { get; set; }
+
+ public WindowMode WindowMode
+ {
+ get { return windowMode; }
+ set { windowMode = value; }
+ }
public ContentPackage SelectedContentPackage { get; set; }
@@ -122,7 +135,10 @@ namespace Barotrauma
GraphicsHeight = GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Height;
}
- FullScreenEnabled = ToolBox.GetAttributeBool(graphicsMode, "fullscreen", true);
+ //FullScreenEnabled = ToolBox.GetAttributeBool(graphicsMode, "fullscreen", true);
+
+ var windowModeStr = ToolBox.GetAttributeString(graphicsMode, "displaymode", "Fullscreen");
+ if (Enum.TryParse(windowModeStr, out windowMode));
MasterServerUrl = ToolBox.GetAttributeString(doc.Root, "masterserverurl", "");
@@ -218,14 +234,14 @@ namespace Barotrauma
if (GraphicsWidth==0 || GraphicsHeight==0)
{
- gMode.ReplaceAttributes(new XAttribute("fullscreen", FullScreenEnabled ? "true" : "false"));
+ gMode.ReplaceAttributes(new XAttribute("displaymode", windowMode));
}
else
{
gMode.ReplaceAttributes(
new XAttribute("width", GraphicsWidth),
new XAttribute("height", GraphicsHeight),
- new XAttribute("fullscreen", FullScreenEnabled ? "true" : "false"));
+ new XAttribute("displaymode", windowMode));
}
@@ -270,16 +286,16 @@ namespace Barotrauma
return true;
}
- private bool ToggleFullScreen(object userData)
- {
- UnsavedSettings = true;
- FullScreenEnabled = !FullScreenEnabled;
+ //private bool ToggleFullScreen(object userData)
+ //{
+ // UnsavedSettings = true;
+ // FullScreenEnabled = !FullScreenEnabled;
- GameMain.Graphics.IsFullScreen = FullScreenEnabled;
- GameMain.Graphics.ApplyChanges();
+ // GameMain.Graphics.IsFullScreen = FullScreenEnabled;
+ // GameMain.Graphics.ApplyChanges();
- return true;
- }
+ // return true;
+ //}
public void ResetSettingsFrame()
{
@@ -316,11 +332,21 @@ namespace Barotrauma
y += 50;
- var fullScreenTick = new GUITickBox(new Rectangle(x, y, 20, 20), "Fullscreen", Alignment.TopLeft, settingsFrame);
- fullScreenTick.OnSelected = ToggleFullScreen;
- fullScreenTick.Selected = FullScreenEnabled;
+ //var fullScreenTick = new GUITickBox(new Rectangle(x, y, 20, 20), "Fullscreen", Alignment.TopLeft, settingsFrame);
+ //fullScreenTick.OnSelected = ToggleFullScreen;
+ //fullScreenTick.Selected = FullScreenEnabled;
- y += 50;
+ new GUITextBlock(new Rectangle(x, y, 20, 20), "Display mode", GUI.Style, Alignment.TopLeft, Alignment.TopLeft, settingsFrame);
+ var displayModeDD = new GUIDropDown(new Rectangle(x, y + 20, 180, 20), "", GUI.Style, settingsFrame);
+ displayModeDD.AddItem("Fullscreen", WindowMode.Fullscreen);
+ displayModeDD.AddItem("Windowed", WindowMode.Windowed);
+ displayModeDD.AddItem("Borderless windowed", WindowMode.BorderlessWindowed);
+
+ displayModeDD.SelectItem(GameMain.Config.WindowMode);
+
+ displayModeDD.OnSelected = (guiComponent) => { GameMain.Config.WindowMode = (WindowMode)guiComponent.UserData; return true; };
+
+ y += 70;
new GUITextBlock(new Rectangle(0, y, 100, 20), "Sound volume:", GUI.Style, settingsFrame);
GUIScrollBar soundScrollBar = new GUIScrollBar(new Rectangle(0, y+20, 150, 20), GUI.Style,0.1f, settingsFrame);
@@ -409,7 +435,7 @@ namespace Barotrauma
while (keyBox.Selected && PlayerInput.GetKeyboardState.GetPressedKeys().Length==0
&& !PlayerInput.LeftButtonClicked() && !PlayerInput.RightButtonClicked())
{
- if (Screen.Selected != GameMain.MainMenuScreen) yield return CoroutineStatus.Success;
+ if (Screen.Selected != GameMain.MainMenuScreen && !GUI.SettingsMenuOpen) yield return CoroutineStatus.Success;
yield return CoroutineStatus.Running;
}