Share My Creation Webview HTML5 Game Test

bluejay

Active Member
Licensed User
This is a test program to explore running HTML5 games in a Webview - proof of concept.

The html is is the Files folder, you can also run this in a desktop browser by opening index.html in Firefox or Chrome.

The HTML5 code was created using Construct2 (free version).

Well.. it runs complete with 2D physics engine but sooo slow. The html code does not seem to be mobile friendly with very high cpu utilisation.

Project file is attached for those that want to play with this.

bluejay

**** UPDATED 14th March, 2013 to work with current version of WebViewExtras library (currently ver 1.35)
 

Attachments

Last edited:

eps

Expert
Licensed User
Very interesting!

Thanks for posting this.

When you say that it doesn't work well on mobiles, which phone did you try it on?
 

bluejay

Active Member
Licensed User
So far tested on Samsung Galaxy S OS 2.3.3 and ASUS transformer OS 3.2.

CPU utilization on Galaxy S was 78%, the java script physics engine seems to re-calculate everything even if they are not moving or changing.

Attached is the javascript which has not be minified ie the readable version.

The javascript also uses JQuery. Source for games was edited so it does not try download this everytime the app runs.

bluejay
 

Attachments

robife

Member
Licensed User
I got this error trying compile
B4X:
Parsing code.                           0.03
Compiling code.                         Error
Error compiling program.
Error description: Missing parameter.
Occurred on line: 35
MyWebViewExtras.addWebChromeClient(WebView1)
Word: )
 

tecevit

Member
Licensed User
I got this error trying compile
B4X:
Parsing code.                           0.03
Compiling code.                         Error
Error compiling program.
Error description: Missing parameter.
Occurred on line: 35
MyWebViewExtras.addWebChromeClient(WebView1)
Word: )

Looks like MyWebViewExtras.addWebChromeClient needs another parameter : MyWebViewExtras.addWebChromeClient(WebView1,"WebView1")

"somestring" works too for this case..
 

bluejay

Active Member
Licensed User
Thanks robife and tecevit for spotting this.

There was a breaking change in the WebViewExtras library which now has an extra EventName parameter.

I have updated the first post with a new project file to make the following change:

B4X:
MyWebViewExtras.addWebChromeClient(WebView1,"")
Runs at reasonable speed on a Samsung Galaxy S3 but devices with poor Javascript implementation, such as Samsung Galaxy TAB2, still struggle.

bluejay
 
Top