topical media & game development
lib-js-terminal-sample-invaders.htm / htm
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1">
<title>Invaders Sample</title>
<script language="JavaScript" type="text/javascript" src="lib-js-terminal-termlib.js"></script>
<script language="JavaScript" type="text/javascript" src="lib-js-terminal-termlib-invaders.js"></script>
<script type="text/javascript">
<!--
// *** text wrap sample ***
// mass:werk, N.Landsteiner 2007
var help = [
'%+r **** termlib.js text wrap sample **** %-r',
' ',
' * type "invaders" to play invaders.',
' * type "help" to see this page.',
' * type "exit" to quit.',
' '
]
var term;
function termOpen() {
if ((!term) || (term.closed)) {
term = new Terminal(
{
x: 220,
y: 70,
cols: 90,
rows: 30,
termDiv: 'termDiv',
bgColor: '#111111',
greeting: help.join('\%n'),
handler: termHandler,
exitHandler: termExitHandler
}
);
term.open();
// dimm UI text
var mainPane = (document.getElementById)?
document.getElementById('mainPane') : document.all.mainPane;
if (mainPane) mainPane.className = 'lh15 dimmed';
}
}
function termExitHandler() {
// reset the UI
var mainPane = (document.getElementById)?
document.getElementById('mainPane') : document.all.mainPane;
if (mainPane) mainPane.className = 'lh15';
}
function termHandler() {
// default handler + exit
this.newLine();
if (this.lineBuffer.match(/^\s*exit\s*/i)) {
TermlibInvaders.start(this);
return;
}
else if (this.lineBuffer.match(/^\s*help\s*
(C) Æliens
04/09/2009
You may not copy or print any of this material without explicit permission of the author or the publisher.
In case of other copyright issues, contact the author.