Difference between revisions of "Script Classes for Adventure Games/View Class"

From SCI Wiki
Jump to navigationJump to search
 
(3 intermediate revisions by the same user not shown)
Line 84: Line 84:
 
<blockquote>The lastSeen rectangle for the View — its nowSeen rectangle from the previous animation cycle. Once again, do not touch.</blockquote>
 
<blockquote>The lastSeen rectangle for the View — its nowSeen rectangle from the previous animation cycle. Once again, do not touch.</blockquote>
  
====<br /> brTop<br />brLeft<br />brBottom<br />brRight ====
+
====<br /> baseRect ====
 +
 
 +
<blockquote>
 +
===== brTop =====
 +
===== brLeft =====
 +
===== brBottom =====
 +
===== brRight =====
 
<blockquote>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.</blockquote>
 
<blockquote>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.</blockquote>
 +
</blockquote>
  
 
====<br /> signal ====
 
====<br /> signal ====
Line 95: Line 102:
 
<blockquote>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.</blockquote>
 
<blockquote>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.</blockquote>
  
====<br /> posn: x y z
+
====<br /> posn: x y z ====
 
<blockquote>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.</blockquote>
 
<blockquote>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.</blockquote>
  
Line 104: Line 111:
 
<blockquote>This undoes a previous stopUpd: of an View.</blockquote>
 
<blockquote>This undoes a previous stopUpd: of an View.</blockquote>
  
====<br /> forceUpd:
+
====<br /> forceUpd: ====
 
<blockquote>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.</blockquote>
 
<blockquote>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.</blockquote>
  
Line 155: Line 162:
  
 
<span style="float: left">[[Script Classes for Adventure Games/Feature Class|&lt; Previous: The Feature Class]]</span>
 
<span style="float: left">[[Script Classes for Adventure Games/Feature Class|&lt; Previous: The Feature Class]]</span>
<span style="float: right">[[Script Classes for Adventure Games/PicView Class|Next: The PicView Class &gt;]]</span>
+
<span style="float: right">[[Script Classes for Adventure Games/Prop Class|Next: The Prop Class &gt;]]</span>
  
 
&nbsp;
 
&nbsp;

Latest revision as of 21:33, 11 December 2015

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: actor.sc
Inherits from: Feature
Inherited by: Prop


Properties


x

y

The position of the View on the screen.

z

The Views elevation above the ground.


view

The number of the View's current view.


loop

The number of the View's current loop.


cel

The number of the View's current cel.


priority

The visual priority of the View.


underBits

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

Don't monkey with this.


nsTop
nsLeft
nsBottom
nsRight

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


nsTop
nsLeft
nsBottom
nsRight

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.


lsTop
lsLeft
lsBottom
lsRight

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


baseRect

brTop
brLeft
brBottom
brRight

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.


signal

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.


Methods


init

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.


stopUpd

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.


startUpd

This undoes a previous stopUpd: of an View.


forceUpd:

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.


show

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


hide

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


dispose

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.


delete

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.


addToPic

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.

 

Notes


 

Table of Contents

 

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