|
Console Library 4.7.0
A header-only library that makes C++ simple
|
用于表示虚拟屏幕的类。 More...
#include <screen.h>
Public Member Functions | |
| Screen () | |
| 默认构造函数,构造一个空白的 Screen | |
| void | point (unsigned x, unsigned y, bool on=true) |
| 在屏幕上绘制一个点。 | |
| void | line (int x0, int y0, int x1, int y1, bool on=true) |
| 在屏幕上绘制一条直线。 | |
| void | rect (int x0, int y0, int x1, int y1, bool on=true) |
| 在屏幕上绘制空心矩形。 | |
| void | fillRect (int x0, int y0, int x1, int y1, bool on=true) |
| 在屏幕上绘制实心矩形。 | |
| void | circle (int cx, int cy, int r, bool on=true) |
| 在屏幕上绘制空心圆。 | |
| void | fillCircle (int cx, int cy, int r, bool on=true) |
| 在屏幕上绘制实心圆。 | |
| void | clear () |
| 清空屏幕。 | |
| void | update (std::ostream &os=std::cout, bool clear=false) const |
| 将 Screen 存储的虚拟屏幕输出到指定流。 | |
用于表示虚拟屏幕的类。
使用八点位位盲文,每像素占用一比特位存储空间。
| COLS | 列数,必须是 2 的倍数。 |
| ROWS | 行数,必须是 4 的倍数。 |
|
inline |
默认构造函数,构造一个空白的 Screen
|
inline |
在屏幕上绘制空心圆。
Bresenham 中点圆算法,效率通常足够。
| cx | 圆中点的 x 坐标。 |
| cy | 中点的 y 坐标。 |
| r | 圆的半径。 |
| on | 绘制 or 擦除? |
|
inline |
清空屏幕。
|
inline |
在屏幕上绘制实心圆。
基于中点圆的扫描线填充算法,效率通常足够。
| cx | 圆中点的 x 坐标。 |
| cy | 中点的 y 坐标。 |
| r | 圆的半径。 |
| on | 绘制 or 擦除? |
|
inline |
在屏幕上绘制实心矩形。
仅调用若干次 point,效率通常足够。
| x0 | 点 A 的 x 坐标。 |
| y0 | 点 A 的 y 坐标。 |
| x1 | 点 B 的 x 坐标。 |
| y1 | 点 B 的 y 坐标。 |
| on | 绘制 or 擦除? |
|
inline |
在屏幕上绘制一条直线。
Bresenham 画线算法,效率通常足够。
| x0 | 起始点的 x 坐标。 |
| y0 | 起始点的 y 坐标。 |
| x1 | 终止点的 x 坐标。 |
| y1 | 终止点的 y 坐标。 |
| on | 绘制 or 擦除? |
|
inline |
在屏幕上绘制一个点。
| x | 点的 X 坐标,向右为正。 |
| y | 点的 y 坐标,向下为正。 |
| on | 绘制 or 擦除? |
< 静默忽略,就当画在外边了
|
inline |
在屏幕上绘制空心矩形。
仅调用 4 次 line,效率通常足够。
| x0 | 点 A 的 x 坐标。 |
| y0 | 点 A 的 y 坐标。 |
| x1 | 点 B 的 x 坐标。 |
| y1 | 点 B 的 y 坐标。 |
| on | 绘制 or 擦除? |
|
inline |
将 Screen 存储的虚拟屏幕输出到指定流。
内部使用临时字符串减少输出次数,减少 IO 导致的效率问题。
| os | 发送到的输出流。 |