init
This commit is contained in:
98
public/console.h
Normal file
98
public/console.h
Normal file
@@ -0,0 +1,98 @@
|
||||
#ifndef CONSOLE_H
|
||||
#define CONSOLE_H
|
||||
|
||||
#include "tier0/platform.h"
|
||||
#include "tier1/utlstring.h"
|
||||
|
||||
class ConVar;
|
||||
class ConCommand;
|
||||
|
||||
typedef void(*ConCommandFn)(int argc, char **argv);
|
||||
|
||||
interface IConsole
|
||||
{
|
||||
public:
|
||||
static void RegisterVar( ConVar *cvar );
|
||||
static void UnRegisterVar( ConVar *cvar );
|
||||
static ConVar *FindVar( const char *pName );
|
||||
|
||||
static void RegisterCommand( ConVar *cvar );
|
||||
static void UnRegisterCommand( ConVar *cvar );
|
||||
static ConCommand *FindCommand( const char *pName );
|
||||
|
||||
static void Execute( void );
|
||||
static void AddCommand( const char *psz );
|
||||
static void InsertCommand( const char *psz );
|
||||
};
|
||||
|
||||
|
||||
#define FCVAR_NONE 0
|
||||
#define FCVAR_DEVELOPMENTONLY 0x1
|
||||
#define FCVAR_GAMEDLL 0x2
|
||||
#define FCVAR_CLIENTDLL 0x4
|
||||
#define FCVAR_HIDDEN 0x8
|
||||
|
||||
#define FCVAR_PROTECTED 0x10
|
||||
#define FCVAR_SPONLY 0x20
|
||||
#define FCVAR_ARCHIVE 0x40
|
||||
#define FCVAR_NOTIFY 0x80
|
||||
#define FCVAR_CHEAT 0x100
|
||||
#define FCVAR_REPLICATED 0x200
|
||||
|
||||
class ConVar
|
||||
{
|
||||
public:
|
||||
ConVar( const char *pName, const char *pDefaultValue, int flags );
|
||||
ConVar( const char *pName, const char *pDefaultValue, int flags,
|
||||
const char *pHelpString );
|
||||
ConVar( const char *pName, const char *pDefaultValue, int flags,
|
||||
const char *pHelpString, ConCommandFn callback );
|
||||
|
||||
bool IsFlagSet( int flag );
|
||||
const char *GetHelpText( void );
|
||||
bool IsRegistered( void );
|
||||
const char *GetName( void );
|
||||
void AddFlags( int flags );
|
||||
bool IsCommand( void );
|
||||
|
||||
void InstallChangeCallback( ConCommandFn );
|
||||
|
||||
float GetFloat( void );
|
||||
int GetInt( void );
|
||||
bool GetBool( void );
|
||||
const char *GetString( void );
|
||||
|
||||
void SetValue( const char *szValue );
|
||||
void SetValue( float fValue );
|
||||
void SetValue( int iValue );
|
||||
private:
|
||||
CUtlString m_szName;
|
||||
CUtlString m_szHelpString;
|
||||
CUtlString m_szDefaultValue;
|
||||
|
||||
CUtlString m_szValue;
|
||||
float m_fValue;
|
||||
int m_nValue;
|
||||
|
||||
int m_flags;
|
||||
};
|
||||
|
||||
|
||||
class ConCommand
|
||||
{
|
||||
public:
|
||||
ConCommand(const char *pName, ConCommandFn callback,
|
||||
const char *pHelpString=0, int flags=0);
|
||||
private:
|
||||
char *m_szName;
|
||||
char *m_szHelpString = NULL;
|
||||
ConCommandFn m_callback;
|
||||
|
||||
int m_flags;
|
||||
};
|
||||
|
||||
void Msg( const char* message );
|
||||
void Warning( const char* message );
|
||||
void Error( const char* message );
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user