2014-01-28 1 views
1

현재 SharpDx와 함께 Windows 8.1을 대상으로하고 다른 xaml 요소와 함께 페이지에 여러 3D 뷰포트가 필요합니다. 나는 지금까지 Nuget을 통해 SharpDx 툴킷을 설치할 수 있었고 표준 툴킷 프로젝트를 실행할 수있었습니다. 그러나 프로젝트는 SwapChainBackgroundPanel 컨트롤을 3D 콘텐츠를 렌더링하는 방법으로 사용합니다 (아래 참조). 내가 읽은 문서에 따르면SharpDx 툴킷 SwapChainPanel 통합

에서 MainPage.xaml

<SwapChainBackgroundPanel 
    x:Class="MyGame1.MainPage" 
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
    xmlns:local="using:MyGame1" 
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
    mc:Ignorable="d" 
    d:DesignWidth="1280" 
    d:DesignHeight="800"> 

</SwapChainBackgroundPanel> 

MainPage.xaml.cs를

public sealed partial class MainPage 
    { 
    private readonly MyGame1 game; 

    public MainPage() 
    { 
     this.InitializeComponent(); 
     game = new MyGame1(); 
     this.Loaded += (sender, args) => game.Run(this); 
    } 
    } 

에서, SwapChainBackgroundPanel은 새로 도입 된 SwapChainPanel에 찬성 사용되지 않습니다,하지만 난에 시도 할 때 SwapChainBackgroundPanel을 SwapChainPanel로 바꾸면 오류가 발생합니다.

SwapChainPanel을 사용하여 현재 SwapChainBackgroundPanel에서 사용하는 것과 동일한 방식으로 SharpDx 툴킷을 업데이트 할 계획이 곧있을 경우 누구에게 알리십니까?

감사합니다.

+0

SharpDX는 거의 매일 업데이트됩니다. [최신 dev 빌드] (http://sharpdx.org/upload/SharpDX-SDK-LatestDev.exe)를 다운로드 할 수 있습니다. 어쨌든, 어떤 오류가 발생 했습니까? 아직 구현되지 않은 경우 [GitHub] (https://github.com/sharpdx/SharpDX)에서 요청할 수 있습니다. – TheWanderer

답변

3

DirectX 11.2 빌드는 이미 SwapChainPanel과의 통합을 완벽하게 지원합니다.

이 기능을 설명하는 sample이 추가되었습니다.

먼저 프로젝트가 DirectX 11.2 어셈블리를 참조하는지 확인하십시오. 이는 here과 같이 프로젝트 편집과 관련이 있습니다. 이 후

, (일부 코드가 간결하게 생략)이 같은 예를 들어, 필요에 따라 페이지의 XAML을 편집

<Page ...> 
    <Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}"> 
     <SwapChainPanel x:Name="panel" x:FieldModifier="private" /> 
    </Grid> 
</Page> 

그런 다음이 같은 평소와 같이 게임을 실행해야합니다

using SharpDX.Toolkit; 

public sealed partial class MainPage 
{ 
    private readonly Game _game; 

    public MainPage() 
    { 
     InitializeComponent(); 

     _game = new MiniCubeGame(); 
     _game.Run(panel); 
    } 
} 

아키텍처가 더 적합한 경우 Loaded 이벤트 처리기로 _game.Run(...) 호출을 이동할 수 있습니다.

+0

게임 리소스를 해제하는 적절한 방법은 무엇입니까? MiniCubeGame impenses는 IDisposable이므로 어딘가에 호출해야합니다. – Dmitry