Difference between revisions of "SHIP:Data Types:Dimension"

From Serious Documentation
Jump to: navigation, search
(SHIPv4)
 
Line 10: Line 10:
  
 
== [[SHIP Version 4|SHIPv4]] ==
 
== [[SHIP Version 4|SHIPv4]] ==
* <code>0x8101</code>, or <code>-32,511</code> is the smallest number; many example projects have the explicit resource constant of [[SHIP_DMIN]] set to this value.
+
* <code>0x8101</code>, or <code>-32,511</code> is the smallest number; many example projects have the explicit resource constant of '''M_MIN_DIM''' set to this value.
* <code>0x7FFF</code>, or <code>+32,767</code> is the largest number; many example projects have the explicit resource constant of [[SHIP_DMAX]] set to this value.
+
* <code>0x7FFF</code>, or <code>+32,767</code> is the largest number; many example projects have the explicit resource constant of '''M_MAX_DIM''' set to this value.
* <code>0x8000</code>, or <code>-32,768</code> is the "not a number" code, meaning this dimension is "unset"; ; many example projects have the explicit resource constant of [[SHIP_DNAN]] set to this value.
+
* <code>0x8000</code>, or <code>-32,768</code> is the "not a number" code, meaning this dimension is "unset"; ; many example projects have the explicit resource constant of '''M_NAN_DIM''' set to this value.
  
Attempts to set a property with type {{DataType|Dimension}} outside these values will have predictable but generally undesirable results.  For example, incrementing a property of type {{DataType|Dimension}} already at SHIP_DMAX will cause that property to roll around (the 16-bit field) and have resultant value <code>-1</code>.
+
Attempts to set a property with type {{DataType|Dimension}} outside these values will have predictable but generally undesirable results.  For example, incrementing a property of type {{DataType|Dimension}} already at '''M_MAX_DIM''' will cause that property to roll around (the 16-bit field) and have resultant value <code>-1</code>.
  
 
== [[SHIP Version 5|SHIPv5]] ==
 
== [[SHIP Version 5|SHIPv5]] ==
Line 21: Line 21:
  
 
In [[SHIP Version 5|SHIPv5]], attempts to set a property with type {{DataType|Dimension}} outside the permitted range will be clipped to the extremes, for example
 
In [[SHIP Version 5|SHIPv5]], attempts to set a property with type {{DataType|Dimension}} outside the permitted range will be clipped to the extremes, for example
  <code>box.ol = 32,768;</code>  
+
  <code>box.ol = 32,767;</code>  
  
will result in <code>box.ol</code> having the value of SHIP_DMAX.
+
will result in <code>box.ol</code> having the value of '''M_MAX_DIM'''.

Latest revision as of 12:01, 27 October 2016

See Also

Node

Data Type Description
Dimension A numeric type specifically within the pixel dimension range.

Dimensional properties such as ol are of type Dimension. Dimensions are similar to Short numbers, however the range is more limited.

SHIPv4

  • 0x8101, or -32,511 is the smallest number; many example projects have the explicit resource constant of M_MIN_DIM set to this value.
  • 0x7FFF, or +32,767 is the largest number; many example projects have the explicit resource constant of M_MAX_DIM set to this value.
  • 0x8000, or -32,768 is the "not a number" code, meaning this dimension is "unset"; ; many example projects have the explicit resource constant of M_NAN_DIM set to this value.

Attempts to set a property with type Dimension outside these values will have predictable but generally undesirable results. For example, incrementing a property of type Dimension already at M_MAX_DIM will cause that property to roll around (the 16-bit field) and have resultant value -1.

SHIPv5

The range for Dimension is under review for SHIPv5 Beta 2, and may be constrained to a 12-bit value from -2^11 to +2&11-1.

In SHIPv5, attempts to set a property with type Dimension outside the permitted range will be clipped to the extremes, for example

box.ol = 32,767; 

will result in box.ol having the value of M_MAX_DIM.