Skip to content

Instantly share code, notes, and snippets.

@ebobtron
Created April 25, 2015 15:53
Show Gist options
  • Select an option

  • Save ebobtron/b59fa6b0518346d4591c to your computer and use it in GitHub Desktop.

Select an option

Save ebobtron/b59fa6b0518346d4591c to your computer and use it in GitHub Desktop.
This is just the beginning sorry I am so quick sometimes.
I will always stop and discuss. Anytime.
/** make the brick wall **/
void createWall(int x){
infobrick[0] = createBrick( 10, 10, 30, 10, bO_DDGRAY, bO_RED);
}
/** make a brick **/
tHEBRICK createBrick(int x, int y, int length, int height,
COLORREF pen, COLORREF brush){
tHEBRICK abrick;
abrick.pen = pen;
abrick.brush = brush;
abrick.rcBrick.left = x;
abrick.rcBrick.top = y;
abrick.rcBrick.right= x + length;
abrick.rcBrick.bottom = y + height;
return abrick;
}
/** drawwall code I am experimenting with **/
/** note: it will only draw the frist brick **/
void drawWall(HDC hdc){
COLORREF lastpen = NULL;
COLORREF lastbrush = NULL;
SelectObject(hdc, GetStockObject(DC_PEN));
SelectObject(hdc, GetStockObject(DC_BRUSH));
lastpen = SetDCPenColor(hdc, infobrick[0].pen); // pen and brush come from global array infobrick[]
lastbrush = SetDCBrushColor(hdc, infobrick[0].brush);
Rectangle(hdc, // rectangle comes from global array infobrick[]
infobrick[0].rcBrick.left, // int nLeftRect
infobrick[0].rcBrick.top, // int nTopRect
infobrick[0].rcBrick.right, // int nRightRect
infobrick[0].rcBrick.bottom); // int nBottomRect
SetDCPenColor(hdc, lastpen);
SetDCBrushColor(hdc, lastbrush);
}
@TsukishirOSan
Copy link
Copy Markdown

I was going to use RECT* , like paddle, without the moving part, so is it a bad idea or go for a nested for lines/rows changing color for each line(that's a detail)?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment