Borderless windowed mode, mid-round settings menu
This commit is contained in:
@@ -14,6 +14,8 @@
|
||||
<MonoGamePlatform>Windows</MonoGamePlatform>
|
||||
<MonoGameContentBuilderExe>
|
||||
</MonoGameContentBuilderExe>
|
||||
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
|
||||
<TargetFrameworkProfile />
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
@@ -24,6 +26,7 @@
|
||||
<DefineConstants>DEBUG;TRACE;WINDOWS</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
@@ -33,6 +36,7 @@
|
||||
<DefineConstants>TRACE;WINDOWS</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<ApplicationIcon>Icon.ico</ApplicationIcon>
|
||||
@@ -68,6 +72,7 @@
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="app.config" />
|
||||
<None Include="packages.config" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
|
||||
@@ -31,7 +31,7 @@ namespace Launcher2
|
||||
|
||||
private List<DisplayMode> 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)
|
||||
{
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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<WindowMode>(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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user