diff --git a/Levels/TestLevel.cpp b/Levels/TestLevel.cpp index 0aaef2a..fc07a5f 100644 --- a/Levels/TestLevel.cpp +++ b/Levels/TestLevel.cpp @@ -339,7 +339,7 @@ void TestLevel::Setup(lwe::GpuInterface* inf) lwe::Entity ent("Main"); ent.SetScale({0.25f, 0.25f, 0.25f}); - ent.SetPos({0.0f, -1.0f, 5.0f}); + ent.SetPos({0.0f, -1.0f, 10.0f}); //ent->SetRot({-90.0f, 180.0f, 0.0f}); //ent->AddComponent(new lwe::Networked(false, false, lwe::EndpointOwner::SERVICE)); @@ -385,7 +385,7 @@ void TestLevel::Setup(lwe::GpuInterface* inf) AddEntity((lwe::Entity&&)ent); lwe::Entity sun("Sun"); - sun.SetPos({-5.0f, 0.0f, 5.0f}); + sun.SetPos({-5.0f, 0.0f, 10.0f}); lwe::AmbientPointLight* sunLight = new lwe::AmbientPointLight("Light"); sunLight->SetDiffuse({1.0f, 0.77254901960784313725490196078431f, 0.56078431372549019607843137254902f}); @@ -394,7 +394,7 @@ void TestLevel::Setup(lwe::GpuInterface* inf) AddEntity((lwe::Entity&&)sun); lwe::Entity emergency("Emergency"); - emergency.SetPos({5.0f, 0.0f, 5.0f}); + emergency.SetPos({5.0f, 0.0f, 10.0f}); lwe::PointLight* pl = new lwe::PointLight("Light"); pl->SetColor({1.0f, 0.0f, 0.0f}); @@ -470,6 +470,17 @@ void TestLevel::OnUpdate(lwe::RenderWindow* win, ehs::Input* input, const float if (!gl) return; + lwe::GuiSystem* guiSys = (lwe::GuiSystem*)GetSystem("GuiSystem"); + if (!guiSys) + return; + + lwe::CollectionGui* stats = (lwe::CollectionGui*)guiSys->GetGui("Stats"); + if (!stats) + return; + + lwe::LabelGui* fps = (lwe::LabelGui*)stats->GetChild("FPS"); + fps->SetText("FPS: " + ehs::Str_8::FromNum(gl->GetTPS())); + const ehs::InputHandler* ih = win->GetInputHandler(); if (!ih) return; @@ -525,17 +536,6 @@ void TestLevel::OnUpdate(lwe::RenderWindow* win, ehs::Input* input, const float cooldown -= delta; } - lwe::GuiSystem* guiSys = (lwe::GuiSystem*)GetSystem("GuiSystem"); - if (!guiSys) - return; - - lwe::CollectionGui* stats = (lwe::CollectionGui*)guiSys->GetGui("Stats"); - if (!stats) - return; - - lwe::LabelGui* fps = (lwe::LabelGui*)stats->GetChild("FPS"); - fps->SetText("FPS: " + ehs::Str_8::FromNum(gl->GetTPS())); - lwe::AudioSource* source = (lwe::AudioSource*)ent->GetComponent("AudioSource3D", "Song"); if (!source) return; diff --git a/main.cpp b/main.cpp index 0eff165..c1cf782 100644 --- a/main.cpp +++ b/main.cpp @@ -92,24 +92,14 @@ ehs::SInt_32 Main(ehs::Str_8* appName, ehs::Str_8* appVerId, ehs::Version* appVe { ehs::Console::Attach(); - #if defined(EHS_OS_WINDOWS) - lwe::GpuInstance::AddExtension(VK_KHR_WIN32_SURFACE_EXTENSION_NAME); - #elif defined(EHS_OS_LINUX) - #if defined(EHS_WS_WAYLAND) - lwe::GpuInstance::AddExtension(VK_KHR_WAYLAND_SURFACE_EXTENSION_NAME); - #elif defined(EHS_WS_XCB) - lwe::GpuInstance::AddExtension(VK_KHR_XCB_SURFACE_EXTENSION_NAME); - #endif - #endif - - lwe::GpuInstance::AddExtension(VK_KHR_SURFACE_EXTENSION_NAME); + lwe::RenderWindow::AddExtensions(); lwe::GpuInstance::Initialize(true); lwe::GpuDevice device = std::move(lwe::GpuDevice::GetBest()); lwe::GpuQueueFamily* family = device.GetQueueFamily(lwe::QueueType::GRAPHICS); lwe::GpuInterface inf(&device); - inf.AddExtensions(VK_KHR_SWAPCHAIN_EXTENSION_NAME); + lwe::RenderWindow::AddExtensions(&inf); lwe::GpuQueue primary(family, &inf, 1.0f);