NumericDisplay element (used with Interface module)
Description:
This element adds a numeric display to an interface. This is an object that can display digits in various fonts, and is much faster and easier than re-writing layers with new digits.
To use:
The code for this element is included in the interface module, linked as follows:
<script language="Javascript" src="gamelib_interface.js"></script>
You then instantiate a NumericDisplay object by adding the following to your script:
myDisplay=new In_NumericDisplay(50,50,6,1);
The four arguments are x,y (position), number of digits, and finally the font face. There are currently 10 faces, each on 2 transparent backgrounds. Faces 0-9 are aliased against black and 10-19 are aliased against white.
List of methods for NumericDisplay
getValue
reset
setResetValue
setValue
Descriptions of methods for NumericDisplay
Method | Parameters | Description |
---|---|---|
getValue | (none) | Returns the current value displayed by the numericDisplay. If the display doesn't have enough digits to display the number, this will still reflect the true value. |
reset | (none) | Resets the numericDisplay to its current reset value (0 by default) You can change the reset value using the setResetValue method. |
setResetValue | Numeric | Sets the reset value. When the reset method is called, the display will be set to this number. |
setValue | Numeric | Sets the value of the display. If the display does not have enough digits to show the whole number, then it will display the last x digits. So if the display had 3 digits, and you tried to display "1234", then the display would show "234". |