OurOS 0.1
Operating System built by McGill Students
 
Loading...
Searching...
No Matches
console.h
Go to the documentation of this file.
1#ifndef CONSOLE_H
2#define CONSOLE_H
3
4#include <stdint.h>
5#include "color.h"
6
7/**
8 * @brief Redraws a character.
9 *
10 * @param row The row.
11 * @param col The column.
12 */
14
15/**
16 * @brief Refreshes the console's screen.
17 */
18void crefresh(void);
19
20/**
21 * @brief Clears the console's screen.
22 *
23 * @param color Background color. */
24void cclear(color_t color);
25
26/**
27 * @brief Clears a cell.
28 *
29 * @param row The row.
30 * @param col The column.
31 * @param color Background color. */
33
34/**
35 * @brief Clears the cell at the cursor's position.
36 *
37 * @param color Background color.
38 */
39void cclearcurchar(color_t color);
40
41/**
42 * @brief Moves the cursor by an offset.
43 *
44 * @param rows Number of rows.
45 * @param cols Number of columns.
46 */
47void cmovecursor(int32_t rows, int32_t cols);
48
49/**
50 * @brief Prints a string to the console, without a newline.
51 *
52 * @param str String to be printed. Must be null-terminated.
53 * @param color Foreground color.
54 */
55void cprint(const char *str, color_t color);
56
57/**
58 * @brief Prints a string to the console followed by a newline.
59 *
60 * @param str String to be printed. Must be null-terminated.
61 * @param color Foreground color of the text.
62 */
63void cprintln(const char *str, color_t color);
64
65/**
66 * @brief Prints a character at the cursor's position in the given color.
67 *
68 * @param c Character to be written.
69 * @param color Foreground color of the text.
70 */
71void cputchar(char c, color_t color);
72
73/**
74 * @brief Writes an integer in base 10 at the cursor's position in the given color.
75 *
76 * @param i Integer to be written.
77 * @param color Foreground color of the text. */
78void cputint(int i, color_t color);
79
80/**
81 * @brief Resets the cursor's position.
82 */
83void crcursor(void);
84
85/**
86 * @brief Sets the cursor's position.
87 *
88 * @param row The row.
89 * @param col The column.
90 */
92
93/**
94 * @brief Sets the cursor's column.
95 *
96 * @param col Column
97 */
98void csetcol(int32_t col);
99
100/**
101 * @brief Sets the cursor's row.
102 *
103 * @param row Row.
104 */
105void csetrow(int32_t row);
106
107/**
108 * @brief Gets the cursor's column.
109 *
110 * @returns Column.
111 */
112uint32_t cgetcol(void);
113
114/**
115 * @brief Gets the cursor's row.
116 *
117 * @returns Row.
118 */
119uint32_t cgetrow(void);
120
121#endif // CONSOLE_H
uint32_t color_t
Represents a color.
Definition color.h:18
static uint8_t row
Definition console.c:28
static uint8_t col
Definition console.c:28
void csetcol(int32_t col)
Sets the cursor's column.
Definition console.c:169
void crcursor(void)
Resets the cursor's position.
Definition console.c:153
void cclear(color_t color)
Clears the console's screen.
Definition console.c:86
void csetrow(int32_t row)
Sets the cursor's row.
Definition console.c:162
void cputchar(char c, color_t color)
Prints a character at the cursor's position in the given color.
Definition console.c:123
void cprint(const char *str, color_t color)
Prints a string to the console, without a newline.
Definition console.c:106
void cclearcurchar(color_t color)
Clears the cell at the cursor's position.
Definition console.c:102
void crefresh(void)
Refreshes the console's screen.
Definition console.c:78
void cputint(int i, color_t color)
Writes an integer in base 10 at the cursor's position in the given color.
Definition console.c:145
void cclearchar(uint32_t row, uint32_t col, color_t color)
Clears a cell.
Definition console.c:96
void credrawchar(uint32_t row, uint32_t col)
Redraws a character.
Definition console.c:65
void cmovecursor(int32_t rows, int32_t cols)
Moves the cursor by an offset.
Definition console.c:113
uint32_t cgetcol(void)
Gets the cursor's column.
Definition console.c:176
void csetcursor(uint32_t row, uint32_t col)
Sets the cursor's position.
Definition console.c:157
uint32_t cgetrow(void)
Gets the cursor's row.
Definition console.c:180
void cprintln(const char *str, color_t color)
Prints a string to the console followed by a newline.
Definition console.c:118
int int32_t
Definition stdint.h:11
unsigned int uint32_t
Definition stdint.h:6