示例#1
0
Menu::Menu(const char* url)
: mWebView(0)
, mPosX(0) , mPosY(0)
, mWidth(0) , mHeight(0)
, mViewLoaded(false)
, mURL(url)
, mVertexBuffer(0)
, mStateBlock(0)
, mFrameCount(0)
{
	static bool sbWebCoreInitilized = false;
	
	// Initialize once the Awesomium web core
	if ( !sbWebCoreInitilized )
	{
		// TODO: Move Awesomium to a separate core
		awe_webcore_initialize( true, true, false, awe_string_empty(), awe_string_empty(), 
			awe_string_empty(), awe_string_empty(), awe_string_empty(), AWE_LL_NORMAL, false, awe_string_empty(), true, 
			awe_string_empty(), awe_string_empty(), awe_string_empty(), awe_string_empty(), awe_string_empty(), awe_string_empty(),
			false, 0, false, false, awe_string_empty() );

		awe_webcore_set_base_directory( AweString("Menus/") ); 

		sbWebCoreInitilized = true;
	}

	// Get the screen dimension
	const VCNPoint& screenRes = VCNRenderCore::GetInstance()->GetResolution();
	mWidth = screenRes.x;
	mHeight = screenRes.y;
	VCN_ASSERT(mWidth != 0 && mHeight != 0);

	// Create the web view
	mWebView = awe_webcore_create_webview(mWidth, mHeight, false);
	ASSERT(mWebView && "Failed to create web view");

	// Map this view to recover in callbacks.
	sViewMap[mWebView] = this;

	// Load initial view
	awe_webview_load_file( mWebView, AweString(mURL.c_str()), awe_string_empty() );
	awe_webview_set_callback_js_callback( mWebView, OnCallbackHandler );
	awe_webview_set_callback_finish_loading( mWebView, OnFinishLoadingHandler );

	// Preserve transparency (for the HUD)
	awe_webview_set_transparent(mWebView, true);

	// Always create a Native object to call native functions from javascript.
	awe_webview_create_object( mWebView, AweString("Native") );
	
	CreateTexture();
	CreateStateBlock();
	CreateVertexBuffer();
}
GameEditor::GameEditor(Game* game)
{
	_game = game;

	UIViewManager::GetInstance()->Init();

	_uiview = new UIView(1024, 768);
	awe_webview_focus(_uiview->GetWebview());
	//_uiview->LoadURL("http://www.google.co.uk");
	_uiview->LoadURL("E:/GameDev/Platformer/Platformer/Debug/data/ui/editor/generic.html");

	awe_webview_set_transparent(_uiview->GetWebview(), true);
}
示例#3
0
	void Awesomium::initializeTransparentWebview(int width, int height)
	{
		webView = awe_webcore_create_webview(width, height, false);
		awe_webview_set_transparent(webView, true);
		add_logA("Awesomium: Webview created");		
	}