C++绘制矩形位置
C++ draw rectangle position
我有我的类:
class Rectangle : public TwoDim
{
public:
void fun() {};
void printShape();
Rectangle(int x1, int y1, int height1, int width1)
{
x = x1;
y = y1;
height = height1;
width = width1;
}
};
以及打印它的功能:
void Rectangle::printShape()
{
{
cout << "+";
for (int i = 0; i < width - 2; i++)
{
cout << "-";
}
cout << "+n";
for (int i = 0; i < height - 2; i++)
{
cout << "|";
for (int j = 0; j < +width - 2; j++)
{
cout << " ";
}
cout << "|n";
}
cout << "+";
for (int i = 0; i < width - 2; i++)
{
cout << "-";
}
cout << "+n";
}
}
如何更改我的函数,以便从点(x, y)
开始绘制矩形?
多谢
我会在实际打印之前输出y
std::endl
s,然后在有效打印每一行之前输出x
" "
。
相关文章:
- 为什么我的点没有在 OpenGL 中绘制鼠标所在的位置?
- 在不同位置绘制多次glbatch
- QGraphicsScene项目在两次(x2)位置绘制
- SFML 将形状绘制到屏幕上的多个位置
- SFML参考窗口在绝对位置绘制
- 如何在 MFC 中围绕当前光标的位置绘制一个矩形
- (C++)在圆内夹紧 2D 位置(使用中点圆算法绘制)
- C++绘制矩形位置
- C++ SDL 根据鼠标位置绘制动态矩形
- 在3D世界中的显示器上固定位置绘制2D文本-OpenGL
- 如何将顶点位置传递给顶点着色器.我写了一个着色器,它不会在屏幕上绘制任何内容
- TMX问题,在正确位置绘制瓷砖(c++)
- 未在指定位置绘制的精灵
- OpenGL 形状仅在初始位置为 (0, 0, 0) 时绘制
- C++:如何在命令提示符的特定位置绘制ASCII字符
- 如何让OpenGL在我想要的位置绘制角色
- 绘制多个网格到不同的位置(DirectX 12)
- 如何使用opencv获取位置并绘制矩形
- OpenGL如何知道它应该基于GL_ARRAY_BUFFER绘制顶点到什么位置
- 无法在屏幕上的所需位置绘制矩形