Skip to content

Latest commit

 

History

History
47 lines (36 loc) · 1.41 KB

flightstick_flightstickadded.md

File metadata and controls

47 lines (36 loc) · 1.41 KB
-api-id -api-type
E:Windows.Gaming.Input.FlightStick.FlightStickAdded
winrt event

Windows.Gaming.Input.FlightStick.FlightStickAdded

-description

Signals when a new flight stick is connected.

-remarks

To identify flight sticks that have already been added, you query the list of connected flight sticks using FlightStick.FlightSticks. However, because you might only be interested in some of the connected flight sticks, we recommend that you maintain your own collection instead of accessing them through FlightSticks.

-see-also

-examples

The following example starts tracking a flight stick that's been added.

#include <winrt/Windows.Gaming.Input.h>
using namespace winrt;
using namespace Windows::Gaming::Input;
...
std::vector<FlightStick> m_myFlightSticks;
...
FlightStick::FlightStickAdded([this](IInspectable const& /* sender */, FlightStick const& args)
    {
        m_myFlightSticks.push_back(args);
    });
FlightStick::FlightStickAdded += 
    ref new EventHandler<FlightStick^>([] (Platform::Object^, FlightStick^ args)
{
    // This code assumes that you're interested in all new flight sticks.
    // `myFlightSticks` is a `Vector<FlightStick^>` that contains the flight sticks that your game is tracking.
    myFlightSticks->Append(args);
});