Add LinuxSystemDriver and WaylandSystemDriver classes
This commit is contained in:
@@ -23,8 +23,10 @@ FetchContent_MakeAvailable(SDL3)
|
|||||||
set(ENGINE_SRC
|
set(ENGINE_SRC
|
||||||
core/debug.cpp
|
core/debug.cpp
|
||||||
drivers/vulkan/render_driver.cpp
|
drivers/vulkan/render_driver.cpp
|
||||||
drivers/win32/system_driver.cpp
|
drivers/windows/system_driver.cpp
|
||||||
drivers/x11/system_driver.cpp
|
drivers/linux/system_driver.cpp
|
||||||
|
drivers/linux/wayland/system_driver.cpp
|
||||||
|
drivers/linux/x11/system_driver.cpp
|
||||||
platform/system.cpp
|
platform/system.cpp
|
||||||
render/renderer.cpp
|
render/renderer.cpp
|
||||||
render/render_device.cpp
|
render/render_device.cpp
|
||||||
|
|||||||
@@ -4,16 +4,16 @@
|
|||||||
* SPDX-License-Identifier: BSD-3-Clause
|
* SPDX-License-Identifier: BSD-3-Clause
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "drivers/win32/system_driver.h"
|
#include "drivers/linux/system_driver.h"
|
||||||
|
|
||||||
#include <nova/core/debug.h>
|
#include <nova/core/debug.h>
|
||||||
|
|
||||||
using namespace Nova;
|
using namespace Nova;
|
||||||
|
|
||||||
Win32SystemDriver::Win32SystemDriver() {
|
LinuxSystemDriver::LinuxSystemDriver() {
|
||||||
NOVA_AUTO_TRACE();
|
NOVA_AUTO_TRACE();
|
||||||
}
|
}
|
||||||
|
|
||||||
Win32SystemDriver::~Win32SystemDriver() {
|
LinuxSystemDriver::~LinuxSystemDriver() {
|
||||||
NOVA_AUTO_TRACE();
|
NOVA_AUTO_TRACE();
|
||||||
}
|
}
|
||||||
@@ -9,9 +9,9 @@
|
|||||||
#include <nova/platform/system_driver.h>
|
#include <nova/platform/system_driver.h>
|
||||||
|
|
||||||
namespace Nova {
|
namespace Nova {
|
||||||
class Win32SystemDriver final : public SystemDriver {
|
class LinuxSystemDriver : public SystemDriver {
|
||||||
public:
|
public:
|
||||||
Win32SystemDriver();
|
LinuxSystemDriver();
|
||||||
~Win32SystemDriver() override;
|
~LinuxSystemDriver() override;
|
||||||
};
|
};
|
||||||
} // namespace Nova
|
} // namespace Nova
|
||||||
19
engine/src/drivers/linux/wayland/system_driver.cpp
Normal file
19
engine/src/drivers/linux/wayland/system_driver.cpp
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
/**
|
||||||
|
* Copyright (c) 2025, Jayden Grubb <contact@jaydengrubb.com>
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: BSD-3-Clause
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "drivers/linux/wayland/system_driver.h"
|
||||||
|
|
||||||
|
#include <nova/core/debug.h>
|
||||||
|
|
||||||
|
using namespace Nova;
|
||||||
|
|
||||||
|
WaylandSystemDriver::WaylandSystemDriver() {
|
||||||
|
NOVA_AUTO_TRACE();
|
||||||
|
}
|
||||||
|
|
||||||
|
WaylandSystemDriver::~WaylandSystemDriver() {
|
||||||
|
NOVA_AUTO_TRACE();
|
||||||
|
}
|
||||||
17
engine/src/drivers/linux/wayland/system_driver.h
Normal file
17
engine/src/drivers/linux/wayland/system_driver.h
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
/**
|
||||||
|
* Copyright (c) 2025, Jayden Grubb <contact@jaydengrubb.com>
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: BSD-3-Clause
|
||||||
|
*/
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "drivers/linux/system_driver.h"
|
||||||
|
|
||||||
|
namespace Nova {
|
||||||
|
class WaylandSystemDriver final : public LinuxSystemDriver {
|
||||||
|
public:
|
||||||
|
WaylandSystemDriver();
|
||||||
|
~WaylandSystemDriver() override;
|
||||||
|
};
|
||||||
|
} // Nova
|
||||||
@@ -4,7 +4,7 @@
|
|||||||
* SPDX-License-Identifier: BSD-3-Clause
|
* SPDX-License-Identifier: BSD-3-Clause
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "drivers/x11/system_driver.h"
|
#include "drivers/linux/x11/system_driver.h"
|
||||||
|
|
||||||
#include <nova/core/debug.h>
|
#include <nova/core/debug.h>
|
||||||
|
|
||||||
@@ -6,10 +6,10 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <nova/platform/system_driver.h>
|
#include "drivers/linux/system_driver.h"
|
||||||
|
|
||||||
namespace Nova {
|
namespace Nova {
|
||||||
class X11SystemDriver final : public SystemDriver {
|
class X11SystemDriver final : public LinuxSystemDriver {
|
||||||
public:
|
public:
|
||||||
X11SystemDriver();
|
X11SystemDriver();
|
||||||
~X11SystemDriver() override;
|
~X11SystemDriver() override;
|
||||||
19
engine/src/drivers/windows/system_driver.cpp
Normal file
19
engine/src/drivers/windows/system_driver.cpp
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
/**
|
||||||
|
* Copyright (c) 2025, Jayden Grubb <contact@jaydengrubb.com>
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: BSD-3-Clause
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "drivers/windows/system_driver.h"
|
||||||
|
|
||||||
|
#include <nova/core/debug.h>
|
||||||
|
|
||||||
|
using namespace Nova;
|
||||||
|
|
||||||
|
WindowsSystemDriver::WindowsSystemDriver() {
|
||||||
|
NOVA_AUTO_TRACE();
|
||||||
|
}
|
||||||
|
|
||||||
|
WindowsSystemDriver::~WindowsSystemDriver() {
|
||||||
|
NOVA_AUTO_TRACE();
|
||||||
|
}
|
||||||
17
engine/src/drivers/windows/system_driver.h
Normal file
17
engine/src/drivers/windows/system_driver.h
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
/**
|
||||||
|
* Copyright (c) 2025, Jayden Grubb <contact@jaydengrubb.com>
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: BSD-3-Clause
|
||||||
|
*/
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <nova/platform/system_driver.h>
|
||||||
|
|
||||||
|
namespace Nova {
|
||||||
|
class WindowsSystemDriver final : public SystemDriver {
|
||||||
|
public:
|
||||||
|
WindowsSystemDriver();
|
||||||
|
~WindowsSystemDriver() override;
|
||||||
|
};
|
||||||
|
} // namespace Nova
|
||||||
@@ -7,8 +7,9 @@
|
|||||||
#include <nova/core/debug.h>
|
#include <nova/core/debug.h>
|
||||||
#include <nova/platform/system.h>
|
#include <nova/platform/system.h>
|
||||||
|
|
||||||
#include "drivers/win32/system_driver.h"
|
#include "drivers/linux/wayland/system_driver.h"
|
||||||
#include "drivers/x11/system_driver.h"
|
#include "drivers/linux/x11/system_driver.h"
|
||||||
|
#include "drivers/windows/system_driver.h"
|
||||||
|
|
||||||
using namespace Nova;
|
using namespace Nova;
|
||||||
|
|
||||||
@@ -19,10 +20,16 @@ void System::init() {
|
|||||||
NOVA_ASSERT(!s_driver);
|
NOVA_ASSERT(!s_driver);
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
s_driver = std::make_unique<Win32SystemDriver>();
|
s_driver = std::make_unique<WindowsSystemDriver>();
|
||||||
#else
|
#else
|
||||||
// TODO: Detect Wayland
|
if (std::getenv("WAYLAND_DISPLAY")) {
|
||||||
s_driver = std::make_unique<X11SystemDriver>();
|
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
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user