Пример #1
0
//-----------------------------------------------------------------------------
// Purpose: 
//-----------------------------------------------------------------------------
void CWebHudFull::HealthParse( void )
{
	if ( !webView )
		return;

	/*
	// Load the default text list
	CUtlBuffer buf( 1024, 0, CUtlBuffer::TEXT_BUFFER );
	if ( !g_pFullFileSystem->ReadFile( "special/webui/hud.html", NULL, buf ) )
		return;

	const char *data = (const char*)buf.Base();
	char finishedHtml[1024];

	// Replacing string in default text list
	Q_StrSubst( data, "{health}", VarArgs( "%i", m_iHealth ), finishedHtml, sizeof(finishedHtml));

	// Updating HTML file with new text
	//webView->loadHTML(finishedHtml);
	*/


	char fullpath[MAX_PATH];
	filesystem->RelativePathToFullPath( "ui/mainmenu.html", "MOD", fullpath, MAX_PATH );
	Msg("Loading html file: %s\n", fullpath);

	Awesomium::WebString awebfilename = Awesomium::WebString::CreateFromUTF8( "file:///", 8);
	Awesomium::WebString afilename = Awesomium::WebString::CreateFromUTF8(fullpath, Q_strlen(fullpath));
	awebfilename.Append( afilename );

	webView->LoadURL( Awesomium::WebURL( awebfilename ) );
}
Пример #2
0
void SRPWindows::OnMethodCall(Awesomium::WebView *caller, unsigned int remote_object_id, const Awesomium::WebString &method_name, const Awesomium::JSArray &args)
{
	/*javascript callback handled, implement working example from PLBerkelium*/

	DebugToConsole("Javascript callback triggered!\n");
	DebugToConsole("name: " + String(const_cast<wchar16*>(method_name.data())) + "\n");
}
Пример #3
0
void ViewListener::OnAddConsoleMessage(Awesomium::WebView* caller, const Awesomium::WebString& message, int line_number, const Awesomium::WebString& source)
{
	if (g_WebView_AddConsoleMessageCallback != nullptr)
		g_WebView_AddConsoleMessageCallback(caller, message.data(), line_number, source.data());
}