diff options
| author | Joe Ludwig <[email protected]> | 2013-06-26 15:22:04 -0700 |
|---|---|---|
| committer | Joe Ludwig <[email protected]> | 2013-06-26 15:22:04 -0700 |
| commit | 39ed87570bdb2f86969d4be821c94b722dc71179 (patch) | |
| tree | abc53757f75f40c80278e87650ea92808274aa59 /sp/src/public/tier2/tier2.h | |
| download | source-sdk-2013-39ed87570bdb2f86969d4be821c94b722dc71179.tar.xz source-sdk-2013-39ed87570bdb2f86969d4be821c94b722dc71179.zip | |
First version of the SOurce SDK 2013
Diffstat (limited to 'sp/src/public/tier2/tier2.h')
| -rw-r--r-- | sp/src/public/tier2/tier2.h | 128 |
1 files changed, 128 insertions, 0 deletions
diff --git a/sp/src/public/tier2/tier2.h b/sp/src/public/tier2/tier2.h new file mode 100644 index 00000000..cc8d16ad --- /dev/null +++ b/sp/src/public/tier2/tier2.h @@ -0,0 +1,128 @@ +//========= Copyright Valve Corporation, All rights reserved. ============//
+//
+// Purpose: A higher level link library for general use in the game and tools.
+//
+//===========================================================================//
+
+
+#ifndef TIER2_H
+#define TIER2_H
+
+#if defined( _WIN32 )
+#pragma once
+#endif
+
+#include "tier1/tier1.h"
+
+
+//-----------------------------------------------------------------------------
+// Forward declarations
+//-----------------------------------------------------------------------------
+class IFileSystem;
+class IMaterialSystem;
+class IColorCorrectionSystem;
+class IMaterialSystemHardwareConfig;
+class IDebugTextureInfo;
+class IVBAllocTracker;
+class IInputSystem;
+class INetworkSystem;
+class IP4;
+class IMdlLib;
+class IQueuedLoader;
+
+
+//-----------------------------------------------------------------------------
+// These tier2 libraries must be set by any users of this library.
+// They can be set by calling ConnectTier2Libraries or InitDefaultFileSystem.
+// It is hoped that setting this, and using this library will be the common mechanism for
+// allowing link libraries to access tier2 library interfaces
+//-----------------------------------------------------------------------------
+extern IFileSystem *g_pFullFileSystem;
+extern IMaterialSystem *materials;
+extern IMaterialSystem *g_pMaterialSystem;
+extern IInputSystem *g_pInputSystem;
+extern INetworkSystem *g_pNetworkSystem;
+extern IMaterialSystemHardwareConfig *g_pMaterialSystemHardwareConfig;
+extern IDebugTextureInfo *g_pMaterialSystemDebugTextureInfo;
+extern IVBAllocTracker *g_VBAllocTracker;
+extern IColorCorrectionSystem *colorcorrection;
+extern IP4 *p4;
+extern IMdlLib *mdllib;
+extern IQueuedLoader *g_pQueuedLoader;
+
+
+//-----------------------------------------------------------------------------
+// Call this to connect to/disconnect from all tier 2 libraries.
+// It's up to the caller to check the globals it cares about to see if ones are missing
+//-----------------------------------------------------------------------------
+void ConnectTier2Libraries( CreateInterfaceFn *pFactoryList, int nFactoryCount );
+void DisconnectTier2Libraries();
+
+
+//-----------------------------------------------------------------------------
+// Call this to get the file system set up to stdio for utilities, etc:
+//-----------------------------------------------------------------------------
+void InitDefaultFileSystem(void);
+void ShutdownDefaultFileSystem(void);
+
+
+//-----------------------------------------------------------------------------
+// for simple utilities using valve libraries, call the entry point below in main(). It will
+// init a filesystem for you, init mathlib, and create the command line.
+//-----------------------------------------------------------------------------
+void InitCommandLineProgram( int argc, char **argv );
+
+
+//-----------------------------------------------------------------------------
+// Helper empty implementation of an IAppSystem for tier2 libraries
+//-----------------------------------------------------------------------------
+template< class IInterface, int ConVarFlag = 0 >
+class CTier2AppSystem : public CTier1AppSystem< IInterface, ConVarFlag >
+{
+ typedef CTier1AppSystem< IInterface, ConVarFlag > BaseClass;
+
+public:
+ CTier2AppSystem( bool bIsPrimaryAppSystem = true ) : BaseClass( bIsPrimaryAppSystem )
+ {
+ }
+
+ virtual bool Connect( CreateInterfaceFn factory )
+ {
+ if ( !BaseClass::Connect( factory ) )
+ return false;
+
+ if ( BaseClass::IsPrimaryAppSystem() )
+ {
+ ConnectTier2Libraries( &factory, 1 );
+ }
+
+ return true;
+ }
+
+ virtual InitReturnVal_t Init()
+ {
+ InitReturnVal_t nRetVal = BaseClass::Init();
+ if ( nRetVal != INIT_OK )
+ return nRetVal;
+
+ return INIT_OK;
+ }
+
+ virtual void Shutdown()
+ {
+ BaseClass::Shutdown();
+ }
+
+ virtual void Disconnect()
+ {
+ if ( BaseClass::IsPrimaryAppSystem() )
+ {
+ DisconnectTier2Libraries();
+ }
+ BaseClass::Disconnect();
+ }
+};
+
+
+#endif // TIER2_H
+
|