changeset 36:afa332a44721

The zui now has a getSize() method which returns the size of the screen in characters. This is communicated to the z-machine.
author Atul Varma <varmaa@toolness.com>
date Tue, 13 May 2008 22:56:06 -0700
parents be2a410b8518
children 9e7a743ccac5
files engine-runner.js trivial-zui.js
diffstat 2 files changed, 15 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/engine-runner.js	Tue May 13 22:33:20 2008 -0700
+++ b/engine-runner.js	Tue May 13 22:56:06 2008 -0700
@@ -2,6 +2,13 @@
 }
 
 Zui.prototype = {
+
+    // Returns a 2-element list containing the width and height of the
+    // screen, in characters.  The width may be 255, which means
+    // "infinite".
+
+    getSize: function() {
+    },
     onLineInput: function(callback) {
     },
     onCharacterInput: function(callback) {
@@ -69,7 +76,11 @@
         },
 
         run: function() {
+            var size = self._zui.getSize();
+
             self._isRunning = true;
+            self._engine.m_memory[0x20] = size[1];
+            self._engine.m_memory[0x21] = size[0];
             self._continueRunning();
         },
 
--- a/trivial-zui.js	Tue May 13 22:33:20 2008 -0700
+++ b/trivial-zui.js	Tue May 13 22:56:06 2008 -0700
@@ -80,6 +80,10 @@
             }
         },
 
+        getSize: function() {
+            return [60, 255];
+        },
+
         onLineInput: function(callback) {
             self._currentCallback = callback;
             $("#content").append(