我正在使用Monogame进行应用程序开发,我想为Windows Phone添加一个项目。我有一个用于测试Windows Mobile 8.1的设备,我正在使用Monogame 3.5(最新版)+ VS 2015.但是我该如何创建一个项目?
Monogame的模板有几个平台,但Windows Mobile的唯一模板似乎是Windows 10 Uniwersal Project(UWP)。我怀疑这会在WM8.1上运行。或者是吗?如果没有,我该如何创建项目呢?
更新
对此进行了更多研究,似乎您需要在开发PC上使用最低版本的Windows 8.1来开发Windows Phone 8.1:
https://www.visualstudio.com/en-us/products/visual-studio-2015-compatibility-vs.aspx
所以我想我会像所有其他移动应用一样支持Android和iOS。
答案 0 :(得分:1)
变式1:
在MainPage.xaml.cs中添加
listnode* LList::next() {
listnode* temp = view;
if(temp != NULL)
view = view->next;
if(view == NULL) {
}
return temp;
};
void LList::reset() {
view = head;
}
LList::LList(){
head = NULL;
view = NULL;
};
void LList::insertTail(element val) {
listnode * temp;
temp = new listnode;
temp -> data = val;
temp -> next = NULL;
if(head == NULL) {
head = temp;
view = head;
}
else
tail -> next = temp;
tail = temp;
};
void LList::clean() {
while(head != NULL)
deleteHead();
};
element LList::deleteHead() {
listnode * temp;
temp = head;
head = head -> next;
delete temp;
return temp -> data;
};
LList::~LList(){
delete head;
};
MainPage.xaml.cs中的更改
using MonoGame.Framework;
更改MainPage.xaml(MyGame - 默认项目命名空间)
public sealed partial class MainPage : SwapChainBackgroundPanel
{
readonly Game1 _game;
public MainPage(string launchArguments)
{
this.InitializeComponent();
_game = XamlGame<Game1>.Create(launchArguments, Window.Current.CoreWindow, this);
}
}
在App.xaml.cs中更改App类
<SwapChainBackgroundPanel
x:Class="MyGame.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:MyGame"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d">
<Grid >
</Grid>
</SwapChainBackgroundPanel>
添加Content.mgcb
将monogameplatform添加到项目文件(.csproj)到PropertyGroup部分
protected override void OnLaunched(LaunchActivatedEventArgs args)
{
var gamePage = Window.Current.Content as MainPage;
if (gamePage == null)
{
gamePage = new MainPage(args.Arguments);
if (args.PreviousExecutionState == ApplicationExecutionState.Terminated)
{
}
Window.Current.Content = gamePage;
}
Window.Current.Activate();
}
private void OnSuspending(object sender, SuspendingEventArgs e)
{
var deferral = e.SuspendingOperation.GetDeferral();
deferral.Complete();
}
将项目文件(.csproj)的下一行添加到项目部分
<PropertyGroup>
...
<MonoGamePlatform>WindowsStoreApp</MonoGamePlatform>
<MonoGameContentBuilderExe>
</MonoGameContentBuilderExe>
...
</PropertyGroup>
变体2:使用Protobuild.org中的工具