Add LinuxSystemDriver and WaylandSystemDriver classes

This commit is contained in:
2025-03-28 14:57:38 +10:00
parent f727261a84
commit 211eb9a1d6
10 changed files with 97 additions and 16 deletions

View File

@@ -7,8 +7,9 @@
#include <nova/core/debug.h>
#include <nova/platform/system.h>
#include "drivers/win32/system_driver.h"
#include "drivers/x11/system_driver.h"
#include "drivers/linux/wayland/system_driver.h"
#include "drivers/linux/x11/system_driver.h"
#include "drivers/windows/system_driver.h"
using namespace Nova;
@@ -19,10 +20,16 @@ void System::init() {
NOVA_ASSERT(!s_driver);
#ifdef WIN32
s_driver = std::make_unique<Win32SystemDriver>();
s_driver = std::make_unique<WindowsSystemDriver>();
#else
// TODO: Detect Wayland
s_driver = std::make_unique<X11SystemDriver>();
if (std::getenv("WAYLAND_DISPLAY")) {
s_driver = std::make_unique<WaylandSystemDriver>();
} else if (std::getenv("DISPLAY")) {
s_driver = std::make_unique<X11SystemDriver>();
} else {
NOVA_ERROR("Unsupported windowing system");
s_driver = std::make_unique<LinuxSystemDriver>();
}
#endif
}