sync simulator state with widget
This commit is contained in:
@ -23,3 +23,4 @@ PackConstructorInitializers: Never
|
|||||||
PointerAlignment: Middle
|
PointerAlignment: Middle
|
||||||
QualifierAlignment: Right
|
QualifierAlignment: Right
|
||||||
ShortNamespaceLines: 0
|
ShortNamespaceLines: 0
|
||||||
|
SortIncludes: Never
|
||||||
|
BIN
Content/LinacLab/MyMyUserWidget.uasset
(Stored with Git LFS)
BIN
Content/LinacLab/MyMyUserWidget.uasset
(Stored with Git LFS)
Binary file not shown.
BIN
Content/LinacLab/vt100_Blueprint.uasset
(Stored with Git LFS)
BIN
Content/LinacLab/vt100_Blueprint.uasset
(Stored with Git LFS)
Binary file not shown.
@ -15,9 +15,5 @@
|
|||||||
"Name": "ModelingToolsEditorMode",
|
"Name": "ModelingToolsEditorMode",
|
||||||
"Enabled": true
|
"Enabled": true
|
||||||
}
|
}
|
||||||
],
|
]
|
||||||
"TargetPlatforms": [],
|
|
||||||
"AdditionalRootDirectories": [],
|
|
||||||
"AdditionalPluginDirectories": [],
|
|
||||||
"EpicSampleNameHash": ""
|
|
||||||
}
|
}
|
@ -1,3 +1,4 @@
|
|||||||
|
#pragma once
|
||||||
#include <HsFFI.h>
|
#include <HsFFI.h>
|
||||||
|
|
||||||
typedef enum ExtCallType {
|
typedef enum ExtCallType {
|
||||||
|
@ -8,6 +8,8 @@
|
|||||||
#include <Internationalization/Text.h>
|
#include <Internationalization/Text.h>
|
||||||
#include <Misc/MessageDialog.h>
|
#include <Misc/MessageDialog.h>
|
||||||
#include <Therac.h>
|
#include <Therac.h>
|
||||||
|
#include <map>
|
||||||
|
#include <Logging/StructuredLog.h>
|
||||||
|
|
||||||
#define LOCTEXT_NAMESPACE "TheracAdapter"
|
#define LOCTEXT_NAMESPACE "TheracAdapter"
|
||||||
|
|
||||||
@ -16,7 +18,7 @@ UTheracAdapterComponent::UTheracAdapterComponent() {
|
|||||||
// Set this component to be initialized when the game starts, and to be ticked
|
// 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
|
// every frame. You can turn these features off to improve performance if you
|
||||||
// don't need them.
|
// don't need them.
|
||||||
// PrimaryComponentTick.bCanEverTick = true;
|
PrimaryComponentTick.bCanEverTick = true;
|
||||||
|
|
||||||
// ...
|
// ...
|
||||||
}
|
}
|
||||||
@ -35,10 +37,17 @@ void UTheracAdapterComponent::BeginPlay() {
|
|||||||
*/
|
*/
|
||||||
Super::BeginPlay();
|
Super::BeginPlay();
|
||||||
wrappedComms = start_machine();
|
wrappedComms = start_machine();
|
||||||
auto si = FText::FromString(StaticCast<char *>(
|
std::map<FText *, StateInfoRequest> hng = {
|
||||||
request_state_info(wrappedComms, RequestActiveSubsystem)
|
{&TreatmentOutcome, RequestTreatmentOutcome},
|
||||||
));
|
{&ActiveSubsystem, RequestActiveSubsystem},
|
||||||
FMessageDialog::Open(EAppMsgType::Ok, si);
|
{&TreatmentState, RequestTreatmentState},
|
||||||
|
{&Reason, RequestReason},
|
||||||
|
{&BeamMode, RequestBeamMode},
|
||||||
|
{&BeamEnergy, RequestBeamEnergy}
|
||||||
|
};
|
||||||
|
for (auto & [hnng, hnnng] : hng) {
|
||||||
|
compMap.Add(hnng, hnnng);
|
||||||
|
}
|
||||||
// ...
|
// ...
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -50,6 +59,15 @@ void UTheracAdapterComponent::TickComponent(
|
|||||||
) {
|
) {
|
||||||
Super::TickComponent(DeltaTime, TickType, ThisTickFunction);
|
Super::TickComponent(DeltaTime, TickType, ThisTickFunction);
|
||||||
|
|
||||||
// ...
|
auto rsi = [&](FText * f) {
|
||||||
|
return FText::FromString(
|
||||||
|
StaticCast<char *>(request_state_info(wrappedComms, *compMap.Find(f)))
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
for (auto & [f, _] : compMap) {
|
||||||
|
// UE_LOGFMT(LogTemp, Warning, "what {dildo}", rsi(f).ToString());
|
||||||
|
*f = rsi(f);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2,31 +2,59 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "CoreMinimal.h"
|
|
||||||
#include "Components/ActorComponent.h"
|
#include "Components/ActorComponent.h"
|
||||||
|
#include "CoreMinimal.h"
|
||||||
#include <HsFFI.h>
|
#include <HsFFI.h>
|
||||||
|
#include <Therac.h>
|
||||||
|
#include <Internationalization/Text.h>
|
||||||
#include "TheracAdapterComponent.generated.h"
|
#include "TheracAdapterComponent.generated.h"
|
||||||
|
|
||||||
|
UCLASS(
|
||||||
|
BlueprintType,
|
||||||
|
ClassGroup = (Custom),
|
||||||
|
meta = (BlueprintSpawnableComponent)
|
||||||
|
)
|
||||||
|
class HSTHERAC25_API UTheracAdapterComponent : public UActorComponent {
|
||||||
|
|
||||||
|
|
||||||
UCLASS( ClassGroup=(Custom), meta=(BlueprintSpawnableComponent) )
|
|
||||||
class HSTHERAC25_API UTheracAdapterComponent : public UActorComponent
|
|
||||||
{
|
|
||||||
GENERATED_BODY()
|
GENERATED_BODY()
|
||||||
|
|
||||||
HsStablePtr wrappedComms;
|
HsStablePtr wrappedComms;
|
||||||
|
|
||||||
|
TMap<FText *, StateInfoRequest> compMap;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
// Sets default values for this component's properties
|
// Sets default values for this component's properties
|
||||||
UTheracAdapterComponent();
|
UTheracAdapterComponent();
|
||||||
|
|
||||||
|
UPROPERTY(BlueprintReadOnly, VisibleAnywhere)
|
||||||
|
FText TreatmentOutcome;
|
||||||
|
|
||||||
|
UPROPERTY(BlueprintReadOnly, VisibleAnywhere)
|
||||||
|
FText ActiveSubsystem;
|
||||||
|
|
||||||
|
// TPhase
|
||||||
|
UPROPERTY(BlueprintReadOnly, VisibleAnywhere)
|
||||||
|
FText TreatmentState;
|
||||||
|
|
||||||
|
// TreatmentOutcome
|
||||||
|
UPROPERTY(BlueprintReadOnly, VisibleAnywhere)
|
||||||
|
FText Reason;
|
||||||
|
|
||||||
|
UPROPERTY(BlueprintReadOnly, VisibleAnywhere)
|
||||||
|
FText BeamMode;
|
||||||
|
|
||||||
|
UPROPERTY(BlueprintReadOnly, VisibleAnywhere)
|
||||||
|
FText BeamEnergy;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// Called when the game starts
|
// Called when the game starts
|
||||||
virtual void BeginPlay() override;
|
virtual void BeginPlay() override;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
// Called every frame
|
// Called every frame
|
||||||
virtual void TickComponent(float DeltaTime, ELevelTick TickType, FActorComponentTickFunction* ThisTickFunction) override;
|
virtual void TickComponent(
|
||||||
|
float DeltaTime,
|
||||||
|
ELevelTick TickType,
|
||||||
|
FActorComponentTickFunction * ThisTickFunction
|
||||||
|
) override;
|
||||||
};
|
};
|
||||||
|
Reference in New Issue
Block a user