Debugging: Add code to print backtrace for guest on SIGSEGV
[nativeclient.git] / tests / quake / quake.html
blobec7cd4177320839cda6ec59c7c40e9596f57e6b4
1 <HTML>
2 <HEAD>
3 <TITLE>Quake Demo</TITLE>
5 <script type="text/javascript">
6 <!--
7 var nacl_elt;
9 // Before scripting the loaded module, ensure the Native Client module is loaded.
10 var startupTimeout;
12 var Completion = function(files_array) {
13 var i;
15 this.seen = new Array();
16 this.files = files_array;
17 this.num_left = files_array.length;
19 for (i = 0; i < this.num_left; ++i) {
20 this.seen[i] = 0;
23 this.done = function(name) {
24 var i;
26 for (i = 0; i < this.files.length; ++i) {
27 if (this.seen[i]) {
28 continue;
30 if (name == this.files[i]) {
31 this.seen[i] = 1;
32 --this.num_left;
33 break;
36 return (0 == this.num_left) ? 1 : 0;
40 var FileLoadCallback = function(filename, url, completion_pred) {
41 this.filename = filename;
42 this.url = url;
43 this.pred = completion_pred;
45 this.onload = function(nacl_desc) {
46 nacl_elt.file(this.filename, nacl_desc, this.pred.done(this.filename));
48 this.onfail = function(object) {
49 window.alert('Failed to load URL: ' + this.url + ', error ' + object);
53 var StartLoad = function(filename, url, comp) {
54 nacl_elt.__urlAsNaClDesc(url,
55 new FileLoadCallback(filename, url, comp));
58 var PostLoadInit = function() {
59 if (nacl_elt.__moduleReady == 1) {
60 clearTimeout(startupTimeout);
61 var load_array = new Array('./id1/pak0.pak');
62 var comp = new Completion(load_array);
63 var i;
64 for (i = 0; i < load_array.length; ++i) {
65 StartLoad(load_array[i], load_array[i], comp);
67 nacl_elt.focus();
68 } else {
69 if (nacl_elt.__moduleReady == undefined) {
70 window.alert('The Native Client plugin was unable to load');
71 return;
73 startupTimeout = setTimeout(PostLoadInit, 100);
77 // Init is called when the document has completed loading. It downloads the
78 // NativeClient modules.
79 var Init = function() {
80 // service_url contains the location of the NativeClient module to be
81 // loaded as a service.
82 nacl_elt = document.getElementById('embed1');
83 PostLoadInit();
86 -->
87 </script>
89 </HEAD>
90 <BODY onload="Init();" onunload="" id="bodyId" bgcolor="#333333" >
91 <span style="color:CCCCCC">
92 <h1>Native Client Quake Demo</h1>
93 <span style="color:999999">
94 <p>
95 Quake, a classic first person shooter released in 1996 by Id Software.
96 Now open source, this demo is playable in the browser as a Native Client
97 module.
98 </p>
99 <p>
100 Click the game area below to give it keyboard focus, then press the
101 spacebar to activate the game menu. Select single player (hit return
102 to select) then select new game. Controls: arrow keys to move, space
103 to jump, control key to fire, numeric keys to select various weapons
104 aquired along the way. Audio is also supported on systems with audio
105 drivers installed. Multiplayer mode is not supported. Loading and
106 saving game progress is not supported.
107 </p>
108 </span>
109 </span>
110 <center>
111 <embed id="embed1" src="nacl_quake" type="application/x-nacl-srpc" width=800 height=600>
112 </center>
113 <br>
116 </BODY>
117 </HTML>