Posts tagged with “webapi”

A plug for the Fullscreen, Gamepad, and Mouse Lock gaming APIs

Syndicator
Sometimes, when things are moving as quickly as they generally do here at the Moz (as in the open web generally), the best that one can do is channel the work of others to try and stay on track with everything.   It certainly beats trying to do everything oneself, at the breakneck speed at which envisioning the new technology – and technology itself – unfolds.


On that note, kudos to Dave HumphriesRob Hawkes and Chris Pearce for their recent blog posts on these brand new APIs.  And so, by way of a rehash…


Fullscreen, Gamepad and Mouse Lock APIs are available in a single experimental desktop build of Firefox.  There are also builds that support these features here.

These APIs are estimated to land soon in the nightly builds.


The Fullscreen API:


Scheduled to ship in firefox 10 by the end of January, you can still try out some of the examples in the latest nightly builds.


Based on the  W3C’s draft spec, this API enables any HTML element to be made “fullscreen”, which hides the browsers UI and stretches the element to cover the entire screen area.


To use it, the developer calls void mozRequestFullScreen(), which, if the request is granted (there are security implications here) gets a mozfullscreenchange event back to the specifying element; otherwise a mozfullscreenerror is dispatched.

The user can ESC or F11 to exit full screen mode.   As with YouTube or other fullscreen videos, navigating (ALT+TAB) will cause fullscreen mode to exit.


There is a cross-browser full-screen API example here. 
The Gamepad API:

As directed by the W3C spec, Javascript and Firefox now gives developers the possibility to connect a gamepad directly to the computer (using USB or Bluetooth) – a domain previously only available to gaming consoles and native computer games.  

You can try it out here; note that you”ll need that custom build.   This wiki page contains more implementation specifics.

Rob Hawkes made a great demo video:



The Mouse Lock API:

This API hides the cursor and locks it to the center of the screen, thus enabling developers to make games and visualizations of a 3D world (otherwise the cursor would go off the side of the screen or hit the edge). With the cursor locked, the user can roam X, Y, Z axes without restrictions.

David Humphrey and his students at Seneca College are currently implementing this API based on the W3C spec.

There are demo files available.


We’re tracking Mouse Lock API on Bugzilla. You can also check out David Humphrey’s series of posts on the development of the Mouse Lock API.

I’m just now trying these out myself; of course, if you find any issues, please feel free to file a bug.

Continue reading