Screen Class
Description
The Screen class provides methods for drawing on the console screen in the game engine.
Methods
DrawCell(cell: Vector2Int, color: ConsoleColor): void
: Draws a single cell on the console screen with the specified color.DrawRenderer(cell: Vector2Int, color: ConsoleColor): void
: Draws a renderer on the console screen with the specified color.GetCellBackgroundColor(cell: Vector2Int): ConsoleColor
: Retrieves the background color of a cell on the console screen.DrawBackgroundRect(position: Vector2, bounds: Rect, color: ConsoleColor, character: string, rotation: number = 0): void
: Draws a rectangular shape on the console screen with the specified color, character, and rotation.
Usage
To use the Screen class, you can call its methods to draw and retrieve information from the console screen. Here's an example:
// Drawing a cell on the console screen
Vector2Int cell = new Vector2Int(10, 5);
ConsoleColor color = ConsoleColor.Red;
Screen.DrawCell(cell, color);
// Drawing a renderer on the console screen
Vector2Int renderer = new Vector2Int(20, 10);
ConsoleColor rendererColor = ConsoleColor.Green;
Screen.DrawRenderer(renderer, rendererColor);
// Retrieving the color of a cell
ConsoleColor backgroundColor = Screen.GetCellBackgroundColor(cell);
// Drawing a background rectangle on the console screen
Vector2Int position = new Vector2Int(30, 15);
Rect bounds = new Rect(5, 3);
ConsoleColor rectColor = ConsoleColor.Blue;
string character = "#";
int rotation = 45;
Screen.DrawBackgroundRect(position, bounds, rectColor, character, rotation);