IGameUI: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
mNo edit summary
 
m (Source 2006 redirect cleanup)
 
(5 intermediate revisions by 2 users not shown)
Line 1: Line 1:
This module not included in the SDK allows you to have some access to the GameUI module.
'''IGameUI''' is an [[:Category:Interfaces|interface]] that allows you to have some access to the [[GameUI]] module. The include file is found in every SDK except [[Source 2006]]. The code below is the lost file from that branch.
==public\gameui\IGameUI.h==
==common\gameui\IGameUI.h==
<pre>//========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============
<source lang="cpp">
//========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============
//
//
// Purpose:  
// Purpose:  
Line 26: Line 27:
{
{
public:
public:
virtual void Initialize( CreateInterfaceFn *factories, int count ) = 0;
 
virtual void Start(struct cl_enginefuncs_s *engineFuncs, int interfaceVersion, IBaseSystem *system) = 0;
virtual void Initialize( CreateInterfaceFn *factories, int count ) = 0;
virtual void Shutdown() = 0;
virtual void Start(struct cl_enginefuncs_s *engineFuncs, int interfaceVersion, IBaseSystem *system) = 0;
virtual void Shutdown() = 0;


virtual int ActivateGameUI() = 0; // activates the menus, returns 0 if it doesn't want to handle it
virtual int ActivateGameUI() = 0; // activates the menus, returns 0 if it doesn't want to handle it
Line 35: Line 37:
virtual int HasExclusiveInput() = 0;
virtual int HasExclusiveInput() = 0;


virtual void RunFrame() = 0;
virtual void RunFrame() = 0;


virtual void ConnectToServer(const char *game, int IP, int port) = 0;
virtual void ConnectToServer(const char *game, int IP, int port) = 0;
virtual void DisconnectFromServer() = 0;
virtual void DisconnectFromServer() = 0;
virtual void HideGameUI() = 0;
virtual void HideGameUI() = 0;


virtual bool IsGameUIActive() = 0;
virtual bool IsGameUIActive() = 0;
virtual void LoadingStarted(const char *resourceType, const char *resourceName) = 0;
virtual void LoadingStarted(const char *resourceType, const char *resourceName) = 0;
virtual void LoadingFinished(const char *resourceType, const char *resourceName) = 0;
virtual void LoadingFinished(const char *resourceType, const char *resourceName) = 0;


virtual void StartProgressBar(const char *progressType, int numProgressPoints) = 0;
virtual void StartProgressBar(const char *progressType, int numProgressPoints) = 0;
virtual int ContinueProgressBar(int progressPoint, float progressFraction) = 0;
virtual int ContinueProgressBar(int progressPoint, float progressFraction) = 0;
virtual void StopProgressBar(bool bError, const char *failureReasonIfAny, const char *extendedReason) = 0;
virtual void StopProgressBar(bool bError, const char *failureReasonIfAny, const char *extendedReason) = 0;
virtual int SetProgressBarStatusText(const char *statusText) = 0;
virtual int SetProgressBarStatusText(const char *statusText) = 0;
   
   
virtual void GetSteamPassword( const char *szAccountName, const char *szUserName ) = 0;
virtual void GetSteamPassword( const char *szAccountName, const char *szUserName ) = 0;


virtual void ValidateCDKey(bool force, bool inConnect) = 0;
virtual void ValidateCDKey(bool force, bool inConnect) = 0;
};
};


Line 59: Line 61:
#define GAMEUI_INTERFACE_VERSION "GameUI011"
#define GAMEUI_INTERFACE_VERSION "GameUI011"


#endif // IGAMEUI_H</pre>
#endif // IGAMEUI_H
</source>
 
==Notes==
Later branches include functions for bonus maps, Xbox 360 integration, and menu interaction. Check your SDK branch for the actual list of functions in the <code>IGameUI.h</code> file.
 
==Access==
==Access==
#include <gameui\IGameUI.h>
These lines go in the client/server init files:
<source lang="cpp">
#include <gameui\IGameUI.h>
IGameUI *gameui = NULL;
</source>
 
<source lang="cpp">
CreateInterfaceFn gameUIFactory = Sys_GetFactory("gameui.dll");
gameui = (IGameUI *)gameUIFactory(GAMEUI_INTERFACE_VERSION, NULL);
</source>


CreateInterfaceFn gameUIFactory = Sys_GetFactory("gameui.dll");
gameui = (IGameUI *)gameUIFactory(GAMEUI_INTERFACE_VERSION,NULL);
[[Category:Interfaces]]
[[Category:Interfaces]]

Latest revision as of 14:25, 30 August 2019

IGameUI is an interface that allows you to have some access to the GameUI module. The include file is found in every SDK except Source 2006. The code below is the lost file from that branch.

common\gameui\IGameUI.h

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

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

#include "interface.h"

struct cl_enginefuncs_s;
class IBaseSystem;

//-----------------------------------------------------------------------------
// Purpose: contains all the functions that the GameUI dll exports
//			GameUI_GetInterface() is exported via dll export table to get this table
//-----------------------------------------------------------------------------
class IGameUI : public IBaseInterface
{
public:

	virtual void 	Initialize( CreateInterfaceFn *factories, int count ) = 0;
	virtual void	Start(struct cl_enginefuncs_s *engineFuncs, int interfaceVersion, IBaseSystem *system) = 0;
	virtual void	Shutdown() = 0;

	virtual int	ActivateGameUI() = 0;	// activates the menus, returns 0 if it doesn't want to handle it
	virtual int	ActivateDemoUI() = 0;	// activates the demo player, returns 0 if it doesn't want to handle it

	virtual int	HasExclusiveInput() = 0;

	virtual void	RunFrame() = 0;

	virtual void	ConnectToServer(const char *game, int IP, int port) = 0;
	virtual void	DisconnectFromServer() = 0;
	virtual void	HideGameUI() = 0;

	virtual bool	IsGameUIActive() = 0;
	
	virtual void	LoadingStarted(const char *resourceType, const char *resourceName) = 0;
	virtual void	LoadingFinished(const char *resourceType, const char *resourceName) = 0;

	virtual void	StartProgressBar(const char *progressType, int numProgressPoints) = 0;
	virtual int	ContinueProgressBar(int progressPoint, float progressFraction) = 0;
	virtual void	StopProgressBar(bool bError, const char *failureReasonIfAny, const char *extendedReason) = 0;
	virtual int	SetProgressBarStatusText(const char *statusText) = 0;
 
	virtual void	GetSteamPassword( const char *szAccountName, const char *szUserName ) = 0;

	virtual void	ValidateCDKey(bool force, bool inConnect) = 0;
};

// the interface version is the number to call GameUI_GetInterface(int interfaceNumber) with
#define GAMEUI_INTERFACE_VERSION "GameUI011"

#endif // IGAMEUI_H

Notes

Later branches include functions for bonus maps, Xbox 360 integration, and menu interaction. Check your SDK branch for the actual list of functions in the IGameUI.h file.

Access

These lines go in the client/server init files:

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