Permalink
Switch branches/tags
Nothing to show
Find file
Fetching contributors…
Cannot retrieve contributors at this time
205 lines (184 sloc) 7.43 KB
<html>
<head>
<script type="text/javascript" src="akihabara/gbox.js"></script>
<script type="text/javascript" src="akihabara/help.js"></script>
<style>
body *{font-size:17px;font-family: Georgia, "Times New Roman", Times, serif;}
H1 { font-size:20px; text-align:right}
H2 { font-size:20px;line-height:0px; }
.settingsbox { border:1px solid black;padding:10px;margin:0px 0px 10px 0px; border-radius: 5px;-moz-border-radius: 5px; -webkit-border-radius: 5px; -moz-box-shadow:0 0 5px #000000; -webkit-box-shadow:0 0 5px #000000; box-shadow:0 0 5px #000000;}
.settingsbox P { font-size:15px }
.settingsbox P * { font-size:15px }
.settingsbox UL { list-style-type: none; padding: 5px;margin: 0; }
.settingsbox LI { line-height:40px; font-size:15px }
.settingsbox .keymap { background-color:white;position:absolute;left:250px; width:300px;padding-left:5px }
.settingsbox .selector { position:absolute;left:250px; width:300px;padding:5px;margin:5px 0px 0px 0px; }
.gameboxkeyboard { background-color:#debebe }
.gameboxaudio { background-color:#debebe }
.gameboxexperimental { background-color:#fecede }
.gameboxsave { background-color:#debebe }
</style>
<title>Akihabara setup</title>
</head>
<body onkeydown="return keycustomized(event)" onkeypress="return false" onkeyup="return false" onload="loaddata()">
<h1>Akihabara setup</h1>
<div class="settingsbox gameboxkeyboard">
<h2>Gamebox buttons setup</h2>
<p>These settings will be used by any Gamebox game hosted by this domain. Click a box and press a key to customize.</p>
<ul>
<li> Up <span class="keymap" id="keyup" READONLY onclick="customizekey({key:'up',input:'keyup'})"></span></li>
<li> Down <span class="keymap" id="keydown" READONLY onclick="customizekey({key:'down',input:'keydown'})"></span></li>
<li> Left <span class="keymap" id="keyleft" READONLY onclick="customizekey({key:'left',input:'keyleft'})"></span></li>
<li> Right <span class="keymap" id="keyright" READONLY onclick="customizekey({key:'right',input:'keyright'})"></span></li>
<li> A Button <span class="keymap" id="keya" READONLY onclick="customizekey({key:'a',input:'keya'})"></span></li>
<li> B Button <span class="keymap" id="keyb" READONLY onclick="customizekey({key:'b',input:'keyb'})"></span></li>
<li> C Button <span class="keymap" id="keyc" READONLY onclick="customizekey({key:'c',input:'keyc'})"></span></li>
</ul>
<span id="extra">
</div>
<div class="settingsbox gameboxaudio">
<h2>Gamebox audio setup</h2>
<p>These settings will be used by any Gamebox game hosted by this domain. <b>Audio is still in beta</b> and is available on some browsers by default.</p>
<ul>
<li><input type="checkbox" id="noaudio" onclick="checkflag(this)"> Disable audio</li>
</ul>
</div>
<div class="settingsbox gameboxaudio">
<h2>Gamebox screen setup</h2>
<p>These settings will be used by any Gamebox game hosted by this domain.</p>
<ul>
<li>Loading screen <select class="selector" id="loadscreen" onchange="changedselect(this)">
<option value="normal">Classic</option>
<option value="c64">Joseph64</option>
</select></li>
<li>Full screen effects <select class="selector" id="fse" onchange="changedselect(this)">
<option value="none">None</option>
<option value="scanlines">Scanlines</option>
<option value="lcd">LCD</option>
</select></li>
</ul>
</div>
<div class="settingsbox gameboxexperimental">
<h2>Gamebox experimental</h2>
<p>This checkbox enables misc experimental features <b>that are really unstable</b>. Use at yout own risk!</p>
<ul>
<li><input type="checkbox" id="experimental" onclick="checkflag(this)"> Enable experimental features</li>
</ul>
<p><i>Experimental features are: iPad with 3.6 firmware, iPhone with 4.x betas (single channel mode), IE9 Beta in IE7 Compat mode, latest builds of Konqueror (single channle mode) and all other audio-enabled devices (untested)</i></p>
</div>
<div class="settingsbox gameboxsave">
<input type="button" onclick="resetdefaults()" value="Reset default settings">
<input type="button" onclick="savesettings()" value="Save settings">
</div>
</body>
<script>
var defaults={
flags:help.cloneObject(gbox._flags)
};
var customizing=null;
var device;
function pjq(id) { return document.getElementById(id) };
function keyidtostring(id) {
var strkey="";
switch (id) {
case 38: { strkey="Up arrow"; break }
case 40: { strkey="Down arrow"; break }
case 37: { strkey="Left arrow"; break }
case 39: { strkey="Right arrow"; break }
default: {
if (((id>64)&&(id<133))||((id>47)&&(id<58))) strkey=String.fromCharCode(id);
}
}
if (device.iswii) {
switch (id) {
case 175: { strkey="Wiimote D-Pad left"; break; }
case 176: { strkey="Wiimote D-Pad right"; break; }
case 177: { strkey="Wiimote D-Pad up"; break; }
case 178: { strkey="Wiimote D-Pad down"; break; }
case 173: { strkey="Wiimote 2 button"; break; }
case 174: { strkey="Wiimote + button"; break; }
case 170: { strkey="Wiimote - button"; break; }
case 172: { strkey="Wiimote 1 button"; break; }
case 13: { strkey="Wiimote A button"; break; }
}
}
return "key "+id+(strkey?" ("+strkey+")":"");
}
function updatescreen() {
pjq("keyup").innerHTML=keyidtostring(gbox._keymap["up"]);
pjq("keydown").innerHTML=keyidtostring(gbox._keymap["down"]);
pjq("keyleft").innerHTML=keyidtostring(gbox._keymap["left"]);
pjq("keyright").innerHTML=keyidtostring(gbox._keymap["right"]);
pjq("keya").innerHTML=keyidtostring(gbox._keymap["a"]);
pjq("keyb").innerHTML=keyidtostring(gbox._keymap["b"]);
pjq("keyc").innerHTML=keyidtostring(gbox._keymap["c"]);
for (var i in gbox._flags) {
switch (gbox._flagstype[i]) {
case "check": {
pjq(i).checked=gbox._flags[i];
break;
}
case "list":{
for (var j=0;j<pjq(i).options.length;j++)
if (pjq(i).options[j].value==gbox._flags[i]) {
pjq(i).selectedIndex=j;
break;
}
break;
}
}
}
}
function checkflag(t) {
gbox._flags[t.id]=(t.checked?true:false);
}
function loaddata() {
defaults.keyboardkeymap=help.cloneObject(gbox._keymap);
device=help.akihabaraInit({hardwareonly:true});
defaults.defaultkeymap=help.cloneObject(gbox._keymap);
gbox._loadsettings();
if (device.iswii)
pjq("extra").innerHTML="<div style='margin-top:10px'><input type=button value='Set USB keyboard default' onclick='setusbkeyboarddefault()'><\/div>";
updatescreen();
}
function changedselect(t) {
gbox._flags[t.id]=t.options[t.selectedIndex].value;
}
function customizekey(p) {
cancelcustomize();
customizing=p;
pjq(customizing.input).style.backgroundColor="#cefede";
}
function cancelcustomize() {
if (customizing) {
pjq(customizing.input).style.backgroundColor="";
updatescreen();
customizing=null;
}
}
function keycustomized(e) {
if (customizing) {
gbox._keymap[customizing.key]=(e.fake||window.event?e.keyCode:e.which);
cancelcustomize();
return false;
}
}
function resetdefaults() {
if (confirm("Revert to default configuration?")) {
gbox._keymap=help.cloneObject(defaults.defaultkeymap);
gbox._flags=help.cloneObject(defaults.flags);
updatescreen();
}
}
function savesettings() {
gbox._savesettings();
alert("Settings saved succesfully.");
}
function setusbkeyboarddefault() {
if (confirm("Set the USB keyboard default input settings?")) {
gbox._keymap=help.cloneObject(defaults.keyboardkeymap);
updatescreen();
}
}
</script>
</html>