diff --git a/.idea/editor.xml b/.idea/editor.xml
index f9a3953..204e8cc 100644
--- a/.idea/editor.xml
+++ b/.idea/editor.xml
@@ -31,7 +31,6 @@
-
@@ -83,5 +82,6 @@
+
\ No newline at end of file
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 56c136b..2e59744 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -33,10 +33,12 @@ add_executable(TechDemo main.cpp Levels/TestLevel.cpp Levels/TestLevel.h Levels/
if (IS_OS_WINDOWS)
add_compile_definitions(VK_USE_PLATFORM_WIN32_KHR)
elseif (IS_OS_LINUX)
- add_compile_definitions(VK_USE_PLATFORM_XCB_KHR)
+ add_compile_definitions(VK_USE_PLATFORM_XCB_KHR LWE_WS_XCB)
endif()
+target_link_directories(TechDemo PRIVATE "${USER_HOME_DIRECTORY}/Libraries/EHS/lib")
target_link_directories(TechDemo PRIVATE "${USER_HOME_DIRECTORY}/Libraries/LWE/lib")
+target_include_directories(TechDemo PRIVATE "${USER_HOME_DIRECTORY}/Libraries/EHS/include")
target_include_directories(TechDemo PRIVATE "${USER_HOME_DIRECTORY}/Libraries/LWE/include")
find_package(Vulkan REQUIRED)
diff --git a/Levels/MainMenu.cpp b/Levels/MainMenu.cpp
index 2c89dc5..1ff238d 100644
--- a/Levels/MainMenu.cpp
+++ b/Levels/MainMenu.cpp
@@ -1,25 +1,25 @@
#include "MainMenu.h"
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
#include "TestLevel.h"
-MainMenu::MainMenu(const lwe::Str_8& id)
+MainMenu::MainMenu(const ehs::Str_8& id)
: Level(id)
{
}
-void MainMenu::SetupResources()
+void MainMenu::SetupResources(lwe::GpuInterface* inf)
{
- Level::SetupResources();
+ Level::SetupResources(inf);
}
@@ -31,12 +31,12 @@ void MainMenu::Setup()
AddSystem(new lwe::RigidBodySystem());
AddSystem(new lwe::GuiSystem());
- lwe::Entity* cam = new lwe::Entity("Camera");
+ lwe::Entity cam("Camera");
lwe::Camera* com = new lwe::Camera("Main");
- cam->AddComponent(com);
+ cam.AddComponent(com);
- AddEntity(cam);
+ AddEntity((lwe::Entity&&)cam);
}
void MainMenu::PostInitialize(lwe::GpuCmdBuffer* cmdBuffer)
@@ -44,11 +44,11 @@ void MainMenu::PostInitialize(lwe::GpuCmdBuffer* cmdBuffer)
Level::PostInitialize(cmdBuffer);
}
-void MainMenu::OnUpdate(lwe::RenderWindow* win, lwe::Input* input, const float delta)
+void MainMenu::OnUpdate(lwe::RenderWindow* win, ehs::Input* input, const float delta)
{
Level::OnUpdate(win, input, delta);
- lwe::Vec2_f client = win->GetScale();
+ ehs::Vec2_f client = win->GetScale();
lwe::Entity* sp = GetEntity("SinglePlayer");
if (sp)
diff --git a/Levels/MainMenu.h b/Levels/MainMenu.h
index e44e501..77e5ca7 100644
--- a/Levels/MainMenu.h
+++ b/Levels/MainMenu.h
@@ -1,26 +1,23 @@
#pragma once
-#include
-
-#include
-#include
+#include
class MainMenu : public lwe::Level
{
public:
MainMenu() = default;
- explicit MainMenu(const lwe::Str_8& id);
+ explicit MainMenu(const ehs::Str_8& id);
MainMenu(const MainMenu& level) = default;
MainMenu& operator=(const MainMenu& level) = default;
- void SetupResources() override;
+ void SetupResources(lwe::GpuInterface* inf) override;
void Setup() override;
void PostInitialize(lwe::GpuCmdBuffer* cmdBuffer) override;
- void OnUpdate(lwe::RenderWindow* win, lwe::Input* input, const float delta) override;
+ void OnUpdate(lwe::RenderWindow* win, ehs::Input* input, const float delta) override;
};
\ No newline at end of file
diff --git a/Levels/TestLevel.cpp b/Levels/TestLevel.cpp
index 9c93611..74c12ba 100644
--- a/Levels/TestLevel.cpp
+++ b/Levels/TestLevel.cpp
@@ -1,62 +1,63 @@
#include "TestLevel.h"
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include "LWE/Timer.h"
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include "lwe/Timer.h"
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
TestLevel::TestLevel()
: count(0), cooldown(0.0f)
{
}
-TestLevel::TestLevel(const lwe::Str_8& id)
+TestLevel::TestLevel(const ehs::Str_8& id)
: Level(id), count(0), cooldown(0.0f)
{
}
@@ -79,30 +80,30 @@ TestLevel& TestLevel::operator=(const TestLevel& level)
return *this;
}
-void TestLevel::SetupResources()
+void TestLevel::SetupResources(lwe::GpuInterface* inf)
{
- lwe::FontAtlas* arial_24 = new lwe::FontAtlas("Resources/Fonts/Arial_24.ehf");
+ lwe::GpuFontAtlas* arial_24 = new lwe::GpuFontAtlas("resources/fonts/Arial_24.ehf", inf);
AddResource(arial_24);
- lwe::Model* vampire = new lwe::Model("Resources/Models/Vampire.ehm");
- vampire->Calculate();
+ lwe::GpuModel* vampire = new lwe::GpuModel("resources/models/Vampire.ehm", inf);
+ //vampire->Calculate();
AddResource(vampire);
- AddResource(lwe::Img::FromFile_Heap("Resources/Textures/Character_Diffuse.png", lwe::IMG_ASPECT_COLOR));
- AddResource(lwe::Img::FromFile_Heap("Resources/Textures/Character_Normal.png", lwe::IMG_ASPECT_COLOR));
- AddResource(lwe::Img::FromFile_Heap("Resources/Textures/Character_Specular.png", lwe::IMG_ASPECT_COLOR));
+ AddResource(new lwe::GpuImg("resources/textures/Character_Diffuse.png", inf, lwe::IMG_ASPECT_COLOR));
+ AddResource(new lwe::GpuImg("resources/textures/Character_Normal.png", inf, lwe::IMG_ASPECT_COLOR));
+ AddResource(new lwe::GpuImg("Resources/Textures/Character_Specular.png", inf, lwe::IMG_ASPECT_COLOR));
- lwe::Mesh* portrait = new lwe::Mesh("Portrait", lwe::portraitVerts, lwe::portraitIndices);
+ lwe::GpuMesh* portrait = new lwe::GpuMesh(inf, ehs::portrait);
//portrait->Calculate();
AddResource(portrait);
- lwe::Mesh* portraitGUI = new lwe::Mesh("PortraitGUI", lwe::portraitGuiVerts, lwe::portraitGuiIndices);
+ lwe::GpuMesh* portraitGUI = new lwe::GpuMesh(inf, ehs::portraitGui);
AddResource(portraitGUI);
- AddResource(new lwe::Model("Resources/Models/Cube.ehm"));
- AddResource(new lwe::Model("Resources/Models/Sphere.ehm"));
- AddResource(new lwe::Model("Resources/Models/PointLight.ehm"));
+ AddResource(new lwe::GpuModel("Resources/Models/Cube.ehm", inf));
+ AddResource(new lwe::GpuModel("Resources/Models/Sphere.ehm", inf));
+ AddResource(new lwe::GpuModel("Resources/Models/PointLight.ehm", inf));
- lwe::CubeMap* cm = new lwe::CubeMap("Resources/Textures/Skybox", "Skybox");
+ lwe::GpuCubeMap* cm = new lwe::GpuCubeMap(inf, "Resources/Textures/Skybox", "Skybox");
AddResource(cm);
AddResource(lwe::Audio::FromFile_Heap("Resources/Audio/sample.wav", lwe::DataType::FLOAT));
@@ -235,7 +236,7 @@ void TestLevel::Setup()
lwe::CollectionGui* stats = new lwe::CollectionGui("Stats");
stats->SetScale({250.0f, 127.0f});
- stats->AddResource(new lwe::FontAtlas("Resources/Fonts/Arial_24.ehf"));
+ stats->AddResource(new lwe::GpuFontAtlas("resources/fonts/Arial_24.ehf", inf));
lwe::SolidBoxGui* bckgrd = new lwe::SolidBoxGui("Background");
bckgrd->SetScale({250.0f, 127.0f});
@@ -248,31 +249,31 @@ void TestLevel::Setup()
lwe::LabelGui* deltaTime = new lwe::LabelGui("DeltaTime", "Arial_24", "Delta Time: 0");
deltaTime->SetColor({1.0f});
- deltaTime->SetPosition({0.0f, 24.0f});
+ deltaTime->SetPosition({0.0f, 24.0f, 0.0f});
stats->AddChild(deltaTime);
lwe::LabelGui* gbg = new lwe::LabelGui("Garbage", "Arial_24", "Garbage: 0");
gbg->SetColor({1.0f});
- gbg->SetPosition({0.0f, 48.0f});
+ gbg->SetPosition({0.0f, 48.0f, 0.0f});
stats->AddChild(gbg);
lwe::LabelGui* playback = new lwe::LabelGui("Playback", "Arial_24", "Playback: 0:0 / 0:0");
playback->SetColor({1.0f});
- playback->SetPosition({0.0f, 72.0f});
+ playback->SetPosition({0.0f, 72.0f, 0.0f});
stats->AddChild(playback);
lwe::LabelGui* volume = new lwe::LabelGui("Volume", "Arial_24", "Volume: 0");
volume->SetColor({1.0f});
- volume->SetPosition({0.0f, 96.0f});
+ volume->SetPosition({0.0f, 96.0f, 0.0f});
stats->AddChild(volume);
guiSys->AddGui(stats);
- lwe::Serializer args(lwe::Endianness::LE);
+ ehs::Serializer args(ehs::Endianness::LE);
args.Write(stats);
args.SetOffset(0);
- timerSys->Add({0, 1.0f, args, [](lwe::Timer* timer, lwe::Serializer& args)
+ timerSys->Add({0, 1.0f, args, [](lwe::Timer* timer, ehs::Serializer& args)
{
lwe::GameLoop* gl = (lwe::GameLoop*)timer->GetParent("GameLoop");
@@ -280,16 +281,23 @@ void TestLevel::Setup()
args.SetOffset(0);
lwe::LabelGui* deltaTime = (lwe::LabelGui*)stats->GetChild("DeltaTime");
- deltaTime->SetText("Delta Time: " + lwe::Str_8::FromNum(gl->GetRawDeltaTime()));
+ deltaTime->SetText("Delta Time: " + ehs::Str_8::FromNum(gl->GetRawDeltaTime()));
lwe::LabelGui* gbg = (lwe::LabelGui*)stats->GetChild("Garbage");
- gbg->SetText("Garbage: " + lwe::Str_8::FromNum(lwe::GarbageCollector::Size()));
+ gbg->SetText("Garbage: " + ehs::Str_8::FromNum(ehs::GarbageCollector::Size()));
}});
+ /*
lwe::PanelGui* testPanel = new lwe::PanelGui("TestPanel");
- testPanel->SetPosition({300.0f, 200.0f});
+ testPanel->SetPosition({300.0f, 200.0f, 0.0f});
testPanel->SetScale({400.0f, 400.0f});
guiSys->AddGui(testPanel);
+ */
+
+ lwe::WindowGui* testWin = new lwe::WindowGui("TestWindow", "Hello world!");
+ testWin->SetPosition({300.0f, 200.0f, 0.0f});
+ testWin->SetScale({400.0f, 400.0f});
+ guiSys->AddGui(testWin);
lwe::Entity* player = new lwe::Entity("Player");
@@ -304,7 +312,7 @@ void TestLevel::Setup()
plyMdl->SetPos({0.0f, 0.0f, -0.5f});
//player->AddComponent(plyMdl);
- AddTemplate(player);
+ AddTemplate((lwe::Entity&&)player);
lwe::Entity* plyPuppet = new lwe::Entity("Puppet");
plyPuppet->AddComponent(new lwe::OBB3D("Head", 1.0f, 1.0f));
@@ -317,7 +325,7 @@ void TestLevel::Setup()
puppetMdl->SetPos({0.0f, 0.0f, -0.5f});
//plyPuppet->AddComponent(puppetMdl);
- AddTemplate(plyPuppet);
+ AddTemplate((lwe::Entity&&)plyPuppet);
CreateEntity(player->GetHashId(), "Player");
@@ -326,7 +334,7 @@ void TestLevel::Setup()
lwe::Skybox* skybox = new lwe::Skybox("Skybox", "Skybox");
skyboxEnt->AddComponent(skybox);
- AddEntity(skyboxEnt);
+ AddEntity((lwe::Entity&&)skyboxEnt);
lwe::Entity* ent = new lwe::Entity("Main");
ent->SetScale({0.25f, 0.25f, 0.25f});
@@ -350,11 +358,11 @@ void TestLevel::Setup()
entCollider->SetPos({0.0f, 1.1f, 0.0f});
entCollider->SetCollidedCb([](lwe::RigidBody* a, lwe::RigidBody* b)
{
- lwe::Entity* aOwner = (lwe::Entity*)a->GetParent();
+ lwe::Entity* aOwner = a->GetEntity();
lwe::Health* health = (lwe::Health*)aOwner->GetComponent("Health");
health->TakeDamage(10);
- lwe::Entity* bOwner = (lwe::Entity*)b->GetParent();
+ lwe::Entity* bOwner = b->GetEntity();
bOwner->Delete();
if (health->GetHealth() <= 0)
@@ -372,16 +380,16 @@ void TestLevel::Setup()
ph->SetAnimation("Test");
ent->AddComponent(ph);
- AddEntity(ent);
+ AddEntity((lwe::Entity&&)ent);
- lwe::Entity* sun = new lwe::Entity("Sun");
- sun->SetPos({-5.0f, 0.0f, 5.0f});
+ lwe::Entity sun("Sun");
+ sun.SetPos({-5.0f, 0.0f, 5.0f});
lwe::AmbientPointLight* sunLight = new lwe::AmbientPointLight("Light");
sunLight->SetDiffuse({1.0f, 0.77254901960784313725490196078431f, 0.56078431372549019607843137254902f});
- sun->AddComponent(sunLight);
+ sun.AddComponent(sunLight);
- AddEntity(sun);
+ AddEntity((lwe::Entity&&)sun);
lwe::Entity* emergency = new lwe::Entity("Emergency");
emergency->SetPos({5.0f, 0.0f, 5.0f});
@@ -390,14 +398,14 @@ void TestLevel::Setup()
pl->SetColor({1.0f, 0.0f, 0.0f});
emergency->AddComponent(pl);
- AddEntity(emergency);
+ AddEntity((lwe::Entity&&)emergency);
lwe::Entity* testEnt = new lwe::Entity("Test");
lwe::Billboard* testBb = new lwe::Billboard("TestBB", "Character_Diffuse");
testEnt->AddComponent(testBb);
- AddEntity(testEnt);
+ AddEntity((lwe::Entity&&)testEnt);
lwe::Entity* bullet = new lwe::Entity("Bullet");
bullet->SetScale({0.1f, 0.1f, 0.1f});
@@ -411,7 +419,7 @@ void TestLevel::Setup()
lwe::SolidColor* bulletMdl = new lwe::SolidColor("Mdl", {1.0f, 1.0f, 0.0f, 1.0f}, "Cube", "");
bullet->AddComponent(bulletMdl);
- AddTemplate(bullet);
+ AddTemplate((lwe::Entity&&)bullet);
}
void TestLevel::PostInitialize(lwe::GpuCmdBuffer* cmdBuffer)
@@ -454,21 +462,21 @@ void TestLevel::PostInitialize(lwe::GpuCmdBuffer* cmdBuffer)
*/
}
-void TestLevel::OnUpdate(lwe::RenderWindow* win, lwe::Input* input, const float delta)
+void TestLevel::OnUpdate(lwe::RenderWindow* win, ehs::Input* input, const float delta)
{
- lwe::GameLoop* gl = (lwe::GameLoop*)GetParent("GameLoop");
+ lwe::GameLoop* gl = GetParent();
if (!gl)
return;
- const lwe::InputHandler* ih = win->GetInputHandler();
+ const ehs::InputHandler* ih = win->GetInputHandler();
if (!ih)
return;
- const lwe::Mouse* mouse = (lwe::Mouse*)ih->GetDeviceByType(LWE_HID_MOUSE);
+ const ehs::Mouse* mouse = (ehs::Mouse*)ih->GetDeviceByType(EHS_HID_MOUSE);
if (!mouse)
return;
- const lwe::Keyboard* keyboard = (lwe::Keyboard*)ih->GetDeviceByType(LWE_HID_KEYBOARD);
+ const ehs::Keyboard* keyboard = (ehs::Keyboard*)ih->GetDeviceByType(EHS_HID_KEYBOARD);
if (!keyboard)
return;
@@ -476,7 +484,7 @@ void TestLevel::OnUpdate(lwe::RenderWindow* win, lwe::Input* input, const float
if (!ent)
return;
- ent->SetRot(ent->GetRot() + lwe::Vec3_f(50.0f) * delta);
+ ent->SetRot(ent->GetRot() + ehs::Vec3_f(50.0f) * delta);
lwe::Entity* ply = GetEntity("Player");
if (ply && win->IsCursorConstrained() && !win->IsCursorVisible())
@@ -488,13 +496,13 @@ void TestLevel::OnUpdate(lwe::RenderWindow* win, lwe::Input* input, const float
if (camSys)
camSys->SetPrimary(ply->GetHashId(), cam->GetHashId());
- if (cooldown <= 0.0f && mouse->IsDown(lwe::Mouse::LMB)) // Left Mouse Button
+ if (cooldown <= 0.0f && mouse->IsDown(ehs::Mouse::LMB)) // Left Mouse Button
{
- lwe::AudioSource* gunshot = new lwe::AudioSource("Gunshot_" + lwe::Str_8::FromNum(count), "Gunshot");
+ lwe::AudioSource* gunshot = new lwe::AudioSource("Gunshot_" + ehs::Str_8::FromNum(count), "Gunshot");
gunshot->SetVolume(1.0f);
ply->AddComponent(gunshot);
- lwe::Entity* bullet = CreateEntity("Bullet", "Bullet_" + lwe::Str_8::FromNum(count++));
+ lwe::Entity* bullet = CreateEntity("Bullet", "Bullet_" + ehs::Str_8::FromNum(count++));
bullet->SetPos(ply->GetPos() + cam->GetTransform().GetForward() * 2.0f);
bullet->SetScale({0.1f, 0.1f, 0.1f});
bullet->SetRot(ply->GetRot());
@@ -524,7 +532,7 @@ void TestLevel::OnUpdate(lwe::RenderWindow* win, lwe::Input* input, const float
return;
lwe::LabelGui* fps = (lwe::LabelGui*)stats->GetChild("FPS");
- fps->SetText("FPS: " + lwe::Str_8::FromNum(gl->GetTPS()));
+ fps->SetText("FPS: " + ehs::Str_8::FromNum(gl->GetTPS()));
lwe::AudioSource* source = (lwe::AudioSource*)ent->GetComponent("AudioSource3D", "Song");
if (!source)
@@ -536,24 +544,24 @@ void TestLevel::OnUpdate(lwe::RenderWindow* win, lwe::Input* input, const float
lwe::LabelGui* playback = (lwe::LabelGui*)stats->GetChild("Playback");
- lwe::UInt_64 elapsed = source->GetFrameOffset() / audio->GetSampleRate();
- lwe::UInt_64 duration = audio->GetFrameCount() / audio->GetSampleRate();
+ ehs::UInt_64 elapsed = source->GetFrameOffset() / audio->GetSampleRate();
+ ehs::UInt_64 duration = audio->GetFrameCount() / audio->GetSampleRate();
- playback->SetText("Playback: " + lwe::Str_8::FromNum(elapsed / 60) + ":" + lwe::Str_8::FromNum(elapsed % 60) +
- " / " + lwe::Str_8::FromNum(duration / 60) + ":" + lwe::Str_8::FromNum(duration % 60));
+ playback->SetText("Playback: " + ehs::Str_8::FromNum(elapsed / 60) + ":" + ehs::Str_8::FromNum(elapsed % 60) +
+ " / " + ehs::Str_8::FromNum(duration / 60) + ":" + ehs::Str_8::FromNum(duration % 60));
if (win->IsCursorConstrained() && !win->IsCursorVisible())
{
- if (keyboard->IsJustReleased(lwe::Keyboard::Left))
+ if (keyboard->IsJustReleased(ehs::Keyboard::Left))
source->SetVolume(source->GetVolume() - 0.25f);
- if (keyboard->IsJustReleased(lwe::Keyboard::Right))
+ if (keyboard->IsJustReleased(ehs::Keyboard::Right))
source->SetVolume(source->GetVolume() + 0.25f);
lwe::LabelGui* volume = (lwe::LabelGui*)stats->GetChild("Volume");
- volume->SetText("Volume: " + lwe::Str_8::FromNum(source->GetVolume()));
+ volume->SetText("Volume: " + ehs::Str_8::FromNum(source->GetVolume()));
- if (keyboard->IsJustReleased(lwe::Keyboard::P))
+ if (keyboard->IsJustReleased(ehs::Keyboard::P))
{
if (source->IsPlaying())
source->Pause();
@@ -561,7 +569,7 @@ void TestLevel::OnUpdate(lwe::RenderWindow* win, lwe::Input* input, const float
source->Play();
}
- if (keyboard->IsJustReleased(lwe::Keyboard::Backspace))
+ if (keyboard->IsJustReleased(ehs::Keyboard::Backspace))
source->Reset();
}
}
diff --git a/Levels/TestLevel.h b/Levels/TestLevel.h
index 5f84046..e069a93 100644
--- a/Levels/TestLevel.h
+++ b/Levels/TestLevel.h
@@ -1,31 +1,29 @@
#pragma once
-#include
-#include
+#include
-#include
-#include
+#include
class TestLevel : public lwe::Level
{
private:
- lwe::UInt_32 count;
+ ehs::UInt_32 count;
float cooldown;
public:
TestLevel();
- explicit TestLevel(const lwe::Str_8& id);
+ explicit TestLevel(const ehs::Str_8& id);
TestLevel(const TestLevel& level);
TestLevel& operator=(const TestLevel& level);
- void SetupResources() override;
+ void SetupResources(lwe::GpuInterface* inf) override;
void Setup() override;
void PostInitialize(lwe::GpuCmdBuffer* cmdBuffer) override;
- void OnUpdate(lwe::RenderWindow* win, lwe::Input* input, const float delta) override;
+ void OnUpdate(lwe::RenderWindow* win, ehs::Input* input, const float delta) override;
};
\ No newline at end of file
diff --git a/main.cpp b/main.cpp
index e4df70f..14b8899 100644
--- a/main.cpp
+++ b/main.cpp
@@ -1,44 +1,28 @@
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+
+#include
+#include
+#include
+#include
#include
#include "Levels/MainMenu.h"
#include "Levels/TestLevel.h"
-bool running = true;
-
-lwe::UInt_32 GcCb(void* params)
+void LogRaised(const ehs::Log& log)
{
- while (running)
- {
- lwe::GarbageCollector::Poll();
- lwe::Thread::SleepFor(50);
- }
+ ehs::Array tags = log.GetTags();
- lwe::GarbageCollector::Dump();
-
- return 0;
-}
-
-void LogRaised(const lwe::Log& log)
-{
- lwe::Array tags = log.GetTags();
-
- lwe::Str_8 result = "{";
+ ehs::Str_8 result = "{";
if (log.HasTag("Info"))
{
@@ -48,63 +32,63 @@ void LogRaised(const lwe::Log& log)
}
else
{
- for (lwe::UInt_32 i = 0; i < tags.Size(); ++i)
+ for (ehs::UInt_32 i = 0; i < tags.Size(); ++i)
{
result += tags[i];
if (i != tags.Size() - 1)
result += ", ";
}
- result += "} (" + lwe::Str_8::FromNum(log.GetCode()) + "): " + log.GetMsg();
+ result += "} (" + ehs::Str_8::FromNum(log.GetCode()) + "): " + log.GetMsg();
}
- lwe::Console::Write_8(result);
+ ehs::Console::Write_8(result);
if (log.HasTag("Error"))
{
- lwe::Console::Read_8();
+ ehs::Console::Read_8();
}
}
-lwe::SInt_32 Main(lwe::Str_8* appName, lwe::Str_8* appVerId, lwe::Version* appVer)
+ehs::SInt_32 Main(ehs::Str_8* appName, ehs::Str_8* appVerId, ehs::Version* appVer)
{
*appName = "TechDemo";
*appVerId = "Release";
*appVer = {1, 0, 0};
- lwe::Log::SetCallback(LogRaised);
+ ehs::Log::SetCallback(LogRaised);
- lwe::File configFile("Config.json", lwe::Mode::READ_WRITE, lwe::Disposition::OPEN_PERSISTENT);
+ ehs::File configFile("Config.json", ehs::Mode::READ_WRITE, ehs::Disposition::OPEN_PERSISTENT);
if (!configFile.Size())
{
- lwe::JsonObj root;
+ ehs::JsonObj root;
- lwe::JsonObj server;
+ ehs::JsonObj server;
server.AddVar({"identifier", ""});
server.AddVar({"address", ""});
server.AddVar({"port", 7840});
server.AddVar({"maxPlayers", 0});
root.AddVar({"server", server});
- lwe::JsonObj client;
+ ehs::JsonObj client;
client.AddVar({"username", ""});
client.AddVar({"connectAddress", ""});
client.AddVar({"connectPort", 7840});
root.AddVar({"client", client});
- lwe::JsonObj server_client;
+ ehs::JsonObj server_client;
server_client.AddVar({"timeout", 5});
server_client.AddVar({"resendRate", 0.5f});
root.AddVar({"server_client", server_client});
- lwe::JsonObj engine;
+ ehs::JsonObj engine;
engine.AddVar({"threadCount", 0});
engine.AddVar({"timeLocked", true});
engine.AddVar({"maxTPS", 60});
root.AddVar({"engine", engine});
- lwe::Json config(root);
+ ehs::Json config(root);
configFile.WriteStr_8(config.ToStr(false));
@@ -113,47 +97,36 @@ lwe::SInt_32 Main(lwe::Str_8* appName, lwe::Str_8* appVerId, lwe::Version* appVe
return 0;
}
- lwe::Json config(configFile.ReadStr_8(configFile.Size()), 0);
+ ehs::Json config(configFile.ReadStr_8(configFile.Size()), 0);
configFile.Release();
- lwe::Vector args = lwe::Console::GetArgs_8();
- if (args.Size() > 1 && lwe::Str_8::Cmp(args[1], "-server"))
+ ehs::Vector args = ehs::Console::GetArgs_8();
+ if (args.Size() > 1 && ehs::Str_8::Cmp(args[1], "-server"))
{
- lwe::Console::Attach();
+ ehs::Console::Attach();
- lwe::Console::SetTitle_8("TechDemo");
+ ehs::Console::SetTitle_8("TechDemo");
- LWE_LOG("Info", 0, "Initializing server, standby.");
+ EHS_LOG("Info", 0, "Initializing server, standby.");
- lwe::GameLoop gl((lwe::UInt_8)*(lwe::JsonNum*)config.RetrieveValue("engine.threadCount"), 0);
- gl.EnableTimeLock(*(lwe::JsonBool*)config.RetrieveValue("engine.timeLocked"));
- gl.SetMaxTPS((lwe::UInt_32)*(lwe::JsonNum*)config.RetrieveValue("engine.maxTPS"));
+ lwe::GameLoop gl((ehs::UInt_8)*(ehs::JsonNum*)config.RetrieveValue("engine.threadCount"), 0);
+ gl.EnableTimeLock(*(ehs::JsonBool*)config.RetrieveValue("engine.timeLocked"));
+ gl.SetMaxTPS((ehs::UInt_32)*(ehs::JsonNum*)config.RetrieveValue("engine.maxTPS"));
- lwe::Frame mainFrame("Main");
- gl.AddFrame(&mainFrame);
- mainFrame.AddLevel(new MainMenu("MainMenu"));
-
- lwe::GarbageCollector::SetStride(1000);
- lwe::GarbageCollector::SetMax(10);
-
- lwe::Thread gcThread;
- gcThread.Start(GcCb, nullptr);
+ gl.AddLevel(new MainMenu("MainMenu"));
gl.Initialize();
gl.Start();
gl.UnInitialize();
-
- running = false;
- gcThread.Join();
}
else
{
- lwe::Console::Attach();
+ ehs::Console::Attach();
- #if defined(LWE_OS_WINDOWS)
+ #if defined(EHS_OS_WINDOWS)
lwe::GpuInstance::AddExtension(VK_KHR_WIN32_SURFACE_EXTENSION_NAME);
- #elif defined(LWE_OS_LINUX)
+ #elif defined(EHS_OS_LINUX)
lwe::GpuInstance::AddExtension(VK_KHR_XCB_SURFACE_EXTENSION_NAME);
#endif
@@ -171,22 +144,14 @@ lwe::SInt_32 Main(lwe::Str_8* appName, lwe::Str_8* appVerId, lwe::Version* appVe
inf.Initialize();
lwe::RenderWindow win(&inf, &primary);
- win.Create_8(lwe::GetAppName_8(), {0, 0}, {1024, 768});
+ win.Create_8(ehs::GetAppName_8(), {0, 0}, {1024, 768});
win.Show();
- lwe::GameLoop gl(&win, (lwe::UInt_8)*(lwe::JsonNum*)config.RetrieveValue("engine.threadCount"), 0);
- gl.EnableTimeLock(*(lwe::JsonBool*)config.RetrieveValue("engine.timeLocked"));
- gl.SetMaxTPS((lwe::UInt_32)*(lwe::JsonNum*)config.RetrieveValue("engine.maxTPS"));
+ lwe::GameLoop gl(&win, (ehs::UInt_8)*(ehs::JsonNum*)config.RetrieveValue("engine.threadCount"), 0);
+ gl.EnableTimeLock(*(ehs::JsonBool*)config.RetrieveValue("engine.timeLocked"));
+ gl.SetMaxTPS((ehs::UInt_32)*(ehs::JsonNum*)config.RetrieveValue("engine.maxTPS"));
- lwe::Frame mainFrame("Main");
- gl.AddFrame(&mainFrame);
- mainFrame.AddLevel(new TestLevel("Test"));
-
- lwe::GarbageCollector::SetStride(1000);
- lwe::GarbageCollector::SetMax(10);
-
- lwe::Thread gcThread;
- gcThread.Start(GcCb, nullptr);
+ gl.AddLevel(new TestLevel("Test"));
gl.Initialize();
gl.Start();
@@ -194,17 +159,12 @@ lwe::SInt_32 Main(lwe::Str_8* appName, lwe::Str_8* appVerId, lwe::Version* appVe
win.Close();
- running = false;
- gcThread.Join();
-
inf.Release();
lwe::GpuInstance::Release();
-
- //lwe::AudioEngine::UnInitialize();
}
- lwe::Console::Free();
+ ehs::Console::Free();
return 0;
}
\ No newline at end of file