Compare commits

...

37 Commits
v1.2.2 ... main

Author SHA1 Message Date
7bc4b9977d Merge pull request 'Added the capability for custom encryption's to be added to EHC.' (#14) from fix into main
All checks were successful
Build & Release / Windows-AMD64-Build (push) Successful in 6m24s
Build & Release / Linux-AMD64-Build (push) Successful in 13m7s
Build & Release / Linux-AARCH64-Build (push) Successful in 39m52s
Reviewed-on: #14
2024-10-06 23:20:53 -07:00
79860c7d39 Added the capability for custom encryption's to be added to EHC.
Some checks failed
Build & Release / Windows-AMD64-Build (push) Waiting to run
Build & Release / Linux-AARCH64-Build (push) Has been cancelled
Build & Release / Linux-AMD64-Build (push) Has been cancelled
2024-10-06 23:19:42 -07:00
99bab4a6ef Merge pull request 'New Audio and EHC PR' (#13) from audio into main
Some checks failed
Build & Release / Linux-AMD64-Build (push) Failing after 3m34s
Build & Release / Windows-AMD64-Build (push) Successful in 6m44s
Build & Release / Linux-AARCH64-Build (push) Has been cancelled
Reviewed-on: #13
2024-10-06 23:00:31 -07:00
8b01ee3c46 Added the capability for custom encryption's to be added to EHC. 2024-10-06 22:54:29 -07:00
1feff0a25c Moved the Event Horizon Communications to this project. 2024-10-06 20:08:22 -07:00
9b42ad6d74 Simplified audio playback & capturing significantly. 2024-10-06 17:24:32 -07:00
9639329df3 Updated readme. 2024-10-06 01:16:04 -07:00
6cd686a17e Updated readme. 2024-10-06 01:14:14 -07:00
3343f8ca28 Fixed workflow.
All checks were successful
Build & Release / Windows-AMD64-Build (push) Successful in 7m5s
Build & Release / Linux-AMD64-Build (push) Successful in 12m7s
Build & Release / Linux-AARCH64-Build (push) Successful in 37m1s
2024-10-05 19:05:30 -07:00
3b8159b75f Fixed workflow.
Some checks failed
Build & Release / Windows-AMD64-Build (push) Failing after 6m8s
Build & Release / Linux-AMD64-Build (push) Failing after 17m38s
Build & Release / Linux-AARCH64-Build (push) Failing after 36m37s
2024-10-01 21:27:31 -07:00
62e7580d3a Added install dependency for pipewire.
Some checks failed
Build & Release / Linux-AARCH64-Build (push) Failing after 7s
Build & Release / Windows-AMD64-Build (push) Failing after 5m13s
Build & Release / Linux-AMD64-Build (push) Failing after 17m37s
2024-10-01 21:00:00 -07:00
11170006e9 Fixed workflow for Windows.
Some checks failed
Build & Release / Linux-AMD64-Build (push) Failing after 8s
Build & Release / Linux-AARCH64-Build (push) Failing after 14s
Build & Release / Windows-AMD64-Build (push) Failing after 5m15s
2024-10-01 20:19:38 -07:00
37e3ca9360 Fixed workflow for Windows.
Some checks failed
Build & Release / Linux-AMD64-Build (push) Failing after 8s
Build & Release / Linux-AARCH64-Build (push) Failing after 14s
Build & Release / Windows-AMD64-Build (push) Failing after 5m19s
2024-10-01 19:58:35 -07:00
daca00603a Fixed workflow for Windows.
Some checks failed
Build & Release / Linux-AMD64-Build (push) Failing after 8s
Build & Release / Linux-AARCH64-Build (push) Failing after 14s
Build & Release / Windows-AMD64-Build (push) Failing after 6m8s
2024-10-01 19:50:21 -07:00
1f5299ad1b Fixed Win32 audio.
Some checks failed
Build & Release / Linux-AMD64-Build (push) Failing after 8s
Build & Release / Linux-AARCH64-Build (push) Failing after 14s
Build & Release / Windows-AMD64-Build (push) Failing after 5m56s
2024-10-01 18:58:15 -07:00
dfa260b87c Backup. 2024-09-30 20:24:25 -07:00
fc8b771026 Added vcpkg.
Some checks failed
Build & Release / Linux-AMD64-Build (push) Failing after 8s
Build & Release / Linux-AARCH64-Build (push) Failing after 14s
Build & Release / Windows-AMD64-Build (push) Failing after 3m52s
2024-09-30 19:55:44 -07:00
0b77c074cf Added vcpkg.
Some checks failed
Build & Release / Linux-AMD64-Build (push) Failing after 8s
Build & Release / Linux-AARCH64-Build (push) Failing after 13s
Build & Release / Windows-AMD64-Build (push) Failing after 30s
2024-09-30 19:48:07 -07:00
5007a1047a Added vcpkg.
Some checks failed
Build & Release / Linux-AMD64-Build (push) Failing after 7s
Build & Release / Linux-AARCH64-Build (push) Failing after 14s
Build & Release / Windows-AMD64-Build (push) Failing after 30s
2024-09-30 19:22:22 -07:00
25860dc32a Added vcpkg. 2024-09-29 21:07:30 -07:00
d870599a60 Added vcpkg. 2024-09-29 21:06:30 -07:00
9bd3e1cd8d Added vcpkg. 2024-09-29 20:41:37 -07:00
681c0d09be Fixed Mat and CMakeLists 2024-09-16 16:18:49 -07:00
25762b0c29 Backup. 2024-09-03 05:37:23 -07:00
6afa08df82 Updated README.md again. 2024-08-15 19:41:05 -07:00
0a995a3f2c Updated README.md 2024-08-15 19:40:31 -07:00
c607b20bad Cleaned up and fixed some errors in the Json Parser. 2024-08-15 19:28:30 -07:00
2e705627ac Fixed CMakeLists.txt and System_LNX.cpp. 2024-08-15 17:33:04 -07:00
86a35fd668 Added System::GetDirDialog. 2024-08-04 02:09:10 -07:00
8d4420528a Optimized Button class. Added IsPressed and GetPressed methods. 2024-08-04 00:47:38 -07:00
3970b8d402 Fixed Mat and CMakeLists 2024-07-27 18:51:19 -07:00
6522994a1f Fixed Win32 keyboard input. 2024-07-27 10:12:10 -07:00
01a21032a5 Simplified Windows build again. 2024-07-24 15:37:45 -07:00
4d7e7596b6 Simplified Windows build. 2024-07-24 14:58:36 -07:00
97b5300e48 Merge pull request 'dynamic' (#10) from dynamic into main
Reviewed-on: #10
2024-07-24 01:39:29 -07:00
8e7cc39000 Added shared library support. 2024-07-24 01:36:20 -07:00
1b70383448 Started dynamic library support. 2024-07-21 10:45:06 -07:00
160 changed files with 4577 additions and 1439 deletions

View File

@ -8,6 +8,9 @@ on:
jobs: jobs:
Windows-AMD64-Build: Windows-AMD64-Build:
runs-on: windows-x86_64 runs-on: windows-x86_64
defaults:
run:
shell: powershell
steps: steps:
- name: Check out repository code - name: Check out repository code
uses: actions/checkout@v3 uses: actions/checkout@v3
@ -19,8 +22,10 @@ jobs:
- name: Building/Compiling/Installing Project - name: Building/Compiling/Installing Project
run: | run: |
cd ${{ gitea.workspace }} cd ${{ gitea.workspace }}
cmake -A x64 -DCMAKE_BUILD_TYPE=Release --preset=default . vcpkg install
mkdir build
cd build cd build
cmake -A x64 -DCMAKE_BUILD_TYPE=Release ..
cmake --build . --config Release cmake --build . --config Release
cmake --install . cmake --install .
@ -28,10 +33,12 @@ jobs:
run: | run: |
cd ${{ gitea.workspace }} cd ${{ gitea.workspace }}
mkdir bin mkdir bin
mv build/Release/EHS_Dyn.dll bin
mv build/Release/StrToHash.exe bin mv build/Release/StrToHash.exe bin
mv build/Release/zlib1.dll bin mv build/Release/zlib1.dll bin
mkdir lib mkdir lib
mv build/Release/EHS.lib lib mv build/Release/EHS_Stc.lib lib
mv build/Release/EHS_Dyn.lib lib
- name: Zipping Binaries - name: Zipping Binaries
run: | run: |
@ -58,7 +65,7 @@ jobs:
- name: Installing Dependencies - name: Installing Dependencies
run: | run: |
sudo pacman -S --noconfirm doxygen zip alsa-lib libxcb xcb-util-cursor sudo pacman -S --noconfirm doxygen zip alsa-lib libxcb xcb-util-cursor pipewire
- name: Generating Documentation - name: Generating Documentation
run: | run: |
@ -73,10 +80,12 @@ jobs:
- name: Creating Appropriate Directories - name: Creating Appropriate Directories
run: | run: |
cd ${{ gitea.workspace }}
mkdir bin mkdir bin
mv libEHS_Dyn.so bin
mv StrToHash bin mv StrToHash bin
mkdir lib mkdir lib
mv libEHS.a lib mv libEHS_Stc.a lib
- name: Zipping Binaries - name: Zipping Binaries
run: zip -r ehs-linux-amd64.zip include bin lib docs LICENSE RADME.md run: zip -r ehs-linux-amd64.zip include bin lib docs LICENSE RADME.md
@ -100,7 +109,7 @@ jobs:
uses: actions/checkout@v3 uses: actions/checkout@v3
- name: Installing Dependencies - name: Installing Dependencies
run: sudo apt install -y doxygen zip libasound2-dev libxcb1-dev libxcb-xinput-dev libxcb-cursor-dev run: sudo apt install -y doxygen zip libasound2-dev libxcb1-dev libxcb-xinput-dev libxcb-cursor-dev libpipewire-0.3-dev
- name: Generating Documentation - name: Generating Documentation
run: | run: |
@ -115,10 +124,12 @@ jobs:
- name: Creating Appropriate Directories - name: Creating Appropriate Directories
run: | run: |
cd ${{ gitea.workspace }}
mkdir bin mkdir bin
mv libEHS_Dyn.so bin
mv StrToHash bin mv StrToHash bin
mkdir lib mkdir lib
mv libEHS.a lib mv libEHS_Stc.a lib
- name: Zipping Binaries - name: Zipping Binaries
run: zip -r ehs-linux-aarch64.zip include bin lib docs LICENSE README.md run: zip -r ehs-linux-aarch64.zip include bin lib docs LICENSE README.md

View File

@ -13,7 +13,8 @@ project(EHS CXX C)
if (${CMAKE_HOST_SYSTEM_NAME} STREQUAL "Windows") if (${CMAKE_HOST_SYSTEM_NAME} STREQUAL "Windows")
set(IS_OS_WINDOWS TRUE) set(IS_OS_WINDOWS TRUE)
set(USER_HOME_DIRECTORY $ENV{USERPROFILE}) set(USER_HOME_DIRECTORY "$ENV{USERPROFILE}")
string(REPLACE "\\" "/" USER_HOME_DIRECTORY "${USER_HOME_DIRECTORY}")
message("Building for the Windows operating system.") message("Building for the Windows operating system.")
elseif (${CMAKE_HOST_SYSTEM_NAME} STREQUAL "Linux") elseif (${CMAKE_HOST_SYSTEM_NAME} STREQUAL "Linux")
set(IS_OS_LINUX TRUE) set(IS_OS_LINUX TRUE)
@ -39,182 +40,191 @@ endif ()
set(CMAKE_CXX_STANDARD 20) set(CMAKE_CXX_STANDARD 20)
set(EHS_SOURCES set(EHS_SOURCES
src/EHS.cpp include/ehs/EHS.h src/EHS.cpp include/ehs/EHS.h
src/Type.cpp include/ehs/Type.h src/Type.cpp include/ehs/Type.h
src/BaseObj.cpp include/ehs/BaseObj.h src/BaseObj.cpp include/ehs/BaseObj.h
src/GC.cpp include/ehs/GC.h src/GC.cpp include/ehs/GC.h
src/Log.cpp include/ehs/Log.h src/Log.cpp include/ehs/Log.h
src/URI.cpp include/ehs/URI.h src/URI.cpp include/ehs/URI.h
src/Math.cpp include/ehs/Math.h src/Math.cpp include/ehs/Math.h
src/Color4.cpp include/ehs/Color4.h src/Color4.cpp include/ehs/Color4.h
src/Color3.cpp include/ehs/Color3.h src/Color3.cpp include/ehs/Color3.h
src/Version.cpp include/ehs/Version.h src/Version.cpp include/ehs/Version.h
src/Base64.cpp include/ehs/Base64.h src/Base64.cpp include/ehs/Base64.h
src/Data.cpp include/ehs/Data.h src/Data.cpp include/ehs/Data.h
src/Range.cpp include/ehs/Range.h src/Range.cpp include/ehs/Range.h
src/Util.cpp include/ehs/Util.h src/Util.cpp include/ehs/Util.h
src/Task.cpp include/ehs/Task.h src/Task.cpp include/ehs/Task.h
src/DataType.cpp include/ehs/DataType.h src/DataType.cpp include/ehs/DataType.h
include/ehs/Anchor.h include/ehs/Anchor.h
include/ehs/Dock.h include/ehs/Dock.h
include/ehs/HashMap.h include/ehs/HashMap.h
include/ehs/HRNG.h include/ehs/HRNG.h
include/ehs/Link.h include/ehs/Link.h
include/ehs/LinkedList.h include/ehs/LinkedList.h
include/ehs/Mat2.h include/ehs/Mat2.h
include/ehs/Mat3.h include/ehs/Mat3.h
include/ehs/Mat4.h include/ehs/Mat4.h
include/ehs/PRNG.h include/ehs/PRNG.h
include/ehs/Quat.h include/ehs/Quat.h
include/ehs/Rect.h include/ehs/Rect.h
include/ehs/Str.h include/ehs/Str.h
include/ehs/Types.h include/ehs/Types.h
include/ehs/UTF.h include/ehs/UTF.h
include/ehs/Vec2.h include/ehs/Vec2.h
include/ehs/Vec3.h include/ehs/Vec3.h
include/ehs/Vec4.h include/ehs/Vec4.h
include/ehs/Serializer.h include/ehs/Serializer.h
include/ehs/Array.h include/ehs/Array.h
include/ehs/Vector.h include/ehs/Vector.h
include/ehs/SArray.h include/ehs/SArray.h
src/PtrData.cpp include/ehs/PtrData.h src/PtrData.cpp include/ehs/PtrData.h
include/ehs/UniPtr.h include/ehs/UniPtr.h
include/ehs/ShdPtr.h include/ehs/ShdPtr.h
include/ehs/WkPtr.h include/ehs/WkPtr.h
src/db/DbVarTmpl.cpp include/ehs/db/DbVarTmpl.h src/db/DbVarTmpl.cpp include/ehs/db/DbVarTmpl.h
src/system/CPU.cpp include/ehs/system/CPU.h src/system/CPU.cpp include/ehs/system/CPU.h
src/system/Thread.cpp include/ehs/system/Thread.h src/system/Thread.cpp include/ehs/system/Thread.h
src/system/BaseMutex.cpp include/ehs/system/BaseMutex.h src/system/BaseMutex.cpp include/ehs/system/BaseMutex.h
src/system/BaseSemaphore.cpp include/ehs/system/BaseSemaphore.h src/system/BaseSemaphore.cpp include/ehs/system/BaseSemaphore.h
src/system/BaseSystem.cpp include/ehs/system/BaseSystem.h src/system/BaseSystem.cpp include/ehs/system/BaseSystem.h
src/system/BaseOpen.cpp include/ehs/system/BaseOpen.h src/system/BaseOpen.cpp include/ehs/system/BaseOpen.h
include/ehs/system/Architecture.h include/ehs/system/Architecture.h
include/ehs/system/Mutex.h include/ehs/system/Mutex.h
include/ehs/system/Open.h include/ehs/system/Open.h
include/ehs/system/OS.h include/ehs/system/OS.h
include/ehs/system/Semaphore.h include/ehs/system/Semaphore.h
include/ehs/system/System.h include/ehs/system/System.h
src/json/Json.cpp include/ehs/json/Json.h src/json/Json.cpp include/ehs/json/Json.h
src/json/JsonBase.cpp include/ehs/json/JsonBase.h src/json/JsonBase.cpp include/ehs/json/JsonBase.h
src/json/JsonNum.cpp include/ehs/json/JsonNum.h src/json/JsonNum.cpp include/ehs/json/JsonNum.h
src/json/JsonBool.cpp include/ehs/json/JsonBool.h src/json/JsonBool.cpp include/ehs/json/JsonBool.h
src/json/JsonStr.cpp include/ehs/json/JsonStr.h src/json/JsonStr.cpp include/ehs/json/JsonStr.h
src/json/JsonObj.cpp include/ehs/json/JsonObj.h src/json/JsonObj.cpp include/ehs/json/JsonObj.h
src/json/JsonArray.cpp include/ehs/json/JsonArray.h src/json/JsonArray.cpp include/ehs/json/JsonArray.h
src/json/JsonVar.cpp include/ehs/json/JsonVar.h src/json/JsonVar.cpp include/ehs/json/JsonVar.h
src/io/Resource.cpp include/ehs/io/Resource.h src/io/Resource.cpp include/ehs/io/Resource.h
src/io/Console.cpp include/ehs/io/Console.h src/io/Console.cpp include/ehs/io/Console.h
src/io/RIFF_Chunk.cpp include/ehs/io/RIFF_Chunk.h src/io/RIFF_Chunk.cpp include/ehs/io/RIFF_Chunk.h
src/io/RIFF.cpp include/ehs/io/RIFF.h src/io/RIFF.cpp include/ehs/io/RIFF.h
src/io/BaseWindow.cpp include/ehs/io/BaseWindow.h src/io/BaseWindow.cpp include/ehs/io/BaseWindow.h
src/io/BaseFile.cpp include/ehs/io/BaseFile.h src/io/BaseFile.cpp include/ehs/io/BaseFile.h
src/io/Glyph.cpp include/ehs/io/Glyph.h src/io/Glyph.cpp include/ehs/io/Glyph.h
src/io/FontAtlas.cpp include/ehs/io/FontAtlas.h src/io/FontAtlas.cpp include/ehs/io/FontAtlas.h
src/io/BaseFileMonitor.cpp include/ehs/io/BaseFileMonitor.h src/io/BaseFileMonitor.cpp include/ehs/io/BaseFileMonitor.h
include/ehs/io/COM.h include/ehs/io/COM.h
include/ehs/io/File.h include/ehs/io/File.h
include/ehs/io/FileMonitor.h include/ehs/io/FileMonitor.h
include/ehs/io/Window.h include/ehs/io/Window.h
src/io/socket/Request.cpp include/ehs/io/socket/Request.h include/ehs/io/socket/Socket.h
src/io/socket/Response.cpp include/ehs/io/socket/Response.h src/io/socket/Request.cpp include/ehs/io/socket/Request.h
src/io/socket/BaseDNS.cpp include/ehs/io/socket/BaseDNS.h src/io/socket/Response.cpp include/ehs/io/socket/Response.h
src/io/socket/BaseUDP.cpp include/ehs/io/socket/BaseUDP.h src/io/socket/BaseDNS.cpp include/ehs/io/socket/BaseDNS.h
src/io/socket/BaseTCP.cpp include/ehs/io/socket/BaseTCP.h include/ehs/io/socket/DNS.h
src/io/socket/SSL.cpp include/ehs/io/socket/SSL.h src/io/socket/BaseUDP.cpp include/ehs/io/socket/BaseUDP.h
include/ehs/io/socket/UDP.h
src/io/socket/BaseTCP.cpp include/ehs/io/socket/BaseTCP.h
include/ehs/io/socket/TCP.h
src/io/socket/SSL.cpp include/ehs/io/socket/SSL.h
src/io/socket/rest/Twitch.cpp include/ehs/io/socket/rest/Twitch.h include/ehs/io/socket/ehc/NetUtils.h
src/io/socket/rest/TwitchChat.cpp include/ehs/io/socket/rest/TwitchChat.h src/io/socket/EHC.cpp include/ehs/io/socket/EHC.h
src/io/socket/rest/Spotify.cpp include/ehs/io/socket/rest/Spotify.h src/io/socket/ehc/NetFrags.cpp include/ehs/io/socket/ehc/NetFrags.h
include/ehs/io/socket/Socket.h src/io/socket/ehc/NetEnd.cpp include/ehs/io/socket/ehc/NetEnd.h
include/ehs/io/socket/TCP.h src/io/socket/ehc/NetSys.cpp include/ehs/io/socket/ehc/NetSys.h
include/ehs/io/socket/UDP.h src/io/socket/ehc/NetOp.cpp include/ehs/io/socket/ehc/NetOp.h
include/ehs/io/socket/DNS.h
src/io/audio/Audio.cpp include/ehs/io/audio/Audio.h src/io/socket/rest/Twitch.cpp include/ehs/io/socket/rest/Twitch.h
src/io/audio/BaseAudioDevice.cpp include/ehs/io/audio/BaseAudioDevice.h src/io/socket/rest/TwitchChat.cpp include/ehs/io/socket/rest/TwitchChat.h
src/io/audio/AudioCodec.cpp include/ehs/io/audio/AudioCodec.h src/io/socket/rest/Spotify.cpp include/ehs/io/socket/rest/Spotify.h
include/ehs/io/audio/AudioDevice.h
src/io/img/PNG.cpp include/ehs/io/img/PNG.h src/io/audio/Audio.cpp include/ehs/io/audio/Audio.h
src/io/img/Img.cpp include/ehs/io/img/Img.h src/io/audio/BaseAudioDevice.cpp include/ehs/io/audio/BaseAudioDevice.h
src/io/img/PNG_Chunk.cpp include/ehs/io/img/PNG_Chunk.h src/io/audio/AudioCodec.cpp include/ehs/io/audio/AudioCodec.h
src/io/img/ImgCodec.cpp include/ehs/io/img/ImgCodec.h include/ehs/io/audio/AudioDevice.h
include/ehs/io/mdl/Vertex.h src/io/img/PNG.cpp include/ehs/io/img/PNG.h
src/io/model/Mesh.cpp include/ehs/io/mdl/Mesh.h src/io/img/Img.cpp include/ehs/io/img/Img.h
src/io/model/Bone.cpp include/ehs/io/mdl/Bone.h src/io/img/PNG_Chunk.cpp include/ehs/io/img/PNG_Chunk.h
src/io/model/Mdl.cpp include/ehs/io/mdl/Mdl.h src/io/img/ImgCodec.cpp include/ehs/io/img/ImgCodec.h
src/io/model/Animation.cpp include/ehs/io/mdl/Animation.h
src/io/model/AnimBone.cpp include/ehs/io/mdl/AnimBone.h
src/io/model/KeyFrame.cpp include/ehs/io/mdl/KeyFrame.h
src/io/model/PropertyChange.cpp include/ehs/io/mdl/PropertyChange.h
src/io/hid/ButtonState.cpp include/ehs/io/hid/ButtonState.h include/ehs/io/mdl/Vertex.h
src/io/hid/Button.cpp include/ehs/io/hid/Button.h src/io/model/Mesh.cpp include/ehs/io/mdl/Mesh.h
src/io/hid/Mouse.cpp include/ehs/io/hid/Mouse.h src/io/model/Bone.cpp include/ehs/io/mdl/Bone.h
src/io/hid/Keyboard.cpp include/ehs/io/hid/Keyboard.h src/io/model/Mdl.cpp include/ehs/io/mdl/Mdl.h
src/io/hid/HID.cpp include/ehs/io/hid/HID.h src/io/model/Animation.cpp include/ehs/io/mdl/Animation.h
src/io/hid/InputHandler.cpp include/ehs/io/hid/InputHandler.h src/io/model/AnimBone.cpp include/ehs/io/mdl/AnimBone.h
src/io/hid/Input.cpp include/ehs/io/hid/Input.h src/io/model/KeyFrame.cpp include/ehs/io/mdl/KeyFrame.h
src/io/model/MdlCodec.cpp src/io/model/PropertyChange.cpp include/ehs/io/mdl/PropertyChange.h
include/ehs/io/mdl/MdlCodec.h
include/ehs/io/UsbBase.h src/io/hid/ButtonState.cpp include/ehs/io/hid/ButtonState.h
src/io/UsbBase.cpp src/io/hid/Button.cpp include/ehs/io/hid/Button.h
include/ehs/db/DbTable.h src/io/hid/Mouse.cpp include/ehs/io/hid/Mouse.h
include/ehs/db/DbObject.h src/io/hid/Keyboard.cpp include/ehs/io/hid/Keyboard.h
include/ehs/db/DbVar.h src/io/hid/HID.cpp include/ehs/io/hid/HID.h
src/db/DbVar.cpp src/io/hid/InputHandler.cpp include/ehs/io/hid/InputHandler.h
include/ehs/db/Database.h src/io/hid/Input.cpp include/ehs/io/hid/Input.h
src/db/DbObject.cpp src/io/model/MdlCodec.cpp
src/db/Database.cpp include/ehs/io/mdl/MdlCodec.h
src/db/Database.cpp include/ehs/io/UsbBase.h
src/db/DbTable.cpp src/io/UsbBase.cpp
include/ehs/io/BaseDirectory.h include/ehs/db/DbTable.h
src/io/BaseDirectory.cpp include/ehs/db/DbObject.h
include/ehs/io/Directory.h include/ehs/db/DbVar.h
src/db/DbVar.cpp
include/ehs/db/Database.h
src/db/DbObject.cpp
src/db/Database.cpp
src/db/Database.cpp
src/db/DbTable.cpp
include/ehs/io/BaseDirectory.h
src/io/BaseDirectory.cpp
include/ehs/io/Directory.h
include/ehs/io/socket/ehc/NetEnc.h
src/io/socket/ehc/NetEnc.cpp
) )
if (IS_OS_WINDOWS) if (IS_OS_WINDOWS)
list(APPEND EHS_SOURCES list(APPEND EHS_SOURCES
src/io/socket/UDP_W32.cpp include/ehs/io/socket/UDP_W32.h src/io/socket/UDP_W32.cpp include/ehs/io/socket/UDP_W32.h
src/io/socket/TCP_W32.cpp include/ehs/io/socket/TCP_W32.h src/io/socket/TCP_W32.cpp include/ehs/io/socket/TCP_W32.h
src/io/socket/DNS_W32.cpp include/ehs/io/socket/DNS_W32.h src/io/socket/DNS_W32.cpp include/ehs/io/socket/DNS_W32.h
src/system/Semaphore_W32.cpp include/ehs/system/Semaphore_W32.h src/system/Semaphore_W32.cpp include/ehs/system/Semaphore_W32.h
src/system/System_W32.cpp include/ehs/system/System_W32.h src/system/System_W32.cpp include/ehs/system/System_W32.h
src/system/Mutex_W32.cpp include/ehs/system/Mutex_W32.h src/system/Mutex_W32.cpp include/ehs/system/Mutex_W32.h
src/system/Open_W32.cpp include/ehs/system/Open_W32.h src/system/Open_W32.cpp include/ehs/system/Open_W32.h
src/io/audio/audioDevice_W32.cpp include/ehs/io/audio/audioDevice_W32.h src/io/audio/audioDevice_W32.cpp include/ehs/io/audio/audioDevice_W32.h
src/io/File_W32.cpp include/ehs/io/File_W32.h src/io/File_W32.cpp include/ehs/io/File_W32.h
src/io/FileMonitor_W32.cpp include/ehs/io/FileMonitor_W32.h src/io/FileMonitor_W32.cpp include/ehs/io/FileMonitor_W32.h
src/io/Window_W32.cpp include/ehs/io/Window_W32.h src/io/Window_W32.cpp include/ehs/io/Window_W32.h
src/io/COM.cpp include/ehs/io/COM.h src/io/COM.cpp include/ehs/io/COM.h
src/system/CPU_MSVC_AMD64.asm src/HRNG_MSVC.asm src/Math_MSVC_AMD64.asm src/system/CPU_MSVC_AMD64.asm src/HRNG_MSVC.asm src/Math_MSVC_AMD64.asm
src/io/Directory_W32.cpp include/ehs/io/Directory_W32.h src/io/Directory_W32.cpp include/ehs/io/Directory_W32.h
) )
elseif (IS_OS_LINUX) elseif (IS_OS_LINUX)
list(APPEND EHS_SOURCES list(APPEND EHS_SOURCES
src/io/socket/UDP_BSD.cpp include/ehs/io/socket/UDP_BSD.h src/io/socket/UDP_BSD.cpp include/ehs/io/socket/UDP_BSD.h
src/io/socket/TCP_BSD.cpp include/ehs/io/socket/TCP_BSD.h src/io/socket/TCP_BSD.cpp include/ehs/io/socket/TCP_BSD.h
src/io/socket/DNS_LNX.cpp include/ehs/io/socket/DNS_LNX.h src/io/socket/DNS_LNX.cpp include/ehs/io/socket/DNS_LNX.h
src/system/Semaphore_P.cpp include/ehs/system/Semaphore_P.h src/system/Semaphore_P.cpp include/ehs/system/Semaphore_P.h
src/system/System_LNX.cpp include/ehs/system/System_LNX.h src/system/System_LNX.cpp include/ehs/system/System_LNX.h
src/system/Open_UNX.cpp include/ehs/system/Open_UNX.h src/system/Open_UNX.cpp include/ehs/system/Open_UNX.h
src/io/File_UNX.cpp include/ehs/io/File_UNX.h src/io/File_UNX.cpp include/ehs/io/File_UNX.h
src/io/FileMonitor_UNX.cpp include/ehs/io/FileMonitor_UNX.h src/io/FileMonitor_UNX.cpp include/ehs/io/FileMonitor_UNX.h
src/system/Mutex_PT.cpp include/ehs/system/Mutex_PT.h src/system/Mutex_PT.cpp include/ehs/system/Mutex_PT.h
src/io/audio/AudioDevice_ALSA.cpp include/ehs/io/audio/AudioDevice_ALSA.h src/io/audio/AudioDevice_PW.cpp include/ehs/io/audio/AudioDevice_PW.h
src/system/FileSystem.cpp include/ehs/system/FileSystem.h src/system/FileSystem.cpp include/ehs/system/FileSystem.h
src/system/User.cpp include/ehs/system/User.h src/system/User.cpp include/ehs/system/User.h
src/io/Directory_LNX.cpp include/ehs/io/Directory_LNX.h src/io/Directory_LNX.cpp include/ehs/io/Directory_LNX.h
src/io/Usb_LNX.cpp include/ehs/io/Usb_LNX.h src/io/Usb_LNX.cpp include/ehs/io/Usb_LNX.h
) )
set(LINUX_WINDOW_SYSTEM "Wayland" CACHE STRING "Linux Window System") #set(LINUX_WINDOW_SYSTEM "Wayland" CACHE STRING "Linux Window System")
if (LINUX_WINDOW_SYSTEM STREQUAL "Wayland") if (LINUX_WINDOW_SYSTEM STREQUAL "Wayland")
add_compile_definitions(EHS_WS_WAYLAND) add_compile_definitions(EHS_WS_WAYLAND)
@ -239,23 +249,37 @@ endif()
#set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC") #set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC")
#message("${CMAKE_CXX_FLAGS}") #message("${CMAKE_CXX_FLAGS}")
add_library(EHS ${EHS_SOURCES}) add_library(EHS_Stc STATIC ${EHS_SOURCES})
add_library(EHS_Dyn SHARED ${EHS_SOURCES})
add_executable(StrToHash src/StrToHash.cpp) add_executable(StrToHash src/StrToHash.cpp)
target_include_directories(EHS PUBLIC ${PROJECT_SOURCE_DIR}/include) target_compile_definitions(EHS_Dyn PRIVATE EHS_LIB_EXPORT)
target_include_directories(EHS_Stc PUBLIC ${PROJECT_SOURCE_DIR}/include)
target_include_directories(EHS_Dyn PUBLIC ${PROJECT_SOURCE_DIR}/include)
if (IS_OS_LINUX) if (IS_OS_LINUX)
set(CMAKE_INSTALL_PREFIX "${USER_HOME_DIRECTORY}/.local") set(CMAKE_INSTALL_PREFIX "${USER_HOME_DIRECTORY}/.local")
install(TARGETS EHS_Dyn LIBRARY DESTINATION "bin")
find_package(PkgConfig REQUIRED)
pkg_check_modules(PIPEWIRE REQUIRED libpipewire-0.3)
target_include_directories(EHS_Stc PRIVATE ${PIPEWIRE_INCLUDE_DIRS})
target_include_directories(EHS_Dyn PRIVATE ${PIPEWIRE_INCLUDE_DIRS})
elseif (IS_OS_WINDOWS) elseif (IS_OS_WINDOWS)
set(CMAKE_INSTALL_PREFIX "${USER_HOME_DIRECTORY}/EHS") set(CMAKE_INSTALL_PREFIX "${USER_HOME_DIRECTORY}/EHS")
install(TARGETS EHS_Dyn LIBRARY DESTINATION "lib")
install(TARGETS EHS_Dyn RUNTIME DESTINATION "bin")
file(GLOB DLL_FILES "${CMAKE_CURRENT_BINARY_DIR}/*.dll")
install(FILES ${DLL_FILES} DESTINATION "bin")
endif () endif ()
install(TARGETS EHS DESTINATION lib) install(TARGETS EHS_Stc DESTINATION "lib")
install(TARGETS StrToHash DESTINATION "bin")
install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/include/ DESTINATION include) install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/include/" DESTINATION "include")
install(TARGETS StrToHash DESTINATION bin)
find_package(ZLIB REQUIRED) find_package(ZLIB REQUIRED)
if (ZLIB_FOUND) if (ZLIB_FOUND)
@ -271,16 +295,22 @@ else ()
message(STATUS "OpenSSL was not found.") message(STATUS "OpenSSL was not found.")
endif () endif ()
target_link_libraries(EHS OpenSSL::SSL OpenSSL::Crypto ZLIB::ZLIB) target_link_libraries(EHS_Stc OpenSSL::SSL OpenSSL::Crypto ZLIB::ZLIB)
target_link_libraries(EHS_Dyn OpenSSL::SSL OpenSSL::Crypto ZLIB::ZLIB)
target_link_libraries(StrToHash OpenSSL::SSL OpenSSL::Crypto ZLIB::ZLIB)
if (IS_OS_WINDOWS) if (IS_OS_WINDOWS)
target_link_libraries(StrToHash ws2_32 avrt EHS) target_link_libraries(EHS_Dyn avrt ws2_32)
target_link_libraries(StrToHash ws2_32 avrt EHS_Stc)
elseif (IS_OS_LINUX) elseif (IS_OS_LINUX)
if (LINUX_WINDOW_SYSTEM STREQUAL "Wayland") if (LINUX_WINDOW_SYSTEM STREQUAL "Wayland")
target_link_libraries(EHS_Dyn wayland-client)
target_link_libraries(StrToHash wayland-client) target_link_libraries(StrToHash wayland-client)
elseif (LINUX_WINDOW_SYSTEM STREQUAL "XCB") elseif (LINUX_WINDOW_SYSTEM STREQUAL "XCB")
target_link_libraries(EHS_Dyn xcb xcb-cursor xcb-xfixes xcb-xinput)
target_link_libraries(StrToHash xcb xcb-cursor xcb-xfixes xcb-xinput) target_link_libraries(StrToHash xcb xcb-cursor xcb-xfixes xcb-xinput)
endif () endif ()
target_link_libraries(StrToHash z asound EHS) target_link_libraries(EHS_Dyn z asound pipewire-0.3)
target_link_libraries(StrToHash z asound EHS_Stc)
endif () endif ()

View File

@ -1,12 +0,0 @@
{
"version": 3,
"configurePresets": [
{
"name": "default",
"binaryDir": "${sourceDir}/build",
"cacheVariables": {
"CMAKE_TOOLCHAIN_FILE": "$env{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake"
}
}
]
}

View File

@ -73,8 +73,10 @@ Wayland Window System. Wayland support is currently not fully supported yet, use
- [CMake](https://cmake.org/) - [CMake](https://cmake.org/)
- [vcpkg](https://learn.microsoft.com/en-us/vcpkg/get_started/get-started?pivots=shell-cmd) - [vcpkg](https://learn.microsoft.com/en-us/vcpkg/get_started/get-started?pivots=shell-cmd)
`vcpkg install` - Use this command in the directory where `vcpkg.json` is located to download/install dependencies.
### Building ### Building
`cmake -A x64 -DCMAKE_BUILD_TYPE=Release --preset=default /path/to/source` `cmake -A x64 -DCMAKE_BUILD_TYPE=Release /path/to/source`
### Compiling ### Compiling
`cmake --build /path/to/build --config Release` `cmake --build /path/to/build --config Release`
@ -89,12 +91,10 @@ This will require the terminal to be running in administrator mode.
#include <ehs/EHS.h> #include <ehs/EHS.h>
#include <ehs/io/Console.h> #include <ehs/io/Console.h>
ehs::Int_32 Main(ehs::Str_8* appName, ehs::Str_8* appVerId, ehs::Version* appVer) int main()
{ {
// Simple identifying meta-data for the logger. // Simple identifying meta-data for the logger.
*appName = "Simple Example App"; // The application's name ehs::Initialize("Simple Example App", "Release", {1, 0, 0});
*appVerId = "Release"; // The app's version prefix; i.e. Alpha, Beta or Release as an example.
*appVer = {1, 0, 0}; // The app's version major, minor and patch number.
ehs::Console::Write_8("How old are you?"); // Write to the console in UTF_8 character encoding. ehs::Console::Write_8("How old are you?"); // Write to the console in UTF_8 character encoding.
@ -103,13 +103,15 @@ ehs::Int_32 Main(ehs::Str_8* appName, ehs::Str_8* appVerId, ehs::Version* appVer
if (!response.IsNum()) if (!response.IsNum())
{ {
ehs::Console::Clear(); // Clear the console's buffer. ehs::Console::Clear(); // Clear the console's buffer.
return Main(appName, appVerId, appVer); // Repeat process if given response is not a number. return main(); // Repeat process if given response is not a number.
} }
ehs::UInt_8 age = response.ToDecimal<ehs::UInt_8>(); // Converts the string number into a number based primitive. ehs::UInt_8 age = response.ToDecimal<ehs::UInt_8>(); // Converts the string number into a number based primitive.
ehs::Console::Write("Your age is " + ehs::Str_8::FromNum(age) + "."); // Write the console with the age converted back to string. ehs::Console::Write("Your age is " + ehs::Str_8::FromNum(age) + "."); // Write the console with the age converted back to string.
ehs::Uninitialize();
return 0; return 0;
} }
``` ```

View File

@ -5,20 +5,20 @@
namespace ehs namespace ehs
{ {
class Base64 class EHS_LIB_IO Base64
{ {
private: private:
static const char ascii[]; static const char ascii[];
public: public:
static Str_8 Encode(const Str_8 input); static Str_8 Encode(const Str_8 &input);
static Str_8 Decode(const Str_8 input); static Str_8 Decode(const Str_8 &input);
private: private:
static char Find(const char c); static char Find(char c);
static bool IsBase64(const char c); static bool IsBase64(char c);
}; };
} }

View File

@ -5,7 +5,7 @@
namespace ehs namespace ehs
{ {
class BaseObj class EHS_LIB_IO BaseObj
{ {
private: private:
Type* hierarchy; Type* hierarchy;

View File

@ -4,7 +4,7 @@
namespace ehs namespace ehs
{ {
class Color3 class EHS_LIB_IO Color3
{ {
public: public:
float r; float r;
@ -13,13 +13,13 @@ namespace ehs
Color3(); Color3();
Color3(const float scalar); Color3(float scalar);
Color3(const float r, const float g, const float b); Color3(float r, float g, float b);
Color3(const Color3& color); Color3(const Color3& color);
Color3& operator=(const float scalar); Color3& operator=(float scalar);
Color3& operator=(const Color3& color); Color3& operator=(const Color3& color);
@ -27,9 +27,9 @@ namespace ehs
bool operator!=(const Color3& color) const; bool operator!=(const Color3& color) const;
float operator[](const UInt_64 i) const; float operator[](UInt_64 i) const;
float& operator[](const UInt_64 i); float& operator[](UInt_64 i);
Color3& operator*=(const Color3& color); Color3& operator*=(const Color3& color);

View File

@ -5,7 +5,7 @@
namespace ehs namespace ehs
{ {
class Color4 class EHS_LIB_IO Color4
{ {
public: public:
float r; float r;
@ -15,15 +15,15 @@ namespace ehs
Color4(); Color4();
Color4(const float scalar); Color4(float scalar);
explicit Color4(const Color3& color); explicit Color4(const Color3& color);
Color4(const float r, const float g, const float b, const float a = 1.0f); Color4(float r, float g, float b, float a = 1.0f);
Color4(const Color4& color); Color4(const Color4& color);
Color4& operator=(const float scalar); Color4& operator=(float scalar);
Color4& operator=(const Color3& color); Color4& operator=(const Color3& color);
@ -33,9 +33,9 @@ namespace ehs
bool operator!=(const Color4& color) const; bool operator!=(const Color4& color) const;
float operator[](const UInt_64 i) const; float operator[](UInt_64 i) const;
float& operator[](const UInt_64 i); float& operator[](UInt_64 i);
Color4& operator*=(const Color4& color); Color4& operator*=(const Color4& color);

View File

@ -5,7 +5,7 @@
namespace ehs namespace ehs
{ {
class Data class EHS_LIB_IO Data
{ {
public: public:
template<typename T> template<typename T>

View File

@ -21,9 +21,9 @@ namespace ehs
UINT_8 UINT_8
}; };
DataType FromAudioBitDepth(UInt_16 bitDepth); EHS_LIB_IO DataType FromAudioBitDepth(UInt_16 bitDepth);
UInt_8 ToByteDepth(DataType type); EHS_LIB_IO UInt_8 ToByteDepth(DataType type);
UInt_8 ToBitDepth(DataType type); EHS_LIB_IO UInt_8 ToBitDepth(DataType type);
} }

View File

@ -13,51 +13,53 @@
namespace ehs namespace ehs
{ {
enum class MemoryPattern enum class MemoryPattern
{ {
SPEED, SPEED,
SIZE SIZE
}; };
EHS_LIB_IO void Initialize(Str_8 appName, Str_8 appVerId, const Version &appVer);
EHS_LIB_IO void Uninitialize();
/// Retrieves the UTF32 C-style string as "Event Horizon Standard" /// Retrieves the UTF32 C-style string as "Event Horizon Standard"
/// @returns The result. /// @returns The result.
const Char_32* GetName_32(); EHS_LIB_IO const Char_32* GetName_32();
/// Retrieves the UTF16 C-style string as "Event Horizon Standard" /// Retrieves the UTF16 C-style string as "Event Horizon Standard"
/// @returns The result. /// @returns The result.
const Char_16* GetName_16(); EHS_LIB_IO const Char_16* GetName_16();
/// Retrieves the UTF8 C-style string as "Event Horizon Standard" /// Retrieves the UTF8 C-style string as "Event Horizon Standard"
/// @returns The result. /// @returns The result.
const Char_8* GetName_8(); EHS_LIB_IO const Char_8* GetName_8();
Str_8 GetAppName_8(); EHS_LIB_IO Str_8 GetAppName_8();
const Char_32* GetAcronym_32(); EHS_LIB_IO const Char_32* GetAcronym_32();
const Char_16* GetAcronym_16(); EHS_LIB_IO const Char_16* GetAcronym_16();
const Char_8* GetAcronym_8(); EHS_LIB_IO const Char_8* GetAcronym_8();
/// Retrieves the version identifier in UTF32. /// Retrieves the version identifier in UTF32.
/// @returns The result. /// @returns The result.
const Char_32* GetVersionId_32(); EHS_LIB_IO const Char_32* GetVersionId_32();
/// Retrieves the version identifier in UTF16. /// Retrieves the version identifier in UTF16.
/// @returns The result. /// @returns The result.
const Char_16* GetVersionId_16(); EHS_LIB_IO const Char_16* GetVersionId_16();
/// Retrieves the version identifier in UTF8. /// Retrieves the version identifier in UTF8.
/// @returns The result. /// @returns The result.
const Char_8* GetVersionId_8(); EHS_LIB_IO const Char_8* GetVersionId_8();
Str_8 GetAppVersionId_8(); EHS_LIB_IO Str_8 GetAppVersionId_8();
/// Retrieves the current Event Horizon Standard version. /// Retrieves the current Event Horizon Standard version.
/// @returns The result. /// @returns The result.
Version GetVersion(); EHS_LIB_IO Version GetVersion();
Version GetAppVersion(); EHS_LIB_IO Version GetAppVersion();
}; };
extern ehs::SInt_32 Main(ehs::Str_8* appName, ehs::Str_8* appVerId, ehs::Version* appVer);

View File

@ -9,7 +9,7 @@ namespace ehs
{ {
typedef bool (*GcLogic)(BaseObj*); typedef bool (*GcLogic)(BaseObj*);
class GC class EHS_LIB_IO GC
{ {
private: private:
static Array<GcLogic> logic; static Array<GcLogic> logic;

View File

@ -5,7 +5,7 @@
namespace ehs namespace ehs
{ {
class HRNG class EHS_LIB_IO HRNG
{ {
public: public:
static UInt_64 GenerateSeed_u64(); static UInt_64 GenerateSeed_u64();

View File

@ -25,7 +25,7 @@ namespace ehs
/// A helper class for holding error information and handling them. /// A helper class for holding error information and handling them.
/// @tparam T The character data type to use. /// @tparam T The character data type to use.
/// @tparam N The number data type to use. /// @tparam N The number data type to use.
class Log class EHS_LIB_IO Log
{ {
private: private:
static void DefaultRaisedCb(const Log &log); static void DefaultRaisedCb(const Log &log);

View File

@ -120,7 +120,7 @@ namespace ehs
Mat2<T> GetMinor() const Mat2<T> GetMinor() const
{ {
Mat2<T> result(0); Mat2<T> result;
result.data[0] = data[3]; result.data[0] = data[3];
result.data[1] = data[2]; result.data[1] = data[2];
result.data[2] = data[1]; result.data[2] = data[1];
@ -187,7 +187,7 @@ namespace ehs
Mat2<T> GetInverse() const Mat2<T> GetInverse() const
{ {
T det = GetDeterminant(); T det = GetDeterminant();
if (Math::ComCmp(det, 0.0f)) if (Math::ComCmp(det, 0))
return {}; return {};
return GetAdjugate() * (1 / det); return GetAdjugate() * (1 / det);
@ -196,7 +196,7 @@ namespace ehs
void Inverse() void Inverse()
{ {
T det = GetDeterminant(); T det = GetDeterminant();
if (Math::ComCmp(det, 0.0f)) if (Math::ComCmp(det, 0))
return; return;
Adjugate(); Adjugate();
@ -212,6 +212,9 @@ namespace ehs
} }
}; };
template class EHS_LIB_IO Mat2<float>;
template class EHS_LIB_IO Mat2<double>;
typedef Mat2<float> Mat2_f; typedef Mat2<float> Mat2_f;
typedef Mat2<double> Mat2_d; typedef Mat2<double> Mat2_d;
} }

View File

@ -50,7 +50,7 @@ namespace ehs
Mat2<T> result; Mat2<T> result;
for (UInt_8 i = 0; i < 4; ++i) for (UInt_8 i = 0; i < 4; ++i)
result.data[i] = data[i / 2 * 4 + i % 2]; result[i] = data[i / 2 * 4 + i % 2];
return result; return result;
} }
@ -234,7 +234,7 @@ namespace ehs
Mat3<T> GetInverse() const Mat3<T> GetInverse() const
{ {
T det = GetDeterminant(); T det = GetDeterminant();
if (Math::ComCmp(det, 0.0f)) if (Math::ComCmp(det, 0))
return {}; return {};
return GetAdjugate() * (1 / det); return GetAdjugate() * (1 / det);
@ -243,7 +243,7 @@ namespace ehs
void Inverse() void Inverse()
{ {
T det = GetDeterminant(); T det = GetDeterminant();
if (Math::ComCmp(det, 0.0f)) if (Math::ComCmp(det, 0))
return; return;
Adjugate(); Adjugate();
@ -317,6 +317,9 @@ namespace ehs
} }
}; };
template class EHS_LIB_IO Mat3<float>;
template class EHS_LIB_IO Mat3<double>;
typedef Mat3<float> Mat3_f; typedef Mat3<float> Mat3_f;
typedef Mat3<double> Mat3_d; typedef Mat3<double> Mat3_d;
} }

View File

@ -268,7 +268,7 @@ namespace ehs
Mat4<T> GetInverse() const Mat4<T> GetInverse() const
{ {
T det = GetDeterminant(); T det = GetDeterminant();
if (Math::ComCmp(det, 0.0f)) if (Math::ComCmp(det, 0))
return {}; return {};
return GetAdjugate() * (1 / det); return GetAdjugate() * (1 / det);
@ -277,7 +277,7 @@ namespace ehs
void Inverse() void Inverse()
{ {
T det = GetDeterminant(); T det = GetDeterminant();
if (Math::ComCmp(det, 0.0f)) if (Math::ComCmp(det, 0))
return; return;
Adjugate(); Adjugate();
@ -332,14 +332,14 @@ namespace ehs
static Mat4<T> YawRotate(const T angle) static Mat4<T> YawRotate(const T angle)
{ {
T radians = Math::Rads(angle); T radians = Math::Rads<T>(angle);
Mat4<T> result; Mat4<T> result;
result.data[0] = Math::Cos(radians); result.data[0] = Math::Cos<T>(radians);
result.data[2] = -Math::Sin(radians); result.data[2] = -Math::Sin<T>(radians);
result.data[5] = 1; result.data[5] = 1;
result.data[8] = Math::Sin(radians); result.data[8] = Math::Sin<T>(radians);
result.data[10] = Math::Cos(radians); result.data[10] = Math::Cos<T>(radians);
result.data[15] = 1; result.data[15] = 1;
return result; return result;
@ -347,7 +347,7 @@ namespace ehs
static Mat4<T> RollRotate(const T angle) static Mat4<T> RollRotate(const T angle)
{ {
T radians = Math::Rads(angle); T radians = Math::Rads<T>(angle);
Mat4<T> result; Mat4<T> result;
result.data[0] = Math::Cos(radians); result.data[0] = Math::Cos(radians);
@ -367,7 +367,7 @@ namespace ehs
static Mat4<T> RH_Perspective(const T fov, const T aspect, const T zNear, const T zFar) static Mat4<T> RH_Perspective(const T fov, const T aspect, const T zNear, const T zFar)
{ {
const float tanHalfFovy = tan(Math::Rads(fov) / 2.0f); const T tanHalfFovy = Math::Tan<T>(Math::Rads(fov) / 2.0f);
Mat4<T> result; Mat4<T> result;
result[0] = 1.0f / (aspect * tanHalfFovy); result[0] = 1.0f / (aspect * tanHalfFovy);
@ -380,7 +380,7 @@ namespace ehs
static Mat4<T> LH_Perspective(const T fov, const T aspect, const T zNear, const T zFar) static Mat4<T> LH_Perspective(const T fov, const T aspect, const T zNear, const T zFar)
{ {
const float tanHalfFovy = Math::Tan(Math::Rads(fov) / 2.0f); const T tanHalfFovy = Math::Tan<T>(Math::Rads(fov) / 2.0f);
Mat4<T> result; Mat4<T> result;
result[0] = 1.0f / (aspect * tanHalfFovy); result[0] = 1.0f / (aspect * tanHalfFovy);
@ -421,6 +421,9 @@ namespace ehs
} }
}; };
template class EHS_LIB_IO Mat4<float>;
template class EHS_LIB_IO Mat4<double>;
typedef Mat4<float> Mat4_f; typedef Mat4<float> Mat4_f;
typedef Mat4<double> Mat4_d; typedef Mat4<double> Mat4_d;
} }

View File

@ -6,7 +6,7 @@
namespace ehs namespace ehs
{ {
class Math class EHS_LIB_IO Math
{ {
private: private:
static float Sqrt_AVX(const float from); static float Sqrt_AVX(const float from);
@ -26,22 +26,22 @@ namespace ehs
constexpr static double dblEpsilon = 1e-16; constexpr static double dblEpsilon = 1e-16;
/// Absolute tolerance comparison for single precision floats. /// Absolute tolerance comparison for single precision floats.
static bool AbsCmp(const float a, const float b); static bool AbsCmp(float a, float b);
/// Absolute tolerance comparison for double precision floats. /// Absolute tolerance comparison for double precision floats.
static bool AbsCmp(const double a, const double b); static bool AbsCmp(double a, double b);
/// Relative tolerance comparison for single precision floats. /// Relative tolerance comparison for single precision floats.
static bool RelCmp(const float a, const float b); static bool RelCmp(float a, float b);
/// Relative tolerance comparison for double precision floats. /// Relative tolerance comparison for double precision floats.
static bool RelCmp(const double a, const double b); static bool RelCmp(double a, double b);
/// Combined absolute and relative tolerance comparison for single precision floats. /// Combined absolute and relative tolerance comparison for single precision floats.
static bool ComCmp(const float a, const float b); static bool ComCmp(float a, float b);
/// Combined absolute and relative tolerance comparison for double precision floats. /// Combined absolute and relative tolerance comparison for double precision floats.
static bool ComCmp(const double a, const double b); static bool ComCmp(double a, double b);
template<typename T = float> template<typename T = float>
static T Max(const T a, const T b) static T Max(const T a, const T b)

View File

@ -10,9 +10,9 @@ namespace ehs
void* data; void* data;
}; };
bool HasPtrData(void* data); EHS_LIB_IO bool HasPtrData(void* data);
void AddPtrData(void* data); EHS_LIB_IO void AddPtrData(void* data);
bool RemovePtrData(void* data); EHS_LIB_IO bool RemovePtrData(void* data);
} }

View File

@ -564,7 +564,7 @@ namespace ehs
return; return;
} }
Util::Copy(data[dstOffset], src, src.Size(true)); Util::Copy(&data[dstOffset], src, src.Size(true));
} }
/// Copies a C-style string to the referenced string object. /// Copies a C-style string to the referenced string object.
@ -580,7 +580,7 @@ namespace ehs
return; return;
} }
Util::Copy(data[dstOffset], src, srcSize * sizeof(T)); Util::Copy(&data[dstOffset], src, srcSize * sizeof(T));
} }
/// Copies a C-style string to the referenced string object. /// Copies a C-style string to the referenced string object.
@ -595,7 +595,7 @@ namespace ehs
return; return;
} }
Util::Copy(data[dstOffset], src, srcSize * sizeof(T)); Util::Copy(&data[dstOffset], src, srcSize * sizeof(T));
} }
/// Inserts a string at a specified index. /// Inserts a string at a specified index.
@ -747,7 +747,7 @@ namespace ehs
T* result = new T[size + inSize + 1]; T* result = new T[size + inSize + 1];
Util::Copy(result, data, Size(true)); Util::Copy(result, data, Size(true));
Util::Copy(result[size], value, inSize * sizeof(T)); Util::Copy(&result[size], value, inSize * sizeof(T));
result[size + inSize] = 0; result[size + inSize] = 0;
@ -1027,7 +1027,7 @@ namespace ehs
/// @param [in] pattern The search pattern for optimization. /// @param [in] pattern The search pattern for optimization.
/// @param [in] result What index to return where the first instance is found. /// @param [in] result What index to return where the first instance is found.
/// @returns The index where the instance was found with the result varying from the result parameter. /// @returns The index where the instance was found with the result varying from the result parameter.
bool Find(const Str<T, N>& ide, N* const index = nullptr, const SearchPattern pattern = SearchPattern::LEFT_RIGHT, const IndexResult result = IndexResult::BEGINNING) const bool Find(const Str<T, N> &ide, N* const index = nullptr, const SearchPattern pattern = SearchPattern::LEFT_RIGHT, const IndexResult result = IndexResult::BEGINNING) const
{ {
if (pattern == SearchPattern::LEFT_RIGHT) if (pattern == SearchPattern::LEFT_RIGHT)
{ {
@ -1271,8 +1271,11 @@ namespace ehs
/// @note Use "IsNum" before this if the string object is not guaranteed to be a number. /// @note Use "IsNum" before this if the string object is not guaranteed to be a number.
float ToFloat() const float ToFloat() const
{ {
Str<T, N> ide;
ide.Push(46);
N decPoint = size; N decPoint = size;
Find(".", &decPoint); Find(ide, &decPoint);
float result = 0.0f; float result = 0.0f;
float fraction = 0.0f; float fraction = 0.0f;
@ -1297,8 +1300,11 @@ namespace ehs
/// @note Use "IsNum" before this if the string object is not guaranteed to be a number. /// @note Use "IsNum" before this if the string object is not guaranteed to be a number.
double ToDouble() const double ToDouble() const
{ {
Str<T, N> ide;
ide.Push(46);
N decPoint = size; N decPoint = size;
Find(".", &decPoint); Find(ide, &decPoint);
double result = 0.0f; double result = 0.0f;
double fraction = 0.0f; double fraction = 0.0f;
@ -1323,8 +1329,11 @@ namespace ehs
/// @note Use "IsNum" before this if the string object is not guaranteed to be a number. /// @note Use "IsNum" before this if the string object is not guaranteed to be a number.
long double ToLDouble() const long double ToLDouble() const
{ {
Str<T, N> ide;
ide.Push(46);
N decPoint = size; N decPoint = size;
Find(".", &decPoint); Find(ide, &decPoint);
long double result = 0.0f; long double result = 0.0f;
long double fraction = 0.0f; long double fraction = 0.0f;
@ -1679,7 +1688,7 @@ namespace ehs
Str<T, N> result; Str<T, N> result;
if (whole < 0) if (whole < 0)
result += "-"; result.Push(45);
result += Str<T, N>::FromNum(whole); result += Str<T, N>::FromNum(whole);
@ -1691,7 +1700,7 @@ namespace ehs
if (!fraction) if (!fraction)
return result; return result;
result += "."; result.Push(46);
Str<T, N> fResult(maxDecimals); Str<T, N> fResult(maxDecimals);
N i = 0; N i = 0;
@ -1721,7 +1730,7 @@ namespace ehs
Str<T, N> result; Str<T, N> result;
if (whole < 0) if (whole < 0)
result += "-"; result.Push(45);
result += Str<T, N>::FromNum(whole); result += Str<T, N>::FromNum(whole);
@ -1733,7 +1742,7 @@ namespace ehs
if (!fraction) if (!fraction)
return result; return result;
result += "."; result.Push(46);
Str<T, N> fResult(maxDecimals); Str<T, N> fResult(maxDecimals);
N i = 0; N i = 0;
@ -1763,7 +1772,7 @@ namespace ehs
Str<T, N> result; Str<T, N> result;
if (whole < 0) if (whole < 0)
result += "-"; result.Push(45);
result += Str<T, N>::FromNum(whole); result += Str<T, N>::FromNum(whole);
@ -1775,7 +1784,7 @@ namespace ehs
if (!fraction) if (!fraction)
return result; return result;
result += "."; result.Push(46);
Str<T, N> fResult(maxDecimals); Str<T, N> fResult(maxDecimals);
N i = 0; N i = 0;
@ -1870,6 +1879,9 @@ namespace ehs
/// @returns The character count. /// @returns The character count.
static N Len(const T* const str) static N Len(const T* const str)
{ {
if (!str)
return 0;
N count = 0; N count = 0;
while (str[count]) while (str[count])
++count; ++count;
@ -1892,6 +1904,10 @@ namespace ehs
} }
}; };
template class EHS_LIB_IO Str<Char_32, UInt_64>;
template class EHS_LIB_IO Str<Char_16, UInt_64>;
template class EHS_LIB_IO Str<Char_8, UInt_64>;
typedef Str<Char_32, UInt_64> Str_32; typedef Str<Char_32, UInt_64> Str_32;
typedef Str<Char_16, UInt_64> Str_16; typedef Str<Char_16, UInt_64> Str_16;
typedef Str<Char_8, UInt_64> Str_8; typedef Str<Char_8, UInt_64> Str_8;

View File

@ -9,7 +9,7 @@ namespace ehs
{ {
typedef void (*TaskCb)(Serializer<UInt_64>*); typedef void (*TaskCb)(Serializer<UInt_64>*);
class Task class EHS_LIB_IO Task
{ {
private: private:
bool working; bool working;

View File

@ -5,7 +5,7 @@
namespace ehs namespace ehs
{ {
class Type class EHS_LIB_IO Type
{ {
private: private:
friend class BaseObj; friend class BaseObj;

View File

@ -5,7 +5,7 @@
namespace ehs namespace ehs
{ {
class URI class EHS_LIB_IO URI
{ {
public: public:
/// Encodes specialized characters in the URI. /// Encodes specialized characters in the URI.

View File

@ -13,7 +13,7 @@ namespace ehs
}; };
/// A helper class for converting between UTF8, 16 and 32. /// A helper class for converting between UTF8, 16 and 32.
class UTF class EHS_LIB_IO UTF
{ {
public: public:
/// Converts the given UTF16 C-style string into UTF32. /// Converts the given UTF16 C-style string into UTF32.

View File

@ -4,7 +4,7 @@
namespace ehs namespace ehs
{ {
class Util class EHS_LIB_IO Util
{ {
public: public:
static bool Compare(const void* a, const void* b, UInt_64 size); static bool Compare(const void* a, const void* b, UInt_64 size);

View File

@ -5,7 +5,7 @@
namespace ehs namespace ehs
{ {
/// A helper class for storing version major, minor and patch. /// A helper class for storing version major, minor and patch.
class Version class EHS_LIB_IO Version
{ {
public: public:
UInt_32 major; UInt_32 major;

View File

@ -5,7 +5,7 @@
namespace ehs namespace ehs
{ {
class Database class EHS_LIB_IO Database
{ {
private: private:
UInt_64 hashId; UInt_64 hashId;

View File

@ -7,7 +7,7 @@ namespace ehs
{ {
class DbTable; class DbTable;
class DbObject class EHS_LIB_IO DbObject
{ {
private: private:
friend class DbTable; friend class DbTable;

View File

@ -10,7 +10,7 @@ namespace ehs
{ {
class Database; class Database;
class DbTable class EHS_LIB_IO DbTable
{ {
private: private:
friend class Database; friend class Database;

View File

@ -8,7 +8,7 @@ namespace ehs
class DbVarTmpl; class DbVarTmpl;
class DbObject; class DbObject;
class DbVar class EHS_LIB_IO DbVar
{ {
private: private:
friend class DbObject; friend class DbObject;

View File

@ -8,7 +8,7 @@ namespace ehs
{ {
class DbVar; class DbVar;
class DbVarTmpl class EHS_LIB_IO DbVarTmpl
{ {
private: private:
friend class DbTable; friend class DbTable;

View File

@ -5,7 +5,7 @@
namespace ehs namespace ehs
{ {
class BaseDirectory class EHS_LIB_IO BaseDirectory
{ {
public: public:
static Array<Str_8> GetAllFiles(const Str_8 &dir); static Array<Str_8> GetAllFiles(const Str_8 &dir);

View File

@ -25,7 +25,7 @@ namespace ehs
}; };
/// A cross-platform wrapper class that handles native file input/output. /// A cross-platform wrapper class that handles native file input/output.
class BaseFile class EHS_LIB_IO BaseFile
{ {
protected: protected:
Str_8 path; Str_8 path;

View File

@ -11,7 +11,7 @@
namespace ehs namespace ehs
{ {
class BaseFileMonitor class EHS_LIB_IO BaseFileMonitor
{ {
protected: protected:
Str_8 filePath; Str_8 filePath;

View File

@ -18,7 +18,7 @@ namespace ehs
I_BEAM I_BEAM
}; };
class BaseWindow class EHS_LIB_IO BaseWindow
{ {
protected: protected:
bool created; bool created;

View File

@ -20,7 +20,7 @@ namespace ehs
TWO TWO
}; };
class COM class EHS_LIB_IO COM
{ {
private: private:
UInt_8 port; UInt_8 port;

View File

@ -12,7 +12,7 @@ namespace ehs
typedef int ConsoleHdl; typedef int ConsoleHdl;
#endif #endif
class Console class EHS_LIB_IO Console
{ {
private: private:
static ConsoleHdl hdlOut; static ConsoleHdl hdlOut;

View File

@ -4,7 +4,7 @@
namespace ehs namespace ehs
{ {
class Directory : public BaseDirectory class EHS_LIB_IO Directory : public BaseDirectory
{ {
public: public:
static Array<Str_8> GetAllFiles(const Str_8 &dir); static Array<Str_8> GetAllFiles(const Str_8 &dir);

View File

@ -4,7 +4,7 @@
namespace ehs namespace ehs
{ {
class Directory : public BaseDirectory class EHS_LIB_IO Directory : public BaseDirectory
{ {
public: public:
static Array<Str_8> GetAllFiles(const Str_8 &dir); static Array<Str_8> GetAllFiles(const Str_8 &dir);

View File

@ -5,7 +5,7 @@
namespace ehs namespace ehs
{ {
class FileMonitor : public BaseFileMonitor class EHS_LIB_IO FileMonitor : public BaseFileMonitor
{ {
private: private:
int hdl; int hdl;

View File

@ -5,7 +5,7 @@
namespace ehs namespace ehs
{ {
class FileMonitor final : public BaseFileMonitor class EHS_LIB_IO FileMonitor final : public BaseFileMonitor
{ {
private: private:
Handle hdl; Handle hdl;

View File

@ -10,7 +10,7 @@
namespace ehs namespace ehs
{ {
class File : public BaseFile class EHS_LIB_IO File : public BaseFile
{ {
private: private:
int hdl; int hdl;

View File

@ -10,7 +10,7 @@
namespace ehs namespace ehs
{ {
class File : public BaseFile class EHS_LIB_IO File : public BaseFile
{ {
private: private:
HANDLE hdl; HANDLE hdl;

View File

@ -10,7 +10,7 @@
namespace ehs namespace ehs
{ {
class FontAtlas : public BaseObj class EHS_LIB_IO FontAtlas : public BaseObj
{ {
private: private:
UInt_64 hashId; UInt_64 hashId;

View File

@ -7,7 +7,7 @@
namespace ehs namespace ehs
{ {
class Glyph class EHS_LIB_IO Glyph
{ {
private: private:
Char_32 code; Char_32 code;

View File

@ -8,7 +8,7 @@
namespace ehs namespace ehs
{ {
class RIFF class EHS_LIB_IO RIFF
{ {
private: private:
Str_8 type; Str_8 type;

View File

@ -6,7 +6,7 @@
namespace ehs namespace ehs
{ {
class RIFF_Chunk class EHS_LIB_IO RIFF_Chunk
{ {
private: private:
Str_8 id; Str_8 id;

View File

@ -7,7 +7,7 @@
namespace ehs namespace ehs
{ {
class Resource : public BaseObj class EHS_LIB_IO Resource : public BaseObj
{ {
private: private:
ehs::UInt_64 hashId; ehs::UInt_64 hashId;

View File

@ -4,7 +4,7 @@
namespace ehs namespace ehs
{ {
class UsbBase class EHS_LIB_IO UsbBase
{ {
private: private:
UInt_32 bus; UInt_32 bus;

View File

@ -5,7 +5,7 @@
namespace ehs namespace ehs
{ {
class Usb final : public UsbBase class EHS_LIB_IO Usb final : public UsbBase
{ {
private: private:
int hdl; int hdl;

View File

@ -14,7 +14,7 @@
namespace ehs namespace ehs
{ {
class Window : public BaseWindow class EHS_LIB_IO Window : public BaseWindow
{ {
private: private:
UInt_32 owner; UInt_32 owner;
@ -71,13 +71,6 @@ namespace ehs
void SetIcon(const Str_8& filePath); void SetIcon(const Str_8& filePath);
/// Sets the windows client scale.
/// @param [in] w The width in pixels.
/// @param [in] h The height in pixels.
void SetClientSize(const Vec2<UInt_32>& size);
Vec2<UInt_32> GetClientSize();
/// Gets the windows native handle for the operating system or other native tasks. /// Gets the windows native handle for the operating system or other native tasks.
/// @returns The window's native handle. /// @returns The window's native handle.
HWND GetHdl() const; HWND GetHdl() const;

View File

@ -8,7 +8,7 @@
namespace ehs namespace ehs
{ {
class Window : public BaseWindow class EHS_LIB_IO Window : public BaseWindow
{ {
protected: protected:
wl_display *display; wl_display *display;

View File

@ -8,7 +8,7 @@
namespace ehs namespace ehs
{ {
class Window : public BaseWindow class EHS_LIB_IO Window : public BaseWindow
{ {
protected: protected:
friend class Input; friend class Input;

View File

@ -11,7 +11,7 @@
namespace ehs namespace ehs
{ {
class Audio : public Resource class EHS_LIB_IO Audio : public Resource
{ {
private: private:
static Array<AudioCodec> codecs; static Array<AudioCodec> codecs;
@ -81,10 +81,14 @@ namespace ehs
UInt_64 GetSampleCount() const; UInt_64 GetSampleCount() const;
UInt_8 GetFrameSize() const;
UInt_64 GetSize() const; UInt_64 GetSize() const;
float GetLength() const; float GetLength() const;
Byte* GetFrame(UInt_64 frameIndex) const;
Array<Byte> FrameAsMono(UInt_64 frameIndex) const; Array<Byte> FrameAsMono(UInt_64 frameIndex) const;
Array<Byte> FrameAsStereo(UInt_64 frameIndex) const; Array<Byte> FrameAsStereo(UInt_64 frameIndex) const;

View File

@ -8,7 +8,7 @@ namespace ehs
{ {
class Audio; class Audio;
class AudioCodec class EHS_LIB_IO AudioCodec
{ {
private: private:
Str_8 id; Str_8 id;

View File

@ -5,5 +5,5 @@
#if defined(EHS_OS_WINDOWS) #if defined(EHS_OS_WINDOWS)
#include "AudioDevice_W32.h" #include "AudioDevice_W32.h"
#elif defined(EHS_OS_LINUX) #elif defined(EHS_OS_LINUX)
#include "AudioDevice_ALSA.h" #include "AudioDevice_PW.h"
#endif #endif

View File

@ -1,46 +0,0 @@
#pragma once
#include "ehs/EHS.h"
#include "BaseAudioDevice.h"
#include <alsa/asoundlib.h>
namespace ehs
{
class AudioDevice : public BaseAudioDevice
{
private:
snd_pcm_t* hdl;
public:
~AudioDevice() override;
AudioDevice();
AudioDevice(AudioDevice&& device) noexcept;
AudioDevice(const AudioDevice& device);
AudioDevice& operator=(AudioDevice&& device) noexcept;
AudioDevice& operator=(const AudioDevice& device);
void Release() override;
void OpenStream() override;
void CloseStream() override;
UInt_64 GetAvailFrames() const override;
Byte* Map(UInt_64* offset, UInt_64* frames) override;
void UnMap(const UInt_64 offset, const UInt_64 frames) override;
bool IsValid() const override;
static AudioDevice GetDefault(const AudioDeviceType type);
static Array<AudioDevice> Get(const AudioDeviceType type, const AudioDeviceState state);
};
}

View File

@ -0,0 +1,67 @@
#pragma once
#include "ehs/EHS.h"
#include "BaseAudioDevice.h"
#include <pipewire/pipewire.h>
#include <pipewire/loop.h>
#include <pipewire/context.h>
#include <pipewire/stream.h>
#include <spa/param/audio/format-utils.h>
namespace ehs
{
class EHS_LIB_IO AudioDevice final : public BaseAudioDevice
{
private:
static Array<AudioDevice> devices;
static AudioDevice defOut;
static AudioDevice defIn;
UInt_32 id;
Str_8 name;
pw_loop *loop;
pw_context *context;
pw_core *core;
pw_stream *input;
pw_stream *output;
static void RegistryEventGlobal(void *data, UInt_32 id, UInt_32 permissions, const char *type, UInt_32 version, const spa_dict *props);
static void RegistryEventGlobalRemove(void *data, UInt_32 id);
static void OnParamChanged(void *data, UInt_32 id, const spa_pod *param);
public:
~AudioDevice() override;
AudioDevice();
AudioDevice(AudioDevice&& device) noexcept;
AudioDevice(const AudioDevice& device);
AudioDevice& operator=(AudioDevice&& device) noexcept;
AudioDevice& operator=(const AudioDevice& device);
void OpenStream() override;
void CloseStream() override;
UInt_64 SendStream(const void *data, UInt_64 size) override;
UInt_64 ReceiveStream(void *data, UInt_64 size) override;
bool IsStreaming() const override;
bool IsValid() const override;
static AudioDevice GetDefault(AudioDeviceType type);
static Array<AudioDevice> Get(AudioDeviceType type, AudioDeviceState state);
private:
Str_8 GetCategory() const;
};
}

View File

@ -12,7 +12,7 @@ struct IMMDevice;
namespace ehs namespace ehs
{ {
class AudioDevice : public BaseAudioDevice class EHS_LIB_IO AudioDevice final : public BaseAudioDevice
{ {
private: private:
IMMDevice* hdl; IMMDevice* hdl;
@ -33,17 +33,13 @@ namespace ehs
AudioDevice& operator=(const AudioDevice& device); AudioDevice& operator=(const AudioDevice& device);
void Release() override;
void OpenStream() override; void OpenStream() override;
void CloseStream() override; void CloseStream() override;
UInt_64 GetAvailFrames() const override; UInt_64 SendStream(const void *data, UInt_64 outFrameSize) override;
Byte* Map(UInt_64* offset, UInt_64* frames) override; UInt_64 ReceiveStream(void *data, UInt_64 inFrameSize) override;
void UnMap(const UInt_64 offset, const UInt_64 frames) override;
Str_32 GetInterfaceName_32() const; Str_32 GetInterfaceName_32() const;
@ -57,10 +53,12 @@ namespace ehs
Str_8 GetName_8() const; Str_8 GetName_8() const;
bool IsStreaming() const override;
bool IsValid() const override; bool IsValid() const override;
static AudioDevice GetDefault(const AudioDeviceType type); static AudioDevice GetDefault(AudioDeviceType type);
static Array<AudioDevice> Get(const AudioDeviceType type, const AudioDeviceState state); static Array<AudioDevice> Get(AudioDeviceType type, AudioDeviceState state);
}; };
} }

View File

@ -10,8 +10,8 @@ namespace ehs
{ {
enum class AudioDeviceType enum class AudioDeviceType
{ {
OUTPUT = 0x0,
INPUT = 0x1, INPUT = 0x1,
OUTPUT = 0x0,
ALL = 0x2 ALL = 0x2
}; };
@ -23,18 +23,17 @@ namespace ehs
UNPLUGGED = 0x8 UNPLUGGED = 0x8
}; };
class BaseAudioDevice class EHS_LIB_IO BaseAudioDevice
{ {
protected: protected:
AudioDeviceType type; AudioDeviceType type;
DataType dataType; DataType dataType;
UInt_16 bitDepth; UInt_16 byteDepth;
UInt_32 sampleRate; UInt_32 sampleRate;
UInt_32 channels; UInt_32 channels;
UInt_32 period; UInt_32 period;
UInt_32 latency; UInt_32 latency;
UInt_64 maxFrames; UInt_64 maxFrames;
bool streaming;
public: public:
virtual ~BaseAudioDevice() = default; virtual ~BaseAudioDevice() = default;
@ -45,21 +44,21 @@ namespace ehs
BaseAudioDevice& operator=(const BaseAudioDevice& device); BaseAudioDevice& operator=(const BaseAudioDevice& device);
virtual void Release();
virtual void OpenStream(); virtual void OpenStream();
virtual void CloseStream(); virtual void CloseStream();
virtual UInt_64 GetAvailFrames() const; virtual UInt_64 SendStream(const void *data, UInt_64 size);
virtual Byte* Map(UInt_64* offset, UInt_64* frames); virtual UInt_64 ReceiveStream(void *data, UInt_64 size);
virtual void UnMap(const UInt_64 offset, const UInt_64 frames); void BridgeStreams(BaseAudioDevice *input, UInt_64 frameBufferSize);
void BridgeStreams(UInt_64 frameBufferSize);
AudioDeviceType GetType() const; AudioDeviceType GetType() const;
void SetDataType(const DataType newDataType); void SetDataType(DataType newDataType);
DataType GetDataType() const; DataType GetDataType() const;
@ -67,39 +66,39 @@ namespace ehs
UInt_16 GetBitDepth() const; UInt_16 GetBitDepth() const;
void SetSampleRate(const UInt_32 newSampleRate); void SetSampleRate(UInt_32 newSampleRate);
UInt_32 GetSampleRate() const; UInt_32 GetSampleRate() const;
void SetChannels(const UInt_32 newChannels); void SetChannels(UInt_32 newChannels);
UInt_16 GetChannels() const; UInt_16 GetChannels() const;
UInt_32 GetFrameSize() const; UInt_32 GetFrameSize() const;
void SetPeriod(const UInt_32 newPeriod); void SetPeriod(UInt_32 newPeriod);
UInt_32 GetPeriod() const; UInt_32 GetPeriod() const;
void SetLatency(const UInt_32 newLatency); void SetLatency(UInt_32 newLatency);
UInt_32 GetLatency() const; UInt_32 GetLatency() const;
UInt_64 GetMaxFrames() const; UInt_64 GetMaxFrames() const;
bool IsStreaming() const; virtual bool IsStreaming() const;
virtual bool IsValid() const; virtual bool IsValid() const;
/// Retrieves the default audio input/output device. /// Retrieves the default audio input/output device.
/// @param [in] type The audio device type to retrieve. /// @param [in] type The audio device type to retrieve.
/// @param [out] device The default audio device. /// @param [out] device The default audio device.
static BaseAudioDevice GetDefault(const AudioDeviceType type); static BaseAudioDevice GetDefault(AudioDeviceType type);
/// Retrieves a list of audio input/output devices. /// Retrieves a list of audio input/output devices.
/// @param [in] type The audio device type to retrieve. /// @param [in] type The audio device type to retrieve.
/// @param [in] state The audio device state to retrieve. /// @param [in] state The audio device state to retrieve.
/// @param [out] devices The list of audio devices. /// @param [out] devices The list of audio devices.
static Array<BaseAudioDevice> Get(const AudioDeviceType type, const AudioDeviceState state); static Array<BaseAudioDevice> Get(AudioDeviceType type, AudioDeviceState state);
}; };
} }

View File

@ -5,27 +5,33 @@
namespace ehs namespace ehs
{ {
class Button class EHS_LIB_IO Button
{ {
private: private:
Str_8 name;
UInt_32 hash; UInt_32 hash;
Str_8 name;
public: public:
Button(); Button();
Button(const Str_8& name); Button(Str_8 name);
Button(const Button& key); Button(Button &&key) noexcept;
Button& operator=(const Button& key); Button(const Button &key);
bool operator==(const Button& key) const; Button &operator=(Button &&key) noexcept;
bool operator!=(const Button& key) const; Button &operator=(const Button &key);
bool operator==(const Button &key) const;
bool operator!=(const Button &key) const;
UInt_32 GetHash() const;
Str_8 GetName() const; Str_8 GetName() const;
UInt_32 GetHash() const; bool IsValid() const;
}; };
} }

View File

@ -13,7 +13,7 @@ namespace ehs
TOUCHED TOUCHED
}; };
class ButtonState class EHS_LIB_IO ButtonState
{ {
private: private:
Button button; Button button;

View File

@ -7,7 +7,7 @@
namespace ehs namespace ehs
{ {
class HID class EHS_LIB_IO HID
{ {
protected: protected:
UInt_8 type; UInt_8 type;
@ -15,11 +15,15 @@ namespace ehs
Str_8 name; Str_8 name;
UInt_64 id; UInt_64 id;
Array<ButtonState> states; Array<ButtonState> states;
Button lastState;
float heldTime;
float activateTime;
bool active;
public: public:
HID(); HID();
HID(const UInt_8 type, Str_8 name, const UInt_64 id); HID(UInt_8 type, Str_8 name, UInt_64 id);
HID(HID&& hid) noexcept; HID(HID&& hid) noexcept;
@ -33,11 +37,11 @@ namespace ehs
bool operator!=(const HID& other) const; bool operator!=(const HID& other) const;
bool operator==(const UInt_64 otherId) const; bool operator==(UInt_64 otherId) const;
bool operator!=(const UInt_64 otherId) const; bool operator!=(UInt_64 otherId) const;
virtual void Poll(); virtual void Poll(float delta);
UInt_8 GetType() const; UInt_8 GetType() const;
@ -71,6 +75,10 @@ namespace ehs
const ButtonState* IsUp() const; const ButtonState* IsUp() const;
const ButtonState *IsPressed(const Button &button);
const ButtonState *GetPressed();
void ButtonDown(const Button& button); void ButtonDown(const Button& button);
void ButtonUp(const Button& button); void ButtonUp(const Button& button);
@ -87,5 +95,11 @@ namespace ehs
bool AddState(const ButtonState& state); bool AddState(const ButtonState& state);
ButtonState* GetState(const Button& button); ButtonState* GetState(const Button& button);
bool TickHoldTime(float delta);
void ResetTime();
void TickActivateTime(float delta);
}; };
} }

View File

@ -6,7 +6,7 @@
namespace ehs namespace ehs
{ {
class Input class EHS_LIB_IO Input
{ {
private: private:
Array<InputHandler*> handlers; Array<InputHandler*> handlers;

View File

@ -5,11 +5,13 @@
namespace ehs namespace ehs
{ {
class InputHandler class EHS_LIB_IO InputHandler
{ {
private: private:
UInt_64 hashId; UInt_64 hashId;
Str_8 id; Str_8 id;
UInt_64 start;
UInt_64 delta;
protected: protected:
Array<HID*> devices; Array<HID*> devices;
@ -29,9 +31,9 @@ namespace ehs
InputHandler& operator=(const InputHandler& ih); InputHandler& operator=(const InputHandler& ih);
bool operator==(const UInt_64 otherHashId); bool operator==(const UInt_64 otherHashId) const;
bool operator!=(const UInt_64 otherHashId); bool operator!=(const UInt_64 otherHashId) const;
virtual bool Initialize(); virtual bool Initialize();

View File

@ -8,7 +8,7 @@
namespace ehs namespace ehs
{ {
class Keyboard : public HID class EHS_LIB_IO Keyboard : public HID
{ {
public: public:
Keyboard(); Keyboard();
@ -23,7 +23,7 @@ namespace ehs
Keyboard& operator=(const Keyboard& hid); Keyboard& operator=(const Keyboard& hid);
void Poll() override; void Poll(float delta) override;
Keyboard* Clone() const override; Keyboard* Clone() const override;

View File

@ -9,7 +9,7 @@
namespace ehs namespace ehs
{ {
class Mouse : public HID class EHS_LIB_IO Mouse : public HID
{ {
private: private:
friend class Input; friend class Input;
@ -19,7 +19,7 @@ namespace ehs
public: public:
Mouse(); Mouse();
Mouse(Str_8 name, const UInt_64 id); Mouse(Str_8 name, UInt_64 id);
Mouse(Mouse&& hid) noexcept = default; Mouse(Mouse&& hid) noexcept = default;
@ -29,7 +29,7 @@ namespace ehs
Mouse& operator=(const Mouse& hid); Mouse& operator=(const Mouse& hid);
void Poll() override; void Poll(float delta) override;
void SetDelta(const Vec2_s32& newDelta); void SetDelta(const Vec2_s32& newDelta);

View File

@ -13,7 +13,7 @@ namespace ehs
NEAREST_NEIGHBOR NEAREST_NEIGHBOR
}; };
class Img : public BaseObj class EHS_LIB_IO Img : public BaseObj
{ {
private: private:
static Array<ImgCodec> codecs; static Array<ImgCodec> codecs;

View File

@ -12,7 +12,7 @@ namespace ehs
typedef bool (*EncodeImgCb)(const ImgCodec* const, Serializer<UInt_64>&, const Img*); typedef bool (*EncodeImgCb)(const ImgCodec* const, Serializer<UInt_64>&, const Img*);
typedef bool (*DecodeImgCb)(const ImgCodec* const, Serializer<UInt_64>&, Img*); typedef bool (*DecodeImgCb)(const ImgCodec* const, Serializer<UInt_64>&, Img*);
class ImgCodec class EHS_LIB_IO ImgCodec
{ {
private: private:
Str_8 id; Str_8 id;

View File

@ -7,7 +7,7 @@
namespace ehs namespace ehs
{ {
class PNG class EHS_LIB_IO PNG
{ {
private: private:
Str_8 id; Str_8 id;

View File

@ -6,7 +6,7 @@
namespace ehs namespace ehs
{ {
class PNG_Chunk class EHS_LIB_IO PNG_Chunk
{ {
private: private:
Str_8 id; Str_8 id;

View File

@ -6,7 +6,7 @@
namespace ehs namespace ehs
{ {
class AnimBone class EHS_LIB_IO AnimBone
{ {
private: private:
UInt_8 boneId; UInt_8 boneId;

View File

@ -7,7 +7,7 @@
namespace ehs namespace ehs
{ {
class Animation class EHS_LIB_IO Animation
{ {
private: private:
UInt_64 hashId; UInt_64 hashId;

View File

@ -6,7 +6,7 @@
namespace ehs namespace ehs
{ {
class Bone class EHS_LIB_IO Bone
{ {
private: private:
UInt_64 hashName; UInt_64 hashName;

View File

@ -9,7 +9,7 @@
namespace ehs namespace ehs
{ {
class KeyFrame class EHS_LIB_IO KeyFrame
{ {
private: private:
float num; float num;

View File

@ -15,7 +15,7 @@ namespace ehs
EHM EHM
}; };
class Mdl : public BaseObj class EHS_LIB_IO Mdl : public BaseObj
{ {
private: private:
static Array<MdlCodec> codecs; static Array<MdlCodec> codecs;

View File

@ -12,7 +12,7 @@ namespace ehs
typedef bool (*EnocdeMdlCb)(const MdlCodec*, Serializer<UInt_64>&, const Mdl*); typedef bool (*EnocdeMdlCb)(const MdlCodec*, Serializer<UInt_64>&, const Mdl*);
typedef bool (*DecodeMdlCb)(const MdlCodec*, Serializer<UInt_64>&, Mdl*); typedef bool (*DecodeMdlCb)(const MdlCodec*, Serializer<UInt_64>&, Mdl*);
class MdlCodec class EHS_LIB_IO MdlCodec
{ {
private: private:
Str_8 id; Str_8 id;

View File

@ -7,7 +7,7 @@
namespace ehs namespace ehs
{ {
class Mesh final : public BaseObj class EHS_LIB_IO Mesh final : public BaseObj
{ {
protected: protected:
UInt_64 hashId; UInt_64 hashId;

View File

@ -19,7 +19,7 @@ namespace ehs
INVALID INVALID
}; };
class PropertyChange class EHS_LIB_IO PropertyChange
{ {
public: public:
ChangeType type; ChangeType type;

View File

@ -5,7 +5,7 @@
namespace ehs namespace ehs
{ {
class BaseDNS class EHS_LIB_IO BaseDNS
{ {
public: public:
static Str_8 Resolve(AddrType type, const Str_8 &hostname); static Str_8 Resolve(AddrType type, const Str_8 &hostname);

View File

@ -9,7 +9,7 @@
namespace ehs namespace ehs
{ {
class BaseTCP class EHS_LIB_IO BaseTCP
{ {
protected: protected:
AddrType addrType; AddrType addrType;

View File

@ -6,7 +6,7 @@
namespace ehs namespace ehs
{ {
class BaseUDP class EHS_LIB_IO BaseUDP
{ {
protected: protected:
AddrType type; AddrType type;

View File

@ -7,7 +7,7 @@
namespace ehs namespace ehs
{ {
class DNS final : public BaseDNS class EHS_LIB_IO DNS final : public BaseDNS
{ {
public: public:
static Str_8 Resolve(AddrType type, const Str_8 &hostname); static Str_8 Resolve(AddrType type, const Str_8 &hostname);

View File

@ -4,7 +4,7 @@
namespace ehs namespace ehs
{ {
class DNS final : public BaseDNS class EHS_LIB_IO DNS final : public BaseDNS
{ {
public: public:
static Str_8 Resolve(AddrType type, const Str_8 &hostname); static Str_8 Resolve(AddrType type, const Str_8 &hostname);

228
include/ehs/io/socket/EHC.h Normal file
View File

@ -0,0 +1,228 @@
#pragma once
#include "ehs/io/socket/ehc/NetUtils.h"
#include "ehs/io/socket/ehc/NetEnc.h"
#include "ehs/Serializer.h"
#include "ehs/Vector.h"
#include "ehs/Array.h"
#include "Socket.h"
#include "UDP.h"
namespace ehs
{
class NetSys;
class NetEnd;
class EHC;
typedef bool (*ConnectCb)(EHC *, NetEnd **, Serializer<UInt_64>);
typedef void (*ConnectedCb)(EHC *, NetEnd *);
typedef void (*ActiveCb)(EHC *, NetEnd *);
typedef void (*DisconnectCb)(EHC *, NetEnd *, Serializer<UInt_64>);
typedef void (*DisconnectedCb)(EHC *, NetEnd *);
typedef void (*TimeoutCb)(EHC *, NetEnd *);
class EHC
{
private:
friend class NetEnc;
friend class NetEnd;
static const Version version;
static const UInt_64 internalSys;
static const UInt_64 connectOp;
static const UInt_64 connectedOp;
static const UInt_64 rejectedOp;
static const UInt_64 disconnectOp;
static const UInt_64 disconnectedOp;
static const UInt_64 statusUpdateOp;
static const UInt_64 pingOp;
static const UInt_64 pongOp;
static const UInt_64 latencyOp;
static const UInt_64 receivedOp;
UDP udp;
Version appVer;
EndDisp disposition;
UInt_64 hashName;
Str_8 name;
bool dropPackets;
Byte* buffer;
UInt_32 bufferSize;
Array<NetEnc *> encryptions;
Array<NetSys *> systems;
UInt_32 maxEndpoints;
UInt_64 lastTSC;
float delta;
float maxTimeout;
float resendRate;
ConnectCb connectCb;
ConnectedCb connectedCb;
ActiveCb activeCb;
DisconnectCb disconnectCb;
DisconnectedCb disconnectedCb;
TimeoutCb timeoutCb;
protected:
Vector<NetEnd*> endpoints;
public:
~EHC();
EHC();
EHC(const Version &ver, Str_8 name, UInt_64 maxEndpoints);
EHC(const Version &ver, Str_8 name);
EHC(EHC &&sock) noexcept;
EHC(const EHC &sock);
EHC &operator=(EHC&& sock) noexcept;
EHC &operator=(const EHC &sock);
void Initialize();
void Release();
void Bind(AddrType newType, const Str_8& newAddress, UInt_16 newPort);
void Connect(AddrType rType, const Str_8& rAddress, UInt_16 rPort, Serializer<UInt_64> data);
bool Disconnect(EndDisp endDisp, const Char_8 token[64], const Str_8& msg);
void Broadcast(EndDisp endDisp, Status endStatus, bool deltaLocked, UInt_64 encHashId,
bool ensure, UInt_64 sysHashId, UInt_64 opHashId,
const Serializer<UInt_64> &payload);
void Broadcast(EndDisp endDisp, Status endStatus, bool deltaLocked, const Str_8 &encId,
bool ensure, const Str_8 &sysId, const Str_8 &opId,
const Serializer<UInt_64> &payload);
void Poll();
bool IsInitialized() const;
AddrType GetLocalAddressType() const;
Str_8 GetLocalAddress() const;
UInt_16 GetLocalPort() const;
bool IsBound() const;
static Version GetVersion();
Version GetAppVersion() const;
EndDisp GetDisposition() const;
UInt_64 GetHashName() const;
Str_8 GetName() const;
void EnableDropPackets(bool enable);
bool IsDropPacketsEnabled() const;
bool HasEncryption(UInt_64 encHashId) const;
bool HasEncryption(const Str_8& encId) const;
bool AddEncryption(NetEnc *enc);
NetEnc* GetEncryption(UInt_64 encHashId) const;
NetEnc* GetEncryption(const Str_8& encId) const;
bool HasSystem(UInt_64 sysHashId) const;
bool HasSystem(const Str_8& sysId) const;
bool AddSystem(NetSys *sys);
NetSys* GetSystem(UInt_64 sysHashId) const;
NetSys* GetSystem(const Str_8& sysId) const;
bool HasEndpoint(EndDisp endDisp, Status endStatus, const Char_8 token[64]) const;
bool HasEndpoint(EndDisp endDisp, Status endStatus, UInt_64 hashId) const;
bool HasEndpoint(EndDisp endDisp, Status endStatus, const Str_8 &id) const;
bool HasEndpoint(EndDisp endDisp, const Char_8 token[64]) const;
bool HasEndpoint(EndDisp endDisp, UInt_64 hashId) const;
bool HasEndpoint(EndDisp endDisp, const Str_8 &id) const;
bool HasEndpoint(const Char_8 token[64]) const;
bool HasEndpoint(UInt_64 hashId) const;
bool HasEndpoint(const Str_8 &id) const;
bool HasEndpoint(const Str_8& rAddress, UInt_16 rPort) const;
NetEnd *GetEndpoint(EndDisp endDisp, Status endStatus, const Char_8 token[64]) const;
NetEnd *GetEndpoint(EndDisp endDisp, Status endStatus, UInt_64 hashId) const;
NetEnd *GetEndpoint(EndDisp endDisp, Status endStatus, const Str_8 &id) const;
NetEnd *GetEndpoint(EndDisp endDisp, const Char_8 token[64]) const;
NetEnd *GetEndpoint(EndDisp endDisp, UInt_64 hashId) const;
NetEnd *GetEndpoint(EndDisp endDisp, const Str_8 &id) const;
NetEnd *GetEndpoint(const Str_8& rAddress, UInt_16 rPort) const;
Array<NetEnd *> GetEndpoints(EndDisp endDisp, Status endStatus);
Array<NetEnd *> GetEndpoints(EndDisp endDisp);
UInt_64 GetEndpointsCount(EndDisp endDisp, Status endStatus);
UInt_64 GetEndpointsCount(EndDisp endDisp);
UInt_64 GetMaxEndpoints() const;
void SetMaxTimeout(float seconds);
float GetMaxTimeout() const;
void SetResendRate(float seconds);
float GetResendRate() const;
void SetConnectCb(ConnectCb cb);
void SetConnectedCb(ConnectedCb cb);
void SetActiveCb(ActiveCb cb);
void SetDisconnectCb(DisconnectCb cb);
void SetDisconnectedCb(DisconnectedCb cb);
void SetTimeoutCb(TimeoutCb cb);
private:
void GenerateToken(Char_8 in[64]);
void UpdateQueue(UInt_64 active);
void UpdateQueue();
bool RemoveEndpoint(EndDisp disposition, const Char_8 token[64]);
bool RemoveEndpoint(const Str_8& address, UInt_16 port);
bool RemoveEndpoint(const NetEnd* end);
void PollEndpoints();
};
}

View File

@ -16,7 +16,7 @@ namespace ehs
DEL DEL
}; };
class Request class EHS_LIB_IO Request
{ {
private: private:
Verb verb; Verb verb;

View File

@ -8,7 +8,7 @@
namespace ehs namespace ehs
{ {
class Response class EHS_LIB_IO Response
{ {
private: private:
UInt_32 code; UInt_32 code;

View File

@ -12,7 +12,7 @@ typedef struct ssl_st SSL;
namespace ehs namespace ehs
{ {
/// A class for handling the HTTP(S) TCP socket layer. /// A class for handling the HTTP(S) TCP socket layer.
class SSL : public TCP class EHS_LIB_IO SSL : public TCP
{ {
private: private:
SSL_CTX* ctx; SSL_CTX* ctx;

View File

@ -10,7 +10,7 @@
namespace ehs namespace ehs
{ {
/// A wrapper class for the transmission control protocol socket. /// A wrapper class for the transmission control protocol socket.
class TCP : public BaseTCP class EHS_LIB_IO TCP : public BaseTCP
{ {
protected: protected:
Socket hdl; Socket hdl;

View File

@ -10,7 +10,7 @@
namespace ehs namespace ehs
{ {
/// A wrapper class for the transmission control protocol socket. /// A wrapper class for the transmission control protocol socket.
class TCP : public BaseTCP class EHS_LIB_IO TCP : public BaseTCP
{ {
protected: protected:
Socket hdl; Socket hdl;

View File

@ -7,7 +7,7 @@
namespace ehs namespace ehs
{ {
/// A wrapper class for the user datagram protocol socket. /// A wrapper class for the user datagram protocol socket.
class UDP : public BaseUDP class EHS_LIB_IO UDP : public BaseUDP
{ {
private: private:
Socket hdl; Socket hdl;

View File

@ -7,7 +7,7 @@
namespace ehs namespace ehs
{ {
/// A wrapper class for the user datagram protocol socket. /// A wrapper class for the user datagram protocol socket.
class UDP : public BaseUDP class EHS_LIB_IO UDP : public BaseUDP
{ {
private: private:
Socket hdl; Socket hdl;

View File

@ -0,0 +1,43 @@
#pragma once
#include "ehs/Str.h"
namespace ehs
{
class EHC;
class NetEnc
{
private:
friend class EHC;
EHC *owner;
UInt_64 hashId;
Str_8 id;
public:
virtual ~NetEnc() = default;
NetEnc();
NetEnc(Str_8 id);
NetEnc(NetEnc &&enc) noexcept;
NetEnc(const NetEnc &enc);
NetEnc &operator=(NetEnc &&enc) noexcept;
NetEnc &operator=(const NetEnc &enc);
EHC *GetOwner() const;
UInt_64 GetHashId() const;
Str_8 GetId() const;
virtual void Encrypt(Byte *data, UInt_64 size) const;
virtual void Decrypt(Byte *data, UInt_64 size) const;
};
}

View File

@ -0,0 +1,134 @@
#pragma once
#include "NetUtils.h"
#include "NetFrags.h"
#include "ehs/Str.h"
#include "ehs/Vector.h"
#include "ehs/Serializer.h"
#include "ehs/io/socket/Socket.h"
namespace ehs
{
class EHC;
class NetEnd
{
private:
friend class EHC;
EHC* owner;
EndDisp disposition;
UInt_64 hashName;
Str_8 name;
Status status;
Architecture arch;
Char_8 token[64];
UInt_64 nextSendId;
Vector<Insurance> sent;
UInt_64 nextRecvId;
Vector<NetFrags> received;
AddrType type;
Str_8 address;
UInt_16 port;
float deltaDuration;
float deltaRate;
float timeout;
float lastPing;
float oldLatency;
float latency;
UInt_64 queueSlot;
public:
NetEnd();
NetEnd(EndDisp disposition, Str_8 id, Architecture arch, AddrType type, Str_8 address, UInt_16 port);
NetEnd(AddrType type, Str_8 address, UInt_16 port);
NetEnd(NetEnd &&end) noexcept;
NetEnd(const NetEnd &end);
NetEnd &operator=(NetEnd &&end) noexcept;
NetEnd &operator=(const NetEnd &end);
EndDisp GetDisposition() const;
UInt_64 GetHashName() const;
Str_8 GetName() const;
Status GetStatus() const;
Architecture GetArchitecture() const;
UInt_64 GetNextSendId() const;
/// Sends data to the remote endpoint.
/// @param [in] deltaLocked Whether or not to match the remote endpoint's delta time to prevent overloading the client. This will drop data if delta time does not match.
/// @param [in] encHashId The hash id of the encryption to use. Can be zero for none.
/// @param [in] ensure Whether or not to ensure the data was received by the remote endpoint.
/// @param [in] sys The system hash id to execute an operation from.
/// @param [in] op The operation hash id in the system to execute.
/// @param [in] payload Additional parameters and data to send to the remote endpoint.
void Send(bool deltaLocked, UInt_64 encHashId, bool ensure, UInt_64 sys, UInt_64 op, const Serializer<UInt_64>& payload);
/// Sends data to the remote endpoint.
/// @param [in] deltaLocked Whether or not to match the remote endpoint's delta time to prevent overloading the client. This will drop data if delta time does not match.
/// @param [in] encId The id of the encryption to use. Can be empty for none.
/// @param [in] ensure Whether or not to ensure the data was received by the remote endpoint.
/// @param [in] sys The system string id to execute an operation from.
/// @param [in] op The operation string id in the system to execute.
/// @param [in] payload Additional parameters and data to send to the remote endpoint.
void Send(bool deltaLocked, const Str_8 &encID, bool ensure, const Str_8& sys, const Str_8& op, const Serializer<UInt_64>& payload);
UInt_64 GetNextRecvId() const;
Str_8 GetAddress() const;
UInt_16 GetPort() const;
void SetDeltaRate(float newDeltaRate);
float GetDeltaRate() const;
float GetTimeout() const;
float GetLastPing() const;
void SendLatency();
float GetLatency() const;
UInt_64 GetQueueSlot() const;
private:
void Poll(float delta);
void SetStatus(Status newStatus);
void RemoveInsurance(UInt_64 msgId, UInt_64 fragment);
void AddReceived(const Header& header, const Serializer<>& payload);
Vector<NetFrags>* GetReceived();
void Ping(float delta);
void Pong(float delta);
void SetLatency(float newLatency);
void SetQueueSlot(UInt_64 slot);
NetFrags FragmentData(const Header& header, const Serializer<>& data);
void Send(const Header& header, const Serializer<>& payload);
bool SortingNeeded() const;
void SortReceived();
};
}

View File

@ -0,0 +1,43 @@
#pragma once
#include "NetUtils.h"
#include <ehs/Serializer.h>
namespace ehs
{
class NetFrags
{
private:
Header header;
Serializer<UInt_64>* data;
UInt_64 size;
public:
~NetFrags();
NetFrags();
NetFrags(const Header &header, const Serializer<UInt_64> &payload);
NetFrags(const Header &header, UInt_64 size);
NetFrags(NetFrags &&frags) noexcept;
NetFrags(const NetFrags &frags);
NetFrags &operator=(NetFrags &&frags) noexcept;
NetFrags &operator=(const NetFrags &frags);
operator Serializer<UInt_64> *() const;
Header GetHeader() const;
UInt_64 Size() const;
bool IsComplete() const;
Packet Combine() const;
};
}

View File

@ -0,0 +1,42 @@
#pragma once
#include "ehs/Str.h"
#include "ehs/Serializer.h"
namespace ehs
{
class EHC;
class NetSys;
class NetEnd;
class NetOp
{
private:
friend class NetSys;
UInt_64 hashId;
Str_8 id;
public:
virtual ~NetOp() = default;
NetOp();
NetOp(Str_8 id);
NetOp(NetOp &&op) noexcept;
NetOp(const NetOp &op);
NetOp &operator=(NetOp &&op) noexcept;
NetOp &operator=(const NetOp &op);
Str_8 GetId() const;
UInt_64 GetHashId() const;
private:
virtual void Process(EHC *ehc, NetEnd *endpoint, NetSys *sys, Serializer<UInt_64> &payload);
};
}

View File

@ -0,0 +1,48 @@
#pragma once
#include "ehs/Str.h"
#include "ehs/Array.h"
#include "ehs/Serializer.h"
namespace ehs
{
class EHC;
class NetEnd;
class NetOp;
class NetSys
{
private:
friend class EHC;
UInt_64 hashId;
Str_8 id;
Array<NetOp*> ops;
public:
virtual ~NetSys();
NetSys();
NetSys(Str_8 id);
NetSys(NetSys &&sys) noexcept;
NetSys(const NetSys &sys);
NetSys &operator=(NetSys &&sys) noexcept;
NetSys &operator=(const NetSys &sys);
Str_8 GetId() const;
UInt_64 GetHashId() const;
bool HasOperation(UInt_64 hashId) const;
bool AddOperation(NetOp *op);
private:
void Execute(EHC *ehc, NetEnd *endpoint, UInt_64 hashId, Serializer<UInt_64> &payload);
};
}

View File

@ -0,0 +1,54 @@
#pragma once
#include "ehs/Serializer.h"
namespace ehs
{
enum class EndDisp : UInt_8
{
ENDPOINT,
SERVICE
};
enum class Status : UInt_8
{
ACTIVE,
PENDING,
IN_LOCAL_QUEUE,
IN_REMOTE_QUEUE,
};
struct Header
{
UInt_64 encHashId = 0;
UInt_64 id = 0;
UInt_64 fragments = 0;
UInt_64 fragment = 0;
bool ensure = false;
EndDisp disposition = EndDisp::ENDPOINT;
Char_8 token[64] = {};
UInt_64 system = 0;
UInt_64 op = 0;
};
struct Packet
{
Header header;
Serializer<UInt_64> payload;
};
struct Insurance
{
Header header;
Serializer<UInt_64> payload;
float lastResend;
};
}
#ifndef EHC_IPV4_PAYLOAD
#define EHC_IPV4_PAYLOAD (EHS_IPV4_UDP_PAYLOAD - (UInt_16)sizeof(Header))
#endif
#ifndef EHC_IPV6_PAYLOAD
#define EHC_IPV6_PAYLOAD (EHS_IPV6_UDP_PAYLOAD - (UInt_16)sizeof(Header))
#endif

View File

@ -21,7 +21,7 @@ namespace ehs
Str_8 id; Str_8 id;
}; };
class Spotify final class EHS_LIB_IO Spotify final
{ {
private: private:
SSL client; SSL client;

View File

@ -6,7 +6,7 @@
namespace ehs namespace ehs
{ {
class Twitch class EHS_LIB_IO Twitch
{ {
private: private:
SSL client; SSL client;

Some files were not shown because too many files have changed in this diff Show More