ModeManager

From Valve Developer Community
Jump to: navigation, search

ModeManager is a required global object that manages ClientModes. Since no Valve game has more than one ClientMode any more, it is almost entirely vestigial. There is no base implementation of the IVModeManager interface.

Minimum implementation

#include "ivmodemanager.h"

class CSkeletonModeManager : public IVModeManager
{
	void	Init() {}
	void	SwitchMode( bool commander, bool force ) {}
	void	LevelInit( const char* newmap ) {}
	void	LevelShutdown() { g_pClientMode->LevelShutdown(); }
};

IVModeManager* modemanager = (IVModeManager*)new CSkeletonModeManager;

SwitchMode() and LevelInit() are both called when a new map is loaded.

See also