00001 // Filename: pandaFramework.I00002 // Created by: drose (02Apr02)00003 //00004 ////////////////////////////////////////////////////////////////////00005 //00006 // PANDA 3D SOFTWARE00007 // Copyright (c) Carnegie Mellon University. All rights reserved.00008 //00009 // All use of this software is subject to the terms of the revised BSD00010 // license. You should have received a copy of this license along00011 // with this source code in a file named "LICENSE."00012 //00013 ////////////////////////////////////////////////////////////////////00014
00015
00016 ////////////////////////////////////////////////////////////////////00017 // Function: PandaFramework::get_graphics_engine00018 // Access: Public00019 // Description: Returns the GraphicsEngine that is used to render all00020 // the windows in the framework. Normally there's no00021 // reason for user code to mess with this.00022 ////////////////////////////////////////////////////////////////////00023 INLINE GraphicsEngine *PandaFramework::00024get_graphics_engine() {
00025 if (_engine == (GraphicsEngine *)NULL) {
00026 _engine = GraphicsEngine::get_global_ptr();
00027 PT(GenericAsyncTask) task = newGenericAsyncTask("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_root00036 // Access: Public00037 // Description: Returns the root of the data graph. This is the00038 // graph of nodes that is traversed to control the00039 // inputs from user devices like the mouse and keyboard.00040 ////////////////////////////////////////////////////////////////////00041 INLINE constNodePath &PandaFramework::00042get_data_root() const {
00043 return _data_root;
00044 }
00045
00046 ////////////////////////////////////////////////////////////////////00047 // Function: PandaFramework::get_event_handler00048 // Access: Public00049 // Description: Returns the EventHandler object that serves events in00050 // the framework. This is primarily used to dispatch on00051 // keypresses and such.00052 ////////////////////////////////////////////////////////////////////00053 INLINE EventHandler &PandaFramework::00054get_event_handler() {
00055 return _event_handler;
00056 }
00057
00058 ////////////////////////////////////////////////////////////////////00059 // Function: PandaFramework::get_task_mgr00060 // Access: Public00061 // Description: Returns the Task Manager object that manages tasks in00062 // the framework.00063 ////////////////////////////////////////////////////////////////////00064 INLINE AsyncTaskManager &PandaFramework::00065get_task_mgr() {
00066 return _task_mgr;
00067 }
00068
00069 ////////////////////////////////////////////////////////////////////00070 // Function: PandaFramework::set_window_title00071 // Access: Public00072 // Description: Specifies the title that is set for all subsequently00073 // created windows.00074 ////////////////////////////////////////////////////////////////////00075 INLINE voidPandaFramework::00076set_window_title(conststring &title) {
00077 _window_title = title;
00078 }
00079
00080 ////////////////////////////////////////////////////////////////////00081 // Function: PandaFramework::get_num_windows00082 // Access: Public00083 // Description: Returns the number of windows that are currently00084 // open.00085 ////////////////////////////////////////////////////////////////////00086 INLINE intPandaFramework::00087get_num_windows() const {
00088 return _windows.size();
00089 }
00090
00091 ////////////////////////////////////////////////////////////////////00092 // Function: PandaFramework::get_window00093 // Access: Public00094 // Description: Returns the nth window currently open.00095 ////////////////////////////////////////////////////////////////////00096 INLINE WindowFramework *PandaFramework::00097get_window(int n) const {
00098 nassertr(n >= 0 && n < (int)_windows.size(), NULL);
00099 return _windows[n];
00100 }
00101
00102 ////////////////////////////////////////////////////////////////////00103 // Function: PandaFramework::close_window00104 // Access: Public00105 // Description: Closes the indicated WindowFramework window and00106 // removes it from the list.00107 ////////////////////////////////////////////////////////////////////00108 INLINE voidPandaFramework::00109close_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_wireframe00118 // Access: Public00119 // Description: Returns the current state of the wireframe flag.00120 ////////////////////////////////////////////////////////////////////00121 INLINE boolPandaFramework::00122get_wireframe() const {
00123 return _wireframe_enabled;
00124 }
00125
00126 ////////////////////////////////////////////////////////////////////00127 // Function: PandaFramework::get_texture00128 // Access: Public00129 // Description: Returns the current state of the texture flag.00130 ////////////////////////////////////////////////////////////////////00131 INLINE boolPandaFramework::00132get_texture() const {
00133 return _texture_enabled;
00134 }
00135
00136 ////////////////////////////////////////////////////////////////////00137 // Function: PandaFramework::get_two_sided00138 // Access: Public00139 // Description: Returns the current state of the two_sided flag.00140 ////////////////////////////////////////////////////////////////////00141 INLINE boolPandaFramework::00142get_two_sided() const {
00143 return _two_sided_enabled;
00144 }
00145
00146 ////////////////////////////////////////////////////////////////////00147 // Function: PandaFramework::get_lighting00148 // Access: Public00149 // Description: Returns the current state of the lighting flag.00150 ////////////////////////////////////////////////////////////////////00151 INLINE boolPandaFramework::00152get_lighting() const {
00153 return _lighting_enabled;
00154 }
00155
00156 ////////////////////////////////////////////////////////////////////00157 // Function: PandaFramework::get_perpixel00158 // Access: Public00159 // Description: Returns the current state of the perpixel flag.00160 ////////////////////////////////////////////////////////////////////00161 INLINE boolPandaFramework::00162get_perpixel() const {
00163 return _perpixel_enabled;
00164 }
00165
00166 ////////////////////////////////////////////////////////////////////00167 // Function: PandaFramework::get_background_type00168 // Access: Public00169 // Description: Returns the current background type setting.00170 ////////////////////////////////////////////////////////////////////00171 INLINE WindowFramework::BackgroundType PandaFramework::00172get_background_type() const {
00173 return _background_type;
00174 }
00175
00176 ////////////////////////////////////////////////////////////////////00177 // Function: PandaFramework::has_highlight00178 // Access: Public00179 // Description: Returns true if any node is highlighted, false00180 // otherwise.00181 ////////////////////////////////////////////////////////////////////00182 INLINE boolPandaFramework::00183has_highlight() const {
00184 return !_highlight.is_empty();
00185 }
00186
00187 ////////////////////////////////////////////////////////////////////00188 // Function: PandaFramework::get_highlight00189 // Access: Public00190 // Description: Returns the currently highlighted node, if any, or an00191 // empty NodePath if no node is highlighted.00192 ////////////////////////////////////////////////////////////////////00193 INLINE constNodePath &PandaFramework::00194get_highlight() const {
00195 return _highlight;
00196 }
00197
00198 ////////////////////////////////////////////////////////////////////00199 // Function: PandaFramework::get_recorder00200 // Access: Public00201 // Description: Returns the RecorderController that has been00202 // associated with the PandaFramework, if any, or NULL00203 // if none has (the normal case).00204 //00205 // If a RecorderController is associated, it will00206 // presumably be used for recording user input to a00207 // session file, or for playing back the user input from00208 // a previously-recorded session.00209 ////////////////////////////////////////////////////////////////////00210 INLINE RecorderController *PandaFramework::00211get_recorder() const {
00212 return _recorder;
00213 }
00214
00215 ////////////////////////////////////////////////////////////////////00216 // Function: PandaFramework::set_recorder00217 // Access: Public00218 // Description: Assigns a RecorderController with the PandaFramework.00219 // This should be called before any windows are opened.00220 // The subsequently opened windows will register their00221 // user inputs with the recorder.00222 //00223 // If a RecorderController is associated, it will00224 // presumably be used for recording user input to a00225 // session file, or for playing back the user input from00226 // a previously-recorded session.00227 ////////////////////////////////////////////////////////////////////00228 INLINE voidPandaFramework::00229set_recorder(RecorderController *recorder) {
00230 _recorder = recorder;
00231 }
00232
00233 ////////////////////////////////////////////////////////////////////00234 // Function: PandaFramework::set_exit_flag00235 // Access: Public00236 // Description: Sets the flag that indicates it is time for the00237 // application to exit. The application will actually00238 // exit at the end of the current frame.00239 ////////////////////////////////////////////////////////////////////00240 INLINE voidPandaFramework::00241set_exit_flag() {
00242 _exit_flag = true;
00243 }
00244
00245 ////////////////////////////////////////////////////////////////////00246 // Function: PandaFramework::clear_exit_flag00247 // Access: Public00248 // Description: Resets the exit flag after it has previously been00249 // set.00250 ////////////////////////////////////////////////////////////////////00251 INLINE voidPandaFramework::00252clear_exit_flag() {
00253 _exit_flag = false;
00254 }