diff --git a/.ignore b/.ignore index b1407d9..69ea373 100644 --- a/.ignore +++ b/.ignore @@ -5,3 +5,5 @@ /DerivedDataCache /Intermediate /Saved +/Plugins/hstherac25/Content +/Plugins/hstherac25/Intermediate diff --git a/Plugins/hstherac25/Resources/Icon128.png b/Plugins/hstherac25/Resources/Icon128.png new file mode 100644 index 0000000..1231d4a Binary files /dev/null and b/Plugins/hstherac25/Resources/Icon128.png differ diff --git a/Plugins/hstherac25/Source/ThirdParty/hstherac25Library/ExampleLibrary.cpp b/Plugins/hstherac25/Source/ThirdParty/hstherac25Library/ExampleLibrary.cpp new file mode 100644 index 0000000..2de2f64 --- /dev/null +++ b/Plugins/hstherac25/Source/ThirdParty/hstherac25Library/ExampleLibrary.cpp @@ -0,0 +1,20 @@ +#if defined _WIN32 || defined _WIN64 + #include + + #define EXAMPLELIBRARY_EXPORT __declspec(dllexport) +#else + #include +#endif + +#ifndef EXAMPLELIBRARY_EXPORT + #define EXAMPLELIBRARY_EXPORT +#endif + +EXAMPLELIBRARY_EXPORT void ExampleLibraryFunction() +{ +#if defined _WIN32 || defined _WIN64 + MessageBox(NULL, TEXT("Loaded ExampleLibrary.dll from Third Party Plugin sample."), TEXT("Third Party Plugin"), MB_OK); +#else + printf("Loaded ExampleLibrary from Third Party Plugin sample"); +#endif +} \ No newline at end of file diff --git a/Plugins/hstherac25/Source/ThirdParty/hstherac25Library/ExampleLibrary.vcxproj b/Plugins/hstherac25/Source/ThirdParty/hstherac25Library/ExampleLibrary.vcxproj new file mode 100644 index 0000000..432f9dc --- /dev/null +++ b/Plugins/hstherac25/Source/ThirdParty/hstherac25Library/ExampleLibrary.vcxproj @@ -0,0 +1,158 @@ + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + {9B50F1F8-0116-442C-A071-F5C3A120A5CB} + Win32Proj + ExampleLibrary + + + + DynamicLibrary + true + v143 + Unicode + + + DynamicLibrary + true + v143 + Unicode + + + DynamicLibrary + false + v143 + true + Unicode + + + DynamicLibrary + false + v143 + true + Unicode + + + + + + + + + + + + + + + + + + + true + + + true + + + false + + + false + $(SolutionDir)$(Platform)\$(Configuration)\ + + + + + + Level3 + Disabled + WIN32;_DEBUG;_WINDOWS;_USRDLL;EXAMPLELIBRARY_EXPORTS;%(PreprocessorDefinitions) + true + + + Windows + true + + + + + + + Level3 + Disabled + WIN32;_DEBUG;_WINDOWS;_USRDLL;EXAMPLELIBRARY_EXPORTS;%(PreprocessorDefinitions) + true + + + Windows + true + + + + + Level3 + + + MaxSpeed + true + true + WIN32;NDEBUG;_WINDOWS;_USRDLL;EXAMPLELIBRARY_EXPORTS;%(PreprocessorDefinitions) + true + + + Windows + true + true + true + + + + + Level3 + + + MaxSpeed + true + true + WIN32;NDEBUG;_WINDOWS;_USRDLL;EXAMPLELIBRARY_EXPORTS;%(PreprocessorDefinitions) + true + + + Windows + true + true + true + + + copy "$(TargetPath)" "$(SolutionDir)..\..\..\Binaries\ThirdParty\hstherac25Library\Win64\" + + + + + + + + + + + + \ No newline at end of file diff --git a/Plugins/hstherac25/Source/ThirdParty/hstherac25Library/ExampleLibrary.vcxproj.filters b/Plugins/hstherac25/Source/ThirdParty/hstherac25Library/ExampleLibrary.vcxproj.filters new file mode 100644 index 0000000..29d3ce7 --- /dev/null +++ b/Plugins/hstherac25/Source/ThirdParty/hstherac25Library/ExampleLibrary.vcxproj.filters @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/Plugins/hstherac25/Source/ThirdParty/hstherac25Library/Mac/Release/libExampleLibrary.dylib b/Plugins/hstherac25/Source/ThirdParty/hstherac25Library/Mac/Release/libExampleLibrary.dylib new file mode 100644 index 0000000..88165a9 Binary files /dev/null and b/Plugins/hstherac25/Source/ThirdParty/hstherac25Library/Mac/Release/libExampleLibrary.dylib differ diff --git a/Plugins/hstherac25/Source/ThirdParty/hstherac25Library/Public/hstherac25Library/ExampleLibrary.h b/Plugins/hstherac25/Source/ThirdParty/hstherac25Library/Public/hstherac25Library/ExampleLibrary.h new file mode 100644 index 0000000..15422eb --- /dev/null +++ b/Plugins/hstherac25/Source/ThirdParty/hstherac25Library/Public/hstherac25Library/ExampleLibrary.h @@ -0,0 +1,9 @@ +#if defined _WIN32 || defined _WIN64 +#define EXAMPLELIBRARY_IMPORT __declspec(dllimport) +#elif defined __linux__ +#define EXAMPLELIBRARY_IMPORT __attribute__((visibility("default"))) +#else +#define EXAMPLELIBRARY_IMPORT +#endif + +EXAMPLELIBRARY_IMPORT void ExampleLibraryFunction(); diff --git a/Plugins/hstherac25/Source/ThirdParty/hstherac25Library/hstherac25Library.Build.cs b/Plugins/hstherac25/Source/ThirdParty/hstherac25Library/hstherac25Library.Build.cs new file mode 100644 index 0000000..e761b74 --- /dev/null +++ b/Plugins/hstherac25/Source/ThirdParty/hstherac25Library/hstherac25Library.Build.cs @@ -0,0 +1,37 @@ +// Fill out your copyright notice in the Description page of Project Settings. + +using System.IO; +using UnrealBuildTool; + +public class hstherac25Library : ModuleRules +{ + public hstherac25Library(ReadOnlyTargetRules Target) : base(Target) + { + Type = ModuleType.External; + PublicSystemIncludePaths.Add("$(ModuleDir)/Public"); + + if (Target.Platform == UnrealTargetPlatform.Win64) + { + // Add the import library + PublicAdditionalLibraries.Add(Path.Combine(ModuleDirectory, "x64", "Release", "ExampleLibrary.lib")); + + // Delay-load the DLL, so we can load it from the right place first + PublicDelayLoadDLLs.Add("ExampleLibrary.dll"); + + // Ensure that the DLL is staged along with the executable + RuntimeDependencies.Add("$(PluginDir)/Binaries/ThirdParty/hstherac25Library/Win64/ExampleLibrary.dll"); + } + else if (Target.Platform == UnrealTargetPlatform.Mac) + { + PublicDelayLoadDLLs.Add(Path.Combine(ModuleDirectory, "Mac", "Release", "libExampleLibrary.dylib")); + RuntimeDependencies.Add("$(PluginDir)/Source/ThirdParty/hstherac25Library/Mac/Release/libExampleLibrary.dylib"); + } + else if (Target.Platform == UnrealTargetPlatform.Linux) + { + string ExampleSoPath = Path.Combine("$(PluginDir)", "Binaries", "ThirdParty", "hstherac25Library", "Linux", "x86_64-unknown-linux-gnu", "libExampleLibrary.so"); + PublicAdditionalLibraries.Add(ExampleSoPath); + PublicDelayLoadDLLs.Add(ExampleSoPath); + RuntimeDependencies.Add(ExampleSoPath); + } + } +} diff --git a/Plugins/hstherac25/Source/ThirdParty/hstherac25Library/hstherac25Library.tps b/Plugins/hstherac25/Source/ThirdParty/hstherac25Library/hstherac25Library.tps new file mode 100644 index 0000000..5bfce86 --- /dev/null +++ b/Plugins/hstherac25/Source/ThirdParty/hstherac25Library/hstherac25Library.tps @@ -0,0 +1,6 @@ + + + +Notes: This is a sample module and not actually third party. + + diff --git a/Plugins/hstherac25/Source/ThirdParty/hstherac25Library/x64/Release/ExampleLibrary.dll b/Plugins/hstherac25/Source/ThirdParty/hstherac25Library/x64/Release/ExampleLibrary.dll new file mode 100644 index 0000000..ccb58d8 Binary files /dev/null and b/Plugins/hstherac25/Source/ThirdParty/hstherac25Library/x64/Release/ExampleLibrary.dll differ diff --git a/Plugins/hstherac25/Source/ThirdParty/hstherac25Library/x64/Release/ExampleLibrary.lib b/Plugins/hstherac25/Source/ThirdParty/hstherac25Library/x64/Release/ExampleLibrary.lib new file mode 100644 index 0000000..3c681c9 Binary files /dev/null and b/Plugins/hstherac25/Source/ThirdParty/hstherac25Library/x64/Release/ExampleLibrary.lib differ diff --git a/Plugins/hstherac25/Source/hstherac25/Private/hstherac25.cpp b/Plugins/hstherac25/Source/hstherac25/Private/hstherac25.cpp new file mode 100644 index 0000000..5d9cf8d --- /dev/null +++ b/Plugins/hstherac25/Source/hstherac25/Private/hstherac25.cpp @@ -0,0 +1,55 @@ +// Copyright Epic Games, Inc. All Rights Reserved. + +#include "hstherac25.h" +#include "Misc/MessageDialog.h" +#include "Modules/ModuleManager.h" +#include "Interfaces/IPluginManager.h" +#include "Misc/Paths.h" +#include "HAL/PlatformProcess.h" +#include "hstherac25Library/ExampleLibrary.h" + +#define LOCTEXT_NAMESPACE "Fhstherac25Module" + +void Fhstherac25Module::StartupModule() +{ + // This code will execute after your module is loaded into memory; the exact timing is specified in the .uplugin file per-module + + // Get the base directory of this plugin + FString BaseDir = IPluginManager::Get().FindPlugin("hstherac25")->GetBaseDir(); + + // Add on the relative location of the third party dll and load it + FString LibraryPath; +#if PLATFORM_WINDOWS + LibraryPath = FPaths::Combine(*BaseDir, TEXT("Binaries/ThirdParty/hstherac25Library/Win64/ExampleLibrary.dll")); +#elif PLATFORM_MAC + LibraryPath = FPaths::Combine(*BaseDir, TEXT("Source/ThirdParty/hstherac25Library/Mac/Release/libExampleLibrary.dylib")); +#elif PLATFORM_LINUX + LibraryPath = FPaths::Combine(*BaseDir, TEXT("Binaries/ThirdParty/hstherac25Library/Linux/x86_64-unknown-linux-gnu/libExampleLibrary.so")); +#endif // PLATFORM_WINDOWS + + ExampleLibraryHandle = !LibraryPath.IsEmpty() ? FPlatformProcess::GetDllHandle(*LibraryPath) : nullptr; + + if (ExampleLibraryHandle) + { + // Call the test function in the third party library that opens a message box + ExampleLibraryFunction(); + } + else + { + FMessageDialog::Open(EAppMsgType::Ok, LOCTEXT("ThirdPartyLibraryError", "Failed to load example third party library")); + } +} + +void Fhstherac25Module::ShutdownModule() +{ + // This function may be called during shutdown to clean up your module. For modules that support dynamic reloading, + // we call this function before unloading the module. + + // Free the dll handle + FPlatformProcess::FreeDllHandle(ExampleLibraryHandle); + ExampleLibraryHandle = nullptr; +} + +#undef LOCTEXT_NAMESPACE + +IMPLEMENT_MODULE(Fhstherac25Module, hstherac25) diff --git a/Plugins/hstherac25/Source/hstherac25/Public/hstherac25.h b/Plugins/hstherac25/Source/hstherac25/Public/hstherac25.h new file mode 100644 index 0000000..419008d --- /dev/null +++ b/Plugins/hstherac25/Source/hstherac25/Public/hstherac25.h @@ -0,0 +1,18 @@ +// Copyright Epic Games, Inc. All Rights Reserved. + +#pragma once + +#include "Modules/ModuleManager.h" + +class Fhstherac25Module : public IModuleInterface +{ +public: + + /** IModuleInterface implementation */ + virtual void StartupModule() override; + virtual void ShutdownModule() override; + +private: + /** Handle to the test dll we will load */ + void* ExampleLibraryHandle; +}; diff --git a/Plugins/hstherac25/Source/hstherac25/hstherac25.Build.cs b/Plugins/hstherac25/Source/hstherac25/hstherac25.Build.cs new file mode 100644 index 0000000..fc95785 --- /dev/null +++ b/Plugins/hstherac25/Source/hstherac25/hstherac25.Build.cs @@ -0,0 +1,51 @@ +// Copyright Epic Games, Inc. All Rights Reserved. + +using UnrealBuildTool; + +public class hstherac25 : ModuleRules +{ + public hstherac25(ReadOnlyTargetRules Target) : base(Target) + { + PCHUsage = ModuleRules.PCHUsageMode.UseExplicitOrSharedPCHs; + + PublicIncludePaths.AddRange( + new string[] { + // ... add public include paths required here ... + } + ); + + + PrivateIncludePaths.AddRange( + new string[] { + // ... add other private include paths required here ... + } + ); + + + PublicDependencyModuleNames.AddRange( + new string[] + { + "Core", + "hstherac25Library", + "Projects" + // ... add other public dependencies that you statically link with here ... + } + ); + + + PrivateDependencyModuleNames.AddRange( + new string[] + { + // ... add private dependencies that you statically link with here ... + } + ); + + + DynamicallyLoadedModuleNames.AddRange( + new string[] + { + // ... add any modules that your module loads dynamically here ... + } + ); + } +} diff --git a/Plugins/hstherac25/hstherac25.uplugin b/Plugins/hstherac25/hstherac25.uplugin new file mode 100644 index 0000000..f91b289 --- /dev/null +++ b/Plugins/hstherac25/hstherac25.uplugin @@ -0,0 +1,24 @@ +{ + "FileVersion": 3, + "Version": 1, + "VersionName": "1.0", + "FriendlyName": "hstherac25", + "Description": "", + "Category": "Other", + "CreatedBy": "", + "CreatedByURL": "", + "DocsURL": "", + "MarketplaceURL": "", + "SupportURL": "", + "CanContainContent": true, + "IsBetaVersion": false, + "IsExperimentalVersion": false, + "Installed": false, + "Modules": [ + { + "Name": "hstherac25", + "Type": "Runtime", + "LoadingPhase": "Default" + } + ] +} \ No newline at end of file diff --git a/Source/MyProject/Private/ModeInputTextBox.cpp b/Source/MyProject/Private/ModeInputTextBox.cpp index 134f6fe..c54c4c8 100644 --- a/Source/MyProject/Private/ModeInputTextBox.cpp +++ b/Source/MyProject/Private/ModeInputTextBox.cpp @@ -6,5 +6,32 @@ void UModeInputTextBox::HandleOnTextChanged(FText const & inText) { auto & s = inText.ToString(); auto lastChar = s.LeftChop(1); lastChar.ToUpperInline(); + if (!lastChar.IsEmpty()) { + + switch (myTarget) { + case THSModeTarget::Energy: + switch (lastChar[0]) { + case 'E': + break; + case 'X': + break; + default: + break; + } + break; + case THSModeTarget::OpMode: + switch (lastChar[0]) { + case 'T': + break; + case 'R': + break; + case 'P': + break; + } + break; + default: + break; + } + } SetText(FText::FromString(lastChar)); } diff --git a/Source/MyProject/Private/TheracSimComponent.cpp b/Source/MyProject/Private/TheracSimComponent.cpp new file mode 100644 index 0000000..69fa831 --- /dev/null +++ b/Source/MyProject/Private/TheracSimComponent.cpp @@ -0,0 +1,34 @@ +// Fill out your copyright notice in the Description page of Project Settings. + + +#include "TheracSimComponent.h" + +// Sets default values for this component's properties +UTheracSimComponent::UTheracSimComponent() +{ + // Set this component to be initialized when the game starts, and to be ticked every frame. You can turn these features + // off to improve performance if you don't need them. + PrimaryComponentTick.bCanEverTick = true; + + // ... +} + + +// Called when the game starts +void UTheracSimComponent::BeginPlay() +{ + Super::BeginPlay(); + + // ... + +} + + +// Called every frame +void UTheracSimComponent::TickComponent(float DeltaTime, ELevelTick TickType, FActorComponentTickFunction* ThisTickFunction) +{ + Super::TickComponent(DeltaTime, TickType, ThisTickFunction); + + // ... +} + diff --git a/Source/MyProject/Public/ModeInputTextBox.h b/Source/MyProject/Public/ModeInputTextBox.h index 91cf02b..6e1bd4a 100644 --- a/Source/MyProject/Public/ModeInputTextBox.h +++ b/Source/MyProject/Public/ModeInputTextBox.h @@ -6,6 +6,12 @@ #include "CoreMinimal.h" #include "ModeInputTextBox.generated.h" +UENUM() +enum class THSModeTarget : uint8 { + Energy, + OpMode +}; + /** * */ @@ -14,5 +20,8 @@ class MYPROJECT_API UModeInputTextBox : public UEditableTextBox { GENERATED_BODY() + UPROPERTY(EditAnywhere) + THSModeTarget myTarget; + void HandleOnTextChanged(FText const & inText) override; }; diff --git a/Source/MyProject/Public/TheracSimComponent.h b/Source/MyProject/Public/TheracSimComponent.h new file mode 100644 index 0000000..c39e7be --- /dev/null +++ b/Source/MyProject/Public/TheracSimComponent.h @@ -0,0 +1,28 @@ +// Fill out your copyright notice in the Description page of Project Settings. + +#pragma once + +#include "CoreMinimal.h" +#include "Components/ActorComponent.h" +#include "TheracSimComponent.generated.h" + + +UCLASS( ClassGroup=(Custom), meta=(BlueprintSpawnableComponent) ) +class MYPROJECT_API UTheracSimComponent : public UActorComponent +{ + GENERATED_BODY() + +public: + // Sets default values for this component's properties + UTheracSimComponent(); + +protected: + // Called when the game starts + virtual void BeginPlay() override; + +public: + // Called every frame + virtual void TickComponent(float DeltaTime, ELevelTick TickType, FActorComponentTickFunction* ThisTickFunction) override; + + +};