diff --git a/.idea/deployment.xml b/.idea/deployment.xml
new file mode 100644
index 0000000..622f4f9
--- /dev/null
+++ b/.idea/deployment.xml
@@ -0,0 +1,20 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/editor.xml b/.idea/editor.xml
index f9a3953..ec90224 100644
--- a/.idea/editor.xml
+++ b/.idea/editor.xml
@@ -1,87 +1,247 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/other.xml b/.idea/other.xml
new file mode 100644
index 0000000..677925b
--- /dev/null
+++ b/.idea/other.xml
@@ -0,0 +1,10 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/CMakeLists.txt b/CMakeLists.txt
index d15ed1e..7050bb7 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -64,7 +64,7 @@ if (IS_OS_WINDOWS)
target_link_directories(Pong PUBLIC "${USER_HOME_DIRECTORY}/LWE/lib")
target_link_directories(Pong PUBLIC $ENV{VULKAN_SDK}/lib)
- target_link_libraries(Pong PUBLIC vulkan-1 ws2_32 avrt)
+ target_link_libraries(Pong PRIVATE LWE_Stc EHS_Stc OpenSSL::SSL OpenSSL::Crypto ZLIB::ZLIB vulkan-1 ws2_32 avrt)
set(CMAKE_INSTALL_PREFIX "${USER_HOME_DIRECTORY}/LWE")
elseif (IS_OS_LINUX)
@@ -77,11 +77,14 @@ elseif (IS_OS_LINUX)
message(STATUS "Vulkan was not found.")
endif ()
+ find_package(PkgConfig REQUIRED)
+ pkg_check_modules(PIPEWIRE REQUIRED libpipewire-0.3)
+
+ target_include_directories(Pong PRIVATE ${PIPEWIRE_INCLUDE_DIRS})
+
target_include_directories(Pong PRIVATE ${USER_HOME_DIRECTORY}/.local/include)
target_link_directories(Pong PRIVATE "${USER_HOME_DIRECTORY}/.local/lib")
- target_link_libraries(Pong PRIVATE xcb xcb-cursor xcb-xfixes xcb-xinput asound Vulkan::Headers Vulkan::Vulkan)
-endif()
-
-target_link_libraries(Pong PRIVATE LWE EHC EHE EHS OpenSSL::SSL OpenSSL::Crypto ZLIB::ZLIB)
\ No newline at end of file
+ target_link_libraries(Pong PRIVATE LWE_Stc EHS_Stc OpenSSL::SSL OpenSSL::Crypto ZLIB::ZLIB xcb xcb-cursor xcb-xfixes xcb-xinput pipewire-0.3 Vulkan::Headers Vulkan::Vulkan)
+endif()
\ No newline at end of file
diff --git a/CMakePresets.json b/CMakePresets.json
deleted file mode 100644
index afabfde..0000000
--- a/CMakePresets.json
+++ /dev/null
@@ -1,12 +0,0 @@
-{
- "version": 3,
- "configurePresets": [
- {
- "name": "default",
- "binaryDir": "${sourceDir}/build",
- "cacheVariables": {
- "CMAKE_TOOLCHAIN_FILE": "$env{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake"
- }
- }
- ]
-}
\ No newline at end of file
diff --git a/Levels/Game.cpp b/Levels/Game.cpp
index 191e4f4..c02ce4e 100644
--- a/Levels/Game.cpp
+++ b/Levels/Game.cpp
@@ -6,7 +6,7 @@
#include
#include
#include
-#include
+#include
#include
#include
#include
@@ -15,7 +15,7 @@
#include
#include
#include
-#include
+#include
#include
const float Game::paddleSpeed = 400.0f;
@@ -56,6 +56,8 @@ void Game::SetupResources(lwe::GpuInterface *inf)
// Setup Resource Code Here
AddResource(new lwe::GpuMesh(inf, ehs::portraitGui));
+ AddResource(new lwe::GpuFontAtlas("resources/fonts/Arial_48.ehf", inf));
+
AddResource(new ehs::Audio("resources/audio/Wall.wav", ehs::DataType::FLOAT));
AddResource(new ehs::Audio("resources/audio/Paddle.wav", ehs::DataType::FLOAT));
AddResource(new ehs::Audio("resources/audio/Score.wav", ehs::DataType::FLOAT));
@@ -81,7 +83,6 @@ void Game::Setup(lwe::GpuInterface *inf)
AddSystem(new lwe::RigidBodySystem());
lwe::GuiSystem* gui = new lwe::GuiSystem();
- gui->AddResource(new lwe::GpuFontAtlas("resources/fonts/Arial_48.ehf", win->GetInterface()));
AddSystem(gui);
ehs::Vec2_f scale = win->GetSwapChain()->GetScale();
@@ -151,24 +152,26 @@ void Game::Setup(lwe::GpuInterface *inf)
{
lwe::Entity* aOwner = (lwe::Entity*)a->GetEntity();
lwe::Entity* bOwner = (lwe::Entity*)b->GetEntity();
+ lwe::Level *lvl = aOwner->GetParent();
+ lwe::AudioSystem *audioSys = (lwe::AudioSystem *)lvl->GetSystem("AudioSystem");
static ehs::UInt_64 id = 0;
if (bOwner->GetId() == "Bounds")
{
- lwe::AudioSource* audio = new lwe::AudioSource("Audio_" + ehs::Str_8::FromNum(id++),"Wall");
- audio->EnableAutoDelete(true);
- audio->EnableLoop(false);
- audio->Play();
- aOwner->AddComponent(audio);
+ lwe::AudioSource audio("Audio_" + ehs::Str_8::FromNum(id++),"Wall");
+ audio.EnableAutoDelete(true);
+ audio.EnableLoop(false);
+ audio.Play();
+ audioSys->AddSource(audio);
}
else
{
- lwe::AudioSource* audio = new lwe::AudioSource("Audio_" + ehs::Str_8::FromNum(id++),"Paddle");
- audio->EnableAutoDelete(true);
- audio->EnableLoop(false);
- audio->Play();
- aOwner->AddComponent(audio);
+ lwe::AudioSource audio("Audio_" + ehs::Str_8::FromNum(id++),"Paddle");
+ audio.EnableAutoDelete(true);
+ audio.EnableLoop(false);
+ audio.Play();
+ audioSys->AddSource(audio);
}
});
ball.AddComponent(ballCollider);
@@ -230,12 +233,11 @@ void Game::OnUpdate(lwe::RenderWindow* win, ehs::Input* input, const float delta
if (!started && keyboard->IsTouched(ehs::Keyboard::Space))
{
- if (!ehs::CPU::HasRDRND())
- return;
+ ehs::PRNG rng((ehs::UInt_8)ehs::CPU::GetTSC());
lwe::AABB2D* ballCollider = (lwe::AABB2D*)ball->GetComponent("AABB2D");
- if (const ehs::UInt_8 result = ehs::HRNG::Generate_s8(0, 4); result == 0)
+ if (const ehs::UInt_8 result = rng.Generate(0, 4); result == 0)
ballCollider->ApplyForce({ballSpeed, ballSpeed, 0.0f});
else if (result == 1)
ballCollider->ApplyForce({-ballSpeed, ballSpeed, 0.0f});
@@ -302,11 +304,13 @@ void Game::PreRender(lwe::GpuCmdBuffer* cmdBuffer)
void Game::ResetGame(const lwe::Entity* bounds, lwe::Entity* ball)
{
- lwe::AudioSource* audio = new lwe::AudioSource("Score", "Score");
- audio->EnableAutoDelete(true);
- audio->EnableLoop(false);
- audio->Play();
- ball->AddComponent(audio);
+ lwe::AudioSystem *audioSys = (lwe::AudioSystem *)GetSystem("AudioSystem");
+
+ lwe::AudioSource audio("Score", "Score");
+ audio.EnableAutoDelete(true);
+ audio.EnableLoop(false);
+ audio.Play();
+ audioSys->AddSource(audio);
ball->SetPos(bounds->GetScale() / 2.0f - ball->GetScale() / 2.0f);
diff --git a/Main.cpp b/Main.cpp
index a6a6315..cbb852f 100644
--- a/Main.cpp
+++ b/Main.cpp
@@ -7,11 +7,9 @@
#include "Levels/Game.h"
-ehs::SInt_32 Main(ehs::Str_8* appName, ehs::Str_8* appVerId, ehs::Version* appVer)
+int main()
{
- *appName = "Pong";
- *appVerId = "Release";
- *appVer = {1, 0, 0};
+ ehs::Initialize("Pong", "Release", {1, 0, 0});
ehs::Log::EnableImmediateMode(true);
@@ -25,21 +23,21 @@ ehs::SInt_32 Main(ehs::Str_8* appName, ehs::Str_8* appVerId, ehs::Version* appVe
lwe::GpuInstance::AddExtension(VK_KHR_SURFACE_EXTENSION_NAME);
- lwe::GpuInstance::Initialize(false);
+ lwe::GpuInstance::Initialize(true);
lwe::GpuDevice primary = lwe::GpuDevice::GetBest();
lwe::GpuQueueFamily* family = primary.GetQueueFamily(lwe::QueueType::GRAPHICS);
lwe::GpuInterface inf(&primary);
- inf.AddExtensions(VK_KHR_SWAPCHAIN_EXTENSION_NAME);
+ inf.AddExtension(VK_KHR_SWAPCHAIN_EXTENSION_NAME);
lwe::GpuQueue queue(family, &inf, 1.0f);
inf.Initialize();
lwe::RenderWindow win(&inf, &queue);
- win.Create_8(*appName, {0, 0}, {1024, 768});
+ win.Create_8(ehs::GetAppName_8(), {0, 0}, {1024, 768});
win.Show();
lwe::GameLoop gl(&win, 6, 0);
@@ -55,5 +53,7 @@ ehs::SInt_32 Main(ehs::Str_8* appName, ehs::Str_8* appVerId, ehs::Version* appVe
lwe::GpuInstance::Release();
+ ehs::Uninitialize();
+
return 0;
}
\ No newline at end of file
diff --git a/vcpkg-configuration.json b/vcpkg-configuration.json
deleted file mode 100644
index 427355d..0000000
--- a/vcpkg-configuration.json
+++ /dev/null
@@ -1,14 +0,0 @@
-{
- "default-registry": {
- "kind": "git",
- "baseline": "42bb0d9e8d4cf33485afb9ee2229150f79f61a1f",
- "repository": "https://github.com/microsoft/vcpkg"
- },
- "registries": [
- {
- "kind": "artifact",
- "location": "https://github.com/microsoft/vcpkg-ce-catalog/archive/refs/heads/main.zip",
- "name": "microsoft"
- }
- ]
-}