mirror of
https://github.com/inexorabletash/jsbasic.git
synced 2025-01-01 12:31:01 +00:00
Use screen for keyboard input
This commit is contained in:
parent
228b819b0f
commit
74ca008c37
@ -39,13 +39,10 @@ By <a href="mailto:inexorabletash@hotmail.com">Joshua Bell</a>
|
||||
<div id="lores" class="lores"></div>
|
||||
<canvas id="hires" width="560" height="384" class="hires"></canvas>
|
||||
<canvas id="hires2" width="560" height="384" class="hires"></canvas>
|
||||
<div id="screen" class="tty"></div>
|
||||
<div id="screen" class="tty" tabIndex="0"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Keyboard - positioned offscreen -->
|
||||
<input id="keyboard" class="keyboard" type="text" title="Hidden Keyboard Input Device">
|
||||
|
||||
<!-- Source -->
|
||||
<div style="float: left; margin: 5px;">
|
||||
Enter code:
|
||||
|
6
index.js
6
index.js
@ -11,7 +11,7 @@ window.onload = function () {
|
||||
} ());
|
||||
|
||||
|
||||
var tty = new TTY($('#screen'), $('#keyboard'), bell);
|
||||
var tty = new TTY($('#screen'), $('#screen'), bell);
|
||||
var dos = new DOS(tty);
|
||||
|
||||
var lores = new LoRes($('#lores'), 40, 48);
|
||||
@ -98,10 +98,10 @@ window.onload = function () {
|
||||
addEvent($('#frame'), 'click', keyboardFocus);
|
||||
addEvent($('#frame'), 'blur', keyboardFocus); // Needed on IE, not sure why it tries to get focus
|
||||
|
||||
addEvent($('#keyboard'), 'focus', function () {
|
||||
addEvent($('#screen'), 'focus', function () {
|
||||
getClassList($('#frame')).add('focused');
|
||||
});
|
||||
addEvent($('#keyboard'), 'blur', function () {
|
||||
addEvent($('#screen'), 'blur', function () {
|
||||
getClassList($('#frame')).remove('focused');
|
||||
});
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user