Kaynağa Gözat

device: add initial Wayland support

Part-of: #165
Daniele Bartolini 17 saat önce
ebeveyn
işleme
4e9385160a

+ 3 - 0
scripts/crown.lua

@@ -103,6 +103,9 @@ function crown_project(_name, _kind, _defines)
 				"pthread",
 				"openal",
 			}
+			includedirs {
+				CROWN_DIR .. "3rdparty/wayland/include",
+			}
 
 		configuration { "wasm" }
 			kind "ConsoleApp"

+ 1 - 0
src/device/device.cpp

@@ -668,6 +668,7 @@ int Device::main_loop()
 	init.allocator = _bgfx_allocator;
 	init.platformData.ndt = _window->native_display();
 	init.platformData.nwh = _window->native_handle();
+	init.platformData.type = (bgfx::NativeWindowHandleType::Enum)(uintptr_t)_window->native_handle_type();
 	init.vendorId = BGFX_PCI_ID_NONE;
 #if CROWN_PLATFORM_ANDROID || CROWN_PLATFORM_EMSCRIPTEN
 	init.type = bgfx::RendererType::OpenGLES;

+ 5 - 0
src/device/main_android.cpp

@@ -276,6 +276,11 @@ struct WindowAndroid : public Window
 		return s_android_device->_window;
 	}
 
+	void *native_handle_type() override
+	{
+		return (void *)(uintptr_t)bgfx::NativeWindowHandleType::Default;
+	}
+
 	void *native_display() override
 	{
 		return NULL;

+ 5 - 0
src/device/main_html5.cpp

@@ -143,6 +143,11 @@ struct WindowEmscripten : public Window
 		return (void *)"#" CROWN_HTML5_CANVAS_NAME;
 	}
 
+	void *native_handle_type() override
+	{
+		return (void *)(uintptr_t)bgfx::NativeWindowHandleType::Default;
+	}
+
 	void *native_display() override
 	{
 		return NULL;

Dosya farkı çok büyük olduğundan ihmal edildi
+ 1060 - 77
src/device/main_linux.cpp


+ 5 - 0
src/device/main_windows.cpp

@@ -899,6 +899,11 @@ struct WindowWin : public Window
 		return (void *)(uintptr_t)s_windows_device->_hwnd;
 	}
 
+	void *native_handle_type() override
+	{
+		return (void *)(uintptr_t)bgfx::NativeWindowHandleType::Default;
+	}
+
 	void *native_display() override
 	{
 		return NULL;

+ 3 - 0
src/device/window.h

@@ -106,6 +106,9 @@ struct Window
 	/// Returns the native window handle or NULL if the platform does not support it.
 	virtual void *native_handle() = 0;
 
+	/// Return the type of the native window handle.
+	virtual void *native_handle_type() = 0;
+
 	/// Returns the native display handle or NULL if the platform does not support it.
 	virtual void *native_display() = 0;
 };

Bu fark içinde çok fazla dosya değişikliği olduğu için bazı dosyalar gösterilmiyor