|
@@ -20,7 +20,7 @@
|
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////
|
|
////////////////////////////////////////////////////////////////////
|
|
|
// Function: GraphicsWindow::get_properties
|
|
// Function: GraphicsWindow::get_properties
|
|
|
-// Access: Public
|
|
|
|
|
|
|
+// Access: Published
|
|
|
// Description: Returns the full Properties structure that describes
|
|
// Description: Returns the full Properties structure that describes
|
|
|
// the window.
|
|
// the window.
|
|
|
////////////////////////////////////////////////////////////////////
|
|
////////////////////////////////////////////////////////////////////
|
|
@@ -31,7 +31,7 @@ get_properties() const {
|
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////
|
|
////////////////////////////////////////////////////////////////////
|
|
|
// Function: GraphicsWindow::get_width
|
|
// Function: GraphicsWindow::get_width
|
|
|
-// Access: Public
|
|
|
|
|
|
|
+// Access: Published
|
|
|
// Description:
|
|
// Description:
|
|
|
////////////////////////////////////////////////////////////////////
|
|
////////////////////////////////////////////////////////////////////
|
|
|
INLINE int GraphicsWindow::
|
|
INLINE int GraphicsWindow::
|
|
@@ -41,7 +41,7 @@ get_width() const {
|
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////
|
|
////////////////////////////////////////////////////////////////////
|
|
|
// Function: GraphicsWindow::get_height
|
|
// Function: GraphicsWindow::get_height
|
|
|
-// Access: Public
|
|
|
|
|
|
|
+// Access: Published
|
|
|
// Description:
|
|
// Description:
|
|
|
////////////////////////////////////////////////////////////////////
|
|
////////////////////////////////////////////////////////////////////
|
|
|
INLINE int GraphicsWindow::
|
|
INLINE int GraphicsWindow::
|
|
@@ -51,7 +51,7 @@ get_height() const {
|
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////
|
|
////////////////////////////////////////////////////////////////////
|
|
|
// Function: GraphicsWindow::get_xorg
|
|
// Function: GraphicsWindow::get_xorg
|
|
|
-// Access: Public
|
|
|
|
|
|
|
+// Access: Published
|
|
|
// Description:
|
|
// Description:
|
|
|
////////////////////////////////////////////////////////////////////
|
|
////////////////////////////////////////////////////////////////////
|
|
|
INLINE int GraphicsWindow::
|
|
INLINE int GraphicsWindow::
|
|
@@ -61,7 +61,7 @@ get_xorg() const {
|
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////
|
|
////////////////////////////////////////////////////////////////////
|
|
|
// Function: GraphicsWindow::get_yorg
|
|
// Function: GraphicsWindow::get_yorg
|
|
|
-// Access: Public
|
|
|
|
|
|
|
+// Access: Published
|
|
|
// Description:
|
|
// Description:
|
|
|
////////////////////////////////////////////////////////////////////
|
|
////////////////////////////////////////////////////////////////////
|
|
|
INLINE int GraphicsWindow::
|
|
INLINE int GraphicsWindow::
|
|
@@ -71,19 +71,24 @@ get_yorg() const {
|
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////
|
|
////////////////////////////////////////////////////////////////////
|
|
|
// Function: GraphicsWindow::get_gsg
|
|
// Function: GraphicsWindow::get_gsg
|
|
|
-// Access: Public
|
|
|
|
|
|
|
+// Access: Published
|
|
|
// Description: Returns the GSG that is associated with this window.
|
|
// Description: Returns the GSG that is associated with this window.
|
|
|
// There is a one-to-one association between windows and
|
|
// There is a one-to-one association between windows and
|
|
|
// GSG's.
|
|
// GSG's.
|
|
|
|
|
+//
|
|
|
|
|
+// It is invalid to call this if the window has been
|
|
|
|
|
+// closed; that is, if is_closed() returns true. In
|
|
|
|
|
+// this case the GSG has been closed as well.
|
|
|
////////////////////////////////////////////////////////////////////
|
|
////////////////////////////////////////////////////////////////////
|
|
|
INLINE GraphicsStateGuardian *GraphicsWindow::
|
|
INLINE GraphicsStateGuardian *GraphicsWindow::
|
|
|
get_gsg() const {
|
|
get_gsg() const {
|
|
|
|
|
+ nassertr(!is_closed(), NULL);
|
|
|
return _gsg;
|
|
return _gsg;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////
|
|
////////////////////////////////////////////////////////////////////
|
|
|
// Function: GraphicsWindow::get_pipe
|
|
// Function: GraphicsWindow::get_pipe
|
|
|
-// Access: Public
|
|
|
|
|
|
|
+// Access: Published
|
|
|
// Description: Returns the GraphicsPipe that this window is
|
|
// Description: Returns the GraphicsPipe that this window is
|
|
|
// associated with. It is possible that the
|
|
// associated with. It is possible that the
|
|
|
// GraphicsPipe might have been deleted while an
|
|
// GraphicsPipe might have been deleted while an
|
|
@@ -97,8 +102,104 @@ get_pipe() const {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////
|
|
////////////////////////////////////////////////////////////////////
|
|
|
-// Function: GraphicsWindow::get_num_input_devices
|
|
|
|
|
|
|
+// Function: GraphicsWindow::close_window
|
|
|
|
|
+// Access: Published
|
|
|
|
|
+// Description: Closes the window and frees all resources associated
|
|
|
|
|
+// with it, including the GSG. The window may not be
|
|
|
|
|
+// opened again.
|
|
|
|
|
+////////////////////////////////////////////////////////////////////
|
|
|
|
|
+INLINE void GraphicsWindow::
|
|
|
|
|
+close_window() {
|
|
|
|
|
+ if (!is_closed()) {
|
|
|
|
|
+ do_close_window();
|
|
|
|
|
+ release_gsg();
|
|
|
|
|
+ }
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+////////////////////////////////////////////////////////////////////
|
|
|
|
|
+// Function: GraphicsWindow::is_closed
|
|
|
|
|
+// Access: Published
|
|
|
|
|
+// Description: Returns true if close_window() has been called on
|
|
|
|
|
+// this window, false otherwise. If the window has been
|
|
|
|
|
+// closed, most of its interface is no longer valid.
|
|
|
|
|
+////////////////////////////////////////////////////////////////////
|
|
|
|
|
+INLINE bool GraphicsWindow::
|
|
|
|
|
+is_closed() const {
|
|
|
|
|
+ return (_gsg == (GraphicsStateGuardian *)NULL);
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+////////////////////////////////////////////////////////////////////
|
|
|
|
|
+// Function: GraphicsWindow::set_frame_number
|
|
|
|
|
+// Access: Published
|
|
|
|
|
+// Description: Sets the current frame number of the window. This
|
|
|
|
|
+// affects the frame numbers written for %f in a RIB or
|
|
|
|
|
+// image filename template. The frame number is
|
|
|
|
|
+// initially zero, and it increments at each call to
|
|
|
|
|
+// end_frame().
|
|
|
|
|
+////////////////////////////////////////////////////////////////////
|
|
|
|
|
+INLINE void GraphicsWindow::
|
|
|
|
|
+set_frame_number(const int f) {
|
|
|
|
|
+ _frame_number = f;
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+////////////////////////////////////////////////////////////////////
|
|
|
|
|
+// Function: GraphicsWindow::get_frame_number
|
|
|
|
|
+// Access: Published
|
|
|
|
|
+// Description: Returns the current frame number of the window. See
|
|
|
|
|
+// set_frame_number().
|
|
|
|
|
+////////////////////////////////////////////////////////////////////
|
|
|
|
|
+INLINE int GraphicsWindow::
|
|
|
|
|
+get_frame_number() const {
|
|
|
|
|
+ return _frame_number;
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+////////////////////////////////////////////////////////////////////
|
|
|
|
|
+// Function: GraphicsWindow::set_draw_callback
|
|
|
|
|
+// Access: Public
|
|
|
|
|
+// Description:
|
|
|
|
|
+////////////////////////////////////////////////////////////////////
|
|
|
|
|
+INLINE void GraphicsWindow::
|
|
|
|
|
+set_draw_callback(Callback *c) {
|
|
|
|
|
+ _draw_callback = c;
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+////////////////////////////////////////////////////////////////////
|
|
|
|
|
+// Function: GraphicsWindow::set_idle_callback
|
|
|
|
|
+// Access: Public
|
|
|
|
|
+// Description:
|
|
|
|
|
+////////////////////////////////////////////////////////////////////
|
|
|
|
|
+INLINE void GraphicsWindow::
|
|
|
|
|
+set_idle_callback(Callback *c) {
|
|
|
|
|
+ _idle_callback = c;
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+////////////////////////////////////////////////////////////////////
|
|
|
|
|
+// Function: GraphicsWindow::call_draw_callback
|
|
|
|
|
+// Access: Public
|
|
|
|
|
+// Description:
|
|
|
|
|
+////////////////////////////////////////////////////////////////////
|
|
|
|
|
+INLINE void GraphicsWindow::
|
|
|
|
|
+call_draw_callback(bool force_redraw) {
|
|
|
|
|
+ if (_draw_callback) {
|
|
|
|
|
+ _draw_callback->draw(force_redraw);
|
|
|
|
|
+ }
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+////////////////////////////////////////////////////////////////////
|
|
|
|
|
+// Function: GraphicsWindow::call_idle_callback
|
|
|
// Access: Public
|
|
// Access: Public
|
|
|
|
|
+// Description:
|
|
|
|
|
+////////////////////////////////////////////////////////////////////
|
|
|
|
|
+INLINE void GraphicsWindow::
|
|
|
|
|
+call_idle_callback() {
|
|
|
|
|
+ if (_idle_callback) {
|
|
|
|
|
+ _idle_callback->idle();
|
|
|
|
|
+ }
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+////////////////////////////////////////////////////////////////////
|
|
|
|
|
+// Function: GraphicsWindow::get_num_input_devices
|
|
|
|
|
+// Access: Published
|
|
|
// Description: Returns the number of separate input devices
|
|
// Description: Returns the number of separate input devices
|
|
|
// associated with the window. Typically, a window will
|
|
// associated with the window. Typically, a window will
|
|
|
// have exactly one input device: the keyboard/mouse
|
|
// have exactly one input device: the keyboard/mouse
|
|
@@ -113,7 +214,7 @@ get_num_input_devices() const {
|
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////
|
|
////////////////////////////////////////////////////////////////////
|
|
|
// Function: GraphicsWindow::get_input_device_name
|
|
// Function: GraphicsWindow::get_input_device_name
|
|
|
-// Access: Public
|
|
|
|
|
|
|
+// Access: Published
|
|
|
// Description: Returns the name of the nth input device.
|
|
// Description: Returns the name of the nth input device.
|
|
|
////////////////////////////////////////////////////////////////////
|
|
////////////////////////////////////////////////////////////////////
|
|
|
INLINE string GraphicsWindow::
|
|
INLINE string GraphicsWindow::
|
|
@@ -124,7 +225,7 @@ get_input_device_name(int device) const {
|
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////
|
|
////////////////////////////////////////////////////////////////////
|
|
|
// Function: GraphicsWindow::has_pointer
|
|
// Function: GraphicsWindow::has_pointer
|
|
|
-// Access: Public
|
|
|
|
|
|
|
+// Access: Published
|
|
|
// Description: Returns true if the nth input device has a
|
|
// Description: Returns true if the nth input device has a
|
|
|
// screen-space pointer (for instance, a mouse), false
|
|
// screen-space pointer (for instance, a mouse), false
|
|
|
// otherwise.
|
|
// otherwise.
|
|
@@ -137,7 +238,7 @@ has_pointer(int device) const {
|
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////
|
|
////////////////////////////////////////////////////////////////////
|
|
|
// Function: GraphicsWindow::has_keyboard
|
|
// Function: GraphicsWindow::has_keyboard
|
|
|
-// Access: Public
|
|
|
|
|
|
|
+// Access: Published
|
|
|
// Description: Returns true if the nth input device has a keyboard,
|
|
// Description: Returns true if the nth input device has a keyboard,
|
|
|
// false otherwise.
|
|
// false otherwise.
|
|
|
////////////////////////////////////////////////////////////////////
|
|
////////////////////////////////////////////////////////////////////
|
|
@@ -149,7 +250,7 @@ has_keyboard(int device) const {
|
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////
|
|
////////////////////////////////////////////////////////////////////
|
|
|
// Function: GraphicsWindow::get_mouse_data
|
|
// Function: GraphicsWindow::get_mouse_data
|
|
|
-// Access: Public
|
|
|
|
|
|
|
+// Access: Published
|
|
|
// Description: Returns the MouseData associated with the nth input
|
|
// Description: Returns the MouseData associated with the nth input
|
|
|
// device.
|
|
// device.
|
|
|
////////////////////////////////////////////////////////////////////
|
|
////////////////////////////////////////////////////////////////////
|
|
@@ -162,7 +263,7 @@ get_mouse_data(int device) const {
|
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////
|
|
////////////////////////////////////////////////////////////////////
|
|
|
// Function: GraphicsWindow::has_button_event
|
|
// Function: GraphicsWindow::has_button_event
|
|
|
-// Access: Public
|
|
|
|
|
|
|
+// Access: Published
|
|
|
// Description: Returns true if the indicated device has a pending
|
|
// Description: Returns true if the indicated device has a pending
|
|
|
// button event (a mouse button or keyboard button
|
|
// button event (a mouse button or keyboard button
|
|
|
// down/up), false otherwise. If this returns true, the
|
|
// down/up), false otherwise. If this returns true, the
|
|
@@ -177,7 +278,7 @@ has_button_event(int device) const {
|
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////
|
|
////////////////////////////////////////////////////////////////////
|
|
|
// Function: GraphicsWindow::get_button_event
|
|
// Function: GraphicsWindow::get_button_event
|
|
|
-// Access: Public
|
|
|
|
|
|
|
+// Access: Published
|
|
|
// Description: Assuming a previous call to has_button_event()
|
|
// Description: Assuming a previous call to has_button_event()
|
|
|
// returned true, this returns the pending button event.
|
|
// returned true, this returns the pending button event.
|
|
|
////////////////////////////////////////////////////////////////////
|
|
////////////////////////////////////////////////////////////////////
|
|
@@ -187,72 +288,3 @@ get_button_event(int device) {
|
|
|
return _input_devices[device].get_button_event();
|
|
return _input_devices[device].get_button_event();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-////////////////////////////////////////////////////////////////////
|
|
|
|
|
-// Function: GraphicsWindow::set_frame_number
|
|
|
|
|
-// Access: Public
|
|
|
|
|
-// Description: Sets the current frame number of the window. This
|
|
|
|
|
-// affects the frame numbers written for %f in a RIB or
|
|
|
|
|
-// image filename template. The frame number is
|
|
|
|
|
-// initially zero, and it increments at each call to
|
|
|
|
|
-// end_frame().
|
|
|
|
|
-////////////////////////////////////////////////////////////////////
|
|
|
|
|
-INLINE void GraphicsWindow::
|
|
|
|
|
-set_frame_number(const int f) {
|
|
|
|
|
- _frame_number = f;
|
|
|
|
|
-}
|
|
|
|
|
-
|
|
|
|
|
-////////////////////////////////////////////////////////////////////
|
|
|
|
|
-// Function: GraphicsWindow::get_frame_number
|
|
|
|
|
-// Access: Public
|
|
|
|
|
-// Description: Returns the current frame number of the window. See
|
|
|
|
|
-// set_frame_number().
|
|
|
|
|
-////////////////////////////////////////////////////////////////////
|
|
|
|
|
-INLINE int GraphicsWindow::
|
|
|
|
|
-get_frame_number() const {
|
|
|
|
|
- return _frame_number;
|
|
|
|
|
-}
|
|
|
|
|
-
|
|
|
|
|
-////////////////////////////////////////////////////////////////////
|
|
|
|
|
-// Function: GraphicsWindow::set_draw_callback
|
|
|
|
|
-// Access: Public
|
|
|
|
|
-// Description:
|
|
|
|
|
-////////////////////////////////////////////////////////////////////
|
|
|
|
|
-INLINE void GraphicsWindow::
|
|
|
|
|
-set_draw_callback(Callback *c) {
|
|
|
|
|
- _draw_callback = c;
|
|
|
|
|
-}
|
|
|
|
|
-
|
|
|
|
|
-////////////////////////////////////////////////////////////////////
|
|
|
|
|
-// Function: GraphicsWindow::set_idle_callback
|
|
|
|
|
-// Access: Public
|
|
|
|
|
-// Description:
|
|
|
|
|
-////////////////////////////////////////////////////////////////////
|
|
|
|
|
-INLINE void GraphicsWindow::
|
|
|
|
|
-set_idle_callback(Callback *c) {
|
|
|
|
|
- _idle_callback = c;
|
|
|
|
|
-}
|
|
|
|
|
-
|
|
|
|
|
-////////////////////////////////////////////////////////////////////
|
|
|
|
|
-// Function: GraphicsWindow::call_draw_callback
|
|
|
|
|
-// Access: Public
|
|
|
|
|
-// Description:
|
|
|
|
|
-////////////////////////////////////////////////////////////////////
|
|
|
|
|
-INLINE void GraphicsWindow::
|
|
|
|
|
-call_draw_callback(bool force_redraw) {
|
|
|
|
|
- if (_draw_callback) {
|
|
|
|
|
- _draw_callback->draw(force_redraw);
|
|
|
|
|
- }
|
|
|
|
|
-}
|
|
|
|
|
-
|
|
|
|
|
-////////////////////////////////////////////////////////////////////
|
|
|
|
|
-// Function: GraphicsWindow::call_idle_callback
|
|
|
|
|
-// Access: Public
|
|
|
|
|
-// Description:
|
|
|
|
|
-////////////////////////////////////////////////////////////////////
|
|
|
|
|
-INLINE void GraphicsWindow::
|
|
|
|
|
-call_idle_callback() {
|
|
|
|
|
- if (_idle_callback) {
|
|
|
|
|
- _idle_callback->idle();
|
|
|
|
|
- }
|
|
|
|
|
-}
|
|
|
|
|
-
|
|
|