Implement initial engio experiments

This commit is contained in:
2023-10-24 17:12:03 -04:00
parent 5381b5708a
commit 0ccc08c7dc
2 changed files with 17 additions and 5 deletions

View File

@@ -134,9 +134,19 @@ void AIntegrationGameModeBase::UpdateTangibles() {
void AIntegrationGameModeBase::ExecuteDebuggingCommand(const FString &fs) { void AIntegrationGameModeBase::ExecuteDebuggingCommand(const FString &fs) {
if (fs == "\\invokeplayer") { if (fs == "\\invokeplayer") {
// FlxLockedWrapper w(LockableWrapper); DPrint(TEXT("Trying to invoke 'myfunction' in lua"));
// int64 player = w.GetActor(); FlxLockedWrapper w(LockableWrapper);
// w->play_invoke_player(w.Get(), player, datapk); FlxStreamBuffer sb;
sb.write_string("myfunction");
sb.write_simple_dynamic_tag(SimpleDynamicTag::NUMBER);
sb.write_double(3.0);
sb.write_simple_dynamic_tag(SimpleDynamicTag::STRING);
sb.write_string("Howdy");
sb.write_simple_dynamic_tag(SimpleDynamicTag::BOOLEAN);
sb.write_bool(true);
std::string_view datapk = sb.view();
int64 player = w.GetActor();
w->play_invoke_engio(w.Get(), player, datapk.size(), datapk.data());
} else { } else {
ConsoleOutput.AppendLine(TEXT("Unknown Command")); ConsoleOutput.AppendLine(TEXT("Unknown Command"));
} }

View File

@@ -4,6 +4,8 @@
#include "lpx-basebuffer.hpp" #include "lpx-basebuffer.hpp"
using FlxSimpleDynamic = SimpleDynamic<std::string>;
class FlxStreamBufferCore { class FlxStreamBufferCore {
private: private:
bool err_eof_on_read_; bool err_eof_on_read_;
@@ -28,13 +30,13 @@ class FlxStreamBuffer : public BaseBuffer<FlxStreamBufferCore, std::string> {
public: public:
using BaseBuffer::BaseBuffer; using BaseBuffer::BaseBuffer;
void write_dxyz(const FVector &xyz) { void write_dvector(const FVector &xyz) {
write_double(xyz.X); write_double(xyz.X);
write_double(xyz.Y); write_double(xyz.Y);
write_double(xyz.Z); write_double(xyz.Z);
} }
FVector read_dxyz() { FVector read_dvector() {
double x = read_double(); double x = read_double();
double y = read_double(); double y = read_double();
double z = read_double(); double z = read_double();