DrawBorderBox(55, 20, 200, 50, 4, fontBlack, pDevice );
void Menu::DrawBorderBox( int x, int y, int w, int h, int thickness, D3DCOLOR Colour, LPDIRECT3DDEVICE9 pDevice)
{
//Top horiz line
DrawFilledRect( x, y, w, thickness, Colour, pDevice );
//Left vertical line
DrawFilledRect( x, y, thickness, h, Colour, pDevice );
//right vertical line
DrawFilledRect( (x + w), y, thickness, h, Colour, pDevice );
//bottom horiz line
DrawFilledRect( x, y + h, w+thickness, thickness, Colour, pDevice );
}
void Menu::DrawFilledRect(int x, int y, int w, int h, D3DCOLOR color, LPDIRECT3DDEVICE9 pDevice)
{
//We create our rectangle to draw on screen
D3DRECT BarRect = { x, y, x + w, y + h };
//We clear that portion of the screen and display our rectangle
pDevice->Clear(1, &BarRect, D3DCLEAR_TARGET | D3DCLEAR_TARGET, color, 0, 0);
}
输入的值在DrawBorderBox
中使用BarRect
,那么调用DrawFilledRect
不使用所有参数?那么BarRect
假设h
吗?
所以我得到 (55,20) 点 1 和 (255,70) 点 2?但这说它画了 1 条线?我很困惑。
我认为厚度在 BarRect 中被用作 h ???我说的对吗?这意味着它实际上会覆盖原始正方形的 4 个像素?