#include
Public Member Functions | |
virtual void | Release ()=0 |
Deletes the console. | |
virtual void | UnregisterVariable (const char *sVarName, bool bDelete=false)=0 |
virtual void | SetScrollMax (int value)=0 |
virtual void | AddOutputPrintSink (IOutputPrintSink *inpSink)=0 |
virtual void | RemoveOutputPrintSink (IOutputPrintSink *inpSink)=0 |
virtual void | ShowConsole (bool show, const int iRequestScrollMax=-1)=0 |
virtual void | DumpCVars (ICVarDumpSink *pCallback, unsigned int nFlagsFilter=0)=0 |
virtual void | CreateKeyBind (const char *sCmd, const char *sRes)=0 |
virtual void | SetImage (ITexture *pImage, bool bDeleteCurrent)=0 |
virtual ITexture * | GetImage ()=0 |
virtual void | StaticBackground (bool bStatic)=0 |
virtual void | SetLoadingImage (const char *szFilename)=0 |
virtual bool | GetLineNo (const int indwLineNo, char *outszBuffer, const int indwBufferSize) const =0 |
virtual int | GetLineCount () const =0 |
virtual ICVar * | GetCVar (const char *name)=0 |
virtual char * | GetVariable (const char *szVarName, const char *szFileName, const char *def_val)=0 |
virtual float | GetVariable (const char *szVarName, const char *szFileName, float def_val)=0 |
virtual void | PrintLine (const char *s)=0 |
virtual void | PrintLinePlus (const char *s)=0 |
virtual bool | GetStatus ()=0 |
virtual void | Clear ()=0 |
Clear the console text. | |
virtual void | Update ()=0 |
Update the console. | |
virtual void | Draw ()=0 |
Draw the console. | |
virtual void | RegisterListener (IManagedConsoleCommandListener *pListener, const char *name)=0 |
virtual void | UnregisterListener (IManagedConsoleCommandListener *pListener)=0 |
virtual void | RemoveCommand (const char *sName)=0 |
virtual void | ExecuteString (const char *command, const bool bSilentMode=false, const bool bDeferExecution=false)=0 |
virtual void | Exit (const char *command,...) PRINTF_PARAMS(2 |
virtual void virtual bool | IsOpened ()=0 |
virtual size_t | GetNumVars (bool bIncludeCommands=false) const =0 |
Auto completion. | |
virtual size_t | GetSortedVars (const char **pszArray, size_t numItems, const char *szPrefix=0, int nListTypes=0) const =0 |
virtual const char * | AutoComplete (const char *substr)=0 |
virtual const char * | AutoCompletePrev (const char *substr)=0 |
virtual const char * | ProcessCompletion (const char *szInputBuffer)=0 |
virtual void | RegisterAutoComplete (const char *sVarOrCommand, IConsoleArgumentAutoComplete *pArgAutoComplete)=0 |
virtual void | UnRegisterAutoComplete (const char *sVarOrCommand)=0 |
virtual void | ResetAutoCompletion ()=0 |
virtual void | GetMemoryUsage (ICrySizer *pSizer) const =0 |
Calculation of the memory used by the whole console system. | |
virtual void | ResetProgressBar (int nProgressRange)=0 |
Function related to progress bar. | |
virtual void | TickProgressBar ()=0 |
Function related to progress bar. | |
virtual void | SetInputLine (const char *szLine)=0 |
virtual void | SetReadOnly (bool readonly)=0 |
Set Console Editable. | |
virtual bool | IsReadOnly ()=0 |
virtual void | DumpKeyBinds (IKeyBindDumpSink *pCallback)=0 |
virtual const char * | FindKeyBind (const char *sCmd) const =0 |
virtual int | GetNumCheatVars ()=0 |
Get Number of cvars that can be hashed. | |
virtual void | SetCheatVarHashRange (size_t firstVar, size_t lastVar)=0 |
Set the range of cvars. | |
virtual void | CalcCheatVarHash ()=0 |
Calculate the hash from current cvars. | |
virtual bool | IsHashCalculated ()=0 |
Since hash is calculated async, check if it's completed. | |
virtual uint64 | GetCheatVarHash ()=0 |
Get the hash calculated. | |
virtual void | PrintCheatVars (bool bUseLastHashRange)=0 |
virtual char * | GetCheatVarAt (uint32 nOffset)=0 |
virtual void | AddConsoleVarSink (IConsoleVarSink *pSink)=0 |
virtual void | RemoveConsoleVarSink (IConsoleVarSink *pSink)=0 |
Removes a console variables sink callback. | |
virtual const char * | GetHistoryElement (const bool bUpOrDown)=0 |
virtual void | AddCommandToHistory (const char *szCommand)=0 |
virtual void | LoadConfigVar (const char *sVariable, const char *sValue)=0 |
virtual void | LoadConfigCommand (const char *szCommand, const char *szArguments=nullptr)=0 |
virtual ELoadConfigurationType | SetCurrentConfigType (ELoadConfigurationType configType)=0 |
virtual void | EnableActivationKey (bool bEnable)=0 |
virtual void | SaveInternalState (struct IDataWriteStream &writer) const =0 |
Save/Load internal state (CVars) - used by LiveCreate. | |
virtual void | LoadInternalState (struct IDataReadStream &reader)=0 |
Protected Member Functions | |
virtual void | AddCommand (const char *sCommand, ConsoleCommandFunc func, int nFlags=0, const char *sHelp=NULL, bool bIsManaged=false)=0 |
virtual void | AddCommand (const char *sName, const char *sScriptFunc, int nFlags=0, const char *sHelp=NULL)=0 |
virtual ICVar * | RegisterString (const char *sName, const char *sValue, int nFlags, const char *help="", ConsoleVarFunc pChangeFunc=0)=0 |
virtual ICVar * | RegisterInt (const char *sName, int iValue, int nFlags, const char *help="", ConsoleVarFunc pChangeFunc=0)=0 |
virtual ICVar * | RegisterInt64 (const char *sName, int64 iValue, int nFlags, const char *help="", ConsoleVarFunc pChangeFunc=0)=0 |
virtual ICVar * | RegisterFloat (const char *sName, float fValue, int nFlags, const char *help="", ConsoleVarFunc pChangeFunc=0)=0 |
virtual ICVar * | Register (const char *name, float *src, float defaultvalue, int nFlags=0, const char *help="", ConsoleVarFunc pChangeFunc=0, bool allowModify=true)=0 |
virtual ICVar * | Register (const char *name, int *src, int defaultvalue, int nFlags=0, const char *help="", ConsoleVarFunc pChangeFunc=0, bool allowModify=true)=0 |
virtual ICVar * | Register (const char *name, const char **src, const char *defaultvalue, int nFlags=0, const char *help="", ConsoleVarFunc pChangeFunc=0, bool allowModify=true)=0 |
virtual ICVar * | Register (ICVar *pVar)=0 |
Interface to the engine console. The engine console allow to manipulate the internal engine parameters and to invoke commands. This interface allow external modules to integrate their functionalities into the console as commands or variables.
|
protected pure virtual |
Register a new console command.
sCommand | Command name. |
func | Pointer to the console command function to be called when command is invoked. |
nFlags | Bitfield consisting of VF_ flags (e.g. VF_CHEAT). |
sHelp | Help string, will be displayed when typing in console "command ?". |
#include
// The function that will be executed with the command
void MyCommand(IConsoleCmdArgs* pArgs)
{
// The first argument is always the name of the command
const char* szCommand = pArgs->GetArg(0);
if (pArgs->GetArgCount() > 1)
{
// Get the first argument, if any
const char* szFirstArgument = pArgs->GetArg(1);
/* Handle the command, and its argument here */
}
}
void RegisterCommand()
{
// Specify bit flags that define the CCommand's behavior, see EVarFlags
const int variableFlags = VF_NULL;
// Register the command in the console
REGISTER_COMMAND("myCommand", MyCommand, variableFlags, "Executes the MyCommand function!");
}
void UnregisterCommand()
{
// Make sure to unregister the command once we are done
gEnv->pConsole->RemoveCommand("myCommand");
}
void ExecuteCommand()
{
// Do not silence execution of the command from logs
const bool silent = false;
// Execute the command immediately, instead of the next frame
const bool deferExecution = false;
gEnv->pConsole->ExecuteString("myCommand", silent, deferExecution);
}
|
protected pure virtual |
Register a new console command that execute script function. EG "Game.Connect(%1)" the symbol "%1" will be replaced with the command parameter 1 writing in the console "connect 127.0.0.1" will invoke Game.Connect("127.0.0.1").
sCommand | Command name. |
sScriptFunc | Script function to be executed when command is invoked. |
nFlags | Bitfield consist of VF_ flags (e.g. VF_CHEAT). |
sHelp | Help string, will be displayed when typing in console "command ?". |
#include
// The function that will be executed with the command
void MyCommand(IConsoleCmdArgs* pArgs)
{
// The first argument is always the name of the command
const char* szCommand = pArgs->GetArg(0);
if (pArgs->GetArgCount() > 1)
{
// Get the first argument, if any
const char* szFirstArgument = pArgs->GetArg(1);
/* Handle the command, and its argument here */
}
}
void RegisterCommand()
{
// Specify bit flags that define the CCommand's behavior, see EVarFlags
const int variableFlags = VF_NULL;
// Register the command in the console
REGISTER_COMMAND("myCommand", MyCommand, variableFlags, "Executes the MyCommand function!");
}
void UnregisterCommand()
{
// Make sure to unregister the command once we are done
gEnv->pConsole->RemoveCommand("myCommand");
}
void ExecuteCommand()
{
// Do not silence execution of the command from logs
const bool silent = false;
// Execute the command immediately, instead of the next frame
const bool deferExecution = false;
gEnv->pConsole->ExecuteString("myCommand", silent, deferExecution);
}
|
pure virtual |
szCommand | Must not be 0. |
|
pure virtual |
Console variable sink. Adds a new console variables sink callback.
|
pure virtual |
Add output sink (clases which are interested in the output) - order is not guaranteed.
inpSink | Must not be 0 and is not allowed to be added twice. |
|
pure virtual |
Bind a console command to a key.
sCmd | console command that must be executed. |
sRes | name of the key to invoke the command. |
|
pure virtual |
Dump all console-variables to a callback-interface.
Callback | Callback-interface which needs to be called for each element. |
|
pure virtual |
Dump all key bindings to a callback-interface.
Callback | callback-interface which needs to be called for each element. |
|
pure virtual |
Enable or disable the activation key (tilde by default). This is useful when user is in a text field and want to be able to enter the default key.
BEnable | If true, console will show. |
|
pure virtual |
Execute a string in the console.
command | Console command e.g. "map testy" - no leading slash |
bSilentMode | true=suppresses log in error case and logging the command to the console |
bDeferExecution | true=the command is stored in special fifo that allows delayed execution by using wait_seconds and wait_frames commands |
#include
// The function that will be executed with the command
void MyCommand(IConsoleCmdArgs* pArgs)
{
// The first argument is always the name of the command
const char* szCommand = pArgs->GetArg(0);
if (pArgs->GetArgCount() > 1)
{
// Get the first argument, if any
const char* szFirstArgument = pArgs->GetArg(1);
/* Handle the command, and its argument here */
}
}
void RegisterCommand()
{
// Specify bit flags that define the CCommand's behavior, see EVarFlags
const int variableFlags = VF_NULL;
// Register the command in the console
REGISTER_COMMAND("myCommand", MyCommand, variableFlags, "Executes the MyCommand function!");
}
void UnregisterCommand()
{
// Make sure to unregister the command once we are done
gEnv->pConsole->RemoveCommand("myCommand");
}
void ExecuteCommand()
{
// Do not silence execution of the command from logs
const bool silent = false;
// Execute the command immediately, instead of the next frame
const bool deferExecution = false;
gEnv->pConsole->ExecuteString("myCommand", silent, deferExecution);
}
|
virtual |
Print a message into the log and abort the execution of the application.
message | error string to print in the log. |
|
pure virtual |
Retrieve a console variable by name - not case sensitive.
name | variable name. |
#include
// Minimal example of how a console variable can be implemented and used
// In this case we create a system, and a variable that determines whether or not the system should be currently updated
class CMySystem
{
CMySystem()
{
// Specify bit flags that define the CVar's behavior, see EVarFlags
const int variableFlags = VF_NULL;
// Register the "g_mySystem_enable" command into the console, allowing modification by designers and code at run-time
REGISTER_CVAR2("g_mySystem_enable", &m_enabled, m_enabled, variableFlags, "Determines whether or not the system should run");
// Retrieve an ICVar instance for the variable from the console
ICVar* pCVar = gEnv->pConsole->GetCVar("g_mySystem_enable");
/* If necessary, utilize pCVar here */
}
~CMySystem()
{
// Make sure to unregister the variable once we go out of scope
gEnv->pConsole->UnregisterVariable("g_mySystem_enable");
}
void Update()
{
// If the system was disabled via the console, skip update
if (m_enabled == 0)
{
return;
}
/* Update system here */
}
protected:
// Store the variable locally here, the console takes a reference that will update the variable in place
// We start off by setting this value to 1.
int m_enabled = 1;
};
|
pure virtual |
bUpOrDown | true=after pressed "up", false=after pressed "down". |
|
pure virtual |
Retrieves the background-image.
|
pure virtual |
|
pure virtual |
Iterate through the lines - used for dedicated server (truncated if needed).
indwLineNo | 0.. counted from the last printed line on. |
outszBuffer | Pointer to the destination string buffer (zero terminated afterwards), must not be 0. |
indwBufferSize | 1.. size of the buffer. |
|
pure virtual |
szPrefix | - 0 or prefix e.g. "sys_spec_". |
|
pure virtual |
Retrieve the status of the console (active/not active).
|
pure virtual |
Read a value from a configuration file (.ini) and return the value.
szVarName | Variable name. |
szFileName | Source configuration file. |
def_val | Default value (if the variable is not found into the file). |
|
pure virtual |
Read a value from a configuration file (.ini) and return the value.
szVarName | variable name. |
szFileName | source configuration file. |
def_val | default value (if the variable is not found into the file). |
|
pure virtual |
Return true if the console is opened.
|
pure virtual |
Executes a command with optional arguments Will defer setting of the value until the command is registered if it hasn't been already
|
pure virtual |
Sets the value of a CVar as loaded from a config Will defer setting of the value until the CVar is registered if it hasn't been already
|
pure virtual |
Print a string in the console and go to the new line.
s | The string to print. |
|
pure virtual |
Append a string in the last console line.
s | The string to print. |
|
protected pure virtual |
Create a new console variable that will update the user defined float.
sName | Console variable name. |
src | Pointer to the memory that will be updated. |
nFlags | User defined flag, this parameter is used by other subsystems and doesn't affect the console variable (basically of user data). |
help | Help text that is shown when you use " |
allowModify | Allow modification through config vars, prevents missing modifications in release mode. |
#include
// Minimal example of how a console variable can be implemented and used
// In this case we create a system, and a variable that determines whether or not the system should be currently updated
class CMySystem
{
CMySystem()
{
// Specify bit flags that define the CVar's behavior, see EVarFlags
const int variableFlags = VF_NULL;
// Register the "g_mySystem_enable" command into the console, allowing modification by designers and code at run-time
REGISTER_CVAR2("g_mySystem_enable", &m_enabled, m_enabled, variableFlags, "Determines whether or not the system should run");
// Retrieve an ICVar instance for the variable from the console
ICVar* pCVar = gEnv->pConsole->GetCVar("g_mySystem_enable");
/* If necessary, utilize pCVar here */
}
~CMySystem()
{
// Make sure to unregister the variable once we go out of scope
gEnv->pConsole->UnregisterVariable("g_mySystem_enable");
}
void Update()
{
// If the system was disabled via the console, skip update
if (m_enabled == 0)
{
return;
}
/* Update system here */
}
protected:
// Store the variable locally here, the console takes a reference that will update the variable in place
// We start off by setting this value to 1.
int m_enabled = 1;
};
|
protected pure virtual |
Create a new console variable that will update the user defined float.
sName | Console variable name. |
src | Pointer to the memory that will be updated. |
nFlags | User defined flag, this parameter is used by other subsystems and doesn't affect the console variable (basically of user data). |
help | Help text that is shown when you use " |
allowModify | Allow modification through config vars, prevents missing modifications in release mode. |
#include
// Minimal example of how a console variable can be implemented and used
// In this case we create a system, and a variable that determines whether or not the system should be currently updated
class CMySystem
{
CMySystem()
{
// Specify bit flags that define the CVar's behavior, see EVarFlags
const int variableFlags = VF_NULL;
// Register the "g_mySystem_enable" command into the console, allowing modification by designers and code at run-time
REGISTER_CVAR2("g_mySystem_enable", &m_enabled, m_enabled, variableFlags, "Determines whether or not the system should run");
// Retrieve an ICVar instance for the variable from the console
ICVar* pCVar = gEnv->pConsole->GetCVar("g_mySystem_enable");
/* If necessary, utilize pCVar here */
}
~CMySystem()
{
// Make sure to unregister the variable once we go out of scope
gEnv->pConsole->UnregisterVariable("g_mySystem_enable");
}
void Update()
{
// If the system was disabled via the console, skip update
if (m_enabled == 0)
{
return;
}
/* Update system here */
}
protected:
// Store the variable locally here, the console takes a reference that will update the variable in place
// We start off by setting this value to 1.
int m_enabled = 1;
};
|
protected pure virtual |
Create a new console variable that will update the user defined float.
sName | Console variable name. |
src | Pointer to the memory that will be updated. |
nFlags | User defined flag, this parameter is used by other subsystems and doesn't affect the console variable (basically of user data). |
help | Help text that is shown when you use " |
allowModify | Allow modification through config vars, prevents missing modifications in release mode. |
#include
// Minimal example of how a console variable can be implemented and used
// In this case we create a system, and a variable that determines whether or not the system should be currently updated
class CMySystem
{
CMySystem()
{
// Specify bit flags that define the CVar's behavior, see EVarFlags
const int variableFlags = VF_NULL;
// Register the "g_mySystem_enable" command into the console, allowing modification by designers and code at run-time
REGISTER_CVAR2("g_mySystem_enable", &m_enabled, m_enabled, variableFlags, "Determines whether or not the system should run");
// Retrieve an ICVar instance for the variable from the console
ICVar* pCVar = gEnv->pConsole->GetCVar("g_mySystem_enable");
/* If necessary, utilize pCVar here */
}
~CMySystem()
{
// Make sure to unregister the variable once we go out of scope
gEnv->pConsole->UnregisterVariable("g_mySystem_enable");
}
void Update()
{
// If the system was disabled via the console, skip update
if (m_enabled == 0)
{
return;
}
/* Update system here */
}
protected:
// Store the variable locally here, the console takes a reference that will update the variable in place
// We start off by setting this value to 1.
int m_enabled = 1;
};
Registers an existing console variable. Should only be used with static duration objects, object is never freed.
pVar | The existing console variable. |
|
protected pure virtual |
Create a new console variable that store the value in a float.
sName | Console variable name. |
fValue | Default value. |
nFlags | User defined flag, this parameter is used by other subsystems and doesn't affect the console variable (basically of user data). |
help | help text that is shown when you use " |
#include
// Minimal example of how a console variable can be implemented and used
// In this case we create a system, and a variable that determines whether or not the system should be currently updated
class CMySystem
{
CMySystem()
{
// Specify bit flags that define the CVar's behavior, see EVarFlags
const int variableFlags = VF_NULL;
// Register the "g_mySystem_enable" command into the console, allowing modification by designers and code at run-time
REGISTER_CVAR2("g_mySystem_enable", &m_enabled, m_enabled, variableFlags, "Determines whether or not the system should run");
// Retrieve an ICVar instance for the variable from the console
ICVar* pCVar = gEnv->pConsole->GetCVar("g_mySystem_enable");
/* If necessary, utilize pCVar here */
}
~CMySystem()
{
// Make sure to unregister the variable once we go out of scope
gEnv->pConsole->UnregisterVariable("g_mySystem_enable");
}
void Update()
{
// If the system was disabled via the console, skip update
if (m_enabled == 0)
{
return;
}
/* Update system here */
}
protected:
// Store the variable locally here, the console takes a reference that will update the variable in place
// We start off by setting this value to 1.
int m_enabled = 1;
};
|
protected pure virtual |
Create a new console variable that store the value in a int.
sName | Console variable name. |
iValue | Default value. |
nFlags | User defined flag, this parameter is used by other subsystems and doesn't affect the console variable (basically of user data). |
Help | help text that is shown when you use " |
#include
// Minimal example of how a console variable can be implemented and used
// In this case we create a system, and a variable that determines whether or not the system should be currently updated
class CMySystem
{
CMySystem()
{
// Specify bit flags that define the CVar's behavior, see EVarFlags
const int variableFlags = VF_NULL;
// Register the "g_mySystem_enable" command into the console, allowing modification by designers and code at run-time
REGISTER_CVAR2("g_mySystem_enable", &m_enabled, m_enabled, variableFlags, "Determines whether or not the system should run");
// Retrieve an ICVar instance for the variable from the console
ICVar* pCVar = gEnv->pConsole->GetCVar("g_mySystem_enable");
/* If necessary, utilize pCVar here */
}
~CMySystem()
{
// Make sure to unregister the variable once we go out of scope
gEnv->pConsole->UnregisterVariable("g_mySystem_enable");
}
void Update()
{
// If the system was disabled via the console, skip update
if (m_enabled == 0)
{
return;
}
/* Update system here */
}
protected:
// Store the variable locally here, the console takes a reference that will update the variable in place
// We start off by setting this value to 1.
int m_enabled = 1;
};
|
protected pure virtual |
Create a new console variable that store the value in a int64.
sName | Console variable name. |
iValue | Default value. |
nFlags | Her defined flag, this parameter is used by other subsystems and doesn't affect the console variable (basically of user data). |
help | - help text that is shown when you use " |
#include
// Minimal example of how a console variable can be implemented and used
// In this case we create a system, and a variable that determines whether or not the system should be currently updated
class CMySystem
{
CMySystem()
{
// Specify bit flags that define the CVar's behavior, see EVarFlags
const int variableFlags = VF_NULL;
// Register the "g_mySystem_enable" command into the console, allowing modification by designers and code at run-time
REGISTER_CVAR2("g_mySystem_enable", &m_enabled, m_enabled, variableFlags, "Determines whether or not the system should run");
// Retrieve an ICVar instance for the variable from the console
ICVar* pCVar = gEnv->pConsole->GetCVar("g_mySystem_enable");
/* If necessary, utilize pCVar here */
}
~CMySystem()
{
// Make sure to unregister the variable once we go out of scope
gEnv->pConsole->UnregisterVariable("g_mySystem_enable");
}
void Update()
{
// If the system was disabled via the console, skip update
if (m_enabled == 0)
{
return;
}
/* Update system here */
}
protected:
// Store the variable locally here, the console takes a reference that will update the variable in place
// We start off by setting this value to 1.
int m_enabled = 1;
};
|
protected pure virtual |
Create a new console variable that store the value in a string.
sName | Console variable name. |
sValue | Default value. |
nFlags | User defined flag, this parameter is used by other subsystems and doesn't affect the console variable (basically of user data). |
help | Help text that is shown when you use " |
|
pure virtual |
Removes a console command which was previously registered with AddCommand.
sCommand | Command name. |
#include
// The function that will be executed with the command
void MyCommand(IConsoleCmdArgs* pArgs)
{
// The first argument is always the name of the command
const char* szCommand = pArgs->GetArg(0);
if (pArgs->GetArgCount() > 1)
{
// Get the first argument, if any
const char* szFirstArgument = pArgs->GetArg(1);
/* Handle the command, and its argument here */
}
}
void RegisterCommand()
{
// Specify bit flags that define the CCommand's behavior, see EVarFlags
const int variableFlags = VF_NULL;
// Register the command in the console
REGISTER_COMMAND("myCommand", MyCommand, variableFlags, "Executes the MyCommand function!");
}
void UnregisterCommand()
{
// Make sure to unregister the command once we are done
gEnv->pConsole->RemoveCommand("myCommand");
}
void ExecuteCommand()
{
// Do not silence execution of the command from logs
const bool silent = false;
// Execute the command immediately, instead of the next frame
const bool deferExecution = false;
gEnv->pConsole->ExecuteString("myCommand", silent, deferExecution);
}
|
pure virtual |
Remove output sink (clases which are interested in the output) - order is not guaranteed.
inpSink | Must not be 0 and has to be added before. |
|
pure virtual |
Sets the background-image.
pImage | background-image. |
|
pure virtual |
szLine | Must not be 0. |
|
pure virtual |
Sets the loading-background-image.
pImage | Background image. |
|
pure virtual |
Set the y coordinate where the console will stop to scroll when is dropped.
value | Y in screen coordinates. |
|
pure virtual |
Show/hide the console.
specifies | if the window must be (true=show,false=hide). |
specifies | iRequestScrollMax <=0 if not used, otherwise it sets SetScrollMax temporary to the given value. |
|
pure virtual |
Sets static/scroll background-mode.
bStatic | true if static. |
|
pure virtual |
Remove a variable from the console.
sVarName | Console variable name. |
bDelete | If true, the variable is deleted. |
#include
// Minimal example of how a console variable can be implemented and used
// In this case we create a system, and a variable that determines whether or not the system should be currently updated
class CMySystem
{
CMySystem()
{
// Specify bit flags that define the CVar's behavior, see EVarFlags
const int variableFlags = VF_NULL;
// Register the "g_mySystem_enable" command into the console, allowing modification by designers and code at run-time
REGISTER_CVAR2("g_mySystem_enable", &m_enabled, m_enabled, variableFlags, "Determines whether or not the system should run");
// Retrieve an ICVar instance for the variable from the console
ICVar* pCVar = gEnv->pConsole->GetCVar("g_mySystem_enable");
/* If necessary, utilize pCVar here */
}
~CMySystem()
{
// Make sure to unregister the variable once we go out of scope
gEnv->pConsole->UnregisterVariable("g_mySystem_enable");
}
void Update()
{
// If the system was disabled via the console, skip update
if (m_enabled == 0)
{
return;
}
/* Update system here */
}
protected:
// Store the variable locally here, the console takes a reference that will update the variable in place
// We start off by setting this value to 1.
int m_enabled = 1;
};