Forum

turn on UI for desktop Petigor's Tale

23 December 2015 00:41 #6050
Petigor's Tale UI only show on mobile devices, Right?
How can I turn on the UI for the desktop?
Looking in blend4web/deploy/tutorials/examples/making_a_game_p1-3 folder I found game_example.html.
I was looking for a CSS platform sniffer for mobile to turn off. But could not find one.

It would be great to have the desktop cursor click on the mobile UI controls

thanks for any help
23 December 2015 01:00 #6051
UPDATE from poster:

OK I found this in blend4web\deploy\tutorials\examples\making_a_game_p4\game_example.js. At line 325

function detect_mobile() {
    if( navigator.userAgent.match(/Android/i)
     || navigator.userAgent.match(/webOS/i)
     || navigator.userAgent.match(/iPhone/i)
     || navigator.userAgent.match(/iPad/i)
     || navigator.userAgent.match(/iPod/i)
     || navigator.userAgent.match(/BlackBerry/i)
     || navigator.userAgent.match(/Windows Phone/i)) {
        return true;
    } else {
        return false;
    }
}

My guess is that "function detect_mobile" is calling from b4w.min.js to trigger the touch UI load. Is there a "userAgent.match(/firefox/i)" or non-mobile?
23 December 2015 17:56 #6067
Hi,

You can simply remove this function call if you always want to see UI regardless of platform.
Instead of

if(detect_mobile()) {
        setup_control_events(right_arrow, up_arrow,
                             left_arrow, down_arrow, touch_jump);
        document.getElementById("control_jump").style.visibility = "visible";
}

just do
setup_control_events(right_arrow, up_arrow,
                   left_arrow, down_arrow, touch_jump);
document.getElementById("control_jump").style.visibility = "visible";

Hope this helps!
Development Lead | Twitter
 
Please register or log in to leave a reply.