Added vcpkg and fixed Windows build.

This commit is contained in:
2024-02-05 21:06:48 -08:00
parent 6b2f3e7247
commit 94ce3146c5
19 changed files with 93 additions and 50 deletions

View File

@@ -1,4 +1,4 @@
#include "io/COM.h"
#include "ehs/io/COM.h"
#include "ehs/Str.h"
#include "ehs/Log.h"

View File

@@ -1,4 +1,4 @@
#include "io/FileMonitor_W32.h"
#include "ehs/io/FileMonitor_W32.h"
#include "ehs/Log.h"
#include "ehs/UTF.h"

View File

@@ -1,4 +1,4 @@
#include "io/File_W32.h"
#include "ehs/io/File_W32.h"
namespace ehs
{

View File

@@ -1,7 +1,7 @@
#include "io/Window_W32.h"
#include "io/hid/Keyboard.h"
#include "io/hid/Mouse.h"
#include "system/Thread.h"
#include "ehs/io/Window_W32.h"
#include "ehs/io/hid/Keyboard.h"
#include "ehs/io/hid/Mouse.h"
#include "ehs/system/Thread.h"
#include <hidusage.h>
@@ -108,16 +108,16 @@ namespace ehs
if (!keyboard)
{
UInt_32 bufferSize;
GetRawInputDeviceInfo(hDevice, RIDI_DEVICENAME, NULL, &bufferSize);
GetRawInputDeviceInfo(raw->header.hDevice, RIDI_DEVICENAME, NULL, &bufferSize);
Char_16* deviceName = new Char_16[bufferSize];
if (GetRawInputDeviceInfo(hDevice, RIDI_DEVICENAME, deviceName, &bufferSize) < 0)
if (GetRawInputDeviceInfo(raw->header.hDevice, RIDI_DEVICENAME, deviceName, &bufferSize) < 0)
{
EHS_LOG_INT("Error, 0, "Failed to retrieve device name.");
return;
EHS_LOG_INT("Error", 0, "Failed to retrieve device name.");
return 0;
}
keyboard = new Keyboard(UTF::To_8(deviceName, bufferSize), (UInt_64)raw->header.hDevice);
keyboard = new Keyboard(UTF::To_8(deviceName, (UInt_64)bufferSize), (UInt_64)raw->header.hDevice);
win->ih.AddDevice(keyboard);
}
@@ -134,16 +134,16 @@ namespace ehs
if (!mouse)
{
UInt_32 bufferSize;
GetRawInputDeviceInfo(hDevice, RIDI_DEVICENAME, NULL, &bufferSize);
GetRawInputDeviceInfo(raw->header.hDevice, RIDI_DEVICENAME, nullptr, &bufferSize);
Char_16* deviceName = new Char_16[bufferSize];
if (GetRawInputDeviceInfo(hDevice, RIDI_DEVICENAME, deviceName, &bufferSize) < 0)
if (GetRawInputDeviceInfo(raw->header.hDevice, RIDI_DEVICENAME, deviceName, &bufferSize) < 0)
{
EHS_LOG_INT("Error, 1, "Failed to retrieve device name.");
return;
EHS_LOG_INT("Error", 1, "Failed to retrieve device name.");
return 0;
}
mouse = new Mouse(UTF::To_8(deviceName, bufferSize), (UInt_64)raw->header.hDevice);
mouse = new Mouse(UTF::To_8(deviceName, (UInt_64)bufferSize), (UInt_64)raw->header.hDevice);
win->ih.AddDevice(mouse);
}
@@ -172,9 +172,19 @@ namespace ehs
else if (code == RI_MOUSE_BUTTON_5_UP)
mouse->ButtonUp(Mouse::Five);
else if (code == RI_MOUSE_WHEEL)
mouse->SetScroll({mouse->GetScroll().x, (SInt_8)raw->data.mouse.usButtonData});
{
if (raw->data.mouse.usButtonData < 0)
mouse->ButtonDown(Mouse::ScrollDown);
else if (raw->data.mouse.usButtonData > 0)
mouse->ButtonDown(Mouse::ScrollUp);
}
else if (code == RI_MOUSE_HWHEEL)
mouse->SetScroll({(SInt_8)raw->data.mouse.usButtonData, mouse->GetScroll().y});
{
if (raw->data.mouse.usButtonData < 0)
mouse->ButtonDown(Mouse::ScrollLeft);
else if (raw->data.mouse.usButtonData > 0)
mouse->ButtonDown(Mouse::ScrollRight);
}
}
delete[] data;

View File

@@ -1,4 +1,4 @@
#include "io/audio/AudioDevice_W32.h"
#include "ehs/io/audio/AudioDevice_W32.h"
#include "ehs/Log.h"
namespace ehs

View File

@@ -1,5 +1,5 @@
#include "io/socket/TCP_W32.h"
#include "io/socket/DNS.h"
#include "ehs/io/socket/TCP_W32.h"
#include "ehs/io/socket/DNS.h"
#include <WinSock2.h>
#include <WS2tcpip.h>
@@ -242,7 +242,7 @@ namespace ehs
return;
remoteHostName = address;
remoteAddr = DNS::Resolve(addrType, address);
remoteAddr = DNS::Resolve(address);
remotePort = port;
if (addrType == AddrType::IPV6)

View File

@@ -1,4 +1,4 @@
#include "io/socket/UDP_W32.h"
#include "ehs/io/socket/UDP_W32.h"
#include "ehs/Log.h"
#include <WinSock2.h>
@@ -110,14 +110,14 @@ namespace ehs
bound = false;
}
void UDP::Bind(const Str_8& address, const UInt_16 port)
void UDP::Bind(const AddrType type, const Str_8& address, const UInt_16 port)
{
if (!IsValid() || bound)
return;
if (addrType == AddrType::IPV6)
if (type == AddrType::IPV6)
Bind_v6(address, port);
else if (addrType == AddrType::IPV4)
else if (type == AddrType::IPV4)
Bind_v4(address, port);
this->address = address;
@@ -126,17 +126,17 @@ namespace ehs
bound = true;
}
UInt_64 UDP::Send(const Str_8& address, const UInt_16 port, const Byte *const data, const UInt_64 size)
UInt_64 UDP::Send(const AddrType type, const Str_8& address, const UInt_16 port, const Byte *const data, const UInt_64 size)
{
if (addrType == AddrType::IPV6)
if (type == AddrType::IPV6)
return Send_v6(address, port, data, size);
else if (addrType == AddrType::IPV4)
else if (type == AddrType::IPV4)
return Send_v4(address, port, data, size);
return 0;
}
UInt_64 UDP::Receive(Str_8* const address, UInt_16* const port, Byte* const data, const UInt_64 size)
UInt_64 UDP::Receive(AddrType* type, Str_8* const address, UInt_16* const port, Byte* const data, const UInt_64 size)
{
if (!IsValid())
{
@@ -174,6 +174,7 @@ namespace ehs
return received;
}
*type = AddrType::IPV6;
*address = tmpAddr;
*port = ntohs(remote.sin6_port);
}
@@ -190,6 +191,7 @@ namespace ehs
return received;
}
*type = AddrType::IPV4;
*address = tmpAddr;
*port = ntohs(((sockaddr_in*)&remote)->sin_port);
}

View File

@@ -1,4 +1,4 @@
#include "system/Mutex_W32.h"
#include "ehs/system/Mutex_W32.h"
#include "ehs/Str.h"
#include "ehs/Log.h"

View File

@@ -1,4 +1,4 @@
#include "system/Open_W32.h"
#include "ehs/system/Open_W32.h"
namespace ehs
{

View File

@@ -1,4 +1,4 @@
#include "system/Semaphore_W32.h"
#include "ehs/system/Semaphore_W32.h"
#include "ehs/UTF.h"
#include "ehs/Log.h"

View File

@@ -1,4 +1,4 @@
#include "system/System_W32.h"
#include "ehs/system/System_W32.h"
#include <shellapi.h>