Updated sample and LottieIsland to consume new interfaces
This commit is contained in:
Родитель
266968446b
Коммит
3e107ef073
|
@ -173,12 +173,12 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LottieSamples", "LottieSamp
|
|||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LottieWinRT", "LottieWinRT\LottieWinRT.csproj", "{DDA0D223-4B59-455D-A8B1-CFAE59523FFB}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SimpleIslandApp", "Lottie\SimpleIslandApp.vcxproj", "{350A5EC2-B156-4AAF-9D80-A864C76BA0C5}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "LottieIsland", "LottieIsland\LottieIsland.vcxproj", "{9BA7A2F2-B723-458B-A575-3F726D271465}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LottieIslandProjection", "LottieIslandProjection\LottieIslandProjection.csproj", "{D2DDC0A0-FD88-4053-9EA2-4233477D8477}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SimpleLottieIslandApp", "SimpleLottieIslandApp\SimpleLottieIslandApp.vcxproj", "{350A5EC2-B156-4AAF-9D80-A864C76BA0C5}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
BETA|Any CPU = BETA|Any CPU
|
||||
|
@ -651,38 +651,6 @@ Global
|
|||
{DDA0D223-4B59-455D-A8B1-CFAE59523FFB}.Release|x64.Build.0 = Release|Any CPU
|
||||
{DDA0D223-4B59-455D-A8B1-CFAE59523FFB}.Release|x86.ActiveCfg = Release|x86
|
||||
{DDA0D223-4B59-455D-A8B1-CFAE59523FFB}.Release|x86.Build.0 = Release|x86
|
||||
{350A5EC2-B156-4AAF-9D80-A864C76BA0C5}.BETA|Any CPU.ActiveCfg = Debug|x64
|
||||
{350A5EC2-B156-4AAF-9D80-A864C76BA0C5}.BETA|Any CPU.Build.0 = Debug|x64
|
||||
{350A5EC2-B156-4AAF-9D80-A864C76BA0C5}.BETA|ARM.ActiveCfg = Debug|x64
|
||||
{350A5EC2-B156-4AAF-9D80-A864C76BA0C5}.BETA|ARM.Build.0 = Debug|x64
|
||||
{350A5EC2-B156-4AAF-9D80-A864C76BA0C5}.BETA|ARM64.ActiveCfg = Debug|ARM64
|
||||
{350A5EC2-B156-4AAF-9D80-A864C76BA0C5}.BETA|ARM64.Build.0 = Debug|ARM64
|
||||
{350A5EC2-B156-4AAF-9D80-A864C76BA0C5}.BETA|x64.ActiveCfg = Debug|x64
|
||||
{350A5EC2-B156-4AAF-9D80-A864C76BA0C5}.BETA|x64.Build.0 = Debug|x64
|
||||
{350A5EC2-B156-4AAF-9D80-A864C76BA0C5}.BETA|x86.ActiveCfg = Debug|Win32
|
||||
{350A5EC2-B156-4AAF-9D80-A864C76BA0C5}.BETA|x86.Build.0 = Debug|Win32
|
||||
{350A5EC2-B156-4AAF-9D80-A864C76BA0C5}.Debug|Any CPU.ActiveCfg = Debug|x64
|
||||
{350A5EC2-B156-4AAF-9D80-A864C76BA0C5}.Debug|Any CPU.Build.0 = Debug|x64
|
||||
{350A5EC2-B156-4AAF-9D80-A864C76BA0C5}.Debug|ARM.ActiveCfg = Debug|x64
|
||||
{350A5EC2-B156-4AAF-9D80-A864C76BA0C5}.Debug|ARM.Build.0 = Debug|x64
|
||||
{350A5EC2-B156-4AAF-9D80-A864C76BA0C5}.Debug|ARM64.ActiveCfg = Debug|ARM64
|
||||
{350A5EC2-B156-4AAF-9D80-A864C76BA0C5}.Debug|ARM64.Build.0 = Debug|ARM64
|
||||
{350A5EC2-B156-4AAF-9D80-A864C76BA0C5}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{350A5EC2-B156-4AAF-9D80-A864C76BA0C5}.Debug|x64.Build.0 = Debug|x64
|
||||
{350A5EC2-B156-4AAF-9D80-A864C76BA0C5}.Debug|x64.Deploy.0 = Debug|x64
|
||||
{350A5EC2-B156-4AAF-9D80-A864C76BA0C5}.Debug|x86.ActiveCfg = Debug|Win32
|
||||
{350A5EC2-B156-4AAF-9D80-A864C76BA0C5}.Debug|x86.Build.0 = Debug|Win32
|
||||
{350A5EC2-B156-4AAF-9D80-A864C76BA0C5}.Debug|x86.Deploy.0 = Debug|Win32
|
||||
{350A5EC2-B156-4AAF-9D80-A864C76BA0C5}.Release|Any CPU.ActiveCfg = Release|x64
|
||||
{350A5EC2-B156-4AAF-9D80-A864C76BA0C5}.Release|Any CPU.Build.0 = Release|x64
|
||||
{350A5EC2-B156-4AAF-9D80-A864C76BA0C5}.Release|ARM.ActiveCfg = Release|x64
|
||||
{350A5EC2-B156-4AAF-9D80-A864C76BA0C5}.Release|ARM.Build.0 = Release|x64
|
||||
{350A5EC2-B156-4AAF-9D80-A864C76BA0C5}.Release|ARM64.ActiveCfg = Release|ARM64
|
||||
{350A5EC2-B156-4AAF-9D80-A864C76BA0C5}.Release|ARM64.Build.0 = Release|ARM64
|
||||
{350A5EC2-B156-4AAF-9D80-A864C76BA0C5}.Release|x64.ActiveCfg = Release|x64
|
||||
{350A5EC2-B156-4AAF-9D80-A864C76BA0C5}.Release|x64.Build.0 = Release|x64
|
||||
{350A5EC2-B156-4AAF-9D80-A864C76BA0C5}.Release|x86.ActiveCfg = Release|Win32
|
||||
{350A5EC2-B156-4AAF-9D80-A864C76BA0C5}.Release|x86.Build.0 = Release|Win32
|
||||
{9BA7A2F2-B723-458B-A575-3F726D271465}.BETA|Any CPU.ActiveCfg = Debug|x64
|
||||
{9BA7A2F2-B723-458B-A575-3F726D271465}.BETA|Any CPU.Build.0 = Debug|x64
|
||||
{9BA7A2F2-B723-458B-A575-3F726D271465}.BETA|ARM.ActiveCfg = Debug|ARM
|
||||
|
@ -743,6 +711,51 @@ Global
|
|||
{D2DDC0A0-FD88-4053-9EA2-4233477D8477}.Release|x64.Build.0 = Release|Any CPU
|
||||
{D2DDC0A0-FD88-4053-9EA2-4233477D8477}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{D2DDC0A0-FD88-4053-9EA2-4233477D8477}.Release|x86.Build.0 = Release|Any CPU
|
||||
{350A5EC2-B156-4AAF-9D80-A864C76BA0C5}.BETA|Any CPU.ActiveCfg = Debug|x64
|
||||
{350A5EC2-B156-4AAF-9D80-A864C76BA0C5}.BETA|Any CPU.Build.0 = Debug|x64
|
||||
{350A5EC2-B156-4AAF-9D80-A864C76BA0C5}.BETA|Any CPU.Deploy.0 = Debug|x64
|
||||
{350A5EC2-B156-4AAF-9D80-A864C76BA0C5}.BETA|ARM.ActiveCfg = Debug|x64
|
||||
{350A5EC2-B156-4AAF-9D80-A864C76BA0C5}.BETA|ARM.Build.0 = Debug|x64
|
||||
{350A5EC2-B156-4AAF-9D80-A864C76BA0C5}.BETA|ARM.Deploy.0 = Debug|x64
|
||||
{350A5EC2-B156-4AAF-9D80-A864C76BA0C5}.BETA|ARM64.ActiveCfg = Debug|ARM64
|
||||
{350A5EC2-B156-4AAF-9D80-A864C76BA0C5}.BETA|ARM64.Build.0 = Debug|ARM64
|
||||
{350A5EC2-B156-4AAF-9D80-A864C76BA0C5}.BETA|ARM64.Deploy.0 = Debug|ARM64
|
||||
{350A5EC2-B156-4AAF-9D80-A864C76BA0C5}.BETA|x64.ActiveCfg = Debug|x64
|
||||
{350A5EC2-B156-4AAF-9D80-A864C76BA0C5}.BETA|x64.Build.0 = Debug|x64
|
||||
{350A5EC2-B156-4AAF-9D80-A864C76BA0C5}.BETA|x64.Deploy.0 = Debug|x64
|
||||
{350A5EC2-B156-4AAF-9D80-A864C76BA0C5}.BETA|x86.ActiveCfg = Debug|Win32
|
||||
{350A5EC2-B156-4AAF-9D80-A864C76BA0C5}.BETA|x86.Build.0 = Debug|Win32
|
||||
{350A5EC2-B156-4AAF-9D80-A864C76BA0C5}.BETA|x86.Deploy.0 = Debug|Win32
|
||||
{350A5EC2-B156-4AAF-9D80-A864C76BA0C5}.Debug|Any CPU.ActiveCfg = Debug|x64
|
||||
{350A5EC2-B156-4AAF-9D80-A864C76BA0C5}.Debug|Any CPU.Build.0 = Debug|x64
|
||||
{350A5EC2-B156-4AAF-9D80-A864C76BA0C5}.Debug|Any CPU.Deploy.0 = Debug|x64
|
||||
{350A5EC2-B156-4AAF-9D80-A864C76BA0C5}.Debug|ARM.ActiveCfg = Debug|x64
|
||||
{350A5EC2-B156-4AAF-9D80-A864C76BA0C5}.Debug|ARM.Build.0 = Debug|x64
|
||||
{350A5EC2-B156-4AAF-9D80-A864C76BA0C5}.Debug|ARM.Deploy.0 = Debug|x64
|
||||
{350A5EC2-B156-4AAF-9D80-A864C76BA0C5}.Debug|ARM64.ActiveCfg = Debug|ARM64
|
||||
{350A5EC2-B156-4AAF-9D80-A864C76BA0C5}.Debug|ARM64.Build.0 = Debug|ARM64
|
||||
{350A5EC2-B156-4AAF-9D80-A864C76BA0C5}.Debug|ARM64.Deploy.0 = Debug|ARM64
|
||||
{350A5EC2-B156-4AAF-9D80-A864C76BA0C5}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{350A5EC2-B156-4AAF-9D80-A864C76BA0C5}.Debug|x64.Build.0 = Debug|x64
|
||||
{350A5EC2-B156-4AAF-9D80-A864C76BA0C5}.Debug|x64.Deploy.0 = Debug|x64
|
||||
{350A5EC2-B156-4AAF-9D80-A864C76BA0C5}.Debug|x86.ActiveCfg = Debug|Win32
|
||||
{350A5EC2-B156-4AAF-9D80-A864C76BA0C5}.Debug|x86.Build.0 = Debug|Win32
|
||||
{350A5EC2-B156-4AAF-9D80-A864C76BA0C5}.Debug|x86.Deploy.0 = Debug|Win32
|
||||
{350A5EC2-B156-4AAF-9D80-A864C76BA0C5}.Release|Any CPU.ActiveCfg = Release|x64
|
||||
{350A5EC2-B156-4AAF-9D80-A864C76BA0C5}.Release|Any CPU.Build.0 = Release|x64
|
||||
{350A5EC2-B156-4AAF-9D80-A864C76BA0C5}.Release|Any CPU.Deploy.0 = Release|x64
|
||||
{350A5EC2-B156-4AAF-9D80-A864C76BA0C5}.Release|ARM.ActiveCfg = Release|x64
|
||||
{350A5EC2-B156-4AAF-9D80-A864C76BA0C5}.Release|ARM.Build.0 = Release|x64
|
||||
{350A5EC2-B156-4AAF-9D80-A864C76BA0C5}.Release|ARM.Deploy.0 = Release|x64
|
||||
{350A5EC2-B156-4AAF-9D80-A864C76BA0C5}.Release|ARM64.ActiveCfg = Release|ARM64
|
||||
{350A5EC2-B156-4AAF-9D80-A864C76BA0C5}.Release|ARM64.Build.0 = Release|ARM64
|
||||
{350A5EC2-B156-4AAF-9D80-A864C76BA0C5}.Release|ARM64.Deploy.0 = Release|ARM64
|
||||
{350A5EC2-B156-4AAF-9D80-A864C76BA0C5}.Release|x64.ActiveCfg = Release|x64
|
||||
{350A5EC2-B156-4AAF-9D80-A864C76BA0C5}.Release|x64.Build.0 = Release|x64
|
||||
{350A5EC2-B156-4AAF-9D80-A864C76BA0C5}.Release|x64.Deploy.0 = Release|x64
|
||||
{350A5EC2-B156-4AAF-9D80-A864C76BA0C5}.Release|x86.ActiveCfg = Release|Win32
|
||||
{350A5EC2-B156-4AAF-9D80-A864C76BA0C5}.Release|x86.Build.0 = Release|Win32
|
||||
{350A5EC2-B156-4AAF-9D80-A864C76BA0C5}.Release|x86.Deploy.0 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
|
|
@ -9,16 +9,14 @@
|
|||
#include <Microsoft.UI.Dispatching.Interop.h> // For ContentPreTranslateMessage
|
||||
#include <winrt/LottieIsland.h>
|
||||
#include <winrt/AnimatedVisuals.h>
|
||||
#include <winrt/LottieWinRT.h>
|
||||
|
||||
namespace winrt
|
||||
{
|
||||
using namespace winrt::Windows::Foundation;
|
||||
using namespace winrt::Microsoft::UI;
|
||||
using namespace winrt::Microsoft::UI::Content;
|
||||
using namespace winrt::Microsoft::UI::Dispatching;
|
||||
using namespace winrt::LottieIsland;
|
||||
using namespace winrt::LottieWinRT;
|
||||
using namespace winrt::Windows::Foundation;
|
||||
using float2 = winrt::Windows::Foundation::Numerics::float2;
|
||||
}
|
||||
|
||||
|
@ -198,17 +196,18 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
|||
winrt::GetWindowIdFromWindow(hWnd));
|
||||
|
||||
// Create the LottieIsland, which is a WinRT wrapper for hosting a Lottie animation in a ContentIsland
|
||||
windowInfo->LottieIsland = winrt::LottieContentIsland{ windowInfo->Compositor };
|
||||
windowInfo->LottieIsland = winrt::LottieIsland::LottieContentIsland::Create(windowInfo->Compositor);
|
||||
|
||||
// Connect the ContentIsland to the DesktopChildSiteBridge
|
||||
windowInfo->Bridge.Connect(windowInfo->LottieIsland.Island());
|
||||
windowInfo->Bridge.Show();
|
||||
|
||||
// Live JSON loaded animation!
|
||||
winrt::LottieVisualSourceWinRT lottieVisualSource = winrt::LottieVisualSourceWinRT::CreateFromString(L"ms-appx:///LottieLogo1.json");
|
||||
lottieVisualSource.AnimatedVisualInvalidated([windowInfo, lottieVisualSource](const winrt::IInspectable sender, auto&&)
|
||||
{
|
||||
windowInfo->LottieIsland.AnimatedVisualSource(lottieVisualSource);
|
||||
|
||||
|
||||
|
||||
windowInfo->LottieIsland.PointerPressed([=](auto&...) {
|
||||
// Clicking on the Lottie animation acts like clicking "Pause/Resume"
|
||||
OnButtonClicked(ButtonType::PauseButton, windowInfo, hWnd);
|
||||
});
|
||||
|
||||
// Add some Win32 controls to allow the app to play with the animation
|
||||
|
@ -225,7 +224,27 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
|||
|
||||
if (windowInfo->Bridge)
|
||||
{
|
||||
windowInfo->Bridge.MoveAndResize({ k_padding, k_padding, width - (k_padding * 2), height - (k_padding * 3) - k_buttonHeight });
|
||||
// Layout our bridge: we want to use all available height (minus a button and some padding),
|
||||
// but respect the ratio that the LottieIsland wants to display at. This can be accessed through
|
||||
// the "RequestedSize" property on the ContentSiteView.
|
||||
|
||||
int availableHeight = height - (k_padding * 3) - k_buttonHeight;
|
||||
int availableWidth = width - (k_padding * 2);
|
||||
|
||||
// Check what size the lottie wants to be
|
||||
winrt::float2 requestedSize = windowInfo->Bridge.SiteView().RequestedSize();
|
||||
|
||||
// Scale the width to be the ratio the lottie wants
|
||||
int bridgeWidth = 0;
|
||||
if (requestedSize.y > 0) // Guard against divide-by-zero
|
||||
{
|
||||
bridgeWidth = static_cast<int>((requestedSize.x / requestedSize.y) * availableHeight);
|
||||
}
|
||||
|
||||
// ... but don't overflow the width we have available
|
||||
bridgeWidth = std::min(availableWidth, bridgeWidth);
|
||||
|
||||
windowInfo->Bridge.MoveAndResize({ k_padding, k_padding, bridgeWidth, availableHeight });
|
||||
}
|
||||
|
||||
LayoutButton(ButtonType::PlayButton, width, height, hWnd);
|
||||
|
@ -353,10 +372,25 @@ void CreateWin32Button(ButtonType type, const std::wstring_view& text, HWND pare
|
|||
|
||||
void OnButtonClicked(ButtonType type, WindowInfo* windowInfo, HWND topLevelWindow)
|
||||
{
|
||||
winrt::Windows::Foundation::IAsyncAction asyncAction{ nullptr };
|
||||
switch (type)
|
||||
{
|
||||
case ButtonType::PlayButton:
|
||||
windowInfo->LottieIsland.PlayAsync(0.0, 1.0, true);
|
||||
asyncAction = windowInfo->LottieIsland.PlayAsync(0.0, 1.0, true);
|
||||
asyncAction.Completed([](auto&&, auto&& asyncStatus)
|
||||
{
|
||||
// Check if the async operation was successfully completed
|
||||
if (asyncStatus == winrt::Windows::Foundation::AsyncStatus::Completed)
|
||||
{
|
||||
OutputDebugString(L"Async operation completed successfully.\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
OutputDebugString(L"Async operation failed or was canceled.\n");
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
SetPauseState(windowInfo, false, topLevelWindow);
|
||||
break;
|
||||
case ButtonType::PauseButton:
|
||||
|
@ -408,4 +442,4 @@ void SetPauseState(WindowInfo* windowInfo, bool isPaused, HWND topLevelWindow)
|
|||
topLevelWindow);
|
||||
|
||||
windowInfo->isPaused = isPaused;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,3 +20,4 @@
|
|||
#include <winrt/Microsoft.UI.Dispatching.h>
|
||||
#include <winrt/Microsoft.UI.Interop.h>
|
||||
#include <winrt/Windows.Foundation.h>
|
||||
#include <winrt/LottieWinRT.h>
|
||||
|
|
|
@ -4,6 +4,11 @@
|
|||
|
||||
namespace winrt::LottieIsland::implementation
|
||||
{
|
||||
winrt::LottieContentIsland LottieContentIsland::Create(const winrt::Compositor& compositor)
|
||||
{
|
||||
return winrt::make<LottieContentIsland>(compositor);
|
||||
}
|
||||
|
||||
LottieContentIsland::LottieContentIsland(
|
||||
const winrt::Compositor& compositor)
|
||||
: m_compositor(compositor)
|
||||
|
@ -12,15 +17,29 @@ namespace winrt::LottieIsland::implementation
|
|||
m_island = winrt::ContentIsland::Create(m_rootVisual);
|
||||
|
||||
m_island.StateChanged({ get_weak(), &LottieContentIsland::OnIslandStateChanged });
|
||||
|
||||
// Once it's not experimental, we should use InputPointerSource::GetForVisual on our root visual.
|
||||
// This will give us automatic hittesting for whatever content and shape the Lottie animation has.
|
||||
// Currently hittesting will just be a rectangle the size of the island, regardless of content.
|
||||
m_inputPointerSource = winrt::Microsoft::UI::Input::InputPointerSource::GetForIsland(m_island);
|
||||
|
||||
InitializeInputHandlers();
|
||||
}
|
||||
|
||||
winrt::LottieVisualSourceWinRT LottieContentIsland::AnimatedVisualSource() const
|
||||
LottieContentIsland::~LottieContentIsland()
|
||||
{
|
||||
// Dispose (Close) our island. This will revoke any event handlers from it or sub-objects, which
|
||||
// is why the LottieContentIsland doesn't need to manually revoke event handlers.
|
||||
m_island.Close();
|
||||
}
|
||||
|
||||
winrt::IAnimatedVisualSource LottieContentIsland::AnimatedVisualSource() const
|
||||
{
|
||||
// Return the AnimatedVisualSource
|
||||
return m_animatedVisualSource;
|
||||
}
|
||||
|
||||
void LottieContentIsland::AnimatedVisualSource(winrt::LottieVisualSourceWinRT const& value)
|
||||
void LottieContentIsland::AnimatedVisualSource(winrt::IAnimatedVisualSource const& value)
|
||||
{
|
||||
if (m_animatedVisualSource == value)
|
||||
{
|
||||
|
@ -77,12 +96,12 @@ namespace winrt::LottieIsland::implementation
|
|||
return m_progressPropertySet != nullptr;
|
||||
}
|
||||
|
||||
double LottieContentIsland::PlaybackRate() const
|
||||
float LottieContentIsland::PlaybackRate() const
|
||||
{
|
||||
return m_playbackRate;
|
||||
}
|
||||
|
||||
void LottieContentIsland::PlaybackRate(double rate)
|
||||
void LottieContentIsland::PlaybackRate(float rate)
|
||||
{
|
||||
m_playbackRate = rate;
|
||||
if (m_animationController != nullptr)
|
||||
|
@ -99,15 +118,40 @@ namespace winrt::LottieIsland::implementation
|
|||
}
|
||||
}
|
||||
|
||||
winrt::Windows::Foundation::IAsyncAction LottieContentIsland::PlayAsync(double fromProgress, double toProgress, bool looped)
|
||||
winrt::Windows::Foundation::IAsyncAction LottieContentIsland::PlayAsync(float fromProgress, float toProgress, bool looped)
|
||||
{
|
||||
if (m_animationCompletionEvent.get() == nullptr)
|
||||
{
|
||||
m_animationCompletionEvent = winrt::handle(CreateEvent(nullptr, false, false, nullptr));
|
||||
}
|
||||
|
||||
// Stop any existing animation
|
||||
StopAnimation();
|
||||
|
||||
// TODO: actually implement the async portion of this properly using composition batches.
|
||||
auto batch = m_compositor.CreateScopedBatch(CompositionBatchTypes::Animation);
|
||||
|
||||
StartAnimation(fromProgress, toProgress, looped);
|
||||
co_return;
|
||||
|
||||
// Keep track of whether the animation is looped, since we will have to
|
||||
// manually fire the event if Stop() is called in the non-looped case.
|
||||
// We don't hook up the event here in the looped case, because ScopedBatches
|
||||
// complete immediately if their animation is looped.
|
||||
m_looped = looped;
|
||||
if (!looped)
|
||||
{
|
||||
// Hook up an event handler to the Completed event of the batch
|
||||
batch.Completed([&](auto&&, auto&&)
|
||||
{
|
||||
// Set the completion event when the batch completes
|
||||
SetEvent(m_animationCompletionEvent.get());
|
||||
});
|
||||
}
|
||||
|
||||
// Commit the batch
|
||||
batch.End();
|
||||
|
||||
// Wait for the completion event asynchronously
|
||||
co_await winrt::resume_on_signal(m_animationCompletionEvent.get()); // Wait for the event to be signaled
|
||||
}
|
||||
|
||||
void LottieContentIsland::Resume()
|
||||
|
@ -123,7 +167,7 @@ namespace winrt::LottieIsland::implementation
|
|||
StopAnimation();
|
||||
}
|
||||
|
||||
void LottieContentIsland::StartAnimation(double fromProgress, double toProgress, bool loop)
|
||||
void LottieContentIsland::StartAnimation(float fromProgress, float toProgress, bool loop)
|
||||
{
|
||||
if (m_animatedVisual == nullptr)
|
||||
{
|
||||
|
@ -164,6 +208,11 @@ namespace winrt::LottieIsland::implementation
|
|||
m_progressPropertySet.StopAnimation(L"Progress");
|
||||
m_progressPropertySet.InsertScalar(L"Progress", m_previousFromProgress);
|
||||
|
||||
if (m_looped)
|
||||
{
|
||||
SetEvent(m_animationCompletionEvent.get());
|
||||
}
|
||||
|
||||
// Cleanup
|
||||
m_previousFromProgress = 0.0;
|
||||
m_animationController = nullptr;
|
||||
|
@ -206,4 +255,27 @@ namespace winrt::LottieIsland::implementation
|
|||
m_rootVisual.Scale({ scale.x, scale.y, 1.f });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void LottieContentIsland::InitializeInputHandlers()
|
||||
{
|
||||
m_inputPointerSource.PointerEntered([this](auto& /*sender*/, auto& args) {
|
||||
m_pointerEnteredEvent(*this, args);
|
||||
});
|
||||
|
||||
m_inputPointerSource.PointerExited([this](auto& /*sender*/, auto& args) {
|
||||
m_pointerExitedEvent(*this, args);
|
||||
});
|
||||
|
||||
m_inputPointerSource.PointerMoved([this](auto& /*sender*/, auto& args) {
|
||||
m_pointerMovedEvent(*this, args);
|
||||
});
|
||||
|
||||
m_inputPointerSource.PointerPressed([this](auto& /*sender*/, auto& args) {
|
||||
m_pointerPressedEvent(*this, args);
|
||||
});
|
||||
|
||||
m_inputPointerSource.PointerReleased([this](auto& /*sender*/, auto& args) {
|
||||
m_pointerReleasedEvent(*this, args);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,19 +2,34 @@
|
|||
|
||||
#include "LottieContentIsland.g.h"
|
||||
|
||||
namespace winrt::Microsoft::UI::Xaml::Controls
|
||||
{
|
||||
interface IAnimatedVisualSource;
|
||||
}
|
||||
|
||||
namespace winrt
|
||||
{
|
||||
using namespace ::winrt::LottieIsland;
|
||||
}
|
||||
|
||||
namespace winrt::LottieIsland::implementation
|
||||
{
|
||||
struct LottieContentIsland : LottieContentIslandT<LottieContentIsland>
|
||||
{
|
||||
using PointerEventHandler = Windows::Foundation::TypedEventHandler<winrt::LottieIsland::LottieContentIsland, winrt::PointerEventArgs>;
|
||||
|
||||
static winrt::LottieContentIsland Create(const winrt::Compositor& compositor);
|
||||
|
||||
LottieContentIsland(const winrt::Compositor& compositor);
|
||||
~LottieContentIsland();
|
||||
|
||||
winrt::ContentIsland Island() const
|
||||
{
|
||||
return m_island;
|
||||
}
|
||||
|
||||
winrt::LottieVisualSourceWinRT AnimatedVisualSource() const;
|
||||
void AnimatedVisualSource(const winrt::LottieVisualSourceWinRT& source);
|
||||
winrt::IAnimatedVisualSource AnimatedVisualSource() const;
|
||||
void AnimatedVisualSource(const winrt::IAnimatedVisualSource& source);
|
||||
|
||||
winrt::Windows::Foundation::TimeSpan Duration() const;
|
||||
|
||||
|
@ -22,34 +37,60 @@ namespace winrt::LottieIsland::implementation
|
|||
|
||||
bool IsPlaying() const;
|
||||
|
||||
double PlaybackRate() const;
|
||||
void PlaybackRate(double rate);
|
||||
float PlaybackRate() const;
|
||||
void PlaybackRate(float rate);
|
||||
|
||||
winrt::event_token PointerEntered(const PointerEventHandler& handler) { return m_pointerEnteredEvent.add(handler); }
|
||||
void PointerEntered(winrt::event_token const& token) noexcept { m_pointerEnteredEvent.remove(token); }
|
||||
|
||||
winrt::event_token PointerExited(const PointerEventHandler& handler) { return m_pointerExitedEvent.add(handler); }
|
||||
void PointerExited(winrt::event_token const& token) noexcept { m_pointerExitedEvent.remove(token); }
|
||||
|
||||
winrt::event_token PointerMoved(const PointerEventHandler& handler) { return m_pointerMovedEvent.add(handler); }
|
||||
void PointerMoved(winrt::event_token const& token) noexcept { m_pointerMovedEvent.remove(token); }
|
||||
|
||||
winrt::event_token PointerPressed(const PointerEventHandler& handler) { return m_pointerPressedEvent.add(handler); }
|
||||
void PointerPressed(winrt::event_token const& token) noexcept { m_pointerPressedEvent.remove(token); }
|
||||
|
||||
winrt::event_token PointerReleased(const PointerEventHandler& handler) { return m_pointerReleasedEvent.add(handler); }
|
||||
void PointerReleased(winrt::event_token const& token) noexcept { m_pointerReleasedEvent.remove(token); }
|
||||
|
||||
void Pause();
|
||||
|
||||
winrt::Windows::Foundation::IAsyncAction PlayAsync(double fromProgress, double toProgress, bool looped);
|
||||
winrt::Windows::Foundation::IAsyncAction PlayAsync(float fromProgress, float toProgress, bool looped);
|
||||
|
||||
void Resume();
|
||||
|
||||
void Stop();
|
||||
|
||||
private:
|
||||
void StartAnimation(double fromProgress, double toProgress, bool loop);
|
||||
void StartAnimation(float fromProgress, float toProgress, bool loop);
|
||||
void StopAnimation();
|
||||
|
||||
void OnIslandStateChanged(const winrt::ContentIsland& island, const winrt::ContentIslandStateChangedEventArgs& args);
|
||||
|
||||
void Resize(const float2& size);
|
||||
|
||||
void InitializeInputHandlers();
|
||||
|
||||
winrt::event<PointerEventHandler> m_pointerEnteredEvent;
|
||||
winrt::event<PointerEventHandler> m_pointerExitedEvent;
|
||||
winrt::event<PointerEventHandler> m_pointerMovedEvent;
|
||||
winrt::event<PointerEventHandler> m_pointerPressedEvent;
|
||||
winrt::event<PointerEventHandler> m_pointerReleasedEvent;
|
||||
|
||||
winrt::Compositor m_compositor{ nullptr };
|
||||
winrt::ContainerVisual m_rootVisual{ nullptr };
|
||||
winrt::ContentIsland m_island{ nullptr };
|
||||
winrt::LottieVisualSourceWinRT m_animatedVisualSource{ nullptr };
|
||||
winrt::AnimatedVisualWinRT m_animatedVisual{ nullptr };
|
||||
winrt::InputPointerSource m_inputPointerSource{ nullptr };
|
||||
winrt::IAnimatedVisualSource m_animatedVisualSource{ nullptr };
|
||||
winrt::IAnimatedVisual m_animatedVisual{ nullptr };
|
||||
winrt::CompositionPropertySet m_progressPropertySet{ nullptr };
|
||||
winrt::AnimationController m_animationController{ nullptr };
|
||||
double m_previousFromProgress = 0.0;
|
||||
double m_playbackRate = 1.0f;
|
||||
float m_previousFromProgress = 0.0;
|
||||
float m_playbackRate = 1.0f;
|
||||
winrt::handle m_animationCompletionEvent{ nullptr };
|
||||
bool m_looped;
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -1,13 +1,12 @@
|
|||
namespace LottieIsland
|
||||
{
|
||||
[default_interface]
|
||||
runtimeclass LottieContentIsland
|
||||
{
|
||||
LottieContentIsland(Microsoft.UI.Composition.Compositor compositor);
|
||||
static LottieContentIsland Create(Microsoft.UI.Composition.Compositor compositor);
|
||||
|
||||
Microsoft.UI.Content.ContentIsland Island{ get; };
|
||||
|
||||
LottieWinRT.LottieVisualSourceWinRT AnimatedVisualSource;
|
||||
LottieWinRT.IAnimatedVisualSource AnimatedVisualSource;
|
||||
|
||||
Windows.Foundation.TimeSpan Duration{ get; };
|
||||
|
||||
|
@ -15,11 +14,21 @@
|
|||
|
||||
Boolean IsPlaying{ get; };
|
||||
|
||||
Double PlaybackRate;
|
||||
Single PlaybackRate;
|
||||
|
||||
event Windows.Foundation.TypedEventHandler<LottieContentIsland, Microsoft.UI.Input.PointerEventArgs> PointerEntered;
|
||||
|
||||
event Windows.Foundation.TypedEventHandler<LottieContentIsland, Microsoft.UI.Input.PointerEventArgs> PointerExited;
|
||||
|
||||
event Windows.Foundation.TypedEventHandler<LottieContentIsland, Microsoft.UI.Input.PointerEventArgs> PointerMoved;
|
||||
|
||||
event Windows.Foundation.TypedEventHandler<LottieContentIsland, Microsoft.UI.Input.PointerEventArgs> PointerPressed;
|
||||
|
||||
event Windows.Foundation.TypedEventHandler<LottieContentIsland, Microsoft.UI.Input.PointerEventArgs> PointerReleased;
|
||||
|
||||
void Pause();
|
||||
|
||||
Windows.Foundation.IAsyncAction PlayAsync(Double fromProgress, Double toProgress, Boolean looped);
|
||||
Windows.Foundation.IAsyncAction PlayAsync(Single fromProgress, Single toProgress, Boolean looped);
|
||||
|
||||
void Resume();
|
||||
|
||||
|
|
|
@ -13,17 +13,16 @@
|
|||
#include <winrt/Windows.UI.h>
|
||||
#include <winrt/Microsoft.UI.Content.h>
|
||||
#include <winrt/Microsoft.UI.Composition.h>
|
||||
#include <winrt/Microsoft.UI.Input.h>
|
||||
#include <winrt/Microsoft.UI.Xaml.Controls.h>
|
||||
#include <winrt/LottieWinRT.h>
|
||||
//#include <winrt/CommunityToolkit.WinAppSDK.Frameworkless.Lottie.h>
|
||||
|
||||
namespace winrt
|
||||
{
|
||||
using namespace ::winrt::Microsoft::UI::Composition;
|
||||
using namespace ::winrt::Microsoft::UI::Content;
|
||||
using namespace ::winrt::Microsoft::UI::Input;
|
||||
using namespace ::winrt::LottieWinRT;
|
||||
/*using IAnimatedVisual = ::winrt::CommunityToolkit::WinAppSDK::Frameworkless::Lottie::IAnimatedVisual;
|
||||
using IAnimatedVisualSource = ::winrt::CommunityToolkit::WinAppSDK::Frameworkless::Lottie::IAnimatedVisualSource;*/
|
||||
}
|
||||
|
||||
// Opt into time literals (i.e. 200ms, 1min, 15s)
|
||||
|
|
|
@ -1,18 +1,18 @@
|
|||
using System.Numerics;
|
||||
using Microsoft.UI.Composition;
|
||||
using Microsoft.UI.Xaml.Controls;
|
||||
using MUXC = Microsoft.UI.Xaml.Controls;
|
||||
|
||||
namespace LottieWinRT
|
||||
{
|
||||
public sealed class AnimatedVisualWinRT
|
||||
public sealed class AnimatedVisual : IAnimatedVisual
|
||||
{
|
||||
private IAnimatedVisual? _animatedVisual;
|
||||
private MUXC.IAnimatedVisual? _animatedVisual;
|
||||
|
||||
public AnimatedVisualWinRT()
|
||||
public AnimatedVisual()
|
||||
{
|
||||
}
|
||||
|
||||
internal AnimatedVisualWinRT(IAnimatedVisual visual)
|
||||
internal AnimatedVisual(MUXC.IAnimatedVisual visual)
|
||||
{
|
||||
_animatedVisual = visual;
|
||||
}
|
|
@ -0,0 +1,14 @@
|
|||
using System.Numerics;
|
||||
using Microsoft.UI.Composition;
|
||||
|
||||
namespace LottieWinRT
|
||||
{
|
||||
public interface IAnimatedVisual
|
||||
{
|
||||
public TimeSpan Duration { get; }
|
||||
|
||||
public Visual? RootVisual { get; }
|
||||
|
||||
public Vector2 Size { get; }
|
||||
}
|
||||
}
|
|
@ -0,0 +1,9 @@
|
|||
using Microsoft.UI.Composition;
|
||||
|
||||
namespace LottieWinRT
|
||||
{
|
||||
public interface IAnimatedVisualSource
|
||||
{
|
||||
IAnimatedVisual? TryCreateAnimatedVisual(Compositor compositor, out object? diagnostics);
|
||||
}
|
||||
}
|
|
@ -1,11 +1,11 @@
|
|||
using System.Diagnostics;
|
||||
using CommunityToolkit.WinUI.Lottie;
|
||||
using Microsoft.UI.Composition;
|
||||
using Microsoft.UI.Xaml.Controls;
|
||||
using MUXC = Microsoft.UI.Xaml.Controls;
|
||||
|
||||
namespace LottieWinRT
|
||||
{
|
||||
public sealed class LottieVisualSourceWinRT
|
||||
public sealed class LottieVisualSourceWinRT : LottieWinRT.IAnimatedVisualSource
|
||||
{
|
||||
public event EventHandler<object?>? AnimatedVisualInvalidated;
|
||||
|
||||
|
@ -19,7 +19,7 @@ namespace LottieWinRT
|
|||
private LottieVisualSourceWinRT(LottieVisualSourceFrameworkless lottieVisualSource)
|
||||
{
|
||||
_lottieVisualSource = lottieVisualSource;
|
||||
_lottieVisualSource.AnimatedVisualInvalidated += (IAnimatedVisualSource? sender, object? o) =>
|
||||
_lottieVisualSource.AnimatedVisualInvalidated += (MUXC.IAnimatedVisualSource? sender, object? o) =>
|
||||
{
|
||||
AnimatedVisualInvalidated?.Invoke(this, o);
|
||||
};
|
||||
|
@ -56,104 +56,21 @@ namespace LottieWinRT
|
|||
/// <summary>
|
||||
/// Implements <see cref="IAnimatedVisualSource"/>.
|
||||
/// </summary>
|
||||
/// <param name="compositor">The <see cref="Compositor"/> that can be used as a factory for the resulting <see cref="IAnimatedVisual"/>.</param>
|
||||
/// <param name="compositor">The <see cref="Compositor"/> that can be used as a factory for the resulting <see cref="MUXC.IAnimatedVisual"/>.</param>
|
||||
/// <param name="diagnostics">An optional object that may provide extra information about the result.</param>
|
||||
/// <returns>An <see cref="IAnimatedVisual"/>.</returns>
|
||||
public AnimatedVisualWinRT? TryCreateAnimatedVisual(
|
||||
/// <returns>An <see cref="MUXC.IAnimatedVisual"/>.</returns>
|
||||
public IAnimatedVisual? TryCreateAnimatedVisual(
|
||||
Compositor compositor,
|
||||
out object? diagnostics)
|
||||
{
|
||||
diagnostics = null;
|
||||
IAnimatedVisual? visual = _lottieVisualSource?.TryCreateAnimatedVisual(compositor, out diagnostics);
|
||||
MUXC.IAnimatedVisual? visual = _lottieVisualSource?.TryCreateAnimatedVisual(compositor, out diagnostics);
|
||||
if (visual == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return new AnimatedVisualWinRT(visual);
|
||||
return new AnimatedVisual(visual);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//namespace LottieWinRT
|
||||
//{
|
||||
// public sealed class LottieVisualSourceWinRT
|
||||
// {
|
||||
// public event EventHandler<object>? AnimatedVisualInvalidated;
|
||||
|
||||
// public void LoadLottie(string uri)
|
||||
// {
|
||||
// LottieVisualSourceFrameworkless? source = LottieVisualSourceFrameworkless.CreateFromString(uri);
|
||||
// if (source != null)
|
||||
// {
|
||||
// source.AnimatedVisualInvalidated += Source_AnimatedVisualInvalidated;
|
||||
// LottieVisualSourceFrameworkless.CreateFromString("meep");
|
||||
// }
|
||||
|
||||
// _lottieVisualSource = source;
|
||||
// }
|
||||
|
||||
// private void Source_AnimatedVisualInvalidated(IAnimatedVisualSource? sender, object? args)
|
||||
// {
|
||||
// this.AnimatedVisualInvalidated?.Invoke(this, EventArgs.Empty);
|
||||
// }
|
||||
|
||||
// public CommunityToolkit.WinAppSDK.Frameworkless.Lottie.IAnimatedVisualSource? AnimatedVisual { get => _lottieVisualSource; }
|
||||
|
||||
// Compositor? _compositor;
|
||||
// ContainerVisual? _rootVisual;
|
||||
// LottieVisualSourceFrameworkless? _lottieVisualSource;
|
||||
|
||||
// public void SetUpLottie(Compositor compositor, ContainerVisual parent, string uri)
|
||||
// {
|
||||
// _compositor = compositor;
|
||||
// _rootVisual = parent;
|
||||
|
||||
// _lottieVisualSource = LottieVisualSourceFrameworkless.CreateFromString(uri);
|
||||
// if (_lottieVisualSource != null)
|
||||
// {
|
||||
// _lottieVisualSource.AnimatedVisualInvalidated += LottieVisualSource_AnimatedVisualInvalidated;
|
||||
// object? diagnostics = null;
|
||||
// if (_lottieVisualSource.TryCreateAnimatedVisual(_compositor, out diagnostics) != null)
|
||||
// {
|
||||
// LottieVisualSource_AnimatedVisualInvalidated(_lottieVisualSource, null);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
// private void LottieVisualSource_AnimatedVisualInvalidated(IAnimatedVisualSource? sender, object? args)
|
||||
// {
|
||||
// if (_compositor != null)
|
||||
// {
|
||||
// object? diagnostics = null;
|
||||
// IAnimatedVisual? animatedVisual = sender?.TryCreateFrameworklessAnimatedVisual(_compositor, out diagnostics);
|
||||
|
||||
// if (_rootVisual != null)
|
||||
// {
|
||||
// _rootVisual.Children.RemoveAll();
|
||||
// _rootVisual.Children.InsertAtTop(animatedVisual?.RootVisual);
|
||||
// Debug.WriteLine("Added Lottie visual to root. beep boop");
|
||||
|
||||
// if (_compositor != null)
|
||||
// {
|
||||
// var animation = _compositor.CreateScalarKeyFrameAnimation();
|
||||
// if (animatedVisual != null)
|
||||
// {
|
||||
// animation.Duration = animatedVisual.Duration;
|
||||
// var linearEasing = _compositor.CreateLinearEasingFunction();
|
||||
|
||||
// // Play from beginning to end.
|
||||
// animation.InsertKeyFrame(0, 0);
|
||||
// animation.InsertKeyFrame(1, 1, linearEasing);
|
||||
|
||||
// animation.IterationBehavior = AnimationIterationBehavior.Forever;
|
||||
|
||||
// // Start the animation and get the controller.
|
||||
// animatedVisual.RootVisual?.Properties.StartAnimation("Progress", animation);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
|
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -0,0 +1,77 @@
|
|||
#pragma once
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
//
|
||||
// LottieGen version:
|
||||
// 8.0.230813-rc.7+0443b1e789
|
||||
//
|
||||
// Command:
|
||||
// LottieGen -Language Cppwinrt -RootNamespace SimpleIslandApp -WinUIVersion 3.0 -InputFile LottieLogo1.json
|
||||
//
|
||||
// Input file:
|
||||
// LottieLogo1.json (190271 bytes created 0:40-04:00 Mar 13 2024)
|
||||
//
|
||||
// LottieGen source:
|
||||
// http://aka.ms/Lottie
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
#include "AnimatedVisuals.LottieLogo1.g.h"
|
||||
|
||||
namespace winrt::AnimatedVisuals
|
||||
{
|
||||
// Frame rate: 30 fps
|
||||
// Frame count: 179
|
||||
// Duration: 5966.7 mS
|
||||
namespace implementation
|
||||
{
|
||||
class LottieLogo1
|
||||
: public LottieLogo1T<LottieLogo1>
|
||||
{
|
||||
public:
|
||||
// Animation duration: 5.967 seconds.
|
||||
static constexpr int64_t c_durationTicks{ 59666666L };
|
||||
|
||||
winrt::Microsoft::UI::Xaml::Controls::IAnimatedVisual TryCreateAnimatedVisual(
|
||||
winrt::Microsoft::UI::Composition::Compositor const& compositor);
|
||||
|
||||
winrt::Microsoft::UI::Xaml::Controls::IAnimatedVisual TryCreateAnimatedVisual(
|
||||
winrt::Microsoft::UI::Composition::Compositor const& compositor,
|
||||
winrt::Windows::Foundation::IInspectable& diagnostics);
|
||||
|
||||
// Gets the number of frames in the animation.
|
||||
double FrameCount();
|
||||
|
||||
// Gets the framerate of the animation.
|
||||
double Framerate();
|
||||
|
||||
// Gets the duration of the animation.
|
||||
winrt::Windows::Foundation::TimeSpan Duration();
|
||||
|
||||
// Converts a zero-based frame number to the corresponding progress value denoting the
|
||||
// start of the frame.
|
||||
double FrameToProgress(double frameNumber);
|
||||
|
||||
// Returns a map from marker names to corresponding progress values.
|
||||
winrt::Windows::Foundation::Collections::IMapView<hstring, double> Markers();
|
||||
|
||||
// Sets the color property with the given name, or does nothing if no such property
|
||||
// exists.
|
||||
void SetColorProperty(hstring const& propertyName, winrt::Windows::UI::Color value);
|
||||
|
||||
// Sets the scalar property with the given name, or does nothing if no such property
|
||||
// exists.
|
||||
void SetScalarProperty(hstring const& propertyName, double value);
|
||||
};
|
||||
}
|
||||
|
||||
namespace factory_implementation
|
||||
{
|
||||
struct LottieLogo1 : LottieLogo1T<LottieLogo1, implementation::LottieLogo1>
|
||||
{
|
||||
};
|
||||
}
|
||||
}
|
|
@ -0,0 +1,29 @@
|
|||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
//
|
||||
// LottieGen version:
|
||||
// 8.0.230813-rc.7+0443b1e789
|
||||
//
|
||||
// Command:
|
||||
// LottieGen -Language Cppwinrt -RootNamespace SimpleIslandApp -WinUIVersion 3.0 -InputFile LottieLogo1.json
|
||||
//
|
||||
// Input file:
|
||||
// LottieLogo1.json (190271 bytes created 0:40-04:00 Mar 13 2024)
|
||||
//
|
||||
// LottieGen source:
|
||||
// http://aka.ms/Lottie
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
namespace AnimatedVisuals
|
||||
{
|
||||
runtimeclass LottieLogo1
|
||||
: [default] Microsoft.UI.Xaml.Controls.IAnimatedVisualSource
|
||||
, Microsoft.UI.Xaml.Controls.IAnimatedVisualSource2
|
||||
{
|
||||
LottieLogo1();
|
||||
};
|
||||
}
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -0,0 +1,15 @@
|
|||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
namespace SimpleLottieIslandApp
|
||||
{
|
||||
/* IDL to generate a placeholder WinMD for the AppX project */
|
||||
|
||||
[default_interface]
|
||||
runtimeclass Placeholder
|
||||
{
|
||||
Placeholder();
|
||||
static Placeholder DoNothing();
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,32 @@
|
|||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT License.
|
||||
//{{NO_DEPENDENCIES}}
|
||||
// Microsoft Visual C++ generated include file.
|
||||
// Used by SimpleIslandApp.rc
|
||||
|
||||
#define IDS_APP_TITLE 103
|
||||
|
||||
#define IDR_MAINFRAME 128
|
||||
#define IDD_SIMPLELOTTIEISLANDAPP_DIALOG 102
|
||||
#define IDD_ABOUTBOX 103
|
||||
#define IDM_ABOUT 104
|
||||
#define IDM_EXIT 105
|
||||
#define IDI_SIMPLELOTTIEISLANDAPP 107
|
||||
#define IDI_SMALL 108
|
||||
#define IDC_SIMPLELOTTIEISLANDAPP 109
|
||||
#define IDC_MYICON 2
|
||||
#ifndef IDC_STATIC
|
||||
#define IDC_STATIC -1
|
||||
#endif
|
||||
// Next default values for new objects
|
||||
//
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
#ifndef APSTUDIO_READONLY_SYMBOLS
|
||||
|
||||
#define _APS_NO_MFC 130
|
||||
#define _APS_NEXT_RESOURCE_VALUE 129
|
||||
#define _APS_NEXT_COMMAND_VALUE 32771
|
||||
#define _APS_NEXT_CONTROL_VALUE 1000
|
||||
#define _APS_NEXT_SYMED_VALUE 110
|
||||
#endif
|
||||
#endif
|
|
@ -0,0 +1,453 @@
|
|||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
// SimpleLottieIslandApp.cpp : Defines the entry point for the application.
|
||||
|
||||
#include "pch.h"
|
||||
#include "SimpleLottieIslandApp.h"
|
||||
|
||||
#include <Microsoft.UI.Dispatching.Interop.h> // For ContentPreTranslateMessage
|
||||
#include <winrt/LottieIsland.h>
|
||||
#include <winrt/AnimatedVisuals.h>
|
||||
#include <winrt/LottieWinRT.h>
|
||||
|
||||
namespace winrt
|
||||
{
|
||||
using namespace winrt::Windows::Foundation;
|
||||
using namespace winrt::Microsoft::UI;
|
||||
using namespace winrt::Microsoft::UI::Content;
|
||||
using namespace winrt::Microsoft::UI::Dispatching;
|
||||
using namespace winrt::LottieWinRT;
|
||||
using float2 = winrt::Windows::Foundation::Numerics::float2;
|
||||
}
|
||||
|
||||
// Forward declarations of functions included in this code module:
|
||||
void MyRegisterClass(HINSTANCE hInstance, const wchar_t* szWindowClass);
|
||||
HWND InitInstance(HINSTANCE, int, const wchar_t* szTitle, const wchar_t* szWindowClass);
|
||||
LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);
|
||||
INT_PTR CALLBACK About(HWND, UINT, WPARAM, LPARAM);
|
||||
bool ProcessMessageForTabNavigation(const HWND topLevelWindow, MSG* msg);
|
||||
|
||||
// Extra state for our top-level window, we point to from GWLP_USERDATA.
|
||||
struct WindowInfo
|
||||
{
|
||||
// winrt::DesktopWindowXamlSource DesktopWindowXamlSource{ nullptr };
|
||||
winrt::Microsoft::UI::Composition::Compositor Compositor{};
|
||||
winrt::DesktopChildSiteBridge Bridge{ nullptr };
|
||||
winrt::event_token TakeFocusRequestedToken{};
|
||||
HWND LastFocusedWindow{ NULL };
|
||||
winrt::LottieIsland::LottieContentIsland LottieIsland{ nullptr };
|
||||
bool isPaused = false;
|
||||
};
|
||||
|
||||
enum class ButtonType
|
||||
{
|
||||
PlayButton = 1,
|
||||
PauseButton,
|
||||
StopButton,
|
||||
ReverseButton
|
||||
};
|
||||
|
||||
constexpr int k_padding = 10;
|
||||
constexpr int k_buttonWidth = 150;
|
||||
constexpr int k_buttonHeight = 40;
|
||||
|
||||
void LayoutButton(ButtonType type, int tlwWidth, int tlwHeight, HWND topLevelWindow);
|
||||
void CreateWin32Button(ButtonType type, const std::wstring_view& text, HWND parentHwnd);
|
||||
void OnButtonClicked(ButtonType type, WindowInfo* windowInfo, HWND topLevelWindow);
|
||||
void SetButtonText(ButtonType type, const std::wstring_view& text, HWND topLevelWindow);
|
||||
void SetPauseState(WindowInfo* windowInfo, bool isPaused, HWND topLevelWindow);
|
||||
|
||||
int APIENTRY wWinMain(_In_ HINSTANCE hInstance,
|
||||
_In_opt_ HINSTANCE hPrevInstance,
|
||||
_In_ LPWSTR lpCmdLine,
|
||||
_In_ int nCmdShow)
|
||||
{
|
||||
UNREFERENCED_PARAMETER(hPrevInstance);
|
||||
UNREFERENCED_PARAMETER(lpCmdLine);
|
||||
|
||||
try
|
||||
{
|
||||
// Island-support: Call init_apartment to initialize COM and WinRT for the thread.
|
||||
winrt::init_apartment(winrt::apartment_type::single_threaded);
|
||||
|
||||
// Island-support: We must start a DispatcherQueueController before we can create an island or use Xaml.
|
||||
auto dispatcherQueueController{ winrt::DispatcherQueueController::CreateOnCurrentThread() };
|
||||
|
||||
// The title bar text
|
||||
WCHAR szTitle[100];
|
||||
winrt::check_bool(LoadStringW(hInstance, IDS_APP_TITLE, szTitle, ARRAYSIZE(szTitle)) != 0);
|
||||
|
||||
// The main window class name
|
||||
WCHAR szWindowClass[100];
|
||||
winrt::check_bool(LoadStringW(hInstance, IDC_SIMPLELOTTIEISLANDAPP, szWindowClass, ARRAYSIZE(szWindowClass)) != 0);
|
||||
|
||||
MyRegisterClass(hInstance, szWindowClass);
|
||||
|
||||
// Perform application initialization:
|
||||
InitInstance(hInstance, nCmdShow, szTitle, szWindowClass);
|
||||
|
||||
HACCEL hAccelTable = LoadAccelerators(hInstance, MAKEINTRESOURCE(IDC_SIMPLELOTTIEISLANDAPP));
|
||||
|
||||
MSG msg{};
|
||||
|
||||
// Main message loop:
|
||||
while (GetMessage(&msg, nullptr, 0, 0))
|
||||
{
|
||||
// Island-support: It's important to call ContentPreTranslateMessage in the event loop so that WinAppSDK can be aware of
|
||||
// the messages. If you don't need to use an accelerator table, you could just call DispatcherQueue.RunEventLoop
|
||||
// to do the message pump for you (it will call ContentPreTranslateMessage automatically).
|
||||
if (::ContentPreTranslateMessage(&msg))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (TranslateAccelerator(msg.hwnd, hAccelTable, &msg))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
TranslateMessage(&msg);
|
||||
DispatchMessage(&msg);
|
||||
}
|
||||
|
||||
// Island-support: To properly shut down after using a DispatcherQueue, call ShutdownQueue[Aysnc]().
|
||||
dispatcherQueueController.ShutdownQueue();
|
||||
}
|
||||
catch (const winrt::hresult_error& exception)
|
||||
{
|
||||
// An exception was thrown, let's make the exit code the HR value of the exception.
|
||||
return exception.code().value;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
//
|
||||
// FUNCTION: MyRegisterClass()
|
||||
//
|
||||
// PURPOSE: Registers the window class.
|
||||
//
|
||||
void MyRegisterClass(HINSTANCE hInstance, const wchar_t* szWindowClass)
|
||||
{
|
||||
WNDCLASSEXW wcex;
|
||||
|
||||
wcex.cbSize = sizeof(WNDCLASSEX);
|
||||
|
||||
wcex.style = CS_HREDRAW | CS_VREDRAW;
|
||||
wcex.lpfnWndProc = WndProc;
|
||||
wcex.cbClsExtra = 0;
|
||||
wcex.cbWndExtra = 0;
|
||||
wcex.hInstance = hInstance;
|
||||
wcex.hIcon = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_SIMPLELOTTIEISLANDAPP));
|
||||
wcex.hCursor = LoadCursor(nullptr, IDC_ARROW);
|
||||
wcex.hbrBackground = (HBRUSH)(COLOR_WINDOW+1);
|
||||
wcex.lpszMenuName = MAKEINTRESOURCEW(IDC_SIMPLELOTTIEISLANDAPP);
|
||||
wcex.lpszClassName = szWindowClass;
|
||||
wcex.hIconSm = LoadIcon(wcex.hInstance, MAKEINTRESOURCE(IDI_SMALL));
|
||||
|
||||
winrt::check_bool(RegisterClassExW(&wcex) != 0);
|
||||
}
|
||||
|
||||
//
|
||||
// FUNCTION: InitInstance(HINSTANCE, int)
|
||||
//
|
||||
// PURPOSE: Saves instance handle and creates main window
|
||||
//
|
||||
// COMMENTS:
|
||||
//
|
||||
// In this function, we save the instance handle in a global variable and
|
||||
// create and display the main program window.
|
||||
//
|
||||
HWND InitInstance(HINSTANCE /*hInstance*/, int nCmdShow, const wchar_t* szTitle, const wchar_t* szWindowClass)
|
||||
{
|
||||
HWND hWnd = CreateWindowW(szWindowClass, szTitle, WS_OVERLAPPEDWINDOW,
|
||||
CW_USEDEFAULT, 0, CW_USEDEFAULT, 0, nullptr, nullptr, ::GetModuleHandle(NULL), nullptr);
|
||||
winrt::check_bool(hWnd != NULL);
|
||||
|
||||
ShowWindow(hWnd, nCmdShow);
|
||||
UpdateWindow(hWnd);
|
||||
return hWnd;
|
||||
}
|
||||
|
||||
//
|
||||
// FUNCTION: WndProc(HWND, UINT, WPARAM, LPARAM)
|
||||
//
|
||||
// PURPOSE: Processes messages for the main window.
|
||||
//
|
||||
// WM_COMMAND - process the application menu
|
||||
// WM_PAINT - Paint the main window
|
||||
// WM_DESTROY - post a quit message and return
|
||||
//
|
||||
//
|
||||
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
WindowInfo* windowInfo = reinterpret_cast<WindowInfo*>(::GetWindowLongPtr(hWnd, GWLP_USERDATA));
|
||||
|
||||
switch (message)
|
||||
{
|
||||
case WM_CREATE:
|
||||
{
|
||||
windowInfo = new WindowInfo();
|
||||
::SetWindowLongPtr(hWnd, GWLP_USERDATA, reinterpret_cast<LONG_PTR>(windowInfo));
|
||||
|
||||
// Create the DesktopChildSiteBridge
|
||||
windowInfo->Bridge = winrt::DesktopChildSiteBridge::Create(
|
||||
windowInfo->Compositor,
|
||||
winrt::GetWindowIdFromWindow(hWnd));
|
||||
|
||||
// Create the LottieIsland, which is a WinRT wrapper for hosting a Lottie animation in a ContentIsland
|
||||
windowInfo->LottieIsland = winrt::LottieIsland::LottieContentIsland::Create(windowInfo->Compositor);
|
||||
|
||||
// Connect the ContentIsland to the DesktopChildSiteBridge
|
||||
windowInfo->Bridge.Connect(windowInfo->LottieIsland.Island());
|
||||
windowInfo->Bridge.Show();
|
||||
|
||||
//// Set the C++/WinRT precompiled Lottie animation!
|
||||
//windowInfo->LottieIsland.AnimatedVisualSource(winrt::AnimatedVisuals::LottieLogo1());
|
||||
|
||||
// Live JSON loaded animation!
|
||||
winrt::LottieVisualSourceWinRT lottieVisualSource = winrt::LottieVisualSourceWinRT::CreateFromString(L"ms-appx:///LottieLogo1.json");
|
||||
lottieVisualSource.AnimatedVisualInvalidated([windowInfo, lottieVisualSource](const winrt::IInspectable sender, auto&&)
|
||||
{
|
||||
windowInfo->LottieIsland.AnimatedVisualSource(lottieVisualSource);
|
||||
});
|
||||
|
||||
windowInfo->LottieIsland.PointerPressed([=](auto&...) {
|
||||
// Clicking on the Lottie animation acts like clicking "Pause/Resume"
|
||||
OnButtonClicked(ButtonType::PauseButton, windowInfo, hWnd);
|
||||
});
|
||||
|
||||
// Add some Win32 controls to allow the app to play with the animation
|
||||
CreateWin32Button(ButtonType::PlayButton, L"Play", hWnd);
|
||||
CreateWin32Button(ButtonType::PauseButton, L"Pause", hWnd);
|
||||
CreateWin32Button(ButtonType::StopButton, L"Stop", hWnd);
|
||||
CreateWin32Button(ButtonType::ReverseButton, L"Reverse", hWnd);
|
||||
}
|
||||
break;
|
||||
case WM_SIZE:
|
||||
{
|
||||
const int width = LOWORD(lParam);
|
||||
const int height = HIWORD(lParam);
|
||||
|
||||
if (windowInfo->Bridge)
|
||||
{
|
||||
// Layout our bridge: we want to use all available height (minus a button and some padding),
|
||||
// but respect the ratio that the LottieIsland wants to display at. This can be accessed through
|
||||
// the "RequestedSize" property on the ContentSiteView.
|
||||
|
||||
int availableHeight = height - (k_padding * 3) - k_buttonHeight;
|
||||
int availableWidth = width - (k_padding * 2);
|
||||
|
||||
// Check what size the lottie wants to be
|
||||
winrt::float2 requestedSize = windowInfo->Bridge.SiteView().RequestedSize();
|
||||
|
||||
// Scale the width to be the ratio the lottie wants
|
||||
int bridgeWidth = 0;
|
||||
if (requestedSize.y > 0) // Guard against divide-by-zero
|
||||
{
|
||||
bridgeWidth = static_cast<int>((requestedSize.x / requestedSize.y) * availableHeight);
|
||||
}
|
||||
|
||||
// ... but don't overflow the width we have available
|
||||
bridgeWidth = std::min(availableWidth, bridgeWidth);
|
||||
|
||||
windowInfo->Bridge.MoveAndResize({ k_padding, k_padding, bridgeWidth, availableHeight });
|
||||
}
|
||||
|
||||
LayoutButton(ButtonType::PlayButton, width, height, hWnd);
|
||||
LayoutButton(ButtonType::PauseButton, width, height, hWnd);
|
||||
LayoutButton(ButtonType::StopButton, width, height, hWnd);
|
||||
LayoutButton(ButtonType::ReverseButton, width, height, hWnd);
|
||||
}
|
||||
break;
|
||||
case WM_ACTIVATE:
|
||||
{
|
||||
// Make focus work nicely when the user presses alt+tab to activate a different window, and then alt+tab
|
||||
// again to come back to this window. We want the focus to go back to the same child HWND that was focused
|
||||
// before.
|
||||
const bool isGettingDeactivated = (LOWORD(wParam) == WA_INACTIVE);
|
||||
if (isGettingDeactivated)
|
||||
{
|
||||
// Remember the HWND that had focus.
|
||||
windowInfo->LastFocusedWindow = ::GetFocus();
|
||||
}
|
||||
else if (windowInfo->LastFocusedWindow != NULL)
|
||||
{
|
||||
::SetFocus(windowInfo->LastFocusedWindow);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case WM_COMMAND:
|
||||
{
|
||||
int wmId = LOWORD(wParam);
|
||||
int wmCode = HIWORD(wParam);
|
||||
// Parse the menu selections:
|
||||
switch (wmId)
|
||||
{
|
||||
case IDM_ABOUT:
|
||||
DialogBox(::GetModuleHandle(NULL), MAKEINTRESOURCE(IDD_ABOUTBOX), hWnd, About);
|
||||
break;
|
||||
case IDM_EXIT:
|
||||
DestroyWindow(hWnd);
|
||||
break;
|
||||
case 501: // Buttons
|
||||
case 502:
|
||||
case 503:
|
||||
case 504:
|
||||
if (wmCode == BN_CLICKED)
|
||||
{
|
||||
ButtonType type = static_cast<ButtonType>(wmId - 500);
|
||||
OnButtonClicked(type, windowInfo, hWnd);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
return DefWindowProc(hWnd, message, wParam, lParam);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case WM_PAINT:
|
||||
{
|
||||
PAINTSTRUCT ps;
|
||||
HDC hdc = BeginPaint(hWnd, &ps);
|
||||
// TODO: Add any drawing code that uses hdc here...
|
||||
UNREFERENCED_PARAMETER(hdc);
|
||||
EndPaint(hWnd, &ps);
|
||||
}
|
||||
break;
|
||||
case WM_DESTROY:
|
||||
PostQuitMessage(0);
|
||||
break;
|
||||
case WM_NCDESTROY:
|
||||
delete windowInfo;
|
||||
::SetWindowLong(hWnd, GWLP_USERDATA, NULL);
|
||||
break;
|
||||
default:
|
||||
return DefWindowProc(hWnd, message, wParam, lParam);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Message handler for about box.
|
||||
INT_PTR CALLBACK About(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
UNREFERENCED_PARAMETER(lParam);
|
||||
switch (message)
|
||||
{
|
||||
case WM_INITDIALOG:
|
||||
return (INT_PTR)TRUE;
|
||||
|
||||
case WM_COMMAND:
|
||||
if (LOWORD(wParam) == IDOK || LOWORD(wParam) == IDCANCEL)
|
||||
{
|
||||
EndDialog(hDlg, LOWORD(wParam));
|
||||
return (INT_PTR)TRUE;
|
||||
}
|
||||
break;
|
||||
}
|
||||
return (INT_PTR)FALSE;
|
||||
}
|
||||
|
||||
void LayoutButton(ButtonType type, int /*tlwWidth*/, int tlwHeight, HWND topLevelWindow)
|
||||
{
|
||||
int buttonIndex = static_cast<int>(type);
|
||||
|
||||
int xPos = ((buttonIndex - 1) * (k_buttonWidth + k_padding)) + k_padding;
|
||||
int yPos = tlwHeight - k_buttonHeight - k_padding;
|
||||
|
||||
HWND buttonHwnd = ::GetDlgItem(topLevelWindow, 500 + buttonIndex);
|
||||
::SetWindowPos(buttonHwnd, NULL, xPos, yPos, k_buttonWidth, k_buttonHeight, SWP_NOZORDER);
|
||||
}
|
||||
|
||||
void CreateWin32Button(ButtonType type, const std::wstring_view& text, HWND parentHwnd)
|
||||
{
|
||||
int buttonIndex = static_cast<int>(type);
|
||||
|
||||
int xPos = ((buttonIndex - 1) * (k_buttonWidth + k_padding)) + k_padding;
|
||||
|
||||
const HINSTANCE hInst = (HINSTANCE)GetWindowLongPtr(parentHwnd, GWLP_HINSTANCE);
|
||||
HMENU fakeHMenu = reinterpret_cast<HMENU>(static_cast<intptr_t>(500 + buttonIndex));
|
||||
::CreateWindowW(
|
||||
L"BUTTON",
|
||||
text.data(),
|
||||
WS_TABSTOP | WS_VISIBLE | WS_CHILD,
|
||||
xPos, 250, k_buttonWidth, k_buttonHeight,
|
||||
parentHwnd,
|
||||
fakeHMenu,
|
||||
hInst,
|
||||
NULL);
|
||||
}
|
||||
|
||||
void OnButtonClicked(ButtonType type, WindowInfo* windowInfo, HWND topLevelWindow)
|
||||
{
|
||||
winrt::Windows::Foundation::IAsyncAction asyncAction{ nullptr };
|
||||
switch (type)
|
||||
{
|
||||
case ButtonType::PlayButton:
|
||||
asyncAction = windowInfo->LottieIsland.PlayAsync(0.0, 1.0, true);
|
||||
asyncAction.Completed([](auto&&, auto&& asyncStatus)
|
||||
{
|
||||
// Check if the async operation was successfully completed
|
||||
if (asyncStatus == winrt::Windows::Foundation::AsyncStatus::Completed)
|
||||
{
|
||||
OutputDebugString(L"Async operation completed successfully.\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
OutputDebugString(L"Async operation failed or was canceled.\n");
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
SetPauseState(windowInfo, false, topLevelWindow);
|
||||
break;
|
||||
case ButtonType::PauseButton:
|
||||
if (windowInfo->isPaused)
|
||||
{
|
||||
windowInfo->LottieIsland.Resume();
|
||||
}
|
||||
else
|
||||
{
|
||||
windowInfo->LottieIsland.Pause();
|
||||
}
|
||||
SetPauseState(windowInfo, !windowInfo->isPaused, topLevelWindow);
|
||||
break;
|
||||
case ButtonType::StopButton:
|
||||
windowInfo->LottieIsland.Stop();
|
||||
SetPauseState(windowInfo, false, topLevelWindow);
|
||||
break;
|
||||
case ButtonType::ReverseButton:
|
||||
if (windowInfo->LottieIsland.PlaybackRate() == 1.0)
|
||||
{
|
||||
windowInfo->LottieIsland.PlaybackRate(-1.0);
|
||||
}
|
||||
else
|
||||
{
|
||||
windowInfo->LottieIsland.PlaybackRate(1.0);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
throw winrt::hresult_invalid_argument{ L"Invalid button type." };
|
||||
}
|
||||
}
|
||||
|
||||
void SetButtonText(ButtonType type, const std::wstring_view& text, HWND topLevelWindow)
|
||||
{
|
||||
int buttonIndex = static_cast<int>(type);
|
||||
HWND buttonHwnd = ::GetDlgItem(topLevelWindow, 500 + buttonIndex);
|
||||
::SendMessageW(buttonHwnd, WM_SETTEXT, 0, reinterpret_cast<LPARAM>(text.data()));
|
||||
}
|
||||
|
||||
void SetPauseState(WindowInfo* windowInfo, bool isPaused, HWND topLevelWindow)
|
||||
{
|
||||
if (windowInfo->isPaused == isPaused)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
SetButtonText(ButtonType::PauseButton,
|
||||
isPaused ? L"Resume" : L"Pause",
|
||||
topLevelWindow);
|
||||
|
||||
windowInfo->isPaused = isPaused;
|
||||
}
|
|
@ -0,0 +1,5 @@
|
|||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT License.
|
||||
#pragma once
|
||||
|
||||
#include "resource.h"
|
Двоичный файл не отображается.
После Ширина: | Высота: | Размер: 45 KiB |
Двоичный файл не отображается.
|
@ -0,0 +1,197 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="..\packages\Microsoft.Windows.SDK.BuildTools.10.0.22621.756\build\Microsoft.Windows.SDK.BuildTools.props" Condition="Exists('..\packages\Microsoft.Windows.SDK.BuildTools.10.0.22621.756\build\Microsoft.Windows.SDK.BuildTools.props')" />
|
||||
<Import Project="..\packages\Microsoft.WindowsAppSDK.1.5.240227000\build\native\Microsoft.WindowsAppSDK.props" Condition="Exists('..\packages\Microsoft.WindowsAppSDK.1.5.240227000\build\native\Microsoft.WindowsAppSDK.props')" />
|
||||
<Import Project="..\packages\Microsoft.Windows.CppWinRT.2.0.230706.1\build\native\Microsoft.Windows.CppWinRT.props" Condition="Exists('..\packages\Microsoft.Windows.CppWinRT.2.0.230706.1\build\native\Microsoft.Windows.CppWinRT.props')" />
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|ARM64">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>ARM64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|ARM64">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>ARM64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Debug|x64">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|x64">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<VCProjectVersion>17.0</VCProjectVersion>
|
||||
<Keyword>Win32Proj</Keyword>
|
||||
<ProjectGuid>{350A5EC2-B156-4AAF-9D80-A864C76BA0C5}</ProjectGuid>
|
||||
<RootNamespace>SimpleLottieIslandApp</RootNamespace>
|
||||
<!-- Island-support: Needed to generate App.xaml.g.h (e.g. pulls in Microsoft.Cpp.AppContainerApplication.props) -->
|
||||
<ApplicationType>Windows Store</ApplicationType>
|
||||
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
|
||||
<!-- Island-support: We want the app to be unpackaged -->
|
||||
<!-- <WindowsPackageType>None</WindowsPackageType> -->
|
||||
<AppxPackage>true</AppxPackage>
|
||||
<CppWinRTOptimized>true</CppWinRTOptimized>
|
||||
<CppWinRTRootNamespaceAutoMerge>true</CppWinRTRootNamespaceAutoMerge>
|
||||
<MinimalCoreWin>true</MinimalCoreWin>
|
||||
<ProjectName>SimpleLottieIslandApp</ProjectName>
|
||||
<RootNamespace>SimpleLottieIslandApp</RootNamespace>
|
||||
<TargetName>$(RootNamespace)</TargetName>
|
||||
<DefaultLanguage>en-US</DefaultLanguage>
|
||||
<AppContainerApplication>false</AppContainerApplication>
|
||||
<ApplicationTypeRevision>10.0</ApplicationTypeRevision>
|
||||
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
|
||||
<!-- Island-support: Min version must be at least 17764.
|
||||
(Needed to set RedirectionTarget to 8.21, so we get the correct version of Microsoft.Windows.UI.Xaml.Cpp.targets) -->
|
||||
<WindowsTargetPlatformMinVersion>10.0.17763.0</WindowsTargetPlatformMinVersion>
|
||||
<EnableMsixTooling>true</EnableMsixTooling>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup>
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
<DesktopCompatible>true</DesktopCompatible>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)'=='Debug'" Label="Configuration">
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)'=='Release'" Label="Configuration">
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="Shared">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<ItemDefinitionGroup>
|
||||
<ClCompile>
|
||||
<!-- Island-support: The markup compiler generates files that include pch.h, better setup PCH. -->
|
||||
<PrecompiledHeader>Use</PrecompiledHeader>
|
||||
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
|
||||
<PrecompiledHeaderOutputFile>$(IntDir)pch.pch</PrecompiledHeaderOutputFile>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<AdditionalDependencies>user32.lib;Ole32.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<DelayLoadDLLs>Microsoft.UI.Windowing.Core.dll</DelayLoadDLLs>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup>
|
||||
<ClCompile>
|
||||
<WarningLevel>Level4</WarningLevel>
|
||||
<TreatWarningAsError>true</TreatWarningAsError>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)'=='Win32'">
|
||||
<ClCompile>
|
||||
<PreprocessorDefinitions>WIN32;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ClCompile>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)'=='Debug'">
|
||||
<ClCompile>
|
||||
<PreprocessorDefinitions>DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ClCompile>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)'=='Release'">
|
||||
<ClCompile>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="pch.h" />
|
||||
<ClInclude Include="Resource.h" />
|
||||
<ClInclude Include="SimpleLottieIslandApp.h" />
|
||||
<ClInclude Include="targetver.h" />
|
||||
<ClInclude Include="AnimatedVisuals.LottieLogo1.h">
|
||||
<DependentUpon>AnimatedVisuals.LottieLogo1.idl</DependentUpon>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="AnimatedVisuals.LottieLogo1.cpp">
|
||||
<DependentUpon>AnimatedVisuals.LottieLogo1.idl</DependentUpon>
|
||||
</ClCompile>
|
||||
<ClCompile Include="pch.cpp">
|
||||
<PrecompiledHeader>Create</PrecompiledHeader>
|
||||
</ClCompile>
|
||||
<!-- Island-support: This generated file implements some activation factories -->
|
||||
<ClCompile Include="SimpleLottieIslandApp.cpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Midl Include="AnimatedVisuals.LottieLogo1.idl" />
|
||||
<Midl Include="Project.idl" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="SimpleLottieIslandApp.rc" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Image Include="SimpleLottieIslandApp.ico" />
|
||||
<Image Include="small.ico" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<CopyFileToFolders Include="Assets\LottieLogo1.json">
|
||||
<DeploymentContent>true</DeploymentContent>
|
||||
<FileType>Document</FileType>
|
||||
</CopyFileToFolders>
|
||||
<None Include="packages.config" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<AppxManifest Include="package.appxmanifest">
|
||||
<SubType>Designer</SubType>
|
||||
</AppxManifest>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\LottieIsland\LottieIsland.vcxproj">
|
||||
<Project>{9ba7a2f2-b723-458b-a575-3f726d271465}</Project>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\LottieWinRT\LottieWinRT.csproj">
|
||||
<Project>{dda0d223-4b59-455d-a8b1-cfae59523ffb}</Project>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
<Import Project="..\packages\Microsoft.Windows.CppWinRT.2.0.230706.1\build\native\Microsoft.Windows.CppWinRT.targets" Condition="Exists('..\packages\Microsoft.Windows.CppWinRT.2.0.230706.1\build\native\Microsoft.Windows.CppWinRT.targets')" />
|
||||
<Import Project="..\packages\Microsoft.WindowsAppSDK.1.5.240227000\build\native\Microsoft.WindowsAppSDK.targets" Condition="Exists('..\packages\Microsoft.WindowsAppSDK.1.5.240227000\build\native\Microsoft.WindowsAppSDK.targets')" />
|
||||
<Import Project="..\packages\Microsoft.Windows.SDK.BuildTools.10.0.22621.756\build\Microsoft.Windows.SDK.BuildTools.targets" Condition="Exists('..\packages\Microsoft.Windows.SDK.BuildTools.10.0.22621.756\build\Microsoft.Windows.SDK.BuildTools.targets')" />
|
||||
<Import Project="..\packages\Microsoft.Graphics.Win2D.1.2.0\build\native\Microsoft.Graphics.Win2D.targets" Condition="Exists('..\packages\Microsoft.Graphics.Win2D.1.2.0\build\native\Microsoft.Graphics.Win2D.targets')" />
|
||||
</ImportGroup>
|
||||
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
|
||||
<PropertyGroup>
|
||||
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
|
||||
</PropertyGroup>
|
||||
<Error Condition="!Exists('..\packages\Microsoft.Windows.CppWinRT.2.0.230706.1\build\native\Microsoft.Windows.CppWinRT.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Microsoft.Windows.CppWinRT.2.0.230706.1\build\native\Microsoft.Windows.CppWinRT.props'))" />
|
||||
<Error Condition="!Exists('..\packages\Microsoft.Windows.CppWinRT.2.0.230706.1\build\native\Microsoft.Windows.CppWinRT.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Microsoft.Windows.CppWinRT.2.0.230706.1\build\native\Microsoft.Windows.CppWinRT.targets'))" />
|
||||
<Error Condition="!Exists('..\packages\Microsoft.WindowsAppSDK.1.5.240227000\build\native\Microsoft.WindowsAppSDK.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Microsoft.WindowsAppSDK.1.5.240227000\build\native\Microsoft.WindowsAppSDK.props'))" />
|
||||
<Error Condition="!Exists('..\packages\Microsoft.WindowsAppSDK.1.5.240227000\build\native\Microsoft.WindowsAppSDK.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Microsoft.WindowsAppSDK.1.5.240227000\build\native\Microsoft.WindowsAppSDK.targets'))" />
|
||||
<Error Condition="!Exists('..\packages\Microsoft.Windows.SDK.BuildTools.10.0.22621.756\build\Microsoft.Windows.SDK.BuildTools.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Microsoft.Windows.SDK.BuildTools.10.0.22621.756\build\Microsoft.Windows.SDK.BuildTools.props'))" />
|
||||
<Error Condition="!Exists('..\packages\Microsoft.Windows.SDK.BuildTools.10.0.22621.756\build\Microsoft.Windows.SDK.BuildTools.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Microsoft.Windows.SDK.BuildTools.10.0.22621.756\build\Microsoft.Windows.SDK.BuildTools.targets'))" />
|
||||
<Error Condition="!Exists('..\packages\Microsoft.Graphics.Win2D.1.2.0\build\native\Microsoft.Graphics.Win2D.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Microsoft.Graphics.Win2D.1.2.0\build\native\Microsoft.Graphics.Win2D.targets'))" />
|
||||
</Target>
|
||||
</Project>
|
|
@ -0,0 +1,78 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<Filter Include="Source Files">
|
||||
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
|
||||
<Extensions>cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Header Files">
|
||||
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
|
||||
<Extensions>h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Resource Files">
|
||||
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
|
||||
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="targetver.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Resource.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="pch.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="AnimatedVisuals.LottieLogo1.h">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="SimpleLottieIslandApp.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="pch.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="AnimatedVisuals.LottieLogo1.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="SimpleLottieIslandApp.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="SimpleLottieIslandApp.rc">
|
||||
<Filter>Resource Files</Filter>
|
||||
</ResourceCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Image Include="small.ico">
|
||||
<Filter>Resource Files</Filter>
|
||||
</Image>
|
||||
<Image Include="SimpleLottieIslandApp.ico">
|
||||
<Filter>Resource Files</Filter>
|
||||
</Image>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="packages.config" />
|
||||
<None Include="Assets\LottieLogo1.json">
|
||||
<Filter>Resource Files</Filter>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<AppxManifest Include="package.appxmanifest" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<AppxManifest Include="package.appxmanifest" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Midl Include="AnimatedVisuals.LottieLogo1.idl">
|
||||
<Filter>Source Files</Filter>
|
||||
</Midl>
|
||||
<Midl Include="Project.idl">
|
||||
<Filter>Source Files</Filter>
|
||||
</Midl>
|
||||
</ItemGroup>
|
||||
</Project>
|
|
@ -0,0 +1,54 @@
|
|||
<Package
|
||||
xmlns="http://schemas.microsoft.com/appx/manifest/foundation/windows10"
|
||||
xmlns:uap="http://schemas.microsoft.com/appx/manifest/uap/windows10"
|
||||
xmlns:rescap="http://schemas.microsoft.com/appx/manifest/foundation/windows10/restrictedcapabilities"
|
||||
IgnorableNamespaces="uap rescap">
|
||||
|
||||
<Identity
|
||||
Name="ea703a93-e074-44b5-ac89-db71e4409e2d"
|
||||
Publisher="CN=Microsoft Corporation"
|
||||
Version="1.0.0.0" />
|
||||
|
||||
<Properties>
|
||||
<DisplayName>SimpleLottieIslandApp</DisplayName>
|
||||
<PublisherDisplayName>Microsoft Corporation</PublisherDisplayName>
|
||||
<Logo>Assets\logo.png</Logo>
|
||||
</Properties>
|
||||
|
||||
<Dependencies>
|
||||
<TargetDeviceFamily Name="Windows.Universal" MinVersion="10.0.17763.0" MaxVersionTested="10.0.19041.0" />
|
||||
<TargetDeviceFamily Name="Windows.Desktop" MinVersion="10.0.17763.0" MaxVersionTested="10.0.19041.0" />
|
||||
</Dependencies>
|
||||
|
||||
<Resources>
|
||||
<Resource Language="x-generate"/>
|
||||
</Resources>
|
||||
|
||||
<Applications>
|
||||
<Application Id="App"
|
||||
Executable="$targetnametoken$.exe"
|
||||
EntryPoint="$targetentrypoint$">
|
||||
<uap:VisualElements
|
||||
DisplayName="CppApp Windows App SDK C++ WinUI Sample"
|
||||
Description="CppApp Windows App SDK C++ WinUI Sample"
|
||||
BackgroundColor="transparent"
|
||||
Square150x150Logo="Assets\Square150x150Logo.png" Square44x44Logo="Assets\Square44x44Logo.png">
|
||||
<uap:DefaultTile Wide310x150Logo="Assets\Wide310x150Logo.png" />
|
||||
</uap:VisualElements>
|
||||
</Application>
|
||||
</Applications>
|
||||
|
||||
<!--In order to host the C# component from C++, you must add the following Extension group and list the activatable classes-->
|
||||
<Extensions>
|
||||
<Extension Category="windows.activatableClass.inProcessServer">
|
||||
<InProcessServer>
|
||||
<Path>LottieIsland.dll</Path>
|
||||
<ActivatableClass ActivatableClassId="LottieIsland.LottieContentIsland" ThreadingModel="both" />
|
||||
</InProcessServer>
|
||||
</Extension>
|
||||
</Extensions>
|
||||
|
||||
<Capabilities>
|
||||
<rescap:Capability Name="runFullTrust" />
|
||||
</Capabilities>
|
||||
</Package>
|
|
@ -0,0 +1,7 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="Microsoft.Graphics.Win2D" version="1.2.0" targetFramework="native" />
|
||||
<package id="Microsoft.Windows.CppWinRT" version="2.0.230706.1" targetFramework="native" />
|
||||
<package id="Microsoft.Windows.SDK.BuildTools" version="10.0.22621.756" targetFramework="native" />
|
||||
<package id="Microsoft.WindowsAppSDK" version="1.5.240227000" targetFramework="native" />
|
||||
</packages>
|
|
@ -0,0 +1,3 @@
|
|||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT License.
|
||||
#include "pch.h"
|
|
@ -0,0 +1,23 @@
|
|||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT License.
|
||||
#pragma once
|
||||
|
||||
#include "targetver.h"
|
||||
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
|
||||
#define NOMINMAX
|
||||
// Windows Header Files
|
||||
#include <windows.h>
|
||||
|
||||
// There's an API named GetCurrentTime in the Storyboard type.
|
||||
#undef GetCurrentTime
|
||||
|
||||
// Com and WinRT headers
|
||||
#include <Unknwn.h>
|
||||
|
||||
// Some generated files, like MainPage.xaml.g.h need files such as Microsoft.UI.Xaml.Markup.h
|
||||
// to already be included. Let's just include a bunch of stuff we know we'll need here in the PCH.
|
||||
#include <winrt/Microsoft.UI.Content.h>
|
||||
#include <winrt/Microsoft.UI.Composition.h>
|
||||
#include <winrt/Microsoft.UI.Dispatching.h>
|
||||
#include <winrt/Microsoft.UI.Interop.h>
|
||||
#include <winrt/Windows.Foundation.h>
|
Двоичный файл не отображается.
После Ширина: | Высота: | Размер: 45 KiB |
|
@ -0,0 +1,9 @@
|
|||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
#pragma once
|
||||
|
||||
// // Including SDKDDKVer.h defines the highest available Windows platform.
|
||||
// If you wish to build your application for a previous Windows platform, include WinSDKVer.h and
|
||||
// set the _WIN32_WINNT macro to the platform you wish to support before including SDKDDKVer.h.
|
||||
#include <SDKDDKVer.h>
|
Загрузка…
Ссылка в новой задаче