Beispiel #1
0
/*
================
VGui_Startup

Load vgui_support library and call VGui_Startup
================
*/
void VGui_Startup( int width, int height )
{
	if(!vgui.initialized)
	{
		void (*F) (vguiapi_t *);
		lib = Com_LoadLibrary(host.vguiloader, false);
		if(!lib)
			MsgDev(D_ERROR, "Failed to load vgui_support library!\n");
		else
		{
			F = Com_GetProcAddress(lib, "InitAPI");
			if(F)
			{
				F(&vgui);
				vgui.initialized = true;
			}
			else
				MsgDev(D_ERROR, "Failed to find vgui_support library entry point!\n");
		}
		VGUI_InitCursors();
	}
	if (vgui.initialized)
	{
		//host.mouse_visible = true;
		vgui.Startup(width, height);
	}
}
Beispiel #2
0
CEngineSurface :: CEngineSurface( Panel *embeddedPanel ):SurfaceBase( embeddedPanel )
{
	_embeddedPanel = embeddedPanel;
	_drawColor[0] = _drawColor[1] = _drawColor[2] = _drawColor[3] = 255;
	_drawTextColor[0] = _drawTextColor[1] = _drawTextColor[2] = _drawTextColor[3] = 255;

	_surfaceExtents[0] = _surfaceExtents[1] = 0;
	_surfaceExtents[2] = menu.globals->scrWidth;
	_surfaceExtents[3] = menu.globals->scrHeight;
	_drawTextPos[0] = _drawTextPos[1] = 0;
	_hCurrentFont = null;

	VGUI_InitCursors ();
}
Beispiel #3
0
/*
================
VGui_Startup

Load vgui_support library and call VGui_Startup
================
*/
void VGui_Startup( int width, int height )
{
	static qboolean failed = false;
	if( failed )
		return;
	if(!vgui.initialized)
	{
		void (*F) ( vguiapi_t * );
		char vguiloader[256];
		char vguilib[256];

		Com_ResetLibraryError();

		// hack: load vgui with correct path first if specified.
		// it will be reused while resolving vgui support and client deps
		if( Sys_GetParmFromCmdLine( "-vguilib", vguilib ) )
		{
			if( Q_strstr( vguilib, ".dll") )
				Q_strncpy( vguiloader, "vgui_support.dll", 256 );
			else
				Q_strncpy( vguiloader, VGUI_SUPPORT_DLL, 256 );
			if( !Com_LoadLibrary( vguilib, false ) )
				MsgDev( D_WARN, "VGUI preloading failed. Default library will be used!\n");
		}

		if( !Sys_GetParmFromCmdLine( "-vguiloader", vguiloader ) )
			Q_strncpy( vguiloader, VGUI_SUPPORT_DLL, 256 );

		lib = Com_LoadLibrary( vguiloader, false );
		if(!lib)
			MsgDev( D_ERROR, "Failed to load vgui_support library: %s", Com_GetLibraryError() );
		else
		{
			F = Com_GetProcAddress( lib, "InitAPI" );
			if( F )
			{
				F( &vgui );
				vgui.initialized = true;
				VGUI_InitCursors();
			}
			else
				MsgDev( D_ERROR, "Failed to find vgui_support library entry point!\n" );
		}

	}

	// vgui may crash if it cannot find font
	if( width <= 320 )
		width = 320;
	else if( width <= 400 )
		width = 400;
	else if( width <= 512 )
		width = 512;
	else if( width <= 640 )
		width = 640;
	else if( width <= 800 )
		width = 800;
	else if( width <= 1024 )
		width = 1024;
	else if( width <= 1152 )
		width = 1152;
	else if( width <= 1280 )
		width = 1280;
	else //if( width <= 1600 )
		width = 1600;


	if( vgui.initialized )
	{
		//host.mouse_visible = true;
		vgui.Startup( width, height );
	}
	else failed = true;
}