IVGuiModuleLoader

From Valve Developer Community
Jump to: navigation, search

With this interface not included in the SDK, you can activate the server browser module and the friends module.

public\gameui\IVGuiModuleLoader.h

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

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

#include "interface.h"

#define APP_FRIENDS 0
#define APP_SERVERS 1

//-----------------------------------------------------------------------------
// Purpose: interface to accessing all loaded modules
//-----------------------------------------------------------------------------
class IVGuiModuleLoader : public IBaseInterface
{
public:
	virtual int			GetModuleCount() = 0;
	virtual const char *		GetModuleLabel(int moduleIndex) = 0;
	virtual CreateInterfaceFn	GetModuleFactory(int moduleIndex) = 0;
	virtual bool			ActivateModule(int moduleIndex) = 0;
	virtual bool			ActivateModule(const char *moduleName) = 0;
	virtual void			SetPlatformToRestart() = 0;
};

#define VGUIMODULELOADER_INTERFACE_VERSION "VGuiModuleLoader003"


#endif // IVGUIMODULELOADER_H

Access

These lines go in the client/server init files:

#include <gameui\IVGuiModuleLoader.h>
IVGuiModuleLoader * moduleloader = NULL;
	CreateInterfaceFn gameUIFactory = Sys_GetFactory("gameui.dll");
	moduleloader = (IVGuiModuleLoader *)gameUIFactory(VGUIMODULELOADER_INTERFACE_VERSION, NULL);