public void LoadURL(string url) { if (isAwesomiumInit) { AwesomiumWrapper.LoadURL(m_TextureID, url); } }
// Methods should be moved to new class public void Loadfile(string filePath) { if (isAwesomiumInit) { AwesomiumWrapper.LoadFile(m_TextureID, filePath); } }
void OnApplicationQuit() { Debug.Log("quit"); AwesomiumWrapper.CloseFileStream(); //AwesomiumWrapper.DestroyAwesomiumWebView(m_TextureID); //DestroyAwesomium(); //AwesomiumWrapper.Destroy(); }
private void handleKeys() { int dyScroll = (int)Input.GetAxis("Vertical") * 100; if (dyScroll != 0) { AwesomiumWrapper.ScrollWheel(mesh.m_TextureID, dyScroll); } }
void Update() { float scroll = Input.GetAxis("Mouse ScrollWheel"); if (scroll != 0) { AwesomiumWrapper.ScrollWheel(mesh.m_TextureID, (int)scroll); } handleKeys(); }
// Update is called once per frame void Update() { if (isAwesomiumInit == true && controlWindow.showBrowser) { AwesomiumWrapper.Update(); //// Check to see if render flag is set in unmanaged code. Need changing to delegates instead if (AwesomiumWrapper.isDirty(m_TextureID)) { m_texture.SetPixels(m_pixels, 0); m_texture.Apply(); } } }
public void DestroyAwesomiumWindow() { try { if (m_TextureID != 0) { AwesomiumWrapper.DestroyAwesomiumWebView(m_TextureID); m_pixelsHandler.Free(); GetComponent <BrowserGUIEvents>().interactive = false; isAwesomiumInit = false; m_TextureID = 0; } } catch (System.Exception e) { Debug.Log(e); } }
void OnMouseDown() { // Only when interactive is enabled if (!interactive) { return; } RaycastHit hit; if (Physics.Raycast(Camera.main.ScreenPointToRay(Input.mousePosition), out hit)) { int x = /*width -*/ (int)(hit.textureCoord.x * width); int y = height - (int)(hit.textureCoord.y * height); AwesomiumWrapper.MouseMove(mesh.m_TextureID, x, y); AwesomiumWrapper.MouseDown(mesh.m_TextureID, 0); } }
public void InitAwesomium(int width, int height) { Debug.Log("init awsommium"); this.width = width; this.height = height; m_texture = new Texture2D(width, height, TextureFormat.ARGB32, true); //Get Color[] (pixels) from texture m_pixels = m_texture.GetPixels(0); // Create window handle id - future usage m_TextureID = m_texture.GetInstanceID(); Debug.Log("textID : " + m_TextureID); // assign m_texture to this GUITexture texture gameObject.renderer.material.mainTexture = m_texture; // Create GCHandle - Allocation of m_pixels in memory. m_pixelsHandler = GCHandle.Alloc(m_pixels, GCHandleType.Pinned); AwesomiumWrapper.Init(); AwesomiumWrapper.CreateAwesomiumWebView(m_TextureID, m_pixelsHandler.AddrOfPinnedObject(), width, height, this.SetPixels, this.ApplyTexture); isAwesomiumInit = true; GetComponent <BrowserGUIEvents>().interactive = true; Debug.Log("done init awsommium"); }