فهرست منبع

Add Window::show_cursor()

Daniele Bartolini 10 سال پیش
والد
کامیت
60ced3dc78
4فایلهای تغییر یافته به همراه20 افزوده شده و 0 حذف شده
  1. 3 0
      src/device/window.h
  2. 4 0
      src/main/main_android.cpp
  3. 8 0
      src/main/main_linux.cpp
  4. 5 0
      src/main/main_windows.cpp

+ 3 - 0
src/device/window.h

@@ -50,6 +50,9 @@ public:
 	/// Returns the native window handle.
 	virtual void* handle() = 0;
 
+	/// Sets whether to @a show the cursor.
+	virtual void show_cursor(bool show) = 0;
+
 	virtual void bgfx_setup() = 0;
 
 	static Window* create(Allocator& a);

+ 4 - 0
src/main/main_android.cpp

@@ -249,6 +249,10 @@ public:
 	{
 	}
 
+	void show_cursor(bool /*show*/)
+	{
+	}
+
 	void* handle()
 	{
 		return NULL;

+ 8 - 0
src/main/main_linux.cpp

@@ -612,6 +612,14 @@ public:
 	{
 		return (void*)(uintptr_t)_x11_window;
 	}
+
+	void show_cursor(bool show)
+	{
+		XDefineCursor(_x11_display
+			, _x11_window
+			, show ? None : _x11_hidden_cursor
+			);
+	}
 };
 
 Window* Window::create(Allocator& a)

+ 5 - 0
src/main/main_windows.cpp

@@ -558,6 +558,11 @@ public:
 		SetWindowText(_hwnd, title);
 	}
 
+	void show_cursor(bool show)
+	{
+		ShowCursor(show);
+	}
+
 	void* handle()
 	{
 		return (void*)(uintptr_t)_hwnd;