DynamicLoader.cpp 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. #include "DynamicLoader.h"
  2. #include "Runtime/Engine/Classes/Engine/Engine.h"
  3. #include "Runtime/Core/Public/Async/Async.h"
  4. #include "IImageWrapper.h"
  5. #include "ImageUtils.h"
  6. #include "IImageWrapperModule.h"
  7. #include "BlueprintUtilityBPLibrary.h"
  8. #include "Engine/Texture2D.h"
  9. void UImageLoader::LoadImageAsync(const FString& ImagePath,const FString &inputID)
  10. {
  11. AsyncTask(ENamedThreads::AnyThread, [=]()
  12. {
  13. LoadID = inputID;
  14. UTexture2D* reTexture;
  15. reTexture = LoadImageFromDisk(ImagePath);
  16. LoadCompleted.Broadcast(reTexture,LoadID);
  17. });
  18. }
  19. UTexture2D* UImageLoader::LoadImageFromDisk( const FString& ImagePath)
  20. {
  21. bool Succss; int32 Weight;
  22. int32 Highting;
  23. return UBlueprintUtilityBPLibrary::LoadTexture2DFromFile(ImagePath,Succss, Weight,Highting);
  24. }
  25. AExeActor::AExeActor()
  26. {
  27. // Set this actor to call Tick() every frame. You can turn this off to improve performance if you don't need it.
  28. PrimaryActorTick.bCanEverTick = true;
  29. }
  30. bool AExeActor::Getstat()
  31. {
  32. bool a = FPlatformProcess::IsProcRunning(CheckProc);
  33. return a;
  34. //return true;
  35. }
  36. // Called when the game starts or when spawned
  37. void AExeActor::BeginPlay()
  38. {
  39. Super::BeginPlay();
  40. UE_LOG(LogTemp, Warning, TEXT("EXE Begin"));
  41. }
  42. void AExeActor::Tick(float DeltaTime)
  43. {
  44. //Super::Tick();
  45. Super::Tick(DeltaTime);
  46. //UE_LOG(LogTemp, Warning, TEXT("I AM IN There"));
  47. bool a = FPlatformProcess::IsProcRunning(CheckProc);
  48. if (!a && !bisShutDown)
  49. {
  50. UE_LOG(LogTemp, Warning, TEXT("EXE End"));
  51. bisShutDown = true;
  52. ProcShutdown.Broadcast(true);
  53. PrimaryActorTick.bCanEverTick = false;
  54. Destroy();
  55. }
  56. //return true;
  57. }