Panda3D
 All Classes Functions Variables Enumerations
pandaFramework.I
00001 // Filename: pandaFramework.I
00002 // Created by:  drose (02Apr02)
00003 //
00004 ////////////////////////////////////////////////////////////////////
00005 //
00006 // PANDA 3D SOFTWARE
00007 // Copyright (c) Carnegie Mellon University.  All rights reserved.
00008 //
00009 // All use of this software is subject to the terms of the revised BSD
00010 // license.  You should have received a copy of this license along
00011 // with this source code in a file named "LICENSE."
00012 //
00013 ////////////////////////////////////////////////////////////////////
00014 
00015 
00016 ////////////////////////////////////////////////////////////////////
00017 //     Function: PandaFramework::get_graphics_engine
00018 //       Access: Public
00019 //  Description: Returns the GraphicsEngine that is used to render all
00020 //               the windows in the framework.  Normally there's no
00021 //               reason for user code to mess with this.
00022 ////////////////////////////////////////////////////////////////////
00023 INLINE GraphicsEngine *PandaFramework::
00024 get_graphics_engine() {
00025   if (_engine == (GraphicsEngine *)NULL) {
00026     _engine = GraphicsEngine::get_global_ptr();
00027     PT(GenericAsyncTask) task = new GenericAsyncTask("igloop", task_igloop, this);
00028     task->set_sort(50);
00029     _task_mgr.add(task);
00030   }
00031   return _engine;
00032 }
00033 
00034 ////////////////////////////////////////////////////////////////////
00035 //     Function: PandaFramework::get_data_root
00036 //       Access: Public
00037 //  Description: Returns the root of the data graph.  This is the
00038 //               graph of nodes that is traversed to control the
00039 //               inputs from user devices like the mouse and keyboard.
00040 ////////////////////////////////////////////////////////////////////
00041 INLINE const NodePath &PandaFramework::
00042 get_data_root() const {
00043   return _data_root;
00044 }
00045 
00046 ////////////////////////////////////////////////////////////////////
00047 //     Function: PandaFramework::get_event_handler
00048 //       Access: Public
00049 //  Description: Returns the EventHandler object that serves events in
00050 //               the framework.  This is primarily used to dispatch on
00051 //               keypresses and such.
00052 ////////////////////////////////////////////////////////////////////
00053 INLINE EventHandler &PandaFramework::
00054 get_event_handler() {
00055   return _event_handler;
00056 }
00057 
00058 ////////////////////////////////////////////////////////////////////
00059 //     Function: PandaFramework::get_task_mgr
00060 //       Access: Public
00061 //  Description: Returns the Task Manager object that manages tasks in
00062 //               the framework.
00063 ////////////////////////////////////////////////////////////////////
00064 INLINE AsyncTaskManager &PandaFramework::
00065 get_task_mgr() {
00066   return _task_mgr;
00067 }
00068 
00069 ////////////////////////////////////////////////////////////////////
00070 //     Function: PandaFramework::set_window_title
00071 //       Access: Public
00072 //  Description: Specifies the title that is set for all subsequently
00073 //               created windows.
00074 ////////////////////////////////////////////////////////////////////
00075 INLINE void PandaFramework::
00076 set_window_title(const string &title) {
00077   _window_title = title;
00078 }
00079 
00080 ////////////////////////////////////////////////////////////////////
00081 //     Function: PandaFramework::get_num_windows
00082 //       Access: Public
00083 //  Description: Returns the number of windows that are currently
00084 //               open.
00085 ////////////////////////////////////////////////////////////////////
00086 INLINE int PandaFramework::
00087 get_num_windows() const {
00088   return _windows.size();
00089 }
00090 
00091 ////////////////////////////////////////////////////////////////////
00092 //     Function: PandaFramework::get_window
00093 //       Access: Public
00094 //  Description: Returns the nth window currently open.
00095 ////////////////////////////////////////////////////////////////////
00096 INLINE WindowFramework *PandaFramework::
00097 get_window(int n) const {
00098   nassertr(n >= 0 && n < (int)_windows.size(), NULL);
00099   return _windows[n];
00100 }
00101 
00102 ////////////////////////////////////////////////////////////////////
00103 //     Function: PandaFramework::close_window
00104 //       Access: Public
00105 //  Description: Closes the indicated WindowFramework window and
00106 //               removes it from the list.
00107 ////////////////////////////////////////////////////////////////////
00108 INLINE void PandaFramework::
00109 close_window(WindowFramework *wf) {
00110   int n = find_window(wf);
00111   if (n >= 0) {
00112     close_window(n);
00113   }
00114 }
00115 
00116 ////////////////////////////////////////////////////////////////////
00117 //     Function: PandaFramework::get_wireframe
00118 //       Access: Public
00119 //  Description: Returns the current state of the wireframe flag.
00120 ////////////////////////////////////////////////////////////////////
00121 INLINE bool PandaFramework::
00122 get_wireframe() const {
00123   return _wireframe_enabled;
00124 }
00125 
00126 ////////////////////////////////////////////////////////////////////
00127 //     Function: PandaFramework::get_texture
00128 //       Access: Public
00129 //  Description: Returns the current state of the texture flag.
00130 ////////////////////////////////////////////////////////////////////
00131 INLINE bool PandaFramework::
00132 get_texture() const {
00133   return _texture_enabled;
00134 }
00135 
00136 ////////////////////////////////////////////////////////////////////
00137 //     Function: PandaFramework::get_two_sided
00138 //       Access: Public
00139 //  Description: Returns the current state of the two_sided flag.
00140 ////////////////////////////////////////////////////////////////////
00141 INLINE bool PandaFramework::
00142 get_two_sided() const {
00143   return _two_sided_enabled;
00144 }
00145 
00146 ////////////////////////////////////////////////////////////////////
00147 //     Function: PandaFramework::get_lighting
00148 //       Access: Public
00149 //  Description: Returns the current state of the lighting flag.
00150 ////////////////////////////////////////////////////////////////////
00151 INLINE bool PandaFramework::
00152 get_lighting() const {
00153   return _lighting_enabled;
00154 }
00155 
00156 ////////////////////////////////////////////////////////////////////
00157 //     Function: PandaFramework::get_perpixel
00158 //       Access: Public
00159 //  Description: Returns the current state of the perpixel flag.
00160 ////////////////////////////////////////////////////////////////////
00161 INLINE bool PandaFramework::
00162 get_perpixel() const {
00163   return _perpixel_enabled;
00164 }
00165 
00166 ////////////////////////////////////////////////////////////////////
00167 //     Function: PandaFramework::get_background_type
00168 //       Access: Public
00169 //  Description: Returns the current background type setting.
00170 ////////////////////////////////////////////////////////////////////
00171 INLINE WindowFramework::BackgroundType PandaFramework::
00172 get_background_type() const {
00173   return _background_type;
00174 }
00175 
00176 ////////////////////////////////////////////////////////////////////
00177 //     Function: PandaFramework::has_highlight
00178 //       Access: Public
00179 //  Description: Returns true if any node is highlighted, false
00180 //               otherwise.
00181 ////////////////////////////////////////////////////////////////////
00182 INLINE bool PandaFramework::
00183 has_highlight() const {
00184   return !_highlight.is_empty();
00185 }
00186 
00187 ////////////////////////////////////////////////////////////////////
00188 //     Function: PandaFramework::get_highlight
00189 //       Access: Public
00190 //  Description: Returns the currently highlighted node, if any, or an
00191 //               empty NodePath if no node is highlighted.
00192 ////////////////////////////////////////////////////////////////////
00193 INLINE const NodePath &PandaFramework::
00194 get_highlight() const {
00195   return _highlight;
00196 }
00197 
00198 ////////////////////////////////////////////////////////////////////
00199 //     Function: PandaFramework::get_recorder
00200 //       Access: Public
00201 //  Description: Returns the RecorderController that has been
00202 //               associated with the PandaFramework, if any, or NULL
00203 //               if none has (the normal case).
00204 //
00205 //               If a RecorderController is associated, it will
00206 //               presumably be used for recording user input to a
00207 //               session file, or for playing back the user input from
00208 //               a previously-recorded session.
00209 ////////////////////////////////////////////////////////////////////
00210 INLINE RecorderController *PandaFramework::
00211 get_recorder() const {
00212   return _recorder;
00213 }
00214 
00215 ////////////////////////////////////////////////////////////////////
00216 //     Function: PandaFramework::set_recorder
00217 //       Access: Public
00218 //  Description: Assigns a RecorderController with the PandaFramework.
00219 //               This should be called before any windows are opened.
00220 //               The subsequently opened windows will register their
00221 //               user inputs with the recorder.
00222 //
00223 //               If a RecorderController is associated, it will
00224 //               presumably be used for recording user input to a
00225 //               session file, or for playing back the user input from
00226 //               a previously-recorded session.
00227 ////////////////////////////////////////////////////////////////////
00228 INLINE void PandaFramework::
00229 set_recorder(RecorderController *recorder) {
00230   _recorder = recorder;
00231 }
00232 
00233 ////////////////////////////////////////////////////////////////////
00234 //     Function: PandaFramework::set_exit_flag
00235 //       Access: Public
00236 //  Description: Sets the flag that indicates it is time for the
00237 //               application to exit.  The application will actually
00238 //               exit at the end of the current frame.
00239 ////////////////////////////////////////////////////////////////////
00240 INLINE void PandaFramework::
00241 set_exit_flag() {
00242   _exit_flag = true;
00243 }
00244 
00245 ////////////////////////////////////////////////////////////////////
00246 //     Function: PandaFramework::clear_exit_flag
00247 //       Access: Public
00248 //  Description: Resets the exit flag after it has previously been
00249 //               set.
00250 ////////////////////////////////////////////////////////////////////
00251 INLINE void PandaFramework::
00252 clear_exit_flag() {
00253   _exit_flag = false;
00254 }
 All Classes Functions Variables Enumerations