Fix compilation & APIGen issues
This commit is contained in:
@@ -2,8 +2,11 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "Engine/Scripting/ScriptingType.h"
|
||||
|
||||
API_INTERFACE() class FLAXENGINE_API INetworkDriver
|
||||
{
|
||||
DECLARE_SCRIPTING_TYPE_MINIMAL(INetworkDriver);
|
||||
public:
|
||||
virtual void Initialize(const NetworkConfig& config) = 0;
|
||||
virtual void Dispose() = 0;
|
||||
@@ -13,7 +16,7 @@ public:
|
||||
virtual void Disconnect() = 0;
|
||||
virtual void Disconnect(const NetworkConnection& connection) = 0;
|
||||
|
||||
virtual bool PopEvent(NetworkEvent* event);
|
||||
virtual bool PopEvent(NetworkEvent* eventPtr) = 0;
|
||||
|
||||
virtual void SendMessage(NetworkChannelType channelType, const NetworkMessage& message, Array<NetworkConnection, HeapAllocation> targets) = 0;
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
|
||||
API_STRUCT() struct FLAXENGINE_API NetworkConfig
|
||||
{
|
||||
DECLARE_SCRIPTING_TYPE_MINIMAL(NetworkConfig);
|
||||
public:
|
||||
INetworkDriver* NetworkDriver = nullptr;
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
|
||||
API_STRUCT() struct FLAXENGINE_API NetworkConnection
|
||||
{
|
||||
DECLARE_SCRIPTING_TYPE_MINIMAL(NetworkConnection);
|
||||
public:
|
||||
uint32 ConnectionId;
|
||||
};
|
||||
|
||||
@@ -17,6 +17,7 @@ API_ENUM() enum class NetworkEventType
|
||||
|
||||
API_STRUCT() struct FLAXENGINE_API NetworkEvent
|
||||
{
|
||||
DECLARE_SCRIPTING_TYPE_MINIMAL(NetworkEvent);
|
||||
public:
|
||||
API_FIELD();
|
||||
NetworkEventType EventType;
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
|
||||
#include "NetworkMessage.h"
|
||||
#include "NetworkConfig.h"
|
||||
#include "NetworkConnection.h"
|
||||
#include "INetworkDriver.h"
|
||||
|
||||
#include "Engine/Core/Core.h"
|
||||
@@ -77,10 +78,10 @@ void NetworkManager::Disconnect(const NetworkConnection& connection)
|
||||
NetworkDriver->Disconnect(connection);
|
||||
}
|
||||
|
||||
bool NetworkManager::PopEvent(NetworkEvent* event)
|
||||
bool NetworkManager::PopEvent(NetworkEvent* eventPtr)
|
||||
{
|
||||
ASSERT(NetworkDriver != nullptr);
|
||||
return NetworkDriver->PopEvent(event);
|
||||
return NetworkDriver->PopEvent(eventPtr);
|
||||
}
|
||||
|
||||
NetworkMessage NetworkManager::BeginSendMessage()
|
||||
|
||||
@@ -18,7 +18,7 @@ public:
|
||||
API_FUNCTION() static void Disconnect();
|
||||
API_FUNCTION() static void Disconnect(const NetworkConnection& connection);
|
||||
|
||||
API_FUNCTION() static bool PopEvent(NetworkEvent* event);
|
||||
API_FUNCTION() static bool PopEvent(NetworkEvent* eventPtr);
|
||||
|
||||
API_FUNCTION() static NetworkMessage BeginSendMessage();
|
||||
API_FUNCTION() static void AbortSendMessage(const NetworkMessage& message);
|
||||
|
||||
@@ -6,37 +6,42 @@
|
||||
|
||||
API_STRUCT() struct FLAXENGINE_API NetworkMessage
|
||||
{
|
||||
DECLARE_SCRIPTING_TYPE_MINIMAL(NetworkMessage);
|
||||
public:
|
||||
API_FIELD()
|
||||
uint8* Buffer;
|
||||
uint8* Buffer = nullptr;
|
||||
|
||||
API_FIELD()
|
||||
uint32 MessageId; // TODO: Make it read-only
|
||||
uint32 MessageId = 0; // TODO: Make it read-only
|
||||
|
||||
API_FIELD()
|
||||
uint32 BufferSize;
|
||||
uint32 BufferSize = 0;
|
||||
|
||||
API_FIELD()
|
||||
uint32 Length;
|
||||
uint32 Length = 0;
|
||||
|
||||
API_FIELD()
|
||||
uint32 Position;
|
||||
uint32 Position = 0;
|
||||
|
||||
public:
|
||||
NetworkMessage() = default;
|
||||
|
||||
NetworkMessage(uint8* buffer, uint32 messageId, uint32 bufferSize, uint32 length, uint32 position) :
|
||||
Buffer(buffer), MessageId(messageId), BufferSize(bufferSize), Length(length), Position(position)
|
||||
{ }
|
||||
|
||||
~NetworkMessage() = default;
|
||||
|
||||
public:
|
||||
API_FUNCTION() void WriteBytes(uint8* bytes, int numBytes);
|
||||
API_FUNCTION() void ReadBytes(uint8* bytes, int numBytes);
|
||||
void WriteBytes(uint8* bytes, int numBytes);
|
||||
void ReadBytes(uint8* bytes, int numBytes);
|
||||
|
||||
public:
|
||||
API_FUNCTION() void WriteUInt32(uint32 value); // TODO: Macro the shit out of this
|
||||
API_FUNCTION() uint32 ReadUInt32();
|
||||
void WriteUInt32(uint32 value); // TODO: Macro the shit out of this
|
||||
uint32 ReadUInt32();
|
||||
|
||||
public:
|
||||
API_FUNCTION() bool IsValid() const
|
||||
bool IsValid() const
|
||||
{
|
||||
return Buffer != nullptr && BufferSize > 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user