Fullscreen mode
This commit is contained in:
parent
507da48f92
commit
cc8bb460d7
|
@ -27,6 +27,7 @@
|
||||||
public string EmulatorPauseBinding = "Pause";
|
public string EmulatorPauseBinding = "Pause";
|
||||||
public string FrameAdvanceBinding = "F";
|
public string FrameAdvanceBinding = "F";
|
||||||
public string ScreenshotBinding = "F12";
|
public string ScreenshotBinding = "F12";
|
||||||
|
public string ToggleFullscreenBinding = "LeftAlt+Return, RightAlt+Return";
|
||||||
|
|
||||||
// SMS / GameGear Settings
|
// SMS / GameGear Settings
|
||||||
public bool SmsEnableFM = true;
|
public bool SmsEnableFM = true;
|
||||||
|
|
|
@ -119,7 +119,8 @@ namespace BizHawk.MultiClient
|
||||||
public static ControllerDefinition ClientControlsDef = new ControllerDefinition
|
public static ControllerDefinition ClientControlsDef = new ControllerDefinition
|
||||||
{
|
{
|
||||||
Name = "Emulator Frontend Controls",
|
Name = "Emulator Frontend Controls",
|
||||||
BoolButtons = { "Fast Forward", "Rewind", "Hard Reset", "Mode Flip", "Quick Save State", "Quick Load State", "Save Named State", "Load Named State", "Emulator Pause", "Frame Advance", "Screenshot" }
|
BoolButtons = { "Fast Forward", "Rewind", "Hard Reset", "Mode Flip", "Quick Save State", "Quick Load State", "Save Named State", "Load Named State",
|
||||||
|
"Emulator Pause", "Frame Advance", "Screenshot", "Toggle Fullscreen" }
|
||||||
};
|
};
|
||||||
|
|
||||||
private void InitControls()
|
private void InitControls()
|
||||||
|
@ -132,6 +133,7 @@ namespace BizHawk.MultiClient
|
||||||
controls.BindMulti("Emulator Pause", Global.Config.EmulatorPauseBinding);
|
controls.BindMulti("Emulator Pause", Global.Config.EmulatorPauseBinding);
|
||||||
controls.BindMulti("Frame Advance", Global.Config.FrameAdvanceBinding);
|
controls.BindMulti("Frame Advance", Global.Config.FrameAdvanceBinding);
|
||||||
controls.BindMulti("Screenshot", Global.Config.ScreenshotBinding);
|
controls.BindMulti("Screenshot", Global.Config.ScreenshotBinding);
|
||||||
|
controls.BindMulti("Toggle Fullscreen", Global.Config.ToggleFullscreenBinding);
|
||||||
Global.ClientControls = controls;
|
Global.ClientControls = controls;
|
||||||
|
|
||||||
var smsControls = new Controller(SMS.SmsController);
|
var smsControls = new Controller(SMS.SmsController);
|
||||||
|
@ -363,6 +365,12 @@ namespace BizHawk.MultiClient
|
||||||
else Global.Sound.StartSound();
|
else Global.Sound.StartSound();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (Global.ClientControls["Toggle Fullscreen"])
|
||||||
|
{
|
||||||
|
Global.ClientControls.UnpressButton("Toggle Fullscreen");
|
||||||
|
ToggleFullscreen();
|
||||||
|
}
|
||||||
|
|
||||||
if (EmulatorPaused == false || Global.ClientControls["Frame Advance"])
|
if (EmulatorPaused == false || Global.ClientControls["Frame Advance"])
|
||||||
{
|
{
|
||||||
CaptureRewindState();
|
CaptureRewindState();
|
||||||
|
@ -847,7 +855,6 @@ namespace BizHawk.MultiClient
|
||||||
private int lastWidth = -1;
|
private int lastWidth = -1;
|
||||||
private int lastHeight = -1;
|
private int lastHeight = -1;
|
||||||
|
|
||||||
|
|
||||||
private void Render()
|
private void Render()
|
||||||
{
|
{
|
||||||
var video = Global.Emulator.VideoProvider;
|
var video = Global.Emulator.VideoProvider;
|
||||||
|
@ -893,6 +900,31 @@ namespace BizHawk.MultiClient
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private bool InFullscreen = false;
|
||||||
|
private Point WindowedLocation;
|
||||||
|
|
||||||
|
public void ToggleFullscreen()
|
||||||
|
{
|
||||||
|
if (InFullscreen == false)
|
||||||
|
{
|
||||||
|
WindowedLocation = Location;
|
||||||
|
FormBorderStyle = FormBorderStyle.None;
|
||||||
|
WindowState = FormWindowState.Maximized;
|
||||||
|
MainMenuStrip.Visible = false;
|
||||||
|
PerformLayout();
|
||||||
|
Global.RenderPanel.Resized = true;
|
||||||
|
InFullscreen = true;
|
||||||
|
} else {
|
||||||
|
FormBorderStyle = FormBorderStyle.FixedSingle;
|
||||||
|
WindowState = FormWindowState.Normal;
|
||||||
|
MainMenuStrip.Visible = true;
|
||||||
|
Location = WindowedLocation;
|
||||||
|
PerformLayout();
|
||||||
|
FrameBufferResized();
|
||||||
|
InFullscreen = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void zoomMenuItem_Click(object sender, EventArgs e)
|
private void zoomMenuItem_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
if (sender == x1MenuItem) Global.Config.TargetZoomFactor = 1;
|
if (sender == x1MenuItem) Global.Config.TargetZoomFactor = 1;
|
||||||
|
|
|
@ -156,6 +156,7 @@ namespace BizHawk.MultiClient
|
||||||
{
|
{
|
||||||
d3d = direct3D;
|
d3d = direct3D;
|
||||||
backingControl = control;
|
backingControl = control;
|
||||||
|
control.DoubleClick += (o, e) => Global.MainForm.ToggleFullscreen();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void DestroyDevice()
|
private void DestroyDevice()
|
||||||
|
@ -223,13 +224,9 @@ namespace BizHawk.MultiClient
|
||||||
Device.Clear(ClearFlags.Target, BackgroundColor, 1.0f, 0);
|
Device.Clear(ClearFlags.Target, BackgroundColor, 1.0f, 0);
|
||||||
|
|
||||||
// figure out scaling factor
|
// figure out scaling factor
|
||||||
int widthScale = backingControl.Size.Width / video.BufferWidth;
|
float widthScale = (float) backingControl.Size.Width / video.BufferWidth;
|
||||||
int heightScale = backingControl.Size.Height / video.BufferHeight;
|
float heightScale = (float) backingControl.Size.Height / video.BufferHeight;
|
||||||
int finalScale = Math.Min(widthScale, heightScale);
|
float finalScale = Math.Min(widthScale, heightScale);
|
||||||
|
|
||||||
// center position
|
|
||||||
int xpos = (backingControl.Size.Width / 2) - (video.BufferWidth / 2);
|
|
||||||
int ypos = (backingControl.Size.Height / 2) - (video.BufferHeight / 2);
|
|
||||||
|
|
||||||
Device.BeginScene();
|
Device.BeginScene();
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue