Skip to content

Commit

Permalink
Merge pull request MonoGame#2070 from nkast/tnc_Rename_SwapChainBackg…
Browse files Browse the repository at this point in the history
…roundPanel

Rename SwapChainBackgroundPanel
  • Loading branch information
tomspilman committed Apr 24, 2014
2 parents 577d28e + 1799a03 commit 369383d
Show file tree
Hide file tree
Showing 7 changed files with 29 additions and 29 deletions.
2 changes: 1 addition & 1 deletion MonoGame.Framework/GameTimer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ static private void OnTick()

// Do we need to initialize the window event handlers?
if (_windowEvents == null && Window.Current != null)
_windowEvents = new InputEvents(Window.Current.CoreWindow, SharedGraphicsDeviceManager.Current.SwapChainPanel);
_windowEvents = new InputEvents(Window.Current.CoreWindow, SharedGraphicsDeviceManager.Current.SwapChainBackgroundPanel);
if (_windowEvents != null)
_windowEvents.UpdateState();

Expand Down
12 changes: 6 additions & 6 deletions MonoGame.Framework/Graphics/GraphicsDevice.DirectX.cs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public partial class GraphicsDevice
// The swap chain resources.
SharpDX.Direct2D1.Bitmap1 _bitmapTarget;
SharpDX.DXGI.SwapChain1 _swapChain;
SwapChainBackgroundPanel _swapChainPanel;
SwapChainBackgroundPanel _swapChainBackgroundPanel;

float _dpi;
#endif
Expand Down Expand Up @@ -333,7 +333,7 @@ internal void CreateSizeDependentResources()

// We need presentation parameters to continue here.
if ( PresentationParameters == null ||
(PresentationParameters.DeviceWindowHandle == IntPtr.Zero && PresentationParameters.SwapChainPanel == null))
(PresentationParameters.DeviceWindowHandle == IntPtr.Zero && PresentationParameters.SwapChainBackgroundPanel == null))
{
if (_swapChain != null)
{
Expand All @@ -345,9 +345,9 @@ internal void CreateSizeDependentResources()
}

// Did we change swap panels?
if (PresentationParameters.SwapChainPanel != _swapChainPanel)
if (PresentationParameters.SwapChainBackgroundPanel != _swapChainBackgroundPanel)
{
_swapChainPanel = null;
_swapChainBackgroundPanel = null;
if (_swapChain != null)
{
_swapChain.Dispose();
Expand Down Expand Up @@ -415,9 +415,9 @@ internal void CreateSizeDependentResources()
}
else
{
_swapChainPanel = PresentationParameters.SwapChainPanel;
_swapChainBackgroundPanel = PresentationParameters.SwapChainBackgroundPanel;

using (var nativePanel = ComObject.As<SharpDX.DXGI.ISwapChainBackgroundPanelNative>(PresentationParameters.SwapChainPanel))
using (var nativePanel = ComObject.As<SharpDX.DXGI.ISwapChainBackgroundPanelNative>(PresentationParameters.SwapChainBackgroundPanel))
{
_swapChain = dxgiFactory2.CreateSwapChainForComposition(_d3dDevice, ref desc, null);
nativePanel.SwapChain = _swapChain;
Expand Down
2 changes: 1 addition & 1 deletion MonoGame.Framework/Graphics/PresentationParameters.cs
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ public IntPtr DeviceWindowHandle

#if WINDOWS_STOREAPP
[CLSCompliant(false)]
public SwapChainBackgroundPanel SwapChainPanel { get; set; }
public SwapChainBackgroundPanel SwapChainBackgroundPanel { get; set; }
#endif

public DepthFormat DepthStencilFormat
Expand Down
14 changes: 7 additions & 7 deletions MonoGame.Framework/GraphicsDeviceManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -245,15 +245,15 @@ public void ApplyChanges()

// The graphics device can use a XAML panel or a window
// to created the default swapchain target.
if (SwapChainPanel != null)
if (this.SwapChainBackgroundPanel != null)
{
_graphicsDevice.PresentationParameters.DeviceWindowHandle = IntPtr.Zero;
_graphicsDevice.PresentationParameters.SwapChainPanel = SwapChainPanel;
_graphicsDevice.PresentationParameters.SwapChainBackgroundPanel = this.SwapChainBackgroundPanel;
}
else
{
_graphicsDevice.PresentationParameters.DeviceWindowHandle = _game.Window.Handle;
_graphicsDevice.PresentationParameters.SwapChainPanel = null;
_graphicsDevice.PresentationParameters.SwapChainBackgroundPanel = null;
}

// Update the back buffer.
Expand Down Expand Up @@ -339,15 +339,15 @@ private void Initialize()
#elif WINRT
// The graphics device can use a XAML panel or a window
// to created the default swapchain target.
if (SwapChainPanel != null)
if (this.SwapChainBackgroundPanel != null)
{
presentationParameters.DeviceWindowHandle = IntPtr.Zero;
presentationParameters.SwapChainPanel = SwapChainPanel;
presentationParameters.SwapChainBackgroundPanel = this.SwapChainBackgroundPanel;
}
else
{
presentationParameters.DeviceWindowHandle = _game.Window.Handle;
presentationParameters.SwapChainPanel = null;
presentationParameters.SwapChainBackgroundPanel = null;
}
#else
presentationParameters.DeviceWindowHandle = _game.Window.Handle;
Expand Down Expand Up @@ -404,7 +404,7 @@ public void ToggleFullScreen()

#if WINDOWS_STOREAPP
[CLSCompliant(false)]
public SwapChainBackgroundPanel SwapChainPanel { get; set; }
public SwapChainBackgroundPanel SwapChainBackgroundPanel { get; set; }
#endif

public GraphicsProfile GraphicsProfile { get; set; }
Expand Down
4 changes: 2 additions & 2 deletions MonoGame.Framework/SharedGraphicsDeviceManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public SharedGraphicsDeviceManager()

#if WINRT && !WINDOWS_PHONE
[CLSCompliant(false)]
public SwapChainBackgroundPanel SwapChainPanel { get; set; }
public SwapChainBackgroundPanel SwapChainBackgroundPanel { get; set; }
#endif

public event EventHandler<EventArgs> DeviceCreated;
Expand All @@ -90,7 +90,7 @@ public void ApplyChanges()
presentationParameters.MultiSampleCount = MultiSampleCount;
presentationParameters.PresentationInterval = PresentationInterval;
presentationParameters.IsFullScreen = false;
presentationParameters.SwapChainPanel = SwapChainPanel;
presentationParameters.SwapChainBackgroundPanel = this.SwapChainBackgroundPanel;

if (createDevice)
{
Expand Down
4 changes: 2 additions & 2 deletions MonoGame.Framework/Windows/GamerServices/Guide.cs
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,8 @@ private static string ShowKeyboardInput(
bool usePasswordMode)
{
#if WINDOWS_STOREAPP
// If SwapChainPanel is null then we are running the non-XAML template
if (Game.Instance.graphicsDeviceManager.SwapChainPanel == null)
// If SwapChainBackgroundPanel is null then we are running the non-XAML template
if (Game.Instance.graphicsDeviceManager.SwapChainBackgroundPanel == null)
{
throw new NotImplementedException("This method works only when using the XAML template.");
}
Expand Down
20 changes: 10 additions & 10 deletions MonoGame.Framework/Windows8/XamlGame.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,30 +19,30 @@ public static class XamlGame<T>
/// </summary>
/// <param name="launchParameters">The command line arguments from launch.</param>
/// <param name="window">The core window object.</param>
/// <param name="swapPanel">The XAML swapchain panel to which we render the scene and recieve input events.</param>
/// <param name="SwapChainBackgroundPanel">The XAML SwapChainBackgroundPanel to which we render the scene and recieve input events.</param>
/// <returns></returns>
static public T Create(string launchParameters, CoreWindow window, SwapChainBackgroundPanel swapPanel)
static public T Create(string launchParameters, CoreWindow window, SwapChainBackgroundPanel swapChainBackgroundPanel)
{
if (launchParameters == null)
throw new NullReferenceException("The launch parameters cannot be null!");
if (window == null)
throw new NullReferenceException("The window cannot be null!");
if (swapPanel == null)
if (swapChainBackgroundPanel == null)
throw new NullReferenceException("The swap chain panel cannot be null!");

// Save any launch parameters to be parsed by the platform.
MetroGamePlatform.LaunchParameters = launchParameters;

// Setup the window class.
MetroGameWindow.Instance.Initialize(window, swapPanel);
MetroGameWindow.Instance.Initialize(window, swapChainBackgroundPanel);

// Construct the game.
var game = new T();

// Set the swap chain panel on the graphics mananger.
if (game.graphicsDeviceManager == null)
throw new NullReferenceException("You must create the GraphicsDeviceManager in the Game constructor!");
game.graphicsDeviceManager.SwapChainPanel = swapPanel;
game.graphicsDeviceManager.SwapChainBackgroundPanel = swapChainBackgroundPanel;

// Start running the game.
game.Run(GameRunBehavior.Asynchronous);
Expand All @@ -56,20 +56,20 @@ static public T Create(string launchParameters, CoreWindow window, SwapChainBack
/// </summary>
/// <param name="launchParameters">The command line arguments from launch.</param>
/// <param name="window">The core window object.</param>
/// <param name="swapPanel">The XAML swapchain panel to which we render the scene and recieve input events.</param>
/// <param name="swapChainBackgroundPanel">The XAML SwapChainBackgroundPanel to which we render the scene and recieve input events.</param>
/// <returns></returns>
static public T Create(LaunchActivatedEventArgs args, CoreWindow window, SwapChainBackgroundPanel swapPanel)
static public T Create(LaunchActivatedEventArgs args, CoreWindow window, SwapChainBackgroundPanel swapChainBackgroundPanel)
{
MetroGamePlatform.PreviousExecutionState = args.PreviousExecutionState;

return Create(args.Arguments, window, swapPanel);
return Create(args.Arguments, window, swapChainBackgroundPanel);
}

static public T Create(ProtocolActivatedEventArgs args, CoreWindow window, SwapChainBackgroundPanel swapPanel)
static public T Create(ProtocolActivatedEventArgs args, CoreWindow window, SwapChainBackgroundPanel swapChainBackgroundPanel)
{
MetroGamePlatform.PreviousExecutionState = args.PreviousExecutionState;

return Create(args.Uri.AbsoluteUri, window, swapPanel);
return Create(args.Uri.AbsoluteUri, window, swapChainBackgroundPanel);
}
}
}

0 comments on commit 369383d

Please sign in to comment.