(currentMouseState.X -, currentMouseState.Y - ) Public override void Update(GameTime gameTime) This.WebViewTexture = new Texture2D(,, , false, SurfaceFormat.Color) MyGlobalObject.Bind(methodName, true, (s, e) => The handler is of type JavascriptMethodEventHandler. Using (JSObject myGlobalObject = ("game")) These object persist for the lifetime of the web-view. Create and acquire a Global Javascript object. Public void RegisterFunction(string methodName, Action handler) Private Texture2D WebViewTexture )", method, string.Join(",", args.Select(x => """ + x.ToString() + """))) Public class BasicAwesomiumComponent : DrawableGameComponent I will tidy this up with a future edit, but to get you guys started, here is my component. you can then call all your WebView methods using that SynchronizationContext. Thread awesomiumThread = new (new (() =>ĪwesomiumContext = SynchronizationContext.Current You then want to keep a reference to that context on your main thread. I have just got this working, you have to create a new thread, then call Run, then listen for an event to be raised by WebCore which will have created a new SynchronizationContext by then.
All the examples online still tell you to use Update which is Obsolete. How do I set this up? Can't find any examples anywhere. I have also managed to get NullRefrence errors, and if I wait Thread.Sleep(400) before calling WebCore.Run(), it just enters the WebCore.Run() and never completes that line. No errors, but DocumentReady is never fired. JSObject js = WebView.CreateGlobalJavascriptObject("w") WebView WebView = WebCore.CreateWebView(500, 400) Error: Starting an update loop on a thread with an existing message loop, is not supported. Here is some of my attempts: WebCore.Initialize(new WebConfig()) Here are the steps that I've followed so far:
But I can't figure out how to properly initialize awesomium in this new version, I get an error no matter how I try to go about it.Īs I understand it I need to call WebCore.Run() once, instead of WebCore.Update(), but I get various exceptions from that method. I've done this in the past with older versions of awesomium with no problems. I'm trying to render render a browser in side my monogame project, for drawing some interface & stuff.