Change keyboard shortcuts to not need the control character. Sweet feedback when paused.

This commit is contained in:
Eric Fredricksen
2012-01-31 13:37:40 -08:00
parent ead5a61dc7
commit e751c6d346
4 changed files with 48 additions and 29 deletions
-3
View File
@@ -1,6 +1,3 @@
// Before launch
// TODO: Hide cheaters
// After launch // After launch
// TODO: No local storage on IE - why? // TODO: No local storage on IE - why?
// TODO: Do something about background-size failure on IE. // TODO: Do something about background-size failure on IE.
+14 -1
View File
@@ -1,5 +1,7 @@
body {
height: 100%;
}
thead.mid { thead.mid {
border-top: solid 1px grey; border-top: solid 1px grey;
@@ -122,3 +124,14 @@ tr { height: 15px; }
body.iOS div.hint { body.iOS div.hint {
visibility: visible; visibility: visible;
} }
div#paused {
display: none;
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
font-size: 160px;
opacity: 0.5;
}
+7 -4
View File
@@ -8,10 +8,10 @@
<meta name="apple-mobile-web-app-capable" content="yes" /> <meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="viewport" <meta name="viewport"
content="initial-scale=1.0; content="initial-scale=1.0,
maximum-scale=1.0; maximum-scale=1.0,
minimum-scale=1.0; minimum-scale=1.0,
user-scalable=0;" /> user-scalable=0" />
<meta names="apple-mobile-web-app-status-bar-style" content="black" /> <meta names="apple-mobile-web-app-status-bar-style" content="black" />
<link rel="apple-touch-icon" href="touch-icon.png" /> <link rel="apple-touch-icon" href="touch-icon.png" />
</head> </head>
@@ -186,6 +186,9 @@
</div> </div>
<br> <br>
<div id="paused"><br>PAUSED</div>
</body> </body>
+24 -18
View File
@@ -10,7 +10,6 @@ function timeGetTime() {
function StartTimer() { function StartTimer() {
if (!timerid) { if (!timerid) {
lasttick = timeGetTime(); lasttick = timeGetTime();
//timerid = setInterval(Timer1Timer, 100);
timerid = setTimeout(Timer1Timer, 100); timerid = setTimeout(Timer1Timer, 100);
} }
} }
@@ -1113,43 +1112,50 @@ function ToDna(s) {
} }
function FormKeyDown(e) { function FormKeyDown(e) {
if (e.which == 2) { // ^B var key = String.fromCharCode(e.which);
if (key === 'd') {
alert("Your character's genome is " + ToDna(game.dna + ""));
}
if (game.isonline) {
if (key === 'b') {
Brag('brag'); Brag('brag');
//Navigate(GetHostAddr() + 'name=' + UrlEncode(Get(Traits,'Name'))); //Navigate(GetHostAddr() + 'name=' + UrlEncode(Get(Traits,'Name')));
} }
if (e.which == 4) { // ^D if (key === 'g') {
alert("Your character's genome is " + ToDna(game.dna + ""));
}
if (e.which == 7) { // ^G
game.guild = InputBox('Choose a guild.\r\rMake sure you undestand the guild rules before you join one. To learn more about guilds, visit http://progressquest.com/guilds.php', game.guild); game.guild = InputBox('Choose a guild.\r\rMake sure you undestand the guild rules before you join one. To learn more about guilds, visit http://progressquest.com/guilds.php', game.guild);
Brag("guild"); Brag("guild");
} }
if (e.which == 13) { // ^M if (key === 'm') {
game.motto = InputBox('Declare your motto!', game.motto); game.motto = InputBox('Declare your motto!', game.motto);
Brag('motto'); Brag('motto');
} }
if (e.which == 16) { // ^P
if (timerid)
StopTimer();
else
StartTimer();
} }
if (e.which == 17) { // ^Q if (key === 'p') {
if (timerid) {
$('#paused').css('display', 'block');
StopTimer();
} else {
$('#paused').css('display', '');
StartTimer();
}
}
if (key === 'q') {
quit(); quit();
} }
if (e.which == 19) { // ^S if (key === 's') {
SaveGame(); SaveGame();
alert(JSON.stringify(game).length); alert('Saved (' + JSON.stringify(game).length + ' bytes).');
} }
/* /*
if (e.which == 20) { // ^T if (key === 't') {
TaskBar.reposition(TaskBar.Max()); TaskBar.reposition(TaskBar.Max());
} }
*/ */