Script Classes for Adventure Games/View Class

From SCI Wiki
Jump to: navigation, search

Official SCI Documentation

Chapter: 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14
15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | Index

The View Class

Author: Jeff Stephenson

Date: 5 April 1988


The View Class

The View class contains the minimum functionality to put a visible object on the screen in a reversible manner. Thus, as a View, a particular view, loop, and cel may be drawn on the screen and later erased. A View, however neither cycles (like a Prop) nor moves (like an Actor).

In file:
Inherits from: Feature
Inherited by: Prop




The position of the View on the screen.


The Views elevation above the ground.


The number of the View's current view.


The number of the View's current loop.


The number of the View's current cel.


The visual priority of the View.


A handle to the storage for saving the background of the View.

Don't monkey with this.


A handle to the storage for saving the background of the View. Don't monkey with this.


The coordinates of the top, bottom, left, and right edges of the rectangle which encloses the current (nowSeen) cel of the View. Don't monkey with this.


The lastSeen rectangle for the View — its nowSeen rectangle from the previous animation cycle. Once again, do not touch.


This is the base rectangle (or baseRect) — the rectangle which is considered to be the base of the View for detecting collisions with it. This you can monkey with. The default for the base of a View is a rectangle whose left and right sides are the sides of the nowSeen rectangle, and whose bottom and top are the y coordinate of the View's origin.


A bit-mapped word for communicating with the kernel animation routines and various methods. Handles start- and stop- updating, fixed priorities, etc. This property should not generally be manipulated directly — the various methods (setPri:, setCel:, stopUpd:, etc.) should be used instead.



Sets the baseRect of the View and adds it to the cast so that it will be drawn on the screen at its current position.

posn: x y z

Position the View at (x, y, z). Note that the Actual x,y screen coordinates of the object will be x, (y - z). Thus leaving z set to zero will give the traditional x y positioning.


This method sets the signal property to indicate to the interpreter that the image of the object on the screen is not to be updated anymore. This is done to speed up program execution by reducing the number of things to be animated.


This undoes a previous stopUpd: of an View.


This does a one-animation-cycle startUpd: of the View, making a change in the View's view, loop, cel, or position visible, but leaving it in a stopUpd: condition if it was so before.

setPri: [newPri]

This is used to set the priority of a View, based on the value of newPri. Normally, a View is assigned a visual priority by the kernel based on its y position on the screen. If a call to setPri: is made with no newPri specified, the priority is fixed at the current priority of the View. If a value of newPri is specified, the priority is set to that value. A newPri of -1 is used to undo a setPri:, returning control of the priority to the kernel.

setCel: newCel

Sets the cel of the View to newCel.

setLoop: newLoop

Sets the loop of the View to newLoop.

ignoreActors: [n]

If n is absent or TRUE, this allows the View's baseRect to intersect that of Actors. If n is FALSE, the View's baseRect may not intersect that of any Actors — the Actor will collide with it (unless the Actor has itself done an ignoreActors:). The default state of a View is equivalent to ignoreActors:FALSE, i.e. an Actor may not intersect its baseRect.


Place a view that has been hidden with hide: back on th screen.


Remove the View from the screen, but not from the cast.


Tell the kernel to remove the View from the screen. Also set a bit in signal to tell the main animation loop to remove this View from the cast after animation has been completed.


If the proper bit is set in signal, remove this View from the cast and do a (super dispose:).

showStr: where

Format a string describing the View in the storage pointed to by where. This method gives classes inheriting from View the ability to inherit the View part of showSelf: rather than reimplement it.

check: other

This method is used to check for intersection of the baseRect with other. It returns TRUE if the object does not intersect anything. The method for a View or Prop always returns TRUE.

handleEvent: event

All elements of the cast get the handleEvent: message whenever a non-direction event is produced. Only the User's alterEgo is sent direction events.


Add this View to the picture in an irreversible manner, then delete the View. The Views important properties are copied into a PicView object created by the system, and the View is then disposed of. Note that this meens that all methods that have been redefined for the View are lost (including, but not limited to the handleEvent method). Thus if you wish to give an addToPic a specialized handleEvent method a PicView object should be used instead.




Table of Contents


< Previous: The Feature Class Next: The Prop Class >