Download presentation
Presentation is loading. Please wait.
Published byShannon Byrd Modified over 8 years ago
6
D3D11CreateDevice( /* … */ &device, // Returns the Direct3D device created. &m_featureLevel, // Returns feature level of the device. &context // Returns the device immediate context. )
7
struct SimpleVertex { XMFLOAT3 pos; XMFLOAT3 color; }; // Create the shaders m_d3dDevice->CreateVertexShader( … ); m_d3dDevice->CreatePixelShader( … ); // Define the input to the vertex shader m_d3dDevice->CreateInputLayout( … &vertexShaderByteCode, &layoutdesc, … );
15
See XAML SurfaceImageSource DirectX Interop Sample on MSDNXAML SurfaceImageSource DirectX Interop Sample
16
See May talk by Jesse Bishop, “Combining XAML and DirectX in Windows Store apps”Combining XAML and DirectX in Windows Store apps
20
ref class MyFrameworkView : public IFrameworkView { public: // IFrameworkView Methods virtual void Initialize(CoreApplicationView^ applicationView); virtual void SetWindow(CoreWindow^ window); virtual void Load(String^ entryPoint); virtual void Run(); virtual void Uninitialize(); //...
24
m_window->SizeChanged += ref new TypedEventHandler ( this, &Framework::OnWindowSizeChanged );
25
void Framework::OnWindowSizeChanged(CoreWindow^ sender, WindowSizeChangedEventArgs^ args) { using Windows::UI::ViewManagement; if(ApplicationView::Value == ApplicationViewState::Snapped) { /* snapped specific code */ } /* respond to new window size … */ } // See Snap sample on MSDNSnap sample
26
CoreApplication::Suspending += ref new EventHandler (this, &Framework::OnSuspending); CoreApplication::Resuming += ref new EventHandler (this, &Framework::OnResuming); //... void Framework::OnSuspending(Platform::Object^ sender, SuspendingEventArgs^ args) { // Save app state here } void Framework::OnResuming(Platform::Object^ sender, Platform::Object^ args) { // Restore app state here }
31
using namespace Windows::UI::Notifications; using namespace Windows::Data::Xml::Dom; auto tileXml = ref new XmlDocument(); tileXml->LoadXml(" "…" "); TileUpdateManager::CreateTileUpdaterForApplication()->Update( ref new TileNotification(tileXml) ); See App tiles and badges sample on MSDNApp tiles and badges sample
32
tileXmlString = " " + " ” + " " + " My first tile notification! " + " " + " "; // See Build 3-101, “Alive with activity” by Kraig Brockschmidt See App tiles and badges sample on MSDNApp tiles and badges sample
33
using namespace Windows::UI::Notifications; using namespace Windows::Data::Xml::Dom; auto toastXml = ref new XmlDocument(); auto toastXmlString = " ”…” "; toastXml->LoadXml(toastXmlString); auto toast = ref new ToastNotification(toastXml); ToastNotificationManager::CreateToastNotifier()->Show(toast);
34
toastXml->LoadXml(toastXmlString); auto toast = ref new ToastNotification(toastXml); auto cal = ref new Windows::Globalization::Calendar(); cal->SetToNow(); cal->AddSeconds(7); ToastNotificationManager::CreateToastNotifier()->AddToSchedule(ref new ScheduledToastNotification(toastXml,cal->GetDateTime())); // Remember to declare toast in your app manifest!
36
using namespace Windows::UI::Input; EdgeGesture::GetForCurrentView()->Completed += ref new TypedEventHandler ( this, &InputController::OnCompleted ); void InputController::OnCompleted(EdgeGesture^,EdgeGestureEventArgs^){ // Check device orientation and draw app bar… }
37
using namespace Windows::ApplicationModel::DataTransfer; DataTransferManager::GetForCurrentView()->DataRequested += ref new TypedEventHandler ( &App::onShare ); void App::onShare(DataTransferManager^ sender, DataRequestedEventArgs^ args) { auto requestData = args->Request->Data; requestData->Properties->Title = "High Score"; requestData->Properties->Description = “My High Score"; requestData->SetText(“I just got a new high score!“); /* … */ });
38
using namespace Windows::UI::ApplicationSettings; SettingsPane::GetForCurrentView()->CommandsRequested += ref new TypedEventHandler ( &MyApp::OnCommandsRequested );
39
using namespace Windows::UI::ApplicationSettings; void MyApp::OnCommandsRequested(SettingsPane^ settingsPane, SettingsPaneCommandsRequestedEventArgs^ args) { UICommandInvokedHandler^ handler = ref new UICommandInvokedHandler(this, &Scenario::onAudio); SettingsCommand^ audioCommand = ref new SettingsCommand("audioPage", "audio", handler); // Make it visible args->Request->ApplicationCommands->Append(audioCommand); // Add additional settings... }
40
void Scenario::OnAudio(IUICommand^ command) { // Draw audio settings using Direct2D... } Source code from App Settings Sample on MSDNApp Settings
42
auto settingsValues = Windows::Storage::ApplicationData::Current->LocalSettings->Values; float m_time = safe_cast ( settingsValues->Lookup(“time") )->GetSingle(); settingsValues->Insert(“time", PropertyValue::CreateSingle(m_time) );
43
auto settingsValues = Windows::Storage::ApplicationData::Current->RoamingSettings->Values; float m_time = safe_cast ( settingsValues->Lookup(“time") )->GetSingle(); settingsValues->Insert(“time", PropertyValue::CreateSingle(m_time) ); // See Build 3-126, “The Story of State” by Kraig Brockschmidt
49
Please submit session evals on the Build Windows 8 App or at http://aka.ms/BuildSessionshttp://aka.ms/BuildSessions
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.