Pre-release
Adventure.js Docs Downloads
Score: 0 Moves: 0
// Screen.js
(function () {
  /*global adventurejs A*/
  "use strict";

  /**
   * @ajspath adventurejs.Atom.Asset.Matter.Tangible.Thing.Screen
   * @augments adventurejs.Thing
   * @class adventurejs.Screen
   * @ajsconstruct MyGame.createAsset({ "class":"Screen", "name":"foo", [...] })
   * @ajsconstructedby adventurejs.Game#createAsset
   * @ajsnavheading ElectronicsClasses
   * @param {String} game_name The name of the top level game object.
   * @param {String} name A name for the object, to be serialized and used as ID.
   * @summary A screen that can display strings input on a {@link adventurejs.Keyboard|Keyboard}.
   * @classdesc
   * <p>
   * <strong>Screen</strong> is a subclass of
   * {@link adventurejs.Thing|Thing} with its
   * <code class="property">is.typing_target</code> property set to true,
   * which allows it to receive and display strings input
   * on a {@link adventurejs.Keyboard|Keyboard}
   * using the
   * {@link adventurejs.Verb|Verb} {@link type}.
   * With Screen's
   * <code class="property">append_written_strings_to_description</code>
   * property set to true, anything typed on the Keyboard
   * can be included in the Screen's description.
   * </p>
   * <pre class="display border outline">
   * <span class="input">&gt; type "It was the best of times, it was the BLURST of times?" on keyboard</span>
   * You type "It was the best of times, it was the BLURST of times?"
   * on the keyboard. Your input appears on the screen as you type.
   *
   * <span class="input">&gt; x screen</span>
   * It's a fancy monitor. A line of input is visible on it:
   * "It was the best of times, it was the BLURST of times?"
   * </pre>
   * <h3 class="examples">Example:</h3>
   * <pre class="display"><code class="language-javascript">MyGame.createAsset({
   *   class: "Screen",
   *   name: "screen",
   *   place: { on: "desk" },
   *   descriptions: { look: "It's an expensive looking computer display screen. ", },
   *   dov: { take: false, },
   * });
   * MyGame.createAsset({
   *   class: "Keyboard",
   *   name: "keyboard",
   *   place: { on: "desk" },
   *   descriptions: { look: "It's a keyboard. You can type on it. ", },
   *   dov: { take: false, },
   *   typing_target_id: "screen",
   * });
   * </code></pre>
   */
  class Screen extends adventurejs.Thing {
    constructor(name, game_name) {
      super(name, game_name);
      this.class = "Screen";

      this.is.typing_target = true;

      this.append_written_strings_to_description = true;
    }
  }
  adventurejs.Screen = Screen;
})();