瀏覽代碼

add cursor-visible

cxgeorge 24 年之前
父節點
當前提交
9b5662b635
共有 3 個文件被更改,包括 20 次插入1 次删除
  1. 2 1
      panda/src/chancfg/chancfg.cxx
  2. 13 0
      panda/src/display/graphicsWindow.I
  3. 5 0
      panda/src/display/graphicsWindow.h

+ 2 - 1
panda/src/chancfg/chancfg.cxx

@@ -389,7 +389,7 @@ ChanConfig::ChanConfig(GraphicsPipe* pipe, std::string cfg, Node *render,
 
   bool border = !chanconfig.GetBool("no-border", !W.getBorder());
   bool fullscreen = chanconfig.GetBool("fullscreen", false);
-  //  bool cursor = chanconfig.GetBool("cursor-visible", W.getCursor());
+  bool use_cursor = chanconfig.GetBool("cursor-visible", W.getCursor());
   int want_depth_bits = chanconfig.GetInt("want-depth-bits", 1);
   int want_color_bits = chanconfig.GetInt("want-color-bits", 1);
 
@@ -412,6 +412,7 @@ ChanConfig::ChanConfig(GraphicsPipe* pipe, std::string cfg, Node *render,
   props._fullscreen = fullscreen;
   props._want_depth_bits = want_depth_bits;
   props._want_color_bits = want_color_bits;
+  props._bCursorIsVisible = use_cursor;
 
   // stereo prep?
   // DVR prep?

+ 13 - 0
panda/src/display/graphicsWindow.I

@@ -43,6 +43,7 @@ INLINE GraphicsWindow::Properties::Properties(const Properties &InitProp) {
     _mask=InitProp._mask;
     _want_depth_bits=InitProp._want_depth_bits;
     _want_color_bits=InitProp._want_color_bits;
+    _bCursorIsVisible=InitProp._bCursorIsVisible;
 }
 
 ////////////////////////////////////////////////////////////////////
@@ -107,6 +108,18 @@ set_fullscreen(bool fullscreen) {
   _fullscreen = fullscreen;
 }
 
+/*
+////////////////////////////////////////////////////////////////////
+//     Function: GraphicsWindow::Properties::set_cursor_visible
+//       Access: Published
+//  Description: Specifies if mouse cursor is visible
+////////////////////////////////////////////////////////////////////
+INLINE void GraphicsWindow::Properties::
+set_cursor_visible(bool IsVisible) {
+  _bCursorIsVisible=IsVisible;   // note: gsg should override to implement
+}
+*/
+
 ////////////////////////////////////////////////////////////////////
 //     Function: GraphicsWindow::Properties::set_mask
 //       Access: Published

+ 5 - 0
panda/src/display/graphicsWindow.h

@@ -93,6 +93,7 @@ PUBLISHED:
     string _title;
     bool _border;
     bool _fullscreen;
+    bool _bCursorIsVisible;
     uint _mask;
     int _want_depth_bits;
     int _want_color_bits;
@@ -135,6 +136,10 @@ PUBLISHED:
   INLINE void set_sync(const bool);
   INLINE bool get_sync() const;
 
+  // since this requires gsg modification, dont worry about implementing it yet
+  // since init control is good enough
+  // virtual void set_cursor_visible(bool bIsVisible);  // should be overridden by gsg to implement
+
   // resize the window to the given size
   virtual void resize(unsigned int xsize,unsigned int ysize);