Class MFD
Display for general shipboard use.
Mimics a 16x52 DOS-esque terminal, because I like the aesthetic.
Yeah.
# That's rad.
Initialisation methods
For creating and Initialising MFD object.
-
MFD:new (_instanceName, _x, _y)
line 26
-
Creates a new intance of the MFD class.
Parameters:
- _instanceName
string
Name for the consoles and such. Should be identical to object's unique name.
- _x
int
X screen coordinate of MFD's top-left point.
- _y
int
Y screen coordinate of MFD's top-left point.
Returns:
table
A new instance of the MFD class.
Usage:
myMFD = MFD:new("myMFD",423,406)
-
self.container
line 35
-
The container that holds all of the things
-
self.console
line 46
-
The console itself
Notification methods
For drawing notifications on-screen.
-
MFD:notify (text, displayTime, fontSize[, bgColour[, fgColour]])
line 110
-
Raises an on-screen notification, with multiple options for styling.
Raises a notification on screen, centered in lower-middle.
Parameters:
- text
string
string The notification text to display.
- displayTime
int or float
int How many seconds to show the notification. 0 leaves notification indefinitely.
- fontSize
int
int The font size to use (default 12).
- bgColour
string
Colour to use for alert background. Defaults to MFD's current primary if not set.
(optional)
- fgColour
string
Colour to use for foreground text.
(optional)
Usage:
myMFD:notify("Testing...", 160, 50, 2, 12, "#004400", "yellow")
Page methods
Stuff for drawing full pages of text to the MFD screen in a single routine.
-
MFD:writeNavPage ()
line 190
-
Writes UACS and related data to the screen.
Usage:
myMFD:writeNavPage()
Query methods
Stuff for retrieving data to help us draw to the screen.
-
MFD:getColour ()
line 234
-
Retrieves current time of day from Time object, if present.
Defaults to green if no Time object.
Returns:
HTML colour string, depending on Time:isNight().
Usage:
html_colour = MFD:getColour()
Output methods
Stuff for outputting to the MFD screen.
-
MFD:cls ()
line 260
-
Resets and erases the entire screen, and readies for writing.
Clears the entirety of the consoles, and fills it with spaces so write functions can successfully locate.
Usage:
myMFD:cls() myMFD:drawBorder()
-
MFD:drawBorderNav (colour)
line 287
-
Draws a basic border around the edges of the screen, arranged for Nav page.
Will overwrite any text beneath the border!
Parameters:
- colour
string
[optional] Colour to draw border in, as HTML colour name.
Usage:
myMFD:drawBorderNav("forest_green")
-
MFD:setCursor (inputX, inputY, doBlink)
line 323
-
Places an underscore at the given X,Y with optional blinking.
Purely aesthetic, serves no functional purpose.
Parameters:
- inputX
- num X coordinate of cursor position.
- inputY
- num Y coordinate of cursor position.
- doBlink
- bool Blink cursor at the rate of cursorRate if true.
Usage:
myMFD:setCursor(25,12,true)
-
MFD:write (writeText, writeX, writeY, fgColour, bgColour)
line 339
-
Writes text to the MFD.
Writes text of arbitrary length, position, and colour to the MFD. Overwrites existing text for the length of the string.
Parameters:
- writeText
string
The text to be written to the MFD.
- writeX
int
X position of cursor, where text will be inserted. 0-51
- writeY
int
Y position of cursor, where text will be inserted. 0-15
- fgColour
string
Colour to be used for the text foreground colour, as HTML colour name.
- bgColour
string
Colour to be used for the text background colour, as HTML colour name.
Returns:
bool
True, if write successful.
Usage:
myMFD:write("Beginning Δcal routine...", 2, 2, "green", "dim_grey")