From f36cc707b12a730ae82c637afbc7be196e51bbf4 Mon Sep 17 00:00:00 2001 From: David Rose Date: Fri, 10 Dec 2004 20:10:56 +0000 Subject: [PATCH] add get_window() --- panda/src/display/graphicsEngine.cxx | 32 ++++++++++++++++++++++++++-- panda/src/display/graphicsEngine.h | 3 +++ 2 files changed, 33 insertions(+), 2 deletions(-) diff --git a/panda/src/display/graphicsEngine.cxx b/panda/src/display/graphicsEngine.cxx index 854d0dcb4b..e26783accd 100644 --- a/panda/src/display/graphicsEngine.cxx +++ b/panda/src/display/graphicsEngine.cxx @@ -413,14 +413,42 @@ reset_all_windows(bool swapchain) { //////////////////////////////////////////////////////////////////// // Function: GraphicsEngine::is_empty // Access: Published -// Description: Returns true if there are no windows managed by the -// engine, false if there is at least one. +// Description: Returns true if there are no windows or buffers +// managed by the engine, false if there is at least +// one. //////////////////////////////////////////////////////////////////// bool GraphicsEngine:: is_empty() const { return _windows.empty(); } +//////////////////////////////////////////////////////////////////// +// Function: GraphicsEngine::get_num_windows +// Access: Published +// Description: Returns the number of windows (or buffers) managed by +// the engine. +//////////////////////////////////////////////////////////////////// +int GraphicsEngine:: +get_num_windows() const { + return _windows.size(); +} + +//////////////////////////////////////////////////////////////////// +// Function: GraphicsEngine::get_window +// Access: Published +// Description: Returns the nth window or buffers managed by the +// engine, in sorted order. +//////////////////////////////////////////////////////////////////// +GraphicsOutput *GraphicsEngine:: +get_window(int n) const { + nassertr(n >= 0 && n < (int)_windows.size(), NULL); + + if (!_windows_sorted) { + ((GraphicsEngine *)this)->do_resort_windows(); + } + return _windows[n]; +} + //////////////////////////////////////////////////////////////////// // Function: GraphicsEngine::render_frame // Access: Published diff --git a/panda/src/display/graphicsEngine.h b/panda/src/display/graphicsEngine.h index 29e67d99b1..77ab0a9a96 100644 --- a/panda/src/display/graphicsEngine.h +++ b/panda/src/display/graphicsEngine.h @@ -88,7 +88,10 @@ PUBLISHED: bool remove_window(GraphicsOutput *window); void remove_all_windows(); void reset_all_windows(bool swapchain); + bool is_empty() const; + int get_num_windows() const; + GraphicsOutput *get_window(int n) const; void render_frame(); void open_windows();