Skip to content

Commit

Permalink
can now toggle between windowed and fullscreen
Browse files Browse the repository at this point in the history
  • Loading branch information
elennick committed Nov 24, 2016
1 parent 6193e02 commit 42118a7
Show file tree
Hide file tree
Showing 9 changed files with 19 additions and 18 deletions.
Binary file modified .vs/Switch/v14/.suo
Binary file not shown.
2 changes: 1 addition & 1 deletion Switch/Content/obj/DesktopGL/Sprites/icon.mgcontent
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<SourceFile>D:/Development/switch-mono/Switch/Switch/Content/Sprites/icon.png</SourceFile>
<SourceTime>2016-09-07T17:41:41.995907-04:00</SourceTime>
<DestFile>D:/Development/switch-mono/Switch/Switch/Content/bin/DesktopGL/Sprites/icon.xnb</DestFile>
<DestTime>2016-11-23T21:21:40.8940581-05:00</DestTime>
<DestTime>2016-11-23T22:05:48.6048895-05:00</DestTime>
<Importer>TextureImporter</Importer>
<ImporterTime>2016-03-30T02:36:08-04:00</ImporterTime>
<Processor>TextureProcessor</Processor>
Expand Down
23 changes: 15 additions & 8 deletions Switch/Screens/Menus/OptionsMenuScreen.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,24 +10,27 @@ class OptionsMenuScreen : MenuScreen
{
MenuEntry rumbleOnEntry;
MenuEntry musicOnEntry;
MenuEntry fullScreenEntry;
MenuEntry controlsEntry;
MenuEntry videoSettingsEntry;
MenuEntry howToPlayEntry;
MenuEntry creditsEntry;
MenuEntry statsEntry;

static bool musicOn = true;
static bool rumbleOn = true;
static bool fullscreenOn;

public OptionsMenuScreen()
: base("Help & Options")
{
this.setSubMenuTitleText("Configure Your Junk!");

fullscreenOn = SwitchGame.Instance.Graphics.IsFullScreen;

musicOnEntry = new MenuEntry(string.Empty);
rumbleOnEntry = new MenuEntry(string.Empty);
fullScreenEntry = new MenuEntry(string.Empty);
controlsEntry = new MenuEntry("Controls");
videoSettingsEntry = new MenuEntry("Video/Screen");
howToPlayEntry = new MenuEntry("How To Play");
creditsEntry = new MenuEntry("Credits");
statsEntry = new MenuEntry("Game Stats");
Expand All @@ -38,16 +41,16 @@ public OptionsMenuScreen()

rumbleOnEntry.Selected += RumbleOnMenuEntrySelected;
musicOnEntry.Selected += MusicOnMenuEntrySelected;
fullScreenEntry.Selected += FullScreenEntrySelected;
controlsEntry.Selected += ControlsMenuEntrySelected;
videoSettingsEntry.Selected += VideoSettingsMenuEntrySelected;
howToPlayEntry.Selected += HowToPlayMenuEntrySelected;
creditsEntry.Selected += CreditsMenuEntrySelected;
statsEntry.Selected += StatsMenuEntrySelected;
backMenuEntry.Selected += OnCancel;

MenuEntries.Add(rumbleOnEntry);
MenuEntries.Add(musicOnEntry);
MenuEntries.Add(videoSettingsEntry);
MenuEntries.Add(fullScreenEntry);
MenuEntries.Add(controlsEntry);
MenuEntries.Add(howToPlayEntry);
MenuEntries.Add(creditsEntry);
Expand All @@ -59,6 +62,7 @@ void SetMenuEntryText()
{
musicOnEntry.Text = "Music: " + (musicOn ? "ON" : "OFF");
rumbleOnEntry.Text = "Rumble: " + (rumbleOn ? "ON" : "OFF");
fullScreenEntry.Text = "Mode: " + (fullscreenOn ? "FULLSCREEN" : "WINDOWED");
}

void MusicOnMenuEntrySelected(object sender, PlayerIndexEventArgs e)
Expand All @@ -75,14 +79,17 @@ void RumbleOnMenuEntrySelected(object sender, PlayerIndexEventArgs e)
VibrationManager.Instance.setVibrationEnabled(rumbleOn);
}

void ControlsMenuEntrySelected(object sender, PlayerIndexEventArgs e)
void FullScreenEntrySelected(object sender, PlayerIndexEventArgs e)
{
ScreenManager.AddScreen(new ControlsScreen(), null);
fullscreenOn = !fullscreenOn;
SetMenuEntryText();
SwitchGame.Instance.Graphics.IsFullScreen = fullscreenOn;
SwitchGame.Instance.Graphics.ApplyChanges();
}

void VideoSettingsMenuEntrySelected(object sender, PlayerIndexEventArgs e)
void ControlsMenuEntrySelected(object sender, PlayerIndexEventArgs e)
{
ScreenManager.AddScreen(new VideoSettingsScreen(), null);
ScreenManager.AddScreen(new ControlsScreen(), null);
}

void HowToPlayMenuEntrySelected(object sender, PlayerIndexEventArgs e)
Expand Down
1 change: 0 additions & 1 deletion Switch/Switch.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,6 @@
<Compile Include="Screens\Menus\ChallengeModeMenuEntry.cs" />
<Compile Include="Screens\Menus\ChallengeModeMessageBoxScreen.cs" />
<Compile Include="Screens\Menus\ChallengeModeSelectionScreen.cs" />
<Compile Include="Screens\Menus\VideoSettingsScreen.cs" />
<Compile Include="Screens\Menus\ControlsScreen.cs" />
<Compile Include="Screens\Menus\CreditsScreen.cs" />
<Compile Include="Screens\Menus\ExitOrBackMenuEntry.cs" />
Expand Down
11 changes: 3 additions & 8 deletions Switch/SwitchGame.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,6 @@ public class SwitchGame : Microsoft.Xna.Framework.Game

public static bool DEBUG_MODE = true; //skips logo screen, disables music and gives unlimited power to use abilities during gameplay

private static List<SupportedResolution> supportedResolutions = new List<SupportedResolution>
{
new SupportedResolution(1280, 720),
new SupportedResolution(1920, 1080)
};

public SwitchGame()
{
Instance = this;
Expand All @@ -29,8 +23,9 @@ public SwitchGame()

Graphics = new GraphicsDeviceManager(this);

Graphics.PreferredBackBufferWidth = supportedResolutions[0].Width;
Graphics.PreferredBackBufferHeight = supportedResolutions[0].Height;
Graphics.PreferredBackBufferWidth = 1280;
Graphics.PreferredBackBufferHeight = 720;
Graphics.IsFullScreen = !DEBUG_MODE;

// Create the screen manager component.
screenManager = new ScreenManager(this);
Expand Down
Binary file modified Switch/bin/DesktopGL/x86/Debug/Switch.exe
Binary file not shown.
Binary file modified Switch/bin/DesktopGL/x86/Debug/Switch.pdb
Binary file not shown.
Binary file modified Switch/obj/x86/Debug/Switch.exe
Binary file not shown.
Binary file modified Switch/obj/x86/Debug/Switch.pdb
Binary file not shown.

0 comments on commit 42118a7

Please sign in to comment.