UE4的PixelStreaming模块设备驱动
UE4的PixelStreaming模块设备驱动
一, UE4的PixelStreaming模块设备驱动
UE4 使用WebRTC中引擎去做与浏览器之间的交互 , 类似于云游戏怎么一个东西,
InputDevice设备驱动类。
在UE4引擎中对设备驱动服装非常好,是一个模块形势。 在PixelStreamingModule模块中创建的时候转入设备驱动类的驱动模块
在PixelStreamingModule类中创建该类
TSharedPtr<class IInputDevice> FPixelStreamingModule::CreateInputDevice(const TSharedRef<FGenericApplicationMessageHandler>& InMessageHandler)
{
InputDevice = MakeShareable(new FInputDevice(InMessageHandler));
return InputDevice;
}
设备驱动是从对应平台模块的传入设备驱动的ApplicationCore中Private中Mac
以下类说明
MacApplication
WindowApplication
…
在对应平台的-Application中PollGameDeviceState方法进行模块设备传入的操作。
void FMacApplication::PollGameDeviceState(const float TimeDelta)
{
// initialize any externally-implemented input devices (we delay load initialize the array so any plugins have had time to load)
if (!bHasLoadedInputPlugins && GIsRunning)
{
TArray<IInputDeviceModule*> PluginImplementations = IModularFeatures::Get().GetModularFeatureImplementations<IInputDeviceModule>( IInputDeviceModule::GetModularFeatureName() );
for( auto InputPluginIt = PluginImplementations.CreateIterator(); InputPluginIt; ++InputPluginIt )
{
// 模块设备的初始化
TSharedPtr<IInputDevice> Device = (*InputPluginIt)->CreateInputDevice(MessageHandler);
if (Device.IsValid())
{
UE_LOG(LogInit, Log, TEXT("Adding external input plugin."));
ExternalInputDevices.Add(Device);
}
}
bHasLoadedInputPlugins = true;
}
// Poll game device state and send new events
HIDInput->Tick( TimeDelta );
HIDInput->SendControllerEvents();
// Poll externally-implemented devices
for( auto DeviceIt = ExternalInputDevices.CreateIterator(); DeviceIt; ++DeviceIt )
{
(*DeviceIt)->Tick( TimeDelta );
(*DeviceIt)->SendControllerEvents();
}
}