1 //// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF
2 //// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO
3 //// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
4 //// PARTICULAR PURPOSE.
6 //// Copyright (c) Microsoft Corporation. All rights reserved
10 #include "DirectXBase.h"
11 #include "SampleOverlay.h"
12 #include "AutoThrottle.h"
13 #include "BasicSprites.h"
15 namespace SampleSettings
17 static const unsigned int NumAsteroids = 50;
20 static const float TargetFrameTime = 1.0f / 20.0f;
21 static const unsigned int InitialParticleCount = 5000;
22 static const unsigned int ParticleCountDelta = 32;
23 static const unsigned int ParticleCountMin = 1000;
24 static const unsigned int ParticleCountMax = 60000;
28 static const float Gravity = 40000000.0f;
29 static const float Damping = 0.015f;
48 ref class SimpleSprites : public DirectXBase
52 virtual void CreateDeviceIndependentResources() override;
53 virtual void CreateDeviceResources() override;
54 virtual void CreateWindowSizeDependentResources() override;
55 virtual void Render() override;
57 _In_ Windows::UI::Core::CoreWindow^ window,
58 _In_ Windows::UI::Xaml::Controls::SwapChainBackgroundPanel^ swapChainPanel,
61 void Update(float timeTotal, float timeDelta);
62 void AddRepulsor(_In_ uint32 id, _In_ float2 position);
63 void MoveRepulsor(_In_ uint32 id, _In_ float2 position);
64 void RemoveRepulsor(_In_ uint32 id);
67 float RandFloat(float min, float max);
68 SampleOverlay^ m_sampleOverlay;
69 AutoThrottle^ m_autoThrottle;
70 BasicSprites::SpriteBatch^ m_spriteBatch;
71 Microsoft::WRL::ComPtr<ID3D11Texture2D> m_background;
72 Microsoft::WRL::ComPtr<ID3D11Texture2D> m_asteroid;
73 Microsoft::WRL::ComPtr<ID3D11Texture2D> m_particle;
74 std::vector<AsteroidData> m_asteroidData;
75 std::vector<ParticleData> m_particleData;
76 std::map<uint32, float2> m_repulsors;
77 int m_numParticlesToDraw;
78 Windows::UI::Xaml::Controls::SwapChainBackgroundPanel^ panel_;