IGameConsole: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
Line 24: Line 24:
public:
public:
// activates the console, makes it visible and brings it to the foreground
// activates the console, makes it visible and brings it to the foreground
virtual void Activate() = 0;
virtual void Activate() = 0;


virtual void Initialize() = 0;
virtual void Initialize() = 0;


// hides the console
// hides the console
virtual void Hide() = 0;
virtual void Hide() = 0;


// clears the console
// clears the console
virtual void Clear() = 0;
virtual void Clear() = 0;


// return true if the console has focus
// return true if the console has focus
virtual bool IsConsoleVisible() = 0;
virtual bool IsConsoleVisible() = 0;


// prints a message to the console
// prints a message to the console
virtual void Printf(const char *format, ...) = 0;
virtual void Printf(const char *format, ...) = 0;


// printes a debug message to the console
// printes a debug message to the console
virtual void DPrintf(const char *format, ...) = 0;
virtual void DPrintf(const char *format, ...) = 0;


// printes a debug message to the console
// printes a debug message to the console
virtual void ColorPrintf( Color& clr, const char *format, ...) = 0;
virtual void ColorPrintf( Color& clr, const char *format, ...) = 0;


virtual void SetParent( int parent ) = 0;
virtual void SetParent( int parent ) = 0;
};
};



Revision as of 19:19, 6 January 2006

This interface can help you manage the console using the GameUI module. It is not included in any of the SDK code.

public\gameui\IGameConsole.h

//========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============
//
// Purpose: 
//
//=============================================================================

#ifndef IGAMECONSOLE_H
#define IGAMECONSOLE_H
#ifdef _WIN32
#pragma once
#endif

#include "interface.h"

class Color;

//-----------------------------------------------------------------------------
// Purpose: interface to game/dev console
//-----------------------------------------------------------------------------
class IGameConsole : public IBaseInterface
{
public:
	// activates the console, makes it visible and brings it to the foreground
	virtual void	Activate() = 0;

	virtual void	Initialize() = 0;

	// hides the console
	virtual void	Hide() = 0;

	// clears the console
	virtual void	Clear() = 0;

	// return true if the console has focus
	virtual bool	IsConsoleVisible() = 0;

	// prints a message to the console
	virtual void	Printf(const char *format, ...) = 0;

	// printes a debug message to the console
	virtual void	DPrintf(const char *format, ...) = 0;

	// printes a debug message to the console
	virtual void	ColorPrintf( Color& clr, const char *format, ...) = 0;

	virtual void	SetParent( int parent ) = 0;
};

#define GAMECONSOLE_INTERFACE_VERSION "GameConsole003"

#endif // IGAMECONSOLE_H

Access

#include <gameui\IGameConsole.h>
IGameConsole *gameconsole = NULL;
	CreateInterfaceFn gameUIFactory = Sys_GetFactory("gameui.dll");
	gameconsole = (IGameConsole *)gameUIFactory(GAMECONSOLE_INTERFACE_VERSION,NULL);