Fullscreen mode
This commit is contained in:
parent
507da48f92
commit
cc8bb460d7
|
@ -27,6 +27,7 @@
|
|||
public string EmulatorPauseBinding = "Pause";
|
||||
public string FrameAdvanceBinding = "F";
|
||||
public string ScreenshotBinding = "F12";
|
||||
public string ToggleFullscreenBinding = "LeftAlt+Return, RightAlt+Return";
|
||||
|
||||
// SMS / GameGear Settings
|
||||
public bool SmsEnableFM = true;
|
||||
|
|
|
@ -119,7 +119,8 @@ namespace BizHawk.MultiClient
|
|||
public static ControllerDefinition ClientControlsDef = new ControllerDefinition
|
||||
{
|
||||
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()
|
||||
|
@ -132,6 +133,7 @@ namespace BizHawk.MultiClient
|
|||
controls.BindMulti("Emulator Pause", Global.Config.EmulatorPauseBinding);
|
||||
controls.BindMulti("Frame Advance", Global.Config.FrameAdvanceBinding);
|
||||
controls.BindMulti("Screenshot", Global.Config.ScreenshotBinding);
|
||||
controls.BindMulti("Toggle Fullscreen", Global.Config.ToggleFullscreenBinding);
|
||||
Global.ClientControls = controls;
|
||||
|
||||
var smsControls = new Controller(SMS.SmsController);
|
||||
|
@ -363,6 +365,12 @@ namespace BizHawk.MultiClient
|
|||
else Global.Sound.StartSound();
|
||||
}
|
||||
|
||||
if (Global.ClientControls["Toggle Fullscreen"])
|
||||
{
|
||||
Global.ClientControls.UnpressButton("Toggle Fullscreen");
|
||||
ToggleFullscreen();
|
||||
}
|
||||
|
||||
if (EmulatorPaused == false || Global.ClientControls["Frame Advance"])
|
||||
{
|
||||
CaptureRewindState();
|
||||
|
@ -846,8 +854,7 @@ namespace BizHawk.MultiClient
|
|||
|
||||
private int lastWidth = -1;
|
||||
private int lastHeight = -1;
|
||||
|
||||
|
||||
|
||||
private void Render()
|
||||
{
|
||||
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)
|
||||
{
|
||||
if (sender == x1MenuItem) Global.Config.TargetZoomFactor = 1;
|
||||
|
|
|
@ -156,6 +156,7 @@ namespace BizHawk.MultiClient
|
|||
{
|
||||
d3d = direct3D;
|
||||
backingControl = control;
|
||||
control.DoubleClick += (o, e) => Global.MainForm.ToggleFullscreen();
|
||||
}
|
||||
|
||||
private void DestroyDevice()
|
||||
|
@ -223,13 +224,9 @@ namespace BizHawk.MultiClient
|
|||
Device.Clear(ClearFlags.Target, BackgroundColor, 1.0f, 0);
|
||||
|
||||
// figure out scaling factor
|
||||
int widthScale = backingControl.Size.Width / video.BufferWidth;
|
||||
int heightScale = backingControl.Size.Height / video.BufferHeight;
|
||||
int 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);
|
||||
float widthScale = (float) backingControl.Size.Width / video.BufferWidth;
|
||||
float heightScale = (float) backingControl.Size.Height / video.BufferHeight;
|
||||
float finalScale = Math.Min(widthScale, heightScale);
|
||||
|
||||
Device.BeginScene();
|
||||
|
||||
|
|
Loading…
Reference in New Issue