0
点赞
收藏
分享

微信扫一扫

UE4的PixelStreaming模块之设备驱动

悄然丝语 2022-01-22 阅读 122
ue4

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();
	}
}
举报

相关推荐

UE4之性能优化

【UE4】Puerts 集成自己封装的模块

UE4 动画

UE4问题

UE5 UE4 修复GPU驱动程序崩溃

UE4 打LOG

ue4无法编译

UE4 UI记录

UE4简易QTE

0 条评论