You can subscribe to this list here.
| 2005 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(46) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2006 |
Jan
(185) |
Feb
(242) |
Mar
(237) |
Apr
(180) |
May
(102) |
Jun
(278) |
Jul
(114) |
Aug
(92) |
Sep
(246) |
Oct
(212) |
Nov
(279) |
Dec
(99) |
| 2007 |
Jan
(130) |
Feb
(194) |
Mar
(22) |
Apr
(72) |
May
(40) |
Jun
(111) |
Jul
(114) |
Aug
(154) |
Sep
(114) |
Oct
(2) |
Nov
(1) |
Dec
(5) |
| 2008 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(6) |
Oct
(51) |
Nov
(34) |
Dec
(130) |
| 2009 |
Jan
(22) |
Feb
(20) |
Mar
(41) |
Apr
(45) |
May
(82) |
Jun
(96) |
Jul
(48) |
Aug
(90) |
Sep
(13) |
Oct
(49) |
Nov
(31) |
Dec
(21) |
| 2010 |
Jan
(25) |
Feb
(9) |
Mar
(7) |
Apr
(28) |
May
(27) |
Jun
(7) |
Jul
(1) |
Aug
|
Sep
(1) |
Oct
(1) |
Nov
(13) |
Dec
(2) |
| 2013 |
Jan
(1) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
|
From: <cn...@us...> - 2009-06-30 02:59:33
|
Revision: 394
http://hgengine.svn.sourceforge.net/hgengine/?rev=394&view=rev
Author: cnlohr
Date: 2009-06-30 02:59:32 +0000 (Tue, 30 Jun 2009)
Log Message:
-----------
add basis for Mercury Theme
Modified Paths:
--------------
Mercury2/adv_set.c
Mercury2/src/MercuryPrefs.cpp
Added Paths:
-----------
Mercury2/src/MercuryTheme.cpp
Mercury2/src/MercuryTheme.h
Modified: Mercury2/adv_set.c
===================================================================
--- Mercury2/adv_set.c 2009-06-30 02:07:41 UTC (rev 393)
+++ Mercury2/adv_set.c 2009-06-30 02:59:32 UTC (rev 394)
@@ -12,7 +12,8 @@
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/MercuryPrefs.cpp"
+ src/GLHelpers.cpp src/FullscreenQuad.cpp src/MercuryNamedResource.cpp src/MercuryPrefs.cpp \
+ src/MercuryTheme.cpp"
SOURCES="$SOURCES src/MercuryFileDriverDirect.cpp src/MercuryFileDriverMem.cpp \
src/MercuryFileDriverPacked.cpp src/MercuryFileDriverZipped.cpp"
Modified: Mercury2/src/MercuryPrefs.cpp
===================================================================
--- Mercury2/src/MercuryPrefs.cpp 2009-06-30 02:07:41 UTC (rev 393)
+++ Mercury2/src/MercuryPrefs.cpp 2009-06-30 02:59:32 UTC (rev 394)
@@ -31,6 +31,7 @@
MercuryPreferences::~MercuryPreferences()
{
delete m_PrefsDoc;
+ delete m_PrefsNode;
}
bool MercuryPreferences::GetValue( const MString & sDataPointer, MString & sReturn )
Added: Mercury2/src/MercuryTheme.cpp
===================================================================
--- Mercury2/src/MercuryTheme.cpp (rev 0)
+++ Mercury2/src/MercuryTheme.cpp 2009-06-30 02:59:32 UTC (rev 394)
@@ -0,0 +1,124 @@
+#include <MercuryTheme.h>
+#include <MercuryPrefs.h>
+#include <XMLParser.h>
+
+#define MAX_THEMES 100
+
+MercuryThemeManager & MercuryThemeManager::GetInstance()
+{
+ static MercuryThemeManager * m_gTheme = 0;
+ if( !m_gTheme )
+ m_gTheme = new MercuryThemeManager();
+ return *m_gTheme;
+}
+
+MercuryThemeManager::MercuryThemeManager()
+{
+ int i;
+
+ m_vThemes.resize( 0 );
+
+ for( i = 0; i < MAX_THEMES; i++ )
+ {
+ MString ThemeName = PREFSMAN.GetValueS( ssprintf( "Themes.Theme%d", i ) );
+ if( !ThemeName.length() )
+ break;
+
+ m_vThemes.resize( m_vThemes.size() + 1 );
+ if( !m_vThemes[m_vThemes.size()-1].Setup( ThemeName ) )
+ m_vThemes.resize( m_vThemes.size() - 1 );
+ }
+ if( m_vThemes.size() == 0 )
+ {
+ FAIL( "Zero themes loaded. This may be due to a misconfiguration in your preferences.ini" );
+ }
+}
+
+MercuryThemeManager::~MercuryThemeManager()
+{
+ //no code
+}
+
+bool MercuryThemeManager::GetValue( const MString & sDataPointer, MString & sReturn )
+{
+ //XXX: Incomplete
+ //This code needs to be filled out.
+ return true;
+}
+
+MercuryThemeManager::Theme::Theme()
+{
+ m_xDoc = 0;
+ m_xNode = 0;
+}
+
+MercuryThemeManager::Theme::~Theme()
+{
+ SAFE_DELETE( m_xDoc );
+ SAFE_DELETE( m_xNode );
+}
+
+bool MercuryThemeManager::Theme::Setup( const MString & sThemeName )
+{
+ sTheme = sThemeName;
+ m_xDoc = XMLDocument::Load(ssprintf("Themes/%s/metrics.xml",sTheme.c_str()));
+ if( !m_xDoc )
+ {
+ printf( "Could not open: Themes/%s/metrics.xml\n",sTheme.c_str());
+ return false;
+ }
+
+ m_xNode = new XMLNode();
+
+ *m_xNode = m_xDoc->GetRootNode();
+
+ if( !m_xNode->IsValid() )
+ {
+ printf( "Could not get root node in: Themes/%s/metrics.xml\n",sTheme.c_str());
+ return false;
+ }
+
+ *m_xNode = m_xNode->Child();
+
+ if( !m_xNode->IsValid() )
+ {
+ printf( "Could not get sub node in: Themes/%s/metrics.xml\n",sTheme.c_str());
+ return false;
+ }
+
+ return true;
+}
+
+
+/****************************************************************************
+ * 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/MercuryTheme.h
===================================================================
--- Mercury2/src/MercuryTheme.h (rev 0)
+++ Mercury2/src/MercuryTheme.h 2009-06-30 02:59:32 UTC (rev 394)
@@ -0,0 +1,71 @@
+#ifndef _MERCURY_THEME_H
+#define _MERCURY_THEME_H
+
+#include <MercuryNamedResource.h>
+#include <MercuryUtil.h> //huh?
+#include <MercuryVector.h>
+
+class XMLNode;
+class XMLDocument;
+
+class MercuryThemeManager : public MercuryNamedResource
+{
+public:
+ MercuryThemeManager();
+ ~MercuryThemeManager();
+
+ static MercuryThemeManager& GetInstance();
+
+ virtual bool GetValue( const MString & sDataPointer, MString & sReturn );
+private:
+ class Theme
+ {
+ public:
+ Theme( );
+ bool Setup( const MString & sThemeName );
+ ~Theme();
+ MString sTheme;
+ XMLNode * m_xNode;
+ XMLDocument * m_xDoc;
+ };
+ MVector< Theme > m_vThemes;
+};
+
+static InstanceCounter<MercuryThemeManager> MFMcounter("MercuryThemeManager");
+
+#define THEME MercuryFileManager::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.
|
|
From: <cn...@us...> - 2009-06-30 02:53:13
|
Revision: 393
http://hgengine.svn.sourceforge.net/hgengine/?rev=393&view=rev
Author: cnlohr
Date: 2009-06-30 02:07:41 +0000 (Tue, 30 Jun 2009)
Log Message:
-----------
add preferences (whoops)
Added Paths:
-----------
Mercury2/preferences.xml
Added: Mercury2/preferences.xml
===================================================================
--- Mercury2/preferences.xml (rev 0)
+++ Mercury2/preferences.xml 2009-06-30 02:07:41 UTC (rev 393)
@@ -0,0 +1,4 @@
+<xml>
+ <Themes Theme0="default" Theme1="" />
+ <Screen Width="640" Height="480" Name="Mercury 2 Demo" Depth="16" FullScreen="false" />
+</xml>
\ No newline at end of file
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <cn...@us...> - 2009-06-30 02:53:12
|
Revision: 392
http://hgengine.svn.sourceforge.net/hgengine/?rev=392&view=rev
Author: cnlohr
Date: 2009-06-30 01:51:59 +0000 (Tue, 30 Jun 2009)
Log Message:
-----------
update preferences, crash mercury if something's wrong, handle booleans better.
Modified Paths:
--------------
Mercury2/src/MercuryNamedResource.cpp
Mercury2/src/MercuryPrefs.cpp
Mercury2/src/MercuryPrefs.h
Mercury2/src/MercuryUtil.cpp
Mercury2/src/MercuryUtil.h
Mercury2/src/X11Window.cpp
Modified: Mercury2/src/MercuryNamedResource.cpp
===================================================================
--- Mercury2/src/MercuryNamedResource.cpp 2009-06-30 01:22:24 UTC (rev 391)
+++ Mercury2/src/MercuryNamedResource.cpp 2009-06-30 01:51:59 UTC (rev 392)
@@ -43,7 +43,18 @@
{
MString tmpret;
if( GetValue( sDataPointer, tmpret ) )
+ {
+ tmpret = ToUpper( tmpret );
+ if( tmpret.compare( "TRUE" ) == 0 ) return 1;
+ if( tmpret.compare( "FALSE" ) == 0 ) return 0;
+ if( tmpret.compare( "ON" ) == 0 ) return 1;
+ if( tmpret.compare( "OFF" ) == 0 ) return 0;
+ if( tmpret.compare( "YES" ) == 0 ) return 1;
+ if( tmpret.compare( "NO" ) == 0 ) return 0;
+
return StrToInt( tmpret );
+ }
+
if( bSetValue )
SetValueB( sDataPointer, bDefaultValue );
Modified: Mercury2/src/MercuryPrefs.cpp
===================================================================
--- Mercury2/src/MercuryPrefs.cpp 2009-06-30 01:22:24 UTC (rev 391)
+++ Mercury2/src/MercuryPrefs.cpp 2009-06-30 01:51:59 UTC (rev 392)
@@ -12,6 +12,20 @@
MercuryPreferences::MercuryPreferences()
{
m_PrefsDoc = XMLDocument::Load("preferences.xml");
+ if( !m_PrefsDoc )
+ FAIL( "Could not load preferences.xml." );
+
+ m_PrefsNode = new XMLNode();
+
+ *m_PrefsNode = m_PrefsDoc->GetRootNode();
+
+ if( !m_PrefsNode->IsValid() )
+ FAIL( "Could not get root node in Preferences." );
+
+ *m_PrefsNode = m_PrefsNode->Child();
+
+ if( !m_PrefsNode->IsValid() )
+ FAIL( "Could not get Preferences node in Preferences." );
}
MercuryPreferences::~MercuryPreferences()
@@ -21,13 +35,9 @@
bool MercuryPreferences::GetValue( const MString & sDataPointer, MString & sReturn )
{
- return m_PrefsDoc->GetRootNode().GetValue( sDataPointer, sReturn );
+ return m_PrefsNode->GetValue( sDataPointer, sReturn );
}
-XMLNode MercuryPreferences::GetRootXML()
-{
- return m_PrefsDoc->GetRootNode();
-}
/****************************************************************************
* Copyright (C) 2009 by Charles Lohr *
Modified: Mercury2/src/MercuryPrefs.h
===================================================================
--- Mercury2/src/MercuryPrefs.h 2009-06-30 01:22:24 UTC (rev 391)
+++ Mercury2/src/MercuryPrefs.h 2009-06-30 01:51:59 UTC (rev 392)
@@ -17,9 +17,10 @@
static MercuryPreferences & GetInstance();
- XMLNode GetRootXML();
+ XMLNode * GetRootXML() { return m_PrefsNode; }
private:
- XMLDocument * m_PrefsDoc;
+ XMLNode * m_PrefsNode;
+ XMLDocument * m_PrefsDoc;
};
static InstanceCounter<MercuryPreferences> MPcounter("MercuryPreferences");
Modified: Mercury2/src/MercuryUtil.cpp
===================================================================
--- Mercury2/src/MercuryUtil.cpp 2009-06-30 01:22:24 UTC (rev 391)
+++ Mercury2/src/MercuryUtil.cpp 2009-06-30 01:51:59 UTC (rev 392)
@@ -36,6 +36,15 @@
#endif
return x;
}
+
+
+void fail_m( const char * message, const char * file, int line )
+{
+ //Probably should message box here somewhere in the event we're running on Windows.
+ fprintf( stderr, "Fatal Error: \"%s\" in %s:%d\n", message, file, line );
+ exit(-1);
+}
+
void* mmemalign(size_t align, size_t size, void*& mem)
{
uintptr_t mask = ~(uintptr_t)(align - 1);
Modified: Mercury2/src/MercuryUtil.h
===================================================================
--- Mercury2/src/MercuryUtil.h 2009-06-30 01:22:24 UTC (rev 391)
+++ Mercury2/src/MercuryUtil.h 2009-06-30 01:51:59 UTC (rev 392)
@@ -12,6 +12,9 @@
#define TO_ENDIAN( x )
+void fail_m( const char * message, const char * file, int line );
+#define FAIL( message ) fail_m( message, __FILE__, __LINE__ );
+
//returns an aligned pointer, mem is the actual (unaligned) pointer for freeing
void* mmemalign(size_t align, size_t size, void*& mem);
bool isAligned(size_t align, const void* mem);
Modified: Mercury2/src/X11Window.cpp
===================================================================
--- Mercury2/src/X11Window.cpp 2009-06-30 01:22:24 UTC (rev 391)
+++ Mercury2/src/X11Window.cpp 2009-06-30 01:51:59 UTC (rev 392)
@@ -1,6 +1,7 @@
#include <X11Window.h>
#include <MercuryMessageManager.h>
#include <MercuryInput.h>
+#include <MercuryPrefs.h>
Callback0R< MercuryWindow* > MercuryWindow::genWindowClbk(X11Window::GenX11Window); //Register window generation callback
@@ -91,7 +92,14 @@
MercuryWindow* X11Window::GenX11Window()
{
- return new X11Window("Mercury2 Tests", 640, 480, 24, 16, false);
+ return new X11Window(
+ PREFSMAN.GetValueS("Screen.Name", "Screen name not set." ),
+ PREFSMAN.GetValueI( "Screen.Width", 640 ),
+ PREFSMAN.GetValueI( "Screen.Height", 480 ),
+ 24,
+ PREFSMAN.GetValueI( "Screen.Depth", 16 ),
+ PREFSMAN.GetValueB( "Screen.FullScreen", 1 )
+ );
}
bool X11Window::SwapBuffers()
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <cn...@us...> - 2009-06-30 01:22:26
|
Revision: 391
http://hgengine.svn.sourceforge.net/hgengine/?rev=391&view=rev
Author: cnlohr
Date: 2009-06-30 01:22:24 +0000 (Tue, 30 Jun 2009)
Log Message:
-----------
add extra access to get to XML directly
Modified Paths:
--------------
Mercury2/src/MercuryPrefs.cpp
Mercury2/src/MercuryPrefs.h
Modified: Mercury2/src/MercuryPrefs.cpp
===================================================================
--- Mercury2/src/MercuryPrefs.cpp 2009-06-30 01:15:53 UTC (rev 390)
+++ Mercury2/src/MercuryPrefs.cpp 2009-06-30 01:22:24 UTC (rev 391)
@@ -24,6 +24,11 @@
return m_PrefsDoc->GetRootNode().GetValue( sDataPointer, sReturn );
}
+XMLNode MercuryPreferences::GetRootXML()
+{
+ return m_PrefsDoc->GetRootNode();
+}
+
/****************************************************************************
* Copyright (C) 2009 by Charles Lohr *
* *
Modified: Mercury2/src/MercuryPrefs.h
===================================================================
--- Mercury2/src/MercuryPrefs.h 2009-06-30 01:15:53 UTC (rev 390)
+++ Mercury2/src/MercuryPrefs.h 2009-06-30 01:22:24 UTC (rev 391)
@@ -16,6 +16,8 @@
virtual bool GetValue( const MString & sDataPointer, MString & sReturn );
static MercuryPreferences & GetInstance();
+
+ XMLNode GetRootXML();
private:
XMLDocument * m_PrefsDoc;
};
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
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.
|
|
From: <cn...@us...> - 2009-06-29 04:22:15
|
Revision: 389
http://hgengine.svn.sourceforge.net/hgengine/?rev=389&view=rev
Author: cnlohr
Date: 2009-06-29 04:22:13 +0000 (Mon, 29 Jun 2009)
Log Message:
-----------
cleanup the utility file
Modified Paths:
--------------
Mercury2/src/MercuryFBO.cpp
Mercury2/src/MercuryHash.h
Mercury2/src/MercuryUtil.h
Mercury2/src/Shader.cpp
Mercury2/src/Texture.cpp
Modified: Mercury2/src/MercuryFBO.cpp
===================================================================
--- Mercury2/src/MercuryFBO.cpp 2009-06-28 22:00:27 UTC (rev 388)
+++ Mercury2/src/MercuryFBO.cpp 2009-06-29 04:22:13 UTC (rev 389)
@@ -1,6 +1,7 @@
#include <MercuryFBO.h>
#include <GLHeaders.h>
#include <MercuryWindow.h>
+#include <assert.h>
REGISTER_NODE_TYPE(MercuryFBO);
Modified: Mercury2/src/MercuryHash.h
===================================================================
--- Mercury2/src/MercuryHash.h 2009-06-28 22:00:27 UTC (rev 388)
+++ Mercury2/src/MercuryHash.h 2009-06-29 04:22:13 UTC (rev 389)
@@ -3,6 +3,7 @@
#include "global.h"
#include <MercuryVector.h>
+#include <assert.h>
///Mercury Hash Table for Strings
template<typename T>
Modified: Mercury2/src/MercuryUtil.h
===================================================================
--- Mercury2/src/MercuryUtil.h 2009-06-28 22:00:27 UTC (rev 388)
+++ Mercury2/src/MercuryUtil.h 2009-06-29 04:22:13 UTC (rev 389)
@@ -3,13 +3,9 @@
#include <stdlib.h>
#include <MercuryString.h>
-#include <assert.h>
#include <global.h>
+#include <stdio.h>
-/*#ifndef NULL
-#define NULL 0
-#endif*/
-
#define SAFE_DELETE( x ) { if (x) { delete x; } x = NULL; }
#define SAFE_DELETE_ARRAY( x ) { if (x) { delete[] x; } x = NULL; }
#define SAFE_FREE(p) { if(p) { free(p); p=0; } }
@@ -20,8 +16,6 @@
void* mmemalign(size_t align, size_t size, void*& mem);
bool isAligned(size_t align, const void* mem);
-#define ASSERT(x) assert(!x)
-
#if defined(__GNUC__)
#define M_ALIGN(n) __attribute__((aligned(n)))
#else
@@ -56,7 +50,6 @@
//This counter is used with singletons to
//ensure proper destruction order of the
//singleton
-#include <stdio.h>
template<typename T>
class InstanceCounter
{
Modified: Mercury2/src/Shader.cpp
===================================================================
--- Mercury2/src/Shader.cpp 2009-06-28 22:00:27 UTC (rev 388)
+++ Mercury2/src/Shader.cpp 2009-06-29 04:22:13 UTC (rev 389)
@@ -1,10 +1,8 @@
#include <Shader.h>
#include <MercuryNode.h>
#include <MercuryFile.h>
-
+#include <assert.h>
#include <GLHeaders.h>
-
-
#include <string.h>
using namespace std;
Modified: Mercury2/src/Texture.cpp
===================================================================
--- Mercury2/src/Texture.cpp 2009-06-28 22:00:27 UTC (rev 388)
+++ Mercury2/src/Texture.cpp 2009-06-29 04:22:13 UTC (rev 389)
@@ -4,6 +4,7 @@
#include <MercuryNode.h>
#include <GLHeaders.h>
#include <Shader.h>
+#include <assert.h>
using namespace std;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <cn...@us...> - 2009-06-28 22:00:29
|
Revision: 388
http://hgengine.svn.sourceforge.net/hgengine/?rev=388&view=rev
Author: cnlohr
Date: 2009-06-28 22:00:27 +0000 (Sun, 28 Jun 2009)
Log Message:
-----------
update the XML Parser to be able to handle .GetValue(), thus reaping all of the rewards of the named
resource class.
Modified Paths:
--------------
Mercury2/src/XMLParser.cpp
Mercury2/src/XMLParser.h
Modified: Mercury2/src/XMLParser.cpp
===================================================================
--- Mercury2/src/XMLParser.cpp 2009-06-28 21:59:32 UTC (rev 387)
+++ Mercury2/src/XMLParser.cpp 2009-06-28 22:00:27 UTC (rev 388)
@@ -1,13 +1,14 @@
#include <XMLParser.h>
#include <MercuryFile.h>
+#include <MercuryVector.h>
#include <libxml/parser.h>
#include <libxml/tree.h>
-#if defined(WIN32)
-# if defined(_MSC_VER)
-# pragma comment(lib, "libxml2.lib")
-# endif
+#if defined(WIN32)
+# if defined(_MSC_VER)
+# pragma comment(lib, "libxml2.lib")
+# endif
#endif
XMLNode::XMLNode(xmlNode* node, xmlDoc* doc)
@@ -184,6 +185,33 @@
return *this;
}
+bool XMLNode::GetValue( const MString & sDataPointer, MString & sReturn )
+{
+ MVector< MString > out;
+ SplitStrings( sDataPointer, out, ".", " ", 1, 1 );
+ //Out now contains the input in a parsed form;
+ //a.b.c is now:
+ //out[0] = "a"; out[1] = "b"; out[2] = "c";
+ XMLNode & rthis = *this;
+ for( unsigned i = 0; i < out.size() - 1; i++ )
+ {
+ while( rthis.Name() != out[i] && rthis.IsValid() )
+ rthis = rthis.NextNode();
+
+ if( !rthis.IsValid() )
+ return false;
+
+ if( i < out.size() - 2 )
+ rthis = rthis.Child();
+
+ if( !rthis.IsValid() )
+ return false;
+ }
+
+ sReturn = rthis.Attribute( out[out.size()-1] );
+ return true;
+}
+
XMLDocument::XMLDocument()
:m_doc(NULL)
{
Modified: Mercury2/src/XMLParser.h
===================================================================
--- Mercury2/src/XMLParser.h 2009-06-28 21:59:32 UTC (rev 387)
+++ Mercury2/src/XMLParser.h 2009-06-28 22:00:27 UTC (rev 388)
@@ -2,6 +2,7 @@
#define XMLPARSER_H
#include <MAutoPtr.h>
+#include <MercuryNamedResource.h>
struct _xmlNode;
typedef struct _xmlNode xmlNode;
@@ -14,7 +15,7 @@
private:
};
-class XMLNode
+class XMLNode : public MercuryNamedResource
{
public:
XMLNode(xmlNode* node = NULL, xmlDoc* doc = NULL);
@@ -35,6 +36,8 @@
XMLNode FindFallbackNode() const;
const XMLNode& operator=(const XMLNode& n);
+
+ virtual bool GetValue( const MString & sDataPointer, MString & sReturn );
private:
XMLNode RecursiveFindFallbackNode(const MString& path) const;
XMLNode FindParentWithName(const MString& name) const;
@@ -62,26 +65,35 @@
#endif
-/***************************************************************************
- * Copyright (C) 2008 by Joshua Allen *
- * *
- * *
- * 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 developers 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. *
+
+/****************************************************************************
+ * Copyright (C) 2009 by Joshua Allen *
+ * *
+ * *
+ * 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.
|
|
From: <cn...@us...> - 2009-06-28 21:59:33
|
Revision: 387
http://hgengine.svn.sourceforge.net/hgengine/?rev=387&view=rev
Author: cnlohr
Date: 2009-06-28 21:59:32 +0000 (Sun, 28 Jun 2009)
Log Message:
-----------
add utility String functions (this is taken mostly from HG1, these functions proved highly useful and
did not appear to cause problems)
Modified Paths:
--------------
Mercury2/src/MercuryUtil.cpp
Mercury2/src/MercuryUtil.h
Modified: Mercury2/src/MercuryUtil.cpp
===================================================================
--- Mercury2/src/MercuryUtil.cpp 2009-06-28 21:58:37 UTC (rev 386)
+++ Mercury2/src/MercuryUtil.cpp 2009-06-28 21:59:32 UTC (rev 387)
@@ -1,6 +1,7 @@
#include <MercuryUtil.h>
#include <MercuryFile.h>
#include <Mint.h>
+#include <MercuryVector.h>
MString ToUpper(const MString& s)
{
@@ -87,6 +88,55 @@
return (ith<0)?3:(ith>15)?GeneralUsePrimes[15]:GeneralUsePrimes[ith];
}
+//String processing functions
+long BytesUntil( const char* strin, const char * termin, long start, long slen, long termlen )
+{
+ int i;
+ for ( i = start; i < slen; i++ )
+ for ( int j = 0; j < termlen; j++ )
+ if ( termin[j] == strin[i] )
+ return i - start;
+ return i - start;
+}
+
+long BytesNUntil( const char* strin, const char * termin, long start, long slen, long termlen )
+{
+ int i;
+ for ( i = start; i < slen; i++ )
+ {
+ bool found = false;
+ for ( int j = 0; j < termlen; j++ )
+ {
+ if ( termin[j] == strin[i] )
+ found = true;
+ }
+ if ( !found )
+ return i - start;
+ }
+ return i - start;
+}
+
+void SplitStrings( const MString & in, MVector < MString > & out,
+ const char * termin, const char * whitespace,
+ long termlen, long wslen )
+{
+ const char * inStr = in.c_str();
+ long curPos = 0;
+ long inLen = in.length();
+ while ( curPos < inLen )
+ {
+ curPos += BytesNUntil( inStr, whitespace, curPos, inLen, wslen );
+ long NextPos = BytesUntil( inStr, termin, curPos, inLen, termlen );
+ out.push_back( in.substr( curPos, NextPos ) );
+ curPos += NextPos + 1;
+ }
+}
+
+
+
+
+
+
/* Copyright (c) 2009, Joshua Allen and Charles Lohr
* All rights reserved.
*
Modified: Mercury2/src/MercuryUtil.h
===================================================================
--- Mercury2/src/MercuryUtil.h 2009-06-28 21:58:37 UTC (rev 386)
+++ Mercury2/src/MercuryUtil.h 2009-06-28 21:59:32 UTC (rev 387)
@@ -104,6 +104,24 @@
///pattern is the next prime number that's roughly two times the last.
int GetAPrime( int ith );
+
+
+
+//String processing functions
+//XXX: This may not be portable. We do not in fact need to include the header for MVector yet.
+template<typename T>
+class MVector;
+
+///Bytes until desired terminal
+long BytesUntil( const char* strin, const char * termin, long start, long slen, long termlen );
+
+///Bytes until something other than a terminal
+long BytesNUntil( const char* strin, const char * termin, long start, long slen, long termlen );
+
+///Split given string into other strings using delimiters from termin
+void SplitStrings( const MString & in, MVector < MString > & out, const char * termin, const char * whitespace, long termlen, long wslen );
+
+
#endif
/* Copyright (c) 2009, Joshua Allen and Charles Lohr
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <cn...@us...> - 2009-06-28 21:58:39
|
Revision: 386
http://hgengine.svn.sourceforge.net/hgengine/?rev=386&view=rev
Author: cnlohr
Date: 2009-06-28 21:58:37 +0000 (Sun, 28 Jun 2009)
Log Message:
-----------
cleanup - Actually use Mercury Vector, instead of the crazy #define happenstance.
Modified Paths:
--------------
Mercury2/src/MercuryFile.cpp
Mercury2/src/MercuryFile.h
Mercury2/src/MercuryFileDriverDirect.cpp
Mercury2/src/MercuryFileDriverPacked.cpp
Mercury2/src/MercuryFileDriverZipped.cpp
Modified: Mercury2/src/MercuryFile.cpp
===================================================================
--- Mercury2/src/MercuryFile.cpp 2009-06-28 21:57:18 UTC (rev 385)
+++ Mercury2/src/MercuryFile.cpp 2009-06-28 21:58:37 UTC (rev 386)
@@ -1,5 +1,5 @@
#include "MercuryFile.h"
-
+#include <MercuryVector.h>
#include <MercuryFileDriverDirect.h>
#include <MercuryFileDriverNet.h>
#include <MercuryFileDriverMem.h>
Modified: Mercury2/src/MercuryFile.h
===================================================================
--- Mercury2/src/MercuryFile.h 2009-06-28 21:57:18 UTC (rev 385)
+++ Mercury2/src/MercuryFile.h 2009-06-28 21:58:37 UTC (rev 386)
@@ -4,11 +4,10 @@
#include <MAutoPtr.h>
#include <MercuryUtil.h>
-#include <vector>
+//Forward decleration, as there's no real need to have this included unless we _need_ it.
+template< typename t >
+class MVector;
-//XXX When we write a Mercury Vector, replace this line !!! XXX !!! NOTE
-#define MVector std::vector
-
///File permissions (self-explainatory)
enum FilePermission
{
Modified: Mercury2/src/MercuryFileDriverDirect.cpp
===================================================================
--- Mercury2/src/MercuryFileDriverDirect.cpp 2009-06-28 21:57:18 UTC (rev 385)
+++ Mercury2/src/MercuryFileDriverDirect.cpp 2009-06-28 21:58:37 UTC (rev 386)
@@ -1,4 +1,5 @@
-#include "MercuryFileDriverDirect.h"
+#include <MercuryFileDriverDirect.h>
+#include <MercuryVector.h>
#ifndef WIN32
#include <dirent.h>
Modified: Mercury2/src/MercuryFileDriverPacked.cpp
===================================================================
--- Mercury2/src/MercuryFileDriverPacked.cpp 2009-06-28 21:57:18 UTC (rev 385)
+++ Mercury2/src/MercuryFileDriverPacked.cpp 2009-06-28 21:58:37 UTC (rev 386)
@@ -1,4 +1,5 @@
#include <MercuryFileDriverPacked.h>
+#include <MercuryVector.h>
#include <string.h>
const MString PackagePrefix = "Packages/";
Modified: Mercury2/src/MercuryFileDriverZipped.cpp
===================================================================
--- Mercury2/src/MercuryFileDriverZipped.cpp 2009-06-28 21:57:18 UTC (rev 385)
+++ Mercury2/src/MercuryFileDriverZipped.cpp 2009-06-28 21:58:37 UTC (rev 386)
@@ -1,14 +1,15 @@
#include <MercuryFileDriverZipped.h>
#include <MercuryFileDriverPacked.h>
+#include <MercuryVector.h>
//For the store compression on zips
#include <zlib.h>
#include <string.h>
-#if defined(WIN32)
-# if defined(_MSC_VER)
-# pragma comment(lib, "zdll.lib")
-# endif
+#if defined(WIN32)
+# if defined(_MSC_VER)
+# pragma comment(lib, "zdll.lib")
+# endif
#endif
const MString PackagePrefix = "Packages/";
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <cn...@us...> - 2009-06-28 21:57:21
|
Revision: 385
http://hgengine.svn.sourceforge.net/hgengine/?rev=385&view=rev
Author: cnlohr
Date: 2009-06-28 21:57:18 +0000 (Sun, 28 Jun 2009)
Log Message:
-----------
add named resource (useful for making easily readable things)
Added Paths:
-----------
Mercury2/src/MercuryNamedResource.cpp
Mercury2/src/MercuryNamedResource.h
Added: Mercury2/src/MercuryNamedResource.cpp
===================================================================
--- Mercury2/src/MercuryNamedResource.cpp (rev 0)
+++ Mercury2/src/MercuryNamedResource.cpp 2009-06-28 21:57:18 UTC (rev 385)
@@ -0,0 +1,110 @@
+#include <MercuryNamedResource.h>
+#include <MercuryUtil.h>
+
+
+MString MercuryNamedResource::GetValueS( const MString & sDataPointer )
+{
+ MString ret;
+ GetValue( sDataPointer, ret );
+ return ret;
+}
+
+MString MercuryNamedResource::GetValueS( const MString & sDataPointer, MString sDefaultValue, bool bSetValue )
+{
+ MString ret;
+ if( GetValue( sDataPointer, ret ) )
+ return ret;
+
+ if( bSetValue )
+ SetValueS( sDataPointer, sDefaultValue );
+ return sDefaultValue;
+}
+
+
+float MercuryNamedResource::GetValueF( const MString & sDataPointer, float fDefaultValue, bool bSetValue )
+{
+ MString tmpret;
+ if( GetValue( sDataPointer, tmpret ) )
+ return StrToFloat( tmpret );
+ if( bSetValue )
+ SetValueF( sDataPointer, fDefaultValue );
+
+ return fDefaultValue;
+}
+
+void MercuryNamedResource::SetValueF( const MString & sDataPointer, float fValue )
+{
+ char sset[64];
+ snprintf( sset, 63, "%f", fValue );
+ SetValueS( sDataPointer, sset );
+}
+
+bool MercuryNamedResource::GetValueB( const MString & sDataPointer, bool bDefaultValue, bool bSetValue )
+{
+ MString tmpret;
+ if( GetValue( sDataPointer, tmpret ) )
+ return StrToInt( tmpret );
+ if( bSetValue )
+ SetValueB( sDataPointer, bDefaultValue );
+
+ return bDefaultValue;
+}
+
+void MercuryNamedResource::SetValueB( const MString & sDataPointer, bool bValue )
+{
+ if( bValue )
+ SetValueS( sDataPointer, "1" );
+ else
+ SetValueS( sDataPointer, "0" );
+}
+
+int MercuryNamedResource::GetValueI( const MString & sDataPointer, int iDefaultValue, bool bSetValue )
+{
+ MString tmpret;
+ if( GetValue( sDataPointer, tmpret ) )
+ return StrToInt( tmpret );
+ if( bSetValue )
+ SetValueI( sDataPointer, iDefaultValue );
+
+ return iDefaultValue;
+}
+
+void MercuryNamedResource::SetValueI( const MString & sDataPointer, int iValue )
+{
+ char sset[64];
+ snprintf( sset, 63, "%d", iValue );
+ SetValueS( sDataPointer, sset );
+}
+
+
+/****************************************************************************
+ * 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/MercuryNamedResource.h
===================================================================
--- Mercury2/src/MercuryNamedResource.h (rev 0)
+++ Mercury2/src/MercuryNamedResource.h 2009-06-28 21:57:18 UTC (rev 385)
@@ -0,0 +1,82 @@
+#ifndef _MERCURY_NAMED_RESOURCE
+#define _MERCURY_NAMED_RESOURCE
+
+#include <MercuryString.h>
+
+///Base class for several named resources (I.e. Preferences, Theme, etc.)
+class MercuryNamedResource
+{
+public:
+ ///Get a Value
+ /** This function _must_ be overloaded by the base class, as there is no
+ mechanism for the named resource to figure this out. */
+ virtual bool GetValue( const MString & sDataPointer, MString & sReturn ) = 0;
+
+ ///Set a named value.
+ /** This function should be overloaded by the base class, unless you have no
+ means to write back. For instance, the theme will simply ignore this
+ function. */
+ virtual void SetValueS( const MString & sDataPointer, const MString & sValToSet ) { }
+
+ ///Retrieve a named value
+ /** This function can be overloaded by the base class, otherwise, it
+ just makes approprate calls to GetValue */
+ virtual MString GetValueS( const MString & sDataPointer, MString sDefaultValue, bool bSetValue = false );
+
+ ///Shorthand for retrieving a named value (calls GetValueS with null Parameters)
+ /** This function may be overloaded if you wish to improve performance slightly
+ when users are simply doing reads and do not intend to set default values */
+ virtual MString GetValueS( const MString & sDataPointer );
+
+ ///Retrieve a named value and convert it to a float.
+ float GetValueF( const MString & sDataPointer, float fDefaultValue = 0.0f, bool bSetValue = false );
+
+ ///Set a float value on a named resource.
+ void SetValueF( const MString & sDataPointer, float fValue );
+
+ ///Retrieve a named value and convert it to a boolean.
+ bool GetValueB( const MString & sDataPointer, bool bDefaultValue = false, bool bSetValue = false );
+
+ ///Set a float value on a named resource.
+ void SetValueB( const MString & sDataPointer, bool bValue );
+
+ ///Retrieve a named value and convert it to a float.
+ int GetValueI( const MString & sDataPointer, int iDefaultValue = 0, bool bSetValue = false );
+
+ ///Set a float value on a named resource.
+ void SetValueI( const MString & sDataPointer, int iValue );
+};
+
+#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.
|
|
From: <cn...@us...> - 2009-06-28 21:52:54
|
Revision: 384
http://hgengine.svn.sourceforge.net/hgengine/?rev=384&view=rev
Author: cnlohr
Date: 2009-06-28 21:52:53 +0000 (Sun, 28 Jun 2009)
Log Message:
-----------
add the resource node
Modified Paths:
--------------
Mercury2/adv_set.c
Modified: Mercury2/adv_set.c
===================================================================
--- Mercury2/adv_set.c 2009-06-27 22:25:13 UTC (rev 383)
+++ Mercury2/adv_set.c 2009-06-28 21:52:53 UTC (rev 384)
@@ -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/GLHelpers.cpp src/FullscreenQuad.cpp src/MercuryNamedResource.cpp"
SOURCES="$SOURCES src/MercuryFileDriverDirect.cpp src/MercuryFileDriverMem.cpp \
src/MercuryFileDriverPacked.cpp src/MercuryFileDriverZipped.cpp"
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <cn...@us...> - 2009-06-27 22:25:16
|
Revision: 383
http://hgengine.svn.sourceforge.net/hgengine/?rev=383&view=rev
Author: cnlohr
Date: 2009-06-27 22:25:13 +0000 (Sat, 27 Jun 2009)
Log Message:
-----------
glUniformMatrix4fv is an ARB, not in the core.
Modified Paths:
--------------
Mercury2/src/Shader.cpp
Modified: Mercury2/src/Shader.cpp
===================================================================
--- Mercury2/src/Shader.cpp 2009-06-27 22:24:47 UTC (rev 382)
+++ Mercury2/src/Shader.cpp 2009-06-27 22:25:13 UTC (rev 383)
@@ -470,7 +470,7 @@
glUniform4fvARB( location, 4, &x.value.fFloatV4[0] );
break;
case ShaderAttribute::TYPE_MATRIX:
- glUniformMatrix4fv(location, 1, 1, x.value.matrix); //transpase too
+ glUniformMatrix4fvARB(location, 1, 1, x.value.matrix); //transpase too
};
GLERRORCHECK;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <cn...@us...> - 2009-06-27 22:24:54
|
Revision: 382
http://hgengine.svn.sourceforge.net/hgengine/?rev=382&view=rev
Author: cnlohr
Date: 2009-06-27 22:24:47 +0000 (Sat, 27 Jun 2009)
Log Message:
-----------
Windows doesn't tell you whats wrong when you dynamically link things.
Modified Paths:
--------------
Mercury2/src/ModuleManager.cpp
Modified: Mercury2/src/ModuleManager.cpp
===================================================================
--- Mercury2/src/ModuleManager.cpp 2009-06-27 22:24:29 UTC (rev 381)
+++ Mercury2/src/ModuleManager.cpp 2009-06-27 22:24:47 UTC (rev 382)
@@ -70,7 +70,12 @@
if( !m_hAllHandles[ModuleName] )
{
+#ifdef WIN32
+ fprintf( stderr, "Error opening: %s\n", ModuleName.c_str() );
+#else
fprintf( stderr, "Error opening: %s (%s)\n", ModuleName.c_str(), dlerror() );
+#endif
+
return false;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <cn...@us...> - 2009-06-27 22:24:30
|
Revision: 381
http://hgengine.svn.sourceforge.net/hgengine/?rev=381&view=rev
Author: cnlohr
Date: 2009-06-27 22:24:29 +0000 (Sat, 27 Jun 2009)
Log Message:
-----------
Add necessary extensions.
Modified Paths:
--------------
Mercury2/src/OGLExtensions.cpp
Mercury2/src/OGLExtensions.h
Modified: Mercury2/src/OGLExtensions.cpp
===================================================================
--- Mercury2/src/OGLExtensions.cpp 2009-06-27 22:23:00 UTC (rev 380)
+++ Mercury2/src/OGLExtensions.cpp 2009-06-27 22:24:29 UTC (rev 381)
@@ -30,12 +30,23 @@
PFNGLLINKPROGRAMARBPROC glLinkProgramARB;
PFNGLGETUNIFORMLOCATIONARBPROC glGetUniformLocationARB;
PFNGLPROGRAMPARAMETERIEXTPROC glProgramParameteriEXT;
-PFNGLGETACTIVEUNIFORMARBPROC glGetActiveUniformARB;
-PFNGLUNIFORM1IARBPROC glUniform1iARB;
-PFNGLUNIFORM4FVARBPROC glUniform4fvARB;
+PFNGLGETACTIVEUNIFORMARBPROC glGetActiveUniformARB;
+PFNGLUNIFORM1IARBPROC glUniform1iARB;
+PFNGLUNIFORM4FVARBPROC glUniform4fvARB;
+PFNGLDELETEFRAMEBUFFERSEXTPROC glDeleteFramebuffersEXT;
+PFNGLGENRENDERBUFFERSEXTPROC glGenRenderbuffersEXT;
+PFNGLDELETERENDERBUFFERSEXTPROC glDeleteRenderbuffersEXT;
+PFNGLGENFRAMEBUFFERSEXTPROC glGenFramebuffersEXT;
+PFNGLBINDRENDERBUFFEREXTPROC glBindRenderbufferEXT;
+PFNGLRENDERBUFFERSTORAGEEXTPROC glRenderbufferStorageEXT;
+PFNGLBINDFRAMEBUFFEREXTPROC glBindFramebufferEXT;
+PFNGLFRAMEBUFFERTEXTURE2DEXTPROC glFramebufferTexture2DEXT;
+PFNGLFRAMEBUFFERRENDERBUFFEREXTPROC glFramebufferRenderbufferEXT;
+PFNGLCHECKFRAMEBUFFERSTATUSEXTPROC glCheckFramebufferStatusEXT;
+PFNGLDRAWBUFFERSARBPROC glDrawBuffersARB;
+PFNGLUNIFORMMATRIX4FVARBPROC glUniformMatrix4fvARB;
-
#define EXTENSION( proc, name ) \
name = (proc)wglGetProcAddress( #name ); \
if( !name ) \
@@ -68,7 +79,21 @@
EXTENSION( PFNGLLINKPROGRAMARBPROC,glLinkProgramARB );
EXTENSION( PFNGLGETUNIFORMLOCATIONARBPROC,glGetUniformLocationARB );
EXTENSION( PFNGLPROGRAMPARAMETERIEXTPROC,glProgramParameteriEXT );
-EXTENSION( PFNGLGETACTIVEUNIFORMARBPROC,glGetActiveUniformARB );
-EXTENSION( PFNGLUNIFORM1IARBPROC,glUniform1iARB );
+EXTENSION( PFNGLGETACTIVEUNIFORMARBPROC,glGetActiveUniformARB );
+EXTENSION( PFNGLUNIFORM1IARBPROC,glUniform1iARB );
EXTENSION( PFNGLUNIFORM4FVARBPROC,glUniform4fvARB );
+EXTENSION( PFNGLUNIFORMMATRIX4FVARBPROC, glUniformMatrix4fvARB );
+
+
+EXTENSION( PFNGLDELETEFRAMEBUFFERSEXTPROC, glDeleteFramebuffersEXT );
+EXTENSION( PFNGLGENRENDERBUFFERSEXTPROC, glGenRenderbuffersEXT );
+EXTENSION( PFNGLDELETERENDERBUFFERSEXTPROC, glDeleteRenderbuffersEXT );
+EXTENSION( PFNGLGENFRAMEBUFFERSEXTPROC, glGenFramebuffersEXT );
+EXTENSION( PFNGLBINDRENDERBUFFEREXTPROC, glBindRenderbufferEXT );
+EXTENSION( PFNGLRENDERBUFFERSTORAGEEXTPROC, glRenderbufferStorageEXT );
+EXTENSION( PFNGLBINDFRAMEBUFFEREXTPROC, glBindFramebufferEXT );
+EXTENSION( PFNGLFRAMEBUFFERTEXTURE2DEXTPROC, glFramebufferTexture2DEXT );
+EXTENSION( PFNGLFRAMEBUFFERRENDERBUFFEREXTPROC, glFramebufferRenderbufferEXT );
+EXTENSION( PFNGLCHECKFRAMEBUFFERSTATUSEXTPROC, glCheckFramebufferStatusEXT );
+EXTENSION( PFNGLDRAWBUFFERSARBPROC, glDrawBuffersARB );
}
Modified: Mercury2/src/OGLExtensions.h
===================================================================
--- Mercury2/src/OGLExtensions.h 2009-06-27 22:23:00 UTC (rev 380)
+++ Mercury2/src/OGLExtensions.h 2009-06-27 22:24:29 UTC (rev 381)
@@ -25,10 +25,22 @@
extern PFNGLLINKPROGRAMARBPROC glLinkProgramARB;
extern PFNGLGETUNIFORMLOCATIONARBPROC glGetUniformLocationARB;
extern PFNGLPROGRAMPARAMETERIEXTPROC glProgramParameteriEXT;
-extern PFNGLGETACTIVEUNIFORMARBPROC glGetActiveUniformARB;
-extern PFNGLUNIFORM1IARBPROC glUniform1iARB;
-extern PFNGLUNIFORM4FVARBPROC glUniform4fvARB;
+extern PFNGLGETACTIVEUNIFORMARBPROC glGetActiveUniformARB;
+extern PFNGLUNIFORM1IARBPROC glUniform1iARB;
+extern PFNGLUNIFORM4FVARBPROC glUniform4fvARB;
+extern PFNGLUNIFORMMATRIX4FVARBPROC glUniformMatrix4fvARB;
+extern PFNGLDELETEFRAMEBUFFERSEXTPROC glDeleteFramebuffersEXT;
+extern PFNGLGENRENDERBUFFERSEXTPROC glGenRenderbuffersEXT;
+extern PFNGLDELETERENDERBUFFERSEXTPROC glDeleteRenderbuffersEXT;
+extern PFNGLGENFRAMEBUFFERSEXTPROC glGenFramebuffersEXT;
+extern PFNGLBINDRENDERBUFFEREXTPROC glBindRenderbufferEXT;
+extern PFNGLRENDERBUFFERSTORAGEEXTPROC glRenderbufferStorageEXT;
+extern PFNGLBINDFRAMEBUFFEREXTPROC glBindFramebufferEXT;
+extern PFNGLFRAMEBUFFERTEXTURE2DEXTPROC glFramebufferTexture2DEXT;
+extern PFNGLFRAMEBUFFERRENDERBUFFEREXTPROC glFramebufferRenderbufferEXT;
+extern PFNGLCHECKFRAMEBUFFERSTATUSEXTPROC glCheckFramebufferStatusEXT;
+extern PFNGLDRAWBUFFERSARBPROC glDrawBuffersARB;
void SetupOGLExtensions();
#endif
\ No newline at end of file
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <cn...@us...> - 2009-06-27 22:23:01
|
Revision: 380
http://hgengine.svn.sourceforge.net/hgengine/?rev=380&view=rev
Author: cnlohr
Date: 2009-06-27 22:23:00 +0000 (Sat, 27 Jun 2009)
Log Message:
-----------
Add Limits the the includes to get a Windows version of INFINITY
Modified Paths:
--------------
Mercury2/src/MercuryMath.h
Modified: Mercury2/src/MercuryMath.h
===================================================================
--- Mercury2/src/MercuryMath.h 2009-06-27 22:22:33 UTC (rev 379)
+++ Mercury2/src/MercuryMath.h 2009-06-27 22:23:00 UTC (rev 380)
@@ -10,6 +10,11 @@
typedef float FloatRow[4];
#endif
+#ifdef WIN32
+#include <limits>
+#define INFINITY (std::numeric_limits<float>::infinity())
+#endif
+
void ZeroFloatRow(FloatRow& r);
#define DEGRAD 0.01745329251994329576f //degree to radian
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <cn...@us...> - 2009-06-27 22:22:34
|
Revision: 379
http://hgengine.svn.sourceforge.net/hgengine/?rev=379&view=rev
Author: cnlohr
Date: 2009-06-27 22:22:33 +0000 (Sat, 27 Jun 2009)
Log Message:
-----------
Check renderbuffer errors is an extension, not in the core.
Modified Paths:
--------------
Mercury2/src/GLHeaders.h
Modified: Mercury2/src/GLHeaders.h
===================================================================
--- Mercury2/src/GLHeaders.h 2009-06-27 22:22:09 UTC (rev 378)
+++ Mercury2/src/GLHeaders.h 2009-06-27 22:22:33 UTC (rev 379)
@@ -27,7 +27,7 @@
assert(0); } }
#define CHECKFBO { \
-uint32_t e = glCheckFramebufferStatus(GL_FRAMEBUFFER); \
+uint32_t e = glCheckFramebufferStatusEXT(GL_FRAMEBUFFER); \
if ( e != GL_FRAMEBUFFER_COMPLETE ) { \
printf("GL FBO Error:%s\n", GlError2String(e).c_str()); \
assert(0); } }
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <cn...@us...> - 2009-06-27 22:22:11
|
Revision: 378
http://hgengine.svn.sourceforge.net/hgengine/?rev=378&view=rev
Author: cnlohr
Date: 2009-06-27 22:22:09 +0000 (Sat, 27 Jun 2009)
Log Message:
-----------
Classify the mouse enumeration - there is an issue at global scope
Modified Paths:
--------------
Mercury2/src/MercuryInput.cpp
Mercury2/src/MercuryInput.h
Modified: Mercury2/src/MercuryInput.cpp
===================================================================
--- Mercury2/src/MercuryInput.cpp 2009-06-27 22:17:04 UTC (rev 377)
+++ Mercury2/src/MercuryInput.cpp 2009-06-27 22:22:09 UTC (rev 378)
@@ -13,9 +13,9 @@
mi->dy = dy;
uint8_t buttonMasks = 0;
- buttonMasks |= (leftButton << MB_LEFT); //enable if true
- buttonMasks |= (rightButton << MB_RIGHT); //enable if true
- buttonMasks |= (centerButton << MB_CENTER); //enable if true
+ buttonMasks |= (leftButton << MOUSE_LEFT); //enable if true
+ buttonMasks |= (rightButton << MOUSE_RIGHT); //enable if true
+ buttonMasks |= (centerButton << MOUSE_CENTER); //enable if true
mi->buttonMasks = buttonMasks;
currentButtonMasks = buttonMasks;
Modified: Mercury2/src/MercuryInput.h
===================================================================
--- Mercury2/src/MercuryInput.h 2009-06-27 22:17:04 UTC (rev 377)
+++ Mercury2/src/MercuryInput.h 2009-06-27 22:22:09 UTC (rev 378)
@@ -6,13 +6,6 @@
const MString INPUTEVENT_MOUSE = "MouseInputEvent";
const MString INPUTEVENT_KEYBOARD = "KeyboardInputEvent";
-enum MouseButton
-{
- MB_NONE = 0,
- MB_LEFT = 1,
- MB_RIGHT = 2,
- MB_CENTER = 3
-};
class MouseInput : public MessageData
{
@@ -22,6 +15,15 @@
MouseInput();
int32_t dx, dy;
uint8_t buttonMasks;
+
+ enum MouseButton
+ {
+ MOUSE_NONE = 0,
+ MOUSE_LEFT = 1,
+ MOUSE_RIGHT = 2,
+ MOUSE_CENTER = 3
+ };
+
private:
static uint8_t currentButtonMasks;
};
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <cn...@us...> - 2009-06-27 22:17:10
|
Revision: 377
http://hgengine.svn.sourceforge.net/hgengine/?rev=377&view=rev
Author: cnlohr
Date: 2009-06-27 22:17:04 +0000 (Sat, 27 Jun 2009)
Log Message:
-----------
update Windows project.
Modified Paths:
--------------
Mercury2/Mercury2.vcproj
Modified: Mercury2/Mercury2.vcproj
===================================================================
--- Mercury2/Mercury2.vcproj 2009-06-26 04:48:04 UTC (rev 376)
+++ Mercury2/Mercury2.vcproj 2009-06-27 22:17:04 UTC (rev 377)
@@ -186,10 +186,30 @@
>
</File>
<File
+ RelativePath=".\src\Camera.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\src\Camera.h"
+ >
+ </File>
+ <File
RelativePath=".\src\Frustum.cpp"
>
</File>
<File
+ RelativePath=".\src\FullscreenQuad.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\src\FullscreenQuad.h"
+ >
+ </File>
+ <File
+ RelativePath=".\src\GLHelpers.cpp"
+ >
+ </File>
+ <File
RelativePath=".\src\HGMDLMesh.cpp"
>
</File>
@@ -218,6 +238,10 @@
>
</File>
<File
+ RelativePath=".\src\MercuryFBO.cpp"
+ >
+ </File>
+ <File
RelativePath=".\src\MercuryFile.cpp"
>
</File>
@@ -238,6 +262,10 @@
>
</File>
<File
+ RelativePath=".\src\MercuryInput.cpp"
+ >
+ </File>
+ <File
RelativePath=".\src\MercuryMath.cpp"
>
</File>
@@ -302,10 +330,6 @@
>
</File>
<File
- RelativePath=".\src\MQuaternion.h"
- >
- </File>
- <File
RelativePath=".\src\MSemaphore.cpp"
>
</File>
@@ -326,10 +350,6 @@
>
</File>
<File
- RelativePath=".\src\RenderableNode.cpp"
- >
- </File>
- <File
RelativePath=".\src\RenderGraph.cpp"
>
</File>
@@ -392,6 +412,10 @@
>
</File>
<File
+ RelativePath=".\src\GLHelpers.h"
+ >
+ </File>
+ <File
RelativePath=".\src\global.h"
>
</File>
@@ -424,6 +448,10 @@
>
</File>
<File
+ RelativePath=".\src\MercuryFBO.h"
+ >
+ </File>
+ <File
RelativePath=".\src\MercuryFile.h"
>
</File>
@@ -444,6 +472,14 @@
>
</File>
<File
+ RelativePath=".\src\MercuryHash.h"
+ >
+ </File>
+ <File
+ RelativePath=".\src\MercuryInput.h"
+ >
+ </File>
+ <File
RelativePath=".\src\MercuryList.h"
>
</File>
@@ -492,6 +528,10 @@
>
</File>
<File
+ RelativePath=".\src\MercuryVector.h"
+ >
+ </File>
+ <File
RelativePath=".\src\MercuryVertex.h"
>
</File>
@@ -508,6 +548,10 @@
>
</File>
<File
+ RelativePath=".\src\MQuaternion.h"
+ >
+ </File>
+ <File
RelativePath=".\src\MQueue.h"
>
</File>
@@ -589,6 +633,14 @@
RelativePath=".\modules\BillboardNode.h"
>
</File>
+ <File
+ RelativePath=".\modules\TextNode.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\modules\TextNode.h"
+ >
+ </File>
</Filter>
<File
RelativePath=".\scenegraph.xml"
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <cn...@us...> - 2009-06-26 04:48:19
|
Revision: 376
http://hgengine.svn.sourceforge.net/hgengine/?rev=376&view=rev
Author: cnlohr
Date: 2009-06-26 04:48:04 +0000 (Fri, 26 Jun 2009)
Log Message:
-----------
wrong name on the header copyright :)
Modified Paths:
--------------
Mercury2/modules/TextNode.h
Modified: Mercury2/modules/TextNode.h
===================================================================
--- Mercury2/modules/TextNode.h 2009-06-25 05:47:03 UTC (rev 375)
+++ Mercury2/modules/TextNode.h 2009-06-26 04:48:04 UTC (rev 376)
@@ -103,7 +103,8 @@
/****************************************************************************
- * Copyright (C) 2009 by Joshua Allen *
+ * Copyright (C) 2009 by Charles Lohr *
+ * Joshua Allen *
* *
* *
* All rights reserved. *
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <cn...@us...> - 2009-06-25 05:47:04
|
Revision: 375
http://hgengine.svn.sourceforge.net/hgengine/?rev=375&view=rev
Author: cnlohr
Date: 2009-06-25 05:47:03 +0000 (Thu, 25 Jun 2009)
Log Message:
-----------
update font code and font, itself
Modified Paths:
--------------
Mercury2/modules/TextNode.cpp
Mercury2/modules/TextNode.h
Mercury2/scenegraph.xml
Mercury2/testfont.hgfont
Mercury2/testfont.png
Mercury2/tools/fonter/main.cpp
Modified: Mercury2/modules/TextNode.cpp
===================================================================
--- Mercury2/modules/TextNode.cpp 2009-06-25 04:08:08 UTC (rev 374)
+++ Mercury2/modules/TextNode.cpp 2009-06-25 05:47:03 UTC (rev 375)
@@ -9,7 +9,11 @@
REGISTER_NODE_TYPE(TextNode);
TextNode::TextNode()
- :MercuryNode(),m_fSize(1.),m_bDirty(false),m_pThisFont(NULL),m_kVBO(0), m_kTEX(0)
+ :MercuryNode(),m_fSize(1.),
+ m_bDirty(false),m_pThisFont(NULL),
+ m_alignment( LEFT ),
+ m_fTextWidth( INFINITY ),
+ m_kVBO(0), m_kTEX(0)
{
}
@@ -33,6 +37,16 @@
SetSize( StrToFloat( node.Attribute("size") ) );
if ( !node.Attribute("text").empty() )
SetText( node.Attribute("text") );
+ if ( !node.Attribute("width").empty() )
+ SetWidth( StrToFloat( node.Attribute("width") ) );
+ if ( !node.Attribute("alignment").empty() )
+ {
+ MString sAlign = node.Attribute("alignment");
+ if( sAlign == "RIGHT" ) SetAlignment( RIGHT );
+ if( sAlign == "CENTER" ) SetAlignment( CENTER );
+ if( sAlign == "FIT" ) SetAlignment( FIT );
+ if( sAlign == "FIT_FULL" ) SetAlignment( FIT_FULL );
+ }
}
void TextNode::RenderText()
@@ -40,6 +54,7 @@
std::vector< DChar > chars;
float xps = 0;
float yps = 0;
+ bool bWasBlank = true;
if( !m_pThisFont )
return;
@@ -73,29 +88,160 @@
for( const char * c = &m_sText[0]; *c != 0; c++ )
{
if( *c == 9 )
- xps+=80;
+ {
+ xps += m_pThisFont->m_fTab;
+ bWasBlank = true;
+ }
else if( *c == 10 )
{
xps = 0;
- yps += m_pThisFont->m_fHeight; //??XXXX NEED TO SET TO RIGHT VALUE!
+ yps += m_pThisFont->m_fHeight;
+ bWasBlank = true;
}
else if( *c == 32 )
- xps+=20;
+ {
+ xps += m_pThisFont->m_fSpace;
+ bWasBlank = true;
+ }
else
{
if( m_pThisFont->m_mGlyphs.find( *c ) != m_pThisFont->m_mGlyphs.end() )
{
Glyph & g = m_pThisFont->m_mGlyphs[*c];
- chars.push_back( DChar( &g, *c, xps, yps ) );
+ chars.push_back( DChar( &g, *c, xps, yps, g.ilx+m_pThisFont->m_fBlank, bWasBlank ) );
//Here is the right place to do line-splitting if need be.
- xps += g.ilx+4; //Why 4?
+ xps += g.ilx+m_pThisFont->m_fBlank;
+
+ bWasBlank = false;
+
+ //Check wrapping
+ if( xps > m_fTextWidth )
+ {
+ int i, j;
+ //Track backward, and dump current word on next line.
+ for( i = (int)chars.size()-1; i >= 0; i-- )
+ {
+ if( chars[i].bWordStart ) break;
+ }
+
+ //If word begins at the beginning of the line
+ if( chars[i].xps == 0 )
+ {
+ //advance "This" letter to the next line
+ chars[chars.size()-1].xps = 0;
+ chars[chars.size()-1].yps += m_pThisFont->m_fHeight;
+ chars[chars.size()-1].bWordStart = true;
+
+ xps = g.ilx+m_pThisFont->m_fBlank;
+ yps += m_pThisFont->m_fHeight;
+ } else
+ {
+ //break to new line
+ float fPosStart = chars[i].xps;
+ for( j = i; j < (int)chars.size(); j++ )
+ {
+ chars[j].xps -= fPosStart;
+ xps = chars[j].xps;
+ chars[j].yps += m_pThisFont->m_fHeight;
+ }
+ xps += g.ilx+m_pThisFont->m_fBlank;
+ yps += m_pThisFont->m_fHeight;
+ }
+ }
}
}
}
- //Stage 2: Actually generate the geometry.
+ //Stage 2: Handle alignment
+ if( m_alignment != LEFT )
+ {
+ float fLinePos = 0;
+ int iLineStart = 0;
+ int iLettersOnLine = 0;
+ int iWordsOnLine = 0;
+ for( unsigned i = 0; i <= chars.size(); i++ )
+ {
+ bool bNewLine = false;
+ if( i < chars.size() )
+ {
+ DChar & dc = chars[i];
+ if( dc.yps != fLinePos )
+ {
+ bNewLine = true;
+ }
+ fLinePos = dc.yps;
+ } else
+ bNewLine = true;
+
+ iLettersOnLine++;
+
+ if( bNewLine && i > 0 )
+ {
+ float fEndOfLine = chars[i-1].xps + chars[i-1].width;
+
+ iLettersOnLine--;
+
+ if( m_alignment == RIGHT )
+ {
+ float offset = m_fTextWidth - fEndOfLine;
+ for( unsigned j = iLineStart; j < i; j++ )
+ {
+ chars[j].xps += offset;
+ }
+ } else if( m_alignment == CENTER )
+ {
+ float offset = m_fTextWidth - fEndOfLine;
+ offset/=2;
+ for( unsigned j = iLineStart; j < i; j++ )
+ {
+ chars[j].xps += offset;
+ }
+ } else if( m_alignment == FIT_FULL )
+ {
+ float offset = m_fTextWidth - fEndOfLine;
+ offset/=float(iLettersOnLine);
+
+ float letter = 0;
+
+ for( unsigned j = iLineStart; j < i; j++ )
+ {
+ chars[j].xps += offset*letter;
+ letter++;
+ }
+ } else if( m_alignment == FIT )
+ {
+ float offset = m_fTextWidth - fEndOfLine;
+
+ if( iWordsOnLine != 0 )
+ {
+ offset/=float(iWordsOnLine-1);
+
+ float fTOffset = 0;
+
+ for( unsigned j = iLineStart; j < i; j++ )
+ {
+ if( chars[j].bWordStart && j != (unsigned)iLineStart )
+ fTOffset += offset;
+ chars[j].xps += fTOffset ;
+ }
+ }
+ }
+
+ iLineStart = i;
+ iLettersOnLine = 0;
+ iWordsOnLine = 0;
+ }
+
+ if( i < chars.size() )
+ {
+ if( chars[i].bWordStart || i == 0 ) iWordsOnLine++;
+ }
+ }
+ }
+
+ //Stage 3: Actually generate the geometry.
((MercuryVBO*)m_kVBO.Ptr())->AllocateIndexSpace(chars.size()*6);
((MercuryVBO*)m_kVBO.Ptr())->AllocateVertexSpace(chars.size()*4);
@@ -151,7 +297,6 @@
vd[(i*4+3)*8+6] = ey;
vd[(i*4+3)*8+7] = 0;
- printf( "%f %f %f %f %f %f %f %f\n", vd[(i*4+0)*8+5], vd[(i*4+0)*8+6], vd[(i*4+1)*8+5], vd[(i*4+1)*8+6], vd[(i*4+2)*8+5], vd[(i*4+2)*8+6], vd[(i*4+3)*8+5], vd[(i*4+3)*8+6] );
id[i*6+0] = i * 4 + 2;
id[i*6+1] = i * 4 + 1;
id[i*6+2] = i * 4 + 0;
@@ -218,7 +363,7 @@
return false;
}
- if( sscanf( sLine.c_str(), "%f", &m_fHeight ) != 1 )
+ if( sscanf( sLine.c_str(), "%f %f %f %f", &m_fHeight, &m_fBlank, &m_fSpace, &m_fTab ) != 4 )
{
fprintf( stderr, "Malformatted font size.\n" );
delete f;
Modified: Mercury2/modules/TextNode.h
===================================================================
--- Mercury2/modules/TextNode.h 2009-06-25 04:08:08 UTC (rev 374)
+++ Mercury2/modules/TextNode.h 2009-06-25 05:47:03 UTC (rev 375)
@@ -10,18 +10,37 @@
{
public:
TextNode();
+
+ enum TextAlignment
+ {
+ LEFT,
+ RIGHT,
+ CENTER,
+ FIT,
+ FIT_FULL
+ };
+
virtual void Update(float dTime);
virtual void LoadFromXML(const XMLNode& node);
+
virtual bool LoadFont( const MString & sFont );
virtual void SetSize( float fSize );
virtual void SetText( const MString & sText );
- inline void SetDirtyText() { m_bDirty = true; }
-
virtual void RenderText();
+ inline void SetAlignment( TextAlignment t ) { m_alignment = t; }
+ inline TextAlignment GetAlignment() { return m_alignment; }
+
+ inline float GetWidth() { return m_fTextWidth; }
+ inline void SetWidth( float fWidth ) { m_fTextWidth = fWidth; }
+
+ inline const MString & GetText() { return m_sText; }
+ inline void SetDirtyText() { m_bDirty = true; }
+
GENRTTI(TextNode);
+
private:
class Font;
@@ -30,6 +49,9 @@
MString m_sFont;
bool m_bDirty;
Font * m_pThisFont;
+ TextAlignment m_alignment;
+ float m_fTextWidth;
+
MAutoPtr< MercuryAsset > m_kVBO;
MAutoPtr< MercuryAsset > m_kTEX;
@@ -53,6 +75,10 @@
std::map< int, Glyph > m_mGlyphs;
MString m_sImage;
float m_fHeight;
+
+ float m_fBlank; //For space between letters
+ float m_fSpace; //For distance a space advances
+ float m_fTab; //For distance a tab goes
};
static MHash< Font > g_AllFonts;
@@ -61,12 +87,15 @@
class DChar
{
public:
- DChar( Glyph * g, int c, float x, float y ) : glyph(g), character(c), xps(x), yps(y) { }
+ DChar( Glyph * g, int c, float x, float y, float w, bool start ) : glyph(g), character(c), xps(x), yps(y), width(w), bWordStart( start ) { }
Glyph * glyph;
int character;
float xps; //aka pos on line
float yps; //aka line
+ float width;
+
+ bool bWordStart; //used for wrapping
};
};
Modified: Mercury2/scenegraph.xml
===================================================================
--- Mercury2/scenegraph.xml 2009-06-25 04:08:08 UTC (rev 374)
+++ Mercury2/scenegraph.xml 2009-06-25 05:47:03 UTC (rev 375)
@@ -8,7 +8,7 @@
</node>
<node type="transformnode" movz="-5" >
- <node type="TextNode" text="test font 123" font="testfont.hgfont" size=".01" alphaPath="true" />
+ <node type="TextNode" text="test font 123 HELLO WORLD!!! WOOT!" font="testfont.hgfont" size=".01" width="300" alphaPath="true" alignment="FIT_FULL" />
</node>
<!-- <asset type="texture" file="screenFBO_0" dynamic="true"/>
<asset type="fullscreenquad"/>
Modified: Mercury2/testfont.hgfont
===================================================================
--- Mercury2/testfont.hgfont 2009-06-25 04:08:08 UTC (rev 374)
+++ Mercury2/testfont.hgfont 2009-06-25 05:47:03 UTC (rev 375)
@@ -1,4 +1,5 @@
testfont.png
+64 4.000000 15.000000 80.000000
0 0.000000 0.000000 0.031250 0.040039 32 41 8 41
1 0.062500 0.000000 0.093750 0.040039 32 41 8 41
2 0.125000 0.000000 0.156250 0.040039 32 41 8 41
Modified: Mercury2/testfont.png
===================================================================
(Binary files differ)
Modified: Mercury2/tools/fonter/main.cpp
===================================================================
--- Mercury2/tools/fonter/main.cpp 2009-06-25 04:08:08 UTC (rev 374)
+++ Mercury2/tools/fonter/main.cpp 2009-06-25 05:47:03 UTC (rev 375)
@@ -48,7 +48,7 @@
fprintf( stderr, "Could not open font output file: %s\n", fname );
exit( -1 );
}
- fprintf( fontfile, "%s\n%d %f %f %f\n", pngname, FONTSIZE, 4, 15, 80 );
+ fprintf( fontfile, "%s\n%d %f %f %f\n", pngname, FONTSIZE, 4.f, 15.f, 80.f );
my_read_font( argv[1], imagedata, 64, 64, 16, 16 );
my_write_png( pngname, imagedata, 1024, 1024 );
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <cn...@us...> - 2009-06-25 04:08:10
|
Revision: 374
http://hgengine.svn.sourceforge.net/hgengine/?rev=374&view=rev
Author: cnlohr
Date: 2009-06-25 04:08:08 +0000 (Thu, 25 Jun 2009)
Log Message:
-----------
add white (luminance) as well as white_alpha (luminance_alpha)
This makes it possible to use our tighter packed textures and take up 1/2 the texture ram
Modified Paths:
--------------
Mercury2/src/PNGLoader.cpp
Mercury2/src/RawImageData.h
Mercury2/src/Texture.cpp
Modified: Mercury2/src/PNGLoader.cpp
===================================================================
--- Mercury2/src/PNGLoader.cpp 2009-06-25 03:29:06 UTC (rev 373)
+++ Mercury2/src/PNGLoader.cpp 2009-06-25 04:08:08 UTC (rev 374)
@@ -102,17 +102,43 @@
png_free_data(png_ptr, info_ptr, PNG_FREE_ALL, -1);
- if (color_type & PNG_COLOR_MASK_ALPHA)
- image->m_ColorByteType = RGBA;
+ if (color_type & PNG_COLOR_MASK_COLOR )
+ if (color_type & PNG_COLOR_MASK_ALPHA)
+ image->m_ColorByteType = RGBA;
+ else
+ image->m_ColorByteType = RGB;
else
- image->m_ColorByteType = RGB;
+ if (color_type & PNG_COLOR_MASK_ALPHA)
+ image->m_ColorByteType = WHITE_ALPHA;
+ else
+ image->m_ColorByteType = WHITE;
+
// SAFE_DELETE(texture->m_data);
image->m_data = new unsigned char[sizeof(unsigned char) * image->m_height * image->m_width * 4];
switch (image->m_ColorByteType)
{
+ case WHITE:
+ for ( y=0; y < (unsigned)image->m_height; ++y) {
+ png_byte* row = row_pointers[y];
+ for (unsigned long x = 0; x < image->m_width; ++x) {
+ png_byte* ptr = &(row[x]);
+ image->m_data[(x + y * image->m_width)] = ptr[0];
+ }
+ }
+ break;
+ case WHITE_ALPHA:
+ for ( y=0; y < (unsigned)image->m_height; ++y) {
+ png_byte* row = row_pointers[y];
+ for (unsigned long x = 0; x < image->m_width; ++x) {
+ png_byte* ptr = &(row[x*2]);
+ image->m_data[(x + y * image->m_width) * 2] = ptr[0];
+ image->m_data[(x + y * image->m_width) * 2 + 1] = ptr[1];
+ }
+ }
+ break;
case RGBA:
for ( y=0; y < (unsigned)image->m_height; ++y) {
png_byte* row = row_pointers[y];
Modified: Mercury2/src/RawImageData.h
===================================================================
--- Mercury2/src/RawImageData.h 2009-06-25 03:29:06 UTC (rev 373)
+++ Mercury2/src/RawImageData.h 2009-06-25 04:08:08 UTC (rev 374)
@@ -3,6 +3,8 @@
enum ColorByteType
{
+ WHITE,
+ WHITE_ALPHA,
RGB,
RGBA
};
Modified: Mercury2/src/Texture.cpp
===================================================================
--- Mercury2/src/Texture.cpp 2009-06-25 03:29:06 UTC (rev 373)
+++ Mercury2/src/Texture.cpp 2009-06-25 04:08:08 UTC (rev 374)
@@ -52,6 +52,12 @@
switch (m_raw->m_ColorByteType)
{
+ case WHITE:
+ ByteType = GL_LUMINANCE;
+ break;
+ case WHITE_ALPHA:
+ ByteType = GL_LUMINANCE_ALPHA;
+ break;
case RGB:
ByteType = GL_RGB;
break;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <cn...@us...> - 2009-06-25 03:29:10
|
Revision: 373
http://hgengine.svn.sourceforge.net/hgengine/?rev=373&view=rev
Author: cnlohr
Date: 2009-06-25 03:29:06 +0000 (Thu, 25 Jun 2009)
Log Message:
-----------
add default values to font (space, tab, advance)
Modified Paths:
--------------
Mercury2/tools/fonter/main.cpp
Modified: Mercury2/tools/fonter/main.cpp
===================================================================
--- Mercury2/tools/fonter/main.cpp 2009-06-24 10:28:29 UTC (rev 372)
+++ Mercury2/tools/fonter/main.cpp 2009-06-25 03:29:06 UTC (rev 373)
@@ -48,7 +48,7 @@
fprintf( stderr, "Could not open font output file: %s\n", fname );
exit( -1 );
}
- fprintf( fontfile, "%s\n%d\n", pngname, FONTSIZE );
+ fprintf( fontfile, "%s\n%d %f %f %f\n", pngname, FONTSIZE, 4, 15, 80 );
my_read_font( argv[1], imagedata, 64, 64, 16, 16 );
my_write_png( pngname, imagedata, 1024, 1024 );
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <axl...@us...> - 2009-06-24 10:29:07
|
Revision: 372
http://hgengine.svn.sourceforge.net/hgengine/?rev=372&view=rev
Author: axlecrusher
Date: 2009-06-24 10:28:29 +0000 (Wed, 24 Jun 2009)
Log Message:
-----------
Fix again.
It MUST be null if fail
Modified Paths:
--------------
Mercury2/modules/TextNode.cpp
Modified: Mercury2/modules/TextNode.cpp
===================================================================
--- Mercury2/modules/TextNode.cpp 2009-06-24 06:27:59 UTC (rev 371)
+++ Mercury2/modules/TextNode.cpp 2009-06-24 10:28:29 UTC (rev 372)
@@ -173,9 +173,10 @@
{
fprintf( stderr, "Error: Could not load font: \"%s\".", sFont.c_str() );
g_AllFonts.remove( sFont );
+ //This has to be set to null if there is a failure because this is what RenderText uses as a check
+ m_pThisFont = NULL;
return false;
}
- m_pThisFont = &g_AllFonts[sFont];
} else
m_pThisFont = &g_AllFonts[sFont];
SetDirtyText();
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <cn...@us...> - 2009-06-24 06:28:37
|
Revision: 371
http://hgengine.svn.sourceforge.net/hgengine/?rev=371&view=rev
Author: cnlohr
Date: 2009-06-24 06:27:59 +0000 (Wed, 24 Jun 2009)
Log Message:
-----------
fix text
Modified Paths:
--------------
Mercury2/modules/TextNode.cpp
Mercury2/scenegraph.xml
Modified: Mercury2/modules/TextNode.cpp
===================================================================
--- Mercury2/modules/TextNode.cpp 2009-06-24 02:16:55 UTC (rev 370)
+++ Mercury2/modules/TextNode.cpp 2009-06-24 06:27:59 UTC (rev 371)
@@ -168,6 +168,7 @@
{
if( g_AllFonts.get( sFont ) == 0 )
{
+ m_pThisFont = &g_AllFonts[sFont];
if( !m_pThisFont->LoadFromFile( sFont ) )
{
fprintf( stderr, "Error: Could not load font: \"%s\".", sFont.c_str() );
Modified: Mercury2/scenegraph.xml
===================================================================
--- Mercury2/scenegraph.xml 2009-06-24 02:16:55 UTC (rev 370)
+++ Mercury2/scenegraph.xml 2009-06-24 06:27:59 UTC (rev 371)
@@ -8,7 +8,7 @@
</node>
<node type="transformnode" movz="-5" >
- <node type="TextNode" text="test font 123" font="testfont.hgfont" size=".01" />
+ <node type="TextNode" text="test font 123" font="testfont.hgfont" size=".01" alphaPath="true" />
</node>
<!-- <asset type="texture" file="screenFBO_0" dynamic="true"/>
<asset type="fullscreenquad"/>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <cn...@us...> - 2009-06-24 05:24:32
|
Revision: 370
http://hgengine.svn.sourceforge.net/hgengine/?rev=370&view=rev
Author: cnlohr
Date: 2009-06-24 02:16:55 +0000 (Wed, 24 Jun 2009)
Log Message:
-----------
add font
Added Paths:
-----------
Mercury2/testfont.hgfont
Mercury2/testfont.png
Added: Mercury2/testfont.hgfont
===================================================================
--- Mercury2/testfont.hgfont (rev 0)
+++ Mercury2/testfont.hgfont 2009-06-24 02:16:55 UTC (rev 370)
@@ -0,0 +1,257 @@
+testfont.png
+0 0.000000 0.000000 0.031250 0.040039 32 41 8 41
+1 0.062500 0.000000 0.093750 0.040039 32 41 8 41
+2 0.125000 0.000000 0.156250 0.040039 32 41 8 41
+3 0.187500 0.000000 0.218750 0.040039 32 41 8 41
+4 0.250000 0.000000 0.281250 0.040039 32 41 8 41
+5 0.312500 0.000000 0.343750 0.040039 32 41 8 41
+6 0.375000 0.000000 0.406250 0.040039 32 41 8 41
+7 0.437500 0.000000 0.468750 0.040039 32 41 8 41
+8 0.500000 0.000000 0.531250 0.040039 32 41 8 41
+9 0.562500 0.000000 0.593750 0.040039 32 41 8 41
+10 0.625000 0.000000 0.656250 0.040039 32 41 8 41
+11 0.687500 0.000000 0.718750 0.040039 32 41 8 41
+12 0.750000 0.000000 0.781250 0.040039 32 41 8 41
+13 0.812500 0.000000 0.843750 0.040039 32 41 8 41
+14 0.875000 0.000000 0.906250 0.040039 32 41 8 41
+15 0.937500 0.000000 0.968750 0.040039 32 41 8 41
+16 0.000000 0.062500 0.031250 0.102539 32 41 8 41
+17 0.062500 0.062500 0.093750 0.102539 32 41 8 41
+18 0.125000 0.062500 0.156250 0.102539 32 41 8 41
+19 0.187500 0.062500 0.218750 0.102539 32 41 8 41
+20 0.250000 0.062500 0.281250 0.102539 32 41 8 41
+21 0.312500 0.062500 0.343750 0.102539 32 41 8 41
+22 0.375000 0.062500 0.406250 0.102539 32 41 8 41
+23 0.437500 0.062500 0.468750 0.102539 32 41 8 41
+24 0.500000 0.062500 0.531250 0.102539 32 41 8 41
+25 0.562500 0.062500 0.593750 0.102539 32 41 8 41
+26 0.625000 0.062500 0.656250 0.102539 32 41 8 41
+27 0.687500 0.062500 0.718750 0.102539 32 41 8 41
+28 0.750000 0.062500 0.781250 0.102539 32 41 8 41
+29 0.812500 0.062500 0.843750 0.102539 32 41 8 41
+30 0.875000 0.062500 0.906250 0.102539 32 41 8 41
+31 0.937500 0.062500 0.968750 0.102539 32 41 8 41
+32 0.000000 0.125000 0.000000 0.125000 0 0 0 0
+33 0.062500 0.125000 0.068359 0.169922 6 46 7 46
+34 0.125000 0.125000 0.141602 0.140625 17 16 3 46
+35 0.187500 0.125000 0.221680 0.169922 35 46 0 46
+36 0.250000 0.125000 0.279297 0.178711 30 55 3 48
+37 0.312500 0.125000 0.360352 0.171875 49 48 4 47
+38 0.375000 0.125000 0.413086 0.171875 39 48 3 47
+39 0.437500 0.125000 0.443359 0.140625 6 16 3 46
+40 0.500000 0.125000 0.515625 0.182617 16 59 4 46
+41 0.562500 0.125000 0.578125 0.182617 16 59 1 46
+42 0.625000 0.125000 0.645508 0.143555 21 19 2 46
+43 0.687500 0.125000 0.717773 0.155273 31 31 3 38
+44 0.750000 0.125000 0.755859 0.139648 6 15 6 6
+45 0.812500 0.125000 0.829102 0.129883 17 5 2 19
+46 0.875000 0.125000 0.880859 0.130859 6 6 6 6
+47 0.937500 0.125000 0.956055 0.169922 19 46 0 46
+48 0.000000 0.187500 0.029297 0.233398 30 47 3 46
+49 0.062500 0.187500 0.079102 0.232422 17 46 7 46
+50 0.125000 0.187500 0.155273 0.232422 31 46 1 46
+51 0.187500 0.187500 0.216797 0.233398 30 47 3 46
+52 0.250000 0.187500 0.281250 0.231445 32 45 1 45
+53 0.312500 0.187500 0.341797 0.232422 30 46 3 45
+54 0.375000 0.187500 0.405273 0.233398 31 47 2 46
+55 0.437500 0.187500 0.466797 0.231445 30 45 3 45
+56 0.500000 0.187500 0.529297 0.233398 30 47 3 46
+57 0.562500 0.187500 0.591797 0.233398 30 47 3 46
+58 0.625000 0.187500 0.630859 0.220703 6 34 6 34
+59 0.687500 0.187500 0.693359 0.229492 6 43 6 34
+60 0.750000 0.187500 0.778320 0.217773 29 31 4 38
+61 0.812500 0.187500 0.841797 0.206055 30 19 3 32
+62 0.875000 0.187500 0.903320 0.217773 29 31 4 38
+63 0.937500 0.187500 0.966797 0.233398 30 47 3 47
+64 0.000000 0.250000 0.057617 0.308594 59 60 3 47
+65 0.062500 0.250000 0.106445 0.294922 45 46 -1 46
+66 0.125000 0.250000 0.159180 0.294922 35 46 5 46
+67 0.187500 0.250000 0.226562 0.296875 40 48 3 47
+68 0.250000 0.250000 0.287109 0.294922 38 46 5 46
+69 0.312500 0.250000 0.346680 0.294922 35 46 5 46
+70 0.375000 0.250000 0.405273 0.294922 31 46 5 46
+71 0.437500 0.250000 0.479492 0.296875 43 48 3 47
+72 0.500000 0.250000 0.535156 0.294922 36 46 5 46
+73 0.562500 0.250000 0.568359 0.294922 6 46 6 46
+74 0.625000 0.250000 0.650391 0.295898 26 47 1 46
+75 0.687500 0.250000 0.724609 0.294922 38 46 5 46
+76 0.750000 0.250000 0.778320 0.294922 29 46 5 46
+77 0.812500 0.250000 0.854492 0.294922 43 46 5 46
+78 0.875000 0.250000 0.910156 0.294922 36 46 5 46
+79 0.937500 0.250000 0.980469 0.296875 44 48 3 47
+80 0.000000 0.312500 0.034180 0.357422 35 46 5 46
+81 0.062500 0.312500 0.105469 0.362305 44 51 3 47
+82 0.125000 0.312500 0.164062 0.357422 40 46 5 46
+83 0.187500 0.312500 0.223633 0.359375 37 48 3 47
+84 0.250000 0.312500 0.285156 0.357422 36 46 2 46
+85 0.312500 0.312500 0.347656 0.358398 36 47 5 46
+86 0.375000 0.312500 0.418945 0.357422 45 46 -1 46
+87 0.437500 0.312500 0.499023 0.357422 63 46 0 46
+88 0.500000 0.312500 0.540039 0.357422 41 46 -1 46
+89 0.562500 0.312500 0.603516 0.357422 42 46 0 46
+90 0.625000 0.312500 0.660156 0.357422 36 46 1 46
+91 0.687500 0.312500 0.699219 0.370117 12 59 4 46
+92 0.750000 0.312500 0.768555 0.357422 19 46 -1 46
+93 0.812500 0.312500 0.824219 0.370117 12 59 2 46
+94 0.875000 0.312500 0.899414 0.336914 25 25 1 47
+95 0.937500 0.312500 0.973633 0.317383 37 5 -1 -8
+96 0.000000 0.375000 0.010742 0.383789 11 9 3 46
+97 0.062500 0.375000 0.091797 0.410156 30 36 3 35
+98 0.125000 0.375000 0.153320 0.420898 29 47 4 46
+99 0.187500 0.375000 0.215820 0.410156 29 36 3 35
+100 0.250000 0.375000 0.278320 0.420898 29 47 2 46
+101 0.312500 0.375000 0.342773 0.410156 31 36 2 35
+102 0.375000 0.375000 0.394531 0.420898 20 47 1 47
+103 0.437500 0.375000 0.465820 0.422852 29 49 2 35
+104 0.500000 0.375000 0.527344 0.419922 28 46 4 46
+105 0.562500 0.375000 0.568359 0.419922 6 46 4 46
+106 0.625000 0.375000 0.637695 0.433594 13 60 -3 46
+107 0.687500 0.375000 0.714844 0.419922 28 46 4 46
+108 0.750000 0.375000 0.755859 0.419922 6 46 4 46
+109 0.812500 0.375000 0.857422 0.409180 46 35 4 35
+110 0.875000 0.375000 0.902344 0.409180 28 35 4 35
+111 0.937500 0.375000 0.966797 0.410156 30 36 3 35
+112 0.000000 0.437500 0.028320 0.484375 29 48 4 35
+113 0.062500 0.437500 0.090820 0.484375 29 48 2 35
+114 0.125000 0.437500 0.142578 0.471680 18 35 4 35
+115 0.187500 0.437500 0.213867 0.472656 27 36 2 35
+116 0.250000 0.437500 0.265625 0.483398 16 47 1 46
+117 0.312500 0.437500 0.339844 0.471680 28 35 4 34
+118 0.375000 0.437500 0.405273 0.470703 31 34 1 34
+119 0.437500 0.437500 0.485352 0.470703 49 34 -1 34
+120 0.500000 0.437500 0.531250 0.470703 32 34 0 34
+121 0.562500 0.437500 0.593750 0.484375 32 48 0 34
+122 0.625000 0.437500 0.653320 0.470703 29 34 1 34
+123 0.687500 0.437500 0.705078 0.497070 18 61 1 47
+124 0.750000 0.437500 0.754883 0.496094 5 60 6 46
+125 0.812500 0.437500 0.830078 0.497070 18 61 2 47
+126 0.875000 0.437500 0.906250 0.448242 32 11 2 28
+127 0.937500 0.437500 0.968750 0.477539 32 41 8 41
+128 0.000000 0.500000 0.031250 0.540039 32 41 8 41
+129 0.062500 0.500000 0.093750 0.540039 32 41 8 41
+130 0.125000 0.500000 0.156250 0.540039 32 41 8 41
+131 0.187500 0.500000 0.218750 0.540039 32 41 8 41
+132 0.250000 0.500000 0.281250 0.540039 32 41 8 41
+133 0.312500 0.500000 0.343750 0.540039 32 41 8 41
+134 0.375000 0.500000 0.406250 0.540039 32 41 8 41
+135 0.437500 0.500000 0.468750 0.540039 32 41 8 41
+136 0.500000 0.500000 0.531250 0.540039 32 41 8 41
+137 0.562500 0.500000 0.593750 0.540039 32 41 8 41
+138 0.625000 0.500000 0.656250 0.540039 32 41 8 41
+139 0.687500 0.500000 0.718750 0.540039 32 41 8 41
+140 0.750000 0.500000 0.781250 0.540039 32 41 8 41
+141 0.812500 0.500000 0.843750 0.540039 32 41 8 41
+142 0.875000 0.500000 0.906250 0.540039 32 41 8 41
+143 0.937500 0.500000 0.968750 0.540039 32 41 8 41
+144 0.000000 0.562500 0.031250 0.602539 32 41 8 41
+145 0.062500 0.562500 0.093750 0.602539 32 41 8 41
+146 0.125000 0.562500 0.156250 0.602539 32 41 8 41
+147 0.187500 0.562500 0.218750 0.602539 32 41 8 41
+148 0.250000 0.562500 0.281250 0.602539 32 41 8 41
+149 0.312500 0.562500 0.343750 0.602539 32 41 8 41
+150 0.375000 0.562500 0.406250 0.602539 32 41 8 41
+151 0.437500 0.562500 0.468750 0.602539 32 41 8 41
+152 0.500000 0.562500 0.531250 0.602539 32 41 8 41
+153 0.562500 0.562500 0.593750 0.602539 32 41 8 41
+154 0.625000 0.562500 0.656250 0.602539 32 41 8 41
+155 0.687500 0.562500 0.718750 0.602539 32 41 8 41
+156 0.750000 0.562500 0.781250 0.602539 32 41 8 41
+157 0.812500 0.562500 0.843750 0.602539 32 41 8 41
+158 0.875000 0.562500 0.906250 0.602539 32 41 8 41
+159 0.937500 0.562500 0.968750 0.602539 32 41 8 41
+160 0.000000 0.625000 0.000000 0.625000 0 0 0 0
+161 0.062500 0.625000 0.068359 0.670898 6 47 7 34
+162 0.125000 0.625000 0.153320 0.682617 29 59 3 46
+163 0.187500 0.625000 0.219727 0.671875 33 48 1 47
+164 0.250000 0.625000 0.281250 0.652344 32 28 1 36
+165 0.312500 0.625000 0.346680 0.669922 35 46 -1 46
+166 0.375000 0.625000 0.379883 0.683594 5 60 6 46
+167 0.437500 0.625000 0.466797 0.683594 30 60 3 47
+168 0.500000 0.625000 0.517578 0.630859 18 6 2 46
+169 0.562500 0.625000 0.608398 0.671875 47 48 0 47
+170 0.625000 0.625000 0.646484 0.647461 22 23 1 47
+171 0.687500 0.625000 0.713867 0.653320 27 29 4 31
+172 0.750000 0.625000 0.779297 0.643555 30 19 3 32
+173 0.812500 0.625000 0.829102 0.629883 17 5 2 19
+174 0.875000 0.625000 0.920898 0.671875 47 48 0 47
+175 0.937500 0.625000 0.973633 0.629883 37 5 -1 54
+176 0.000000 0.687500 0.016602 0.704102 17 17 4 47
+177 0.062500 0.687500 0.092773 0.724609 31 38 2 38
+178 0.125000 0.687500 0.143555 0.709961 19 23 1 47
+179 0.187500 0.687500 0.206055 0.709961 19 23 1 47
+180 0.250000 0.687500 0.260742 0.696289 11 9 7 45
+181 0.312500 0.687500 0.338867 0.733398 27 47 5 34
+182 0.375000 0.687500 0.408203 0.745117 34 59 0 46
+183 0.437500 0.687500 0.443359 0.693359 6 6 6 25
+184 0.500000 0.687500 0.512695 0.701172 13 14 3 0
+185 0.562500 0.687500 0.574219 0.709961 12 23 4 47
+186 0.625000 0.687500 0.645508 0.709961 21 23 1 47
+187 0.687500 0.687500 0.713867 0.715820 27 29 5 31
+188 0.750000 0.687500 0.796875 0.735352 48 49 4 47
+189 0.812500 0.687500 0.859375 0.734375 48 48 4 47
+190 0.875000 0.687500 0.924805 0.735352 51 49 1 47
+191 0.937500 0.687500 0.965820 0.734375 29 48 5 34
+192 0.000000 0.750000 0.043945 0.806641 45 58 -1 58
+193 0.062500 0.750000 0.106445 0.806641 45 58 -1 58
+194 0.125000 0.750000 0.168945 0.806641 45 58 -1 58
+195 0.187500 0.750000 0.231445 0.805664 45 57 -1 57
+196 0.250000 0.750000 0.293945 0.803711 45 55 -1 55
+197 0.312500 0.750000 0.356445 0.803711 45 55 -1 55
+198 0.375000 0.750000 0.435547 0.794922 62 46 -1 46
+199 0.437500 0.750000 0.476562 0.809570 40 61 3 47
+200 0.500000 0.750000 0.534180 0.806641 35 58 5 58
+201 0.562500 0.750000 0.596680 0.806641 35 58 5 58
+202 0.625000 0.750000 0.659180 0.806641 35 58 5 58
+203 0.687500 0.750000 0.721680 0.803711 35 55 5 55
+204 0.750000 0.750000 0.760742 0.806641 11 58 2 58
+205 0.812500 0.750000 0.823242 0.806641 11 58 5 58
+206 0.875000 0.750000 0.894531 0.806641 20 58 -1 58
+207 0.937500 0.750000 0.955078 0.803711 18 55 0 55
+208 0.000000 0.812500 0.041992 0.857422 43 46 0 46
+209 0.062500 0.812500 0.097656 0.868164 36 57 5 57
+210 0.125000 0.812500 0.167969 0.870117 44 59 3 58
+211 0.187500 0.812500 0.230469 0.870117 44 59 3 58
+212 0.250000 0.812500 0.292969 0.870117 44 59 3 58
+213 0.312500 0.812500 0.355469 0.869141 44 58 3 57
+214 0.375000 0.812500 0.417969 0.867188 44 56 3 55
+215 0.437500 0.812500 0.463867 0.838867 27 27 5 36
+216 0.500000 0.812500 0.543945 0.861328 45 50 3 47
+217 0.562500 0.812500 0.597656 0.870117 36 59 5 58
+218 0.625000 0.812500 0.660156 0.870117 36 59 5 58
+219 0.687500 0.812500 0.722656 0.870117 36 59 5 58
+220 0.750000 0.812500 0.785156 0.867188 36 56 5 55
+221 0.812500 0.812500 0.853516 0.869141 42 58 0 58
+222 0.875000 0.812500 0.909180 0.857422 35 46 5 46
+223 0.937500 0.812500 0.968750 0.859375 32 48 5 47
+224 0.000000 0.875000 0.029297 0.920898 30 47 3 46
+225 0.062500 0.875000 0.091797 0.920898 30 47 3 46
+226 0.125000 0.875000 0.154297 0.920898 30 47 3 46
+227 0.187500 0.875000 0.216797 0.919922 30 46 3 45
+228 0.250000 0.875000 0.279297 0.917969 30 44 3 43
+229 0.312500 0.875000 0.341797 0.922852 30 49 3 48
+230 0.375000 0.875000 0.425781 0.910156 52 36 2 35
+231 0.437500 0.875000 0.465820 0.922852 29 49 3 35
+232 0.500000 0.875000 0.530273 0.920898 31 47 2 46
+233 0.562500 0.875000 0.592773 0.920898 31 47 2 46
+234 0.625000 0.875000 0.655273 0.920898 31 47 2 46
+235 0.687500 0.875000 0.717773 0.917969 31 44 2 43
+236 0.750000 0.875000 0.760742 0.919922 11 46 2 46
+237 0.812500 0.875000 0.823242 0.919922 11 46 5 46
+238 0.875000 0.875000 0.894531 0.919922 20 46 -1 46
+239 0.937500 0.875000 0.955078 0.916992 18 43 0 43
+240 0.000000 0.937500 0.030273 0.983398 31 47 2 46
+241 0.062500 0.937500 0.089844 0.981445 28 45 4 45
+242 0.125000 0.937500 0.154297 0.983398 30 47 3 46
+243 0.187500 0.937500 0.216797 0.983398 30 47 3 46
+244 0.250000 0.937500 0.279297 0.983398 30 47 3 46
+245 0.312500 0.937500 0.341797 0.982422 30 46 3 45
+246 0.375000 0.937500 0.404297 0.980469 30 44 3 43
+247 0.437500 0.937500 0.468750 0.961914 32 25 3 35
+248 0.500000 0.937500 0.531250 0.977539 32 41 3 38
+249 0.562500 0.937500 0.589844 0.983398 28 47 4 46
+250 0.625000 0.937500 0.652344 0.983398 28 47 4 46
+251 0.687500 0.937500 0.714844 0.983398 28 47 4 46
+252 0.750000 0.937500 0.777344 0.980469 28 44 4 43
+253 0.812500 0.937500 0.843750 0.996094 32 60 0 46
+254 0.875000 0.937500 0.903320 0.995117 29 59 4 46
+255 0.937500 0.937500 0.968750 0.993164 32 57 0 43
Added: Mercury2/testfont.png
===================================================================
(Binary files differ)
Property changes on: Mercury2/testfont.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|