|
From: <cn...@us...> - 2009-06-30 01:16:19
|
Revision: 390
http://hgengine.svn.sourceforge.net/hgengine/?rev=390&view=rev
Author: cnlohr
Date: 2009-06-30 01:15:53 +0000 (Tue, 30 Jun 2009)
Log Message:
-----------
add preferences (PREFSMAN)
Modified Paths:
--------------
Mercury2/adv_set.c
Added Paths:
-----------
Mercury2/src/MercuryPrefs.cpp
Mercury2/src/MercuryPrefs.h
Modified: Mercury2/adv_set.c
===================================================================
--- Mercury2/adv_set.c 2009-06-29 04:22:13 UTC (rev 389)
+++ Mercury2/adv_set.c 2009-06-30 01:15:53 UTC (rev 390)
@@ -12,7 +12,7 @@
src/MercuryFile.cpp src/MercuryTimer.cpp src/MercuryMessageManager.cpp src/MercuryVertex.cpp \
src/MercuryPlane.cpp src/BoundingBox.cpp src/Shader.cpp src/RenderGraph.cpp src/Frustum.cpp \
src/Camera.cpp src/MercuryInput.cpp src/MQuaternion.cpp src/ModuleManager.cpp src/MercuryFBO.cpp \
- src/GLHelpers.cpp src/FullscreenQuad.cpp src/MercuryNamedResource.cpp"
+ src/GLHelpers.cpp src/FullscreenQuad.cpp src/MercuryNamedResource.cpp src/MercuryPrefs.cpp"
SOURCES="$SOURCES src/MercuryFileDriverDirect.cpp src/MercuryFileDriverMem.cpp \
src/MercuryFileDriverPacked.cpp src/MercuryFileDriverZipped.cpp"
Added: Mercury2/src/MercuryPrefs.cpp
===================================================================
--- Mercury2/src/MercuryPrefs.cpp (rev 0)
+++ Mercury2/src/MercuryPrefs.cpp 2009-06-30 01:15:53 UTC (rev 390)
@@ -0,0 +1,57 @@
+#include <MercuryPrefs.h>
+#include <XMLParser.h>
+
+MercuryPreferences & MercuryPreferences::GetInstance()
+{
+ static MercuryPreferences * m_gPreferences = 0;
+ if( !m_gPreferences )
+ m_gPreferences = new MercuryPreferences();
+ return *m_gPreferences;
+}
+
+MercuryPreferences::MercuryPreferences()
+{
+ m_PrefsDoc = XMLDocument::Load("preferences.xml");
+}
+
+MercuryPreferences::~MercuryPreferences()
+{
+ delete m_PrefsDoc;
+}
+
+bool MercuryPreferences::GetValue( const MString & sDataPointer, MString & sReturn )
+{
+ return m_PrefsDoc->GetRootNode().GetValue( sDataPointer, sReturn );
+}
+
+/****************************************************************************
+ * Copyright (C) 2009 by Charles Lohr *
+ * *
+ * *
+ * All rights reserved. *
+ * *
+ * Redistribution and use in source and binary forms, with or without *
+ * modification, are permitted provided that the following conditions *
+ * are met: *
+ * * Redistributions of source code must retain the above copyright *
+ * notice, this list of conditions and the following disclaimer. *
+ * * Redistributions in binary form must reproduce the above *
+ * copyright notice, this list of conditions and the following *
+ * disclaimer in the documentation and/or other materials provided *
+ * with the distribution. *
+ * * Neither the name of the Mercury Engine nor the names of its *
+ * contributors may be used to endorse or promote products derived *
+ * from this software without specific prior written permission. *
+ * *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS *
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT *
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR *
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT *
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, *
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT *
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, *
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY *
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT *
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE *
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *
+ ***************************************************************************/
Added: Mercury2/src/MercuryPrefs.h
===================================================================
--- Mercury2/src/MercuryPrefs.h (rev 0)
+++ Mercury2/src/MercuryPrefs.h 2009-06-30 01:15:53 UTC (rev 390)
@@ -0,0 +1,60 @@
+#ifndef _MERCURY_PREFS_H
+#define _MERCURY_PREFS_H
+
+#include <MercuryNamedResource.h>
+#include <MercuryUtil.h>
+
+class XMLNode;
+class XMLDocument;
+
+class MercuryPreferences : public MercuryNamedResource
+{
+public:
+ MercuryPreferences();
+ ~MercuryPreferences();
+
+ virtual bool GetValue( const MString & sDataPointer, MString & sReturn );
+
+ static MercuryPreferences & GetInstance();
+private:
+ XMLDocument * m_PrefsDoc;
+};
+
+static InstanceCounter<MercuryPreferences> MPcounter("MercuryPreferences");
+
+#define PREFSMAN (MercuryPreferences::GetInstance())
+
+#endif
+
+
+/****************************************************************************
+ * Copyright (C) 2009 by Charles Lohr *
+ * *
+ * *
+ * All rights reserved. *
+ * *
+ * Redistribution and use in source and binary forms, with or without *
+ * modification, are permitted provided that the following conditions *
+ * are met: *
+ * * Redistributions of source code must retain the above copyright *
+ * notice, this list of conditions and the following disclaimer. *
+ * * Redistributions in binary form must reproduce the above *
+ * copyright notice, this list of conditions and the following *
+ * disclaimer in the documentation and/or other materials provided *
+ * with the distribution. *
+ * * Neither the name of the Mercury Engine nor the names of its *
+ * contributors may be used to endorse or promote products derived *
+ * from this software without specific prior written permission. *
+ * *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS *
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT *
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR *
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT *
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, *
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT *
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, *
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY *
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT *
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE *
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *
+ ***************************************************************************/
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|