00001 // Filename: config_util.cxx 00002 // Created by: cary (04Jan00) 00003 // 00004 //////////////////////////////////////////////////////////////////// 00005 // 00006 // PANDA 3D SOFTWARE 00007 // Copyright (c) 2001, Disney Enterprises, Inc. All rights reserved 00008 // 00009 // All use of this software is subject to the terms of the Panda 3d 00010 // Software license. You should have received a copy of this license 00011 // along with this source code; you will also find a current copy of 00012 // the license at http://www.panda3d.org/license.txt . 00013 // 00014 // To contact the maintainers of this program write to 00015 // panda3d@yahoogroups.com . 00016 // 00017 //////////////////////////////////////////////////////////////////// 00018 00019 #include "config_util.h" 00020 #include "bamReaderParam.h" 00021 #include "buttonEventList.h" 00022 #include "clockObject.h" 00023 #include "configurable.h" 00024 #include "datagram.h" 00025 #include "factoryParam.h" 00026 #include "namable.h" 00027 #include "referenceCount.h" 00028 #include "typedObject.h" 00029 #include "typedReferenceCount.h" 00030 #include "typedWritable.h" 00031 #include "typedWritableReferenceCount.h" 00032 #include "writableConfigurable.h" 00033 #include "writableParam.h" 00034 #include "keyboardButton.h" 00035 #include "mouseButton.h" 00036 #include "get_config_path.h" 00037 00038 #include <dconfig.h> 00039 00040 ConfigureDef(config_util); 00041 NotifyCategoryDef(util, ""); 00042 NotifyCategoryDef(bam, util_cat); 00043 00044 ConfigureFn(config_util) { 00045 BamReaderParam::init_type(); 00046 ButtonEventList::init_type(); 00047 Configurable::init_type(); 00048 Datagram::init_type(); 00049 FactoryParam::init_type(); 00050 Namable::init_type(); 00051 ReferenceCount::init_type(); 00052 TypedObject::init_type(); 00053 TypedReferenceCount::init_type(); 00054 TypedWritable::init_type(); 00055 TypedWritableReferenceCount::init_type(); 00056 WritableConfigurable::init_type(); 00057 WritableParam::init_type(); 00058 00059 KeyboardButton::init_keyboard_buttons(); 00060 MouseButton::init_mouse_buttons(); 00061 } 00062 00063 00064 // Set this true to enable tracking of ReferenceCount pointer 00065 // allocation/deallcation via the MemoryUsage object. This is 00066 // primarily useful for detecting memory leaks. It has no effect when 00067 // compiling in NDEBUG mode. 00068 00069 // This variable is no longer defined here; instead, it's a member of 00070 // MemoryUsage. 00071 00072 //const bool track_memory_usage = config_util.GetBool("track-memory-usage", false); 00073 00074 DSearchPath & 00075 get_model_path() { 00076 static DSearchPath *model_path = NULL; 00077 return get_config_path("model-path", model_path); 00078 } 00079 00080 DSearchPath & 00081 get_texture_path() { 00082 static DSearchPath *texture_path = NULL; 00083 return get_config_path("texture-path", texture_path); 00084 } 00085 00086 DSearchPath & 00087 get_sound_path() { 00088 static DSearchPath *sound_path = NULL; 00089 return get_config_path("sound-path", sound_path); 00090 }