Windows 10/Windows Phone(10)用のUWP/UWAゲームで作業していて、Xbox One用のDevモードを予期していました。私は今日のdevモードのリリースについて聞いて興奮し、家に帰ってXboxでテストするのを待つことができませんでした。C#(XAMLなし)でXBOX OneでCoreWindowのWin2D CanvasSwapChainをサイズ変更
私のアプリやゲームはうまくいっていますが、描画された領域が切り取られている(「titlesafe/tv safe」領域外の外側の端)以外にエラーは発生していません。
私はWin2D CanvasSwapChainと一般的なCoreWindowを使用しています。
この問題を緩和するためにMyCoreWindowまたはMyViewSourceで何かできることがあるようですが、まだ答えは見つかりませんでした。現時点では睡眠不足かもしれませんが、それを指し示す答えや矢印が自分自身や将来の探求者にとって大きな助けになることを期待しています。
xamlを使用しないことをお勧めします。
ここに私のViewコードがあります。
using Windows.ApplicationModel.Core;
class MyViewSource : IFrameworkViewSource
{
public IFrameworkView CreateView()
{
return new MyCoreWindow();
}
}
そして、これはMyCoreWindow
class MyCoreWindow : IFrameworkView
{
private IGameSurface _surface;
private Engine _gameEngine;
public void Initialize(CoreApplicationView applicationView)
{
applicationView.Activated += applicationView_Activated;
CoreApplication.Suspending += CoreApplication_Suspending;
CoreApplication.Resuming += CoreApplication_Resuming;
}
private void CoreApplication_Resuming(object sender, object e)
{
_surface.Resume(sender, e);
}
private void CoreApplication_Suspending(object sender, SuspendingEventArgs e)
{
_surface.Suspend(sender, e);
}
private void applicationView_Activated(CoreApplicationView sender, IActivatedEventArgs args)
{
Windows.UI.Core.CoreWindow.GetForCurrentThread().Activate();
}
public void Load(string entryPoint)
{
_surface.Load(entryPoint);
}
public void Run()
{
while (_gameEngine.IsRunning)
{
Windows.UI.Core.CoreWindow.GetForCurrentThread().Dispatcher.ProcessEvents(CoreProcessEventsOption.ProcessAllIfPresent);
_surface.Update();
_surface.Draw();
}
}
public void SetWindow(Windows.UI.Core.CoreWindow window)
{
_surface = new Surface(window);
_surface.SetFrameRate(60);
_surface.SetUpdateRate(100);
_gameEngine = new Engine(_surface.CanvasDevice);
_surface.AddComponent(_gameEngine);
}
public void Uninitialize()
{
_surface.Unload();
}
public static void Main(string[] args)
{
CoreApplication.Run(new MyViewSource());
}
}