nimbusinator.command.Command¶
-
class
nimbusinator.command.
Command
(nimbus)¶ Nimbus commands
This class contains the commands to control the Nimbus display. The commands mimick the syntax found in RM Basic but re-written Pythonically. In creating an object of this class it must be bound to a pre-existing Nimbus object. It is highly recommended to read the original Nimbus manuals (particularly RM Basic) to get a deeper understanding of how these commands originally worked.
Parameters: nimbus (Nimbus) – The Nimbus object to bind to -
area
(coord_list, brush=None, scale=1)¶ Draw a filled polygon
Parameters: - coord_list (list) – A list of (x, y) tuples
- brush (int, optional) – Colour value (High-resolution: 0-3, low-resolution: 0-15)
- scale (int, optional) – Scale factor. To elongate pass a tuple (x_size, y_size)
-
ask_brush
()¶ Return the current brush colour
Returns: int
-
ask_charset
()¶ Return the current charset for text
0 is the standard font, 1 is the other font
Returns: int
-
ask_curpos
()¶ Gets the current cursor position as column index, row index
Returns: (int, int)
-
ask_paper
()¶ Return the current paper colour
Returns: int
-
ask_pen
()¶ Return the current pen colour
Returns: int
-
ask_plot_font
()¶ Return the current plot_font
0 is the standard font, 1 is the other font
Returns: int
-
ask_points_style
()¶ Gets the current points style
Returns: int
-
circle
(radius, coord_list, brush=None)¶ Draw one or more circles
Parameters: - radius (int) – The radius of the circle
- coord_list (list) – A list of (x, y) tuples
- brush (int, optional) – Colour value (High-resolution: 0-3, low-resolution: 0-15)
-
cls
()¶ Clear the screen of all text and graphics and reset cursor position
-
fetch
(block_number, filename)¶ Fetch an image from disk and allocate it to an image block
Equivalent to FETCH in the ANIMATE extension. All major image formats are supported but in this loading images with alpha layers may break. It is also advisable to resize your image to fit the Nimbus screen mode using an image editor beforehand.
Parameters: - block_number (int) – The block number to store the image in
- filename (str) – The filename of the image to fetch
-
flush
()¶ Clears the keyboard buffer
-
gets
()¶ Get the oldest char in the keyboard buffer
Equivalent to GET$ in RM Basic except it will also return the following values if a control key is pressed: ‘__F1__’, ‘__F2__’, … , ‘__F10__’, ‘__CTRL_L__’, ‘__CTRL_R__’, ‘__ENTER__’, ‘__BACKSPACE__’, ‘__ESC__’, ‘__DELETE__’, ‘__HOME__’, ‘__PAGE_UP__’, ‘__END__’, ‘__PAGE_DOWN__’, ‘__INSERT__’, ‘__UP__’, ‘__DOWN__’, ‘__LEFT__’, ‘__RIGHT__’, ‘__TAB__’
Returns: str
-
input
(prompt)¶ Collects keyboard input until user presses ENTER then returns the input as a string
Parameters: prompt (str) – Message to be printed Returns: str
-
line
(coord_list, brush=None)¶ Draw one or more connected straight lines
Parameters: - coord_list (list) – A list of (x, y) tuples
- brush (int, optional) – Colour value (High-resolution: 0-3, low-resolution: 0-15)
-
plonk_logo
(coord)¶ Plonk the RM Nimbus logo on screen
Parameters: coord (tuple) – The (x, y) position to plonk the logo
-
plot
(text, coord, size=1, brush=None, direction=0, font=None)¶ Plot text on the screen
Parameters: - text (str) – The text to be plotted
- coord (tuple) – The (x, y) position of the text
- size (int, optional) – Font size. To elongate pass a tuple (x_size, y_size)
- brush (int, optional) – Brush colour
- direction (int, optional) – 0=normal, 1=-90deg, 2=180deg, 3=-270deg
- font (int, optional) – 0 is the standard font, 1 is the other font
-
points
(coord_list, brush=None, size=1, style=None)¶ Draw points on the screen
Parameters: - coord_list (list) –
- coord_list – A list of (x, y) tuples
- brush (int, optional) – Colour value (High-resolution: 0-3, low-resolution: 0-15)
- size (int, optional) – Font size. To elongate pass a tuple (x_size, y_size)
- style (int, optional) – The points style number (0 255)
-
print
(text)¶ Print a string with carriage return at end
Parameters: text (str) – The text to be printed
-
put
(ascii_data)¶ Put a single character or string at the current cursor position
Parameters: ascii_data (int/str) – If an int is passed the corresponding ASCII character will be plotted. If a string is passed then the string will be printed without a terminating carriage return.
-
set_border
(colour)¶ Set the border colour
Parameters: colour (int) – Colour value (High-resolution: 0-3, low-resolution: 0-15)
-
set_brush
(colour)¶ Set the brush colour
Parameters: colour (int) – Colour value (High-resolution: 0-3, low-resolution: 0-15)
-
set_charset
(charset)¶ Set the charset for text
Parameters: charset (int) – 0 is the standard font, 1 is the other font!
-
set_colour
(colour1, colour2)¶ Set a colour to a new colour
Parameters: - colour1 (int) – The colour code to be changed
- colour2 (int) – The new colour to be assigned to colour1
-
set_curpos
(cursor_position)¶ Set the cursor position
Parameters: cursor_position (tuple) – The new cursor position (column, row)
-
set_cursor
(flag)¶ Show or hide cursor
Parameters: flag (boolean) – True to show cursor, False to hide
-
set_mode
(columns)¶ Select either high-resolution or low-resolution screen mode
In RM Basic the screen resolution was set by the number of columns: 40 for low-resolution and 80 for high-resolution. Any other values had no effect. Nimbusinator is more strict and will yield an error if any other values are entered. Check the original RM Basic manual for a description of how screen resolutions worked on the Nimbus.
MODE 40: 40 columns, 25 rows; 320 pixels wide, 250 pixels high; 16 colours
MODE 80: 80 columns, 25 rows; 640 pixels wide, 250 pixels high (but doubled along vertical axis); 4 colours
Parameters: columns (int) – The number of colums (40 or 80)
-
set_paper
(colour)¶ Set the paper colour
Parameters: colour (int) – Colour value (High-resolution: 0-3, low-resolution: 0-15)
-
set_pen
(colour)¶ Set the pen colour
Parameters: colour (int) – Colour value (High-resolution: 0-3, low-resolution: 0-15)
-
set_plot_font
(plot_font)¶ Set the plot font
Parameters: plot_font (int) – 0 is the standard font, 1 is the other font!
-
set_points_style
(points_style, points_list)¶ Set a points style to that define in a points list
You can define up to 256 points styles (0 - 255). The points list is similar to the way patterns are define in RM Basic. Each row in the points style is define by a string, with full-stop chars (.) indicating a filled pixel, and spaces ( ) indicating a filled pixel. The size of a points style is 8x8 pixels.
Parameters: - points_style (int) – The points style number (0 255)
- points_list (list) – The points list as defined above
-
slice_
(radius, from_angle, to_angle, coord_list, brush=None)¶ Draw one or more pie slices
Parameters: - radius (int) – The radius of the slice
- from_angle (int) – The starting angle (degrees)
- to_angle (int) – The finishing angle (degrees)
- coord_list (list) – A list of (x, y) tuples
- brush (int, optional) – Colour value (High-resolution: 0-3, low-resolution: 0-15)
-
writeblock
(block_number, coord)¶ Write an image block to the screen
Equivalent to WRITEBLOCK in the ANIMATE extension. Alpha layers are not yet supported - see documentation for fetch command.
Parameters: - block_number (int) – The block number of the image block
- coord (tuple) – The (x, y) position of the image
-