Skip to content

Commit

Permalink
Support SwapChainPanel on W8.1 / WP8.1 and update tempates to use Swa…
Browse files Browse the repository at this point in the history
…pChainPanel
  • Loading branch information
nkast committed Sep 3, 2017
1 parent 2cae3c4 commit 2d28307
Show file tree
Hide file tree
Showing 15 changed files with 44 additions and 36 deletions.
13 changes: 13 additions & 0 deletions MonoGame.Framework/Windows8/XamlGame.cs
Expand Up @@ -29,10 +29,23 @@ public static class XamlGame<T>
/// <param name="window">The core window object.</param>
/// <param name="swapChainBackgroundPanel">The XAML SwapChainBackgroundPanel to which we render the scene and recieve input events.</param>
/// <returns></returns>
[Obsolete("Use Create(string launchParameters, CoreWindow window, SwapChainPanel swapChainPanel) instead. In future versions this method can be removed.")]
static public T Create(string launchParameters, CoreWindow window, SwapChainBackgroundPanel swapChainBackgroundPanel)
{
return Create(launchParameters, window, new GenericSwapChainPanel(swapChainBackgroundPanel));
}

/// <summary>
/// Creates your Game class initializing it to work within a XAML application window.
/// </summary>
/// <param name="launchParameters">The command line arguments from launch.</param>
/// <param name="window">The core window object.</param>
/// <param name="swapChainPanel">The XAML SwapChainPanel to which we render the scene and receive input events.</param>
/// <returns></returns>
static public T Create(string launchParameters, CoreWindow window, SwapChainPanel swapChainPanel)
{
return Create(launchParameters, window, new GenericSwapChainPanel(swapChainPanel));
}

static private T Create(string launchParameters, CoreWindow window, GenericSwapChainPanel swapChainPanel)
{
Expand Down
@@ -1,4 +1,4 @@
<SwapChainBackgroundPanel
<Page
x:Class="$safeprojectname$.GamePage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Expand All @@ -7,7 +7,6 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d">

<Grid>
</Grid>
<SwapChainPanel x:Name="swapChainPanel" />

</SwapChainBackgroundPanel>
</Page>
Expand Up @@ -9,7 +9,7 @@ namespace $safeprojectname$
/// <summary>
/// The root page used to display the game.
/// </summary>
public sealed partial class GamePage : SwapChainBackgroundPanel
public sealed partial class GamePage : Page
{
readonly Game1 _game;

Expand All @@ -18,7 +18,7 @@ public GamePage(LaunchActivatedEventArgs args)
this.InitializeComponent();

// Create the game.
_game = XamlGame<Game1>.Create(args, Window.Current.CoreWindow, this);
_game = XamlGame<Game1>.Create(args, Window.Current.CoreWindow, swapChainPanel);
}
}
}
Expand Up @@ -16,7 +16,7 @@
<EnableLocationBrowseButton>true</EnableLocationBrowseButton>
<NumberOfParentCategoriesToRollUp>1</NumberOfParentCategoriesToRollUp>
<TargetPlatformName>Windows</TargetPlatformName>
<RequiredPlatformVersion>8</RequiredPlatformVersion>
<RequiredPlatformVersion>8.1</RequiredPlatformVersion>
<CreateInPlace>true</CreateInPlace>
</TemplateData>
<TemplateContent>
Expand Down
@@ -1,4 +1,4 @@
<SwapChainBackgroundPanel
<Page
x:Class="$safeprojectname$.GamePage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Expand All @@ -7,7 +7,6 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d">

<Grid>
<SwapChainPanel x:Name="swapChainPanel" />

</Grid>
</SwapChainBackgroundPanel>
</Page>
Expand Up @@ -20,15 +20,15 @@ namespace $safeprojectname$
/// <summary>
/// An empty page that can be used on its own or navigated to within a Frame.
/// </summary>
public sealed partial class GamePage : SwapChainBackgroundPanel
public sealed partial class GamePage : Page
{
readonly Game1 _game;

public GamePage(string launchArguments)
{
this.InitializeComponent();

_game = XamlGame<Game1>.Create(launchArguments, Window.Current.CoreWindow, this);
_game = XamlGame<Game1>.Create(launchArguments, Window.Current.CoreWindow, swapChainPanel);
}
}
}
@@ -1,4 +1,4 @@
<SwapChainBackgroundPanel
<Page
x:Class="$safeprojectname$.GamePage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Expand All @@ -7,7 +7,6 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d">

<Grid>
</Grid>
<SwapChainPanel x:Name="swapChainPanel" />

</SwapChainBackgroundPanel>
</Page>
Expand Up @@ -9,7 +9,7 @@ namespace $safeprojectname$
/// <summary>
/// The root page used to display the game.
/// </summary>
public sealed partial class GamePage : SwapChainBackgroundPanel
public sealed partial class GamePage : Page
{
readonly Game1 _game;

Expand All @@ -18,7 +18,7 @@ public GamePage(LaunchActivatedEventArgs args)
this.InitializeComponent();

// Create the game.
_game = XamlGame<Game1>.Create(args, Window.Current.CoreWindow, this);
_game = XamlGame<Game1>.Create(args, Window.Current.CoreWindow, swapChainPanel);
}
}
}
@@ -1,4 +1,4 @@
<SwapChainBackgroundPanel
<Page
x:Class="$ext_safeprojectname$.GamePage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Expand All @@ -7,7 +7,6 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d">

<Grid >
<SwapChainPanel x:Name="swapChainPanel" />

</Grid>
</SwapChainBackgroundPanel>
</Page>
Expand Up @@ -20,7 +20,7 @@ namespace $ext_safeprojectname$
/// <summary>
/// An empty page that can be used on its own or navigated to within a Frame.
/// </summary>
public sealed partial class GamePage : SwapChainBackgroundPanel
public sealed partial class GamePage : Page
{
readonly Game1 _game;

Expand All @@ -30,7 +30,7 @@ public GamePage(string launchArguments)

// Create the game.

_game = XamlGame<Game1>.Create(launchArguments, Window.Current.CoreWindow, this);
_game = XamlGame<Game1>.Create(launchArguments, Window.Current.CoreWindow, swapChainPanel);
}
}
}
Expand Up @@ -20,6 +20,7 @@
<PackageCertificateKeyFile>$ext_safeprojectname$.Windows_TemporaryKey.pfx</PackageCertificateKeyFile>
$endif$
<MonoGamePlatform>WindowsStoreApp</MonoGamePlatform>
<TargetPlatformVersion>8.1</TargetPlatformVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
Expand Down
@@ -1,4 +1,4 @@
<SwapChainBackgroundPanel
<Page
x:Class="$safeprojectname$.GamePage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Expand All @@ -7,7 +7,6 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d">

<Grid>
</Grid>
<SwapChainPanel x:Name="swapChainPanel" />

</SwapChainBackgroundPanel>
</Page>
Expand Up @@ -9,7 +9,7 @@ namespace $safeprojectname$
/// <summary>
/// The root page used to display the game.
/// </summary>
public sealed partial class GamePage : SwapChainBackgroundPanel
public sealed partial class GamePage : Page
{
readonly Game1 _game;

Expand Down
@@ -1,4 +1,4 @@
<SwapChainBackgroundPanel
<Page
x:Class="$ext_safeprojectname$.GamePage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Expand All @@ -7,7 +7,6 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d">

<Grid >
<SwapChainPanel x:Name="swapChainPanel" />

</Grid>
</SwapChainBackgroundPanel>
</Page>
Expand Up @@ -20,7 +20,7 @@ namespace $ext_safeprojectname$
/// <summary>
/// An empty page that can be used on its own or navigated to within a Frame.
/// </summary>
public sealed partial class GamePage : SwapChainBackgroundPanel
public sealed partial class GamePage : Page
{
readonly Game1 _game;

Expand All @@ -30,7 +30,7 @@ public GamePage(string launchArguments)

// Create the game.

_game = XamlGame<Game1>.Create(launchArguments, Window.Current.CoreWindow, this);
_game = XamlGame<Game1>.Create(launchArguments, Window.Current.CoreWindow, swapChainPanel);
}
}
}

0 comments on commit 2d28307

Please sign in to comment.