0
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?但是這說它畫了一條線?我很困惑。
我認爲厚度被用作BarRect中的h?我是對的嗎? 這意味着它實際上會覆蓋原始方塊的4個像素?
按照慣例,變量和函數名應該以小寫字母開頭,順便說一句。 –
@AndrewMarshall C++中沒有約定 – Pubby
或者說,有數百個約定。你指的是哪一個? –