warning: not compiled
#define ROWS 50
#define COLS 50
void DrawGrid(HDC hdc, const RECT* rect)
{
for(int x = 0; x < COLS; x++)
{
MoveToEx(hdc, x, 0, NULL);
LineTo(hdc, x, rect->bottom);
}
for(int y = 0; y < ROWS; y++)
{
MoveToEx(hdc, 0, y, NULL);
LineTo(hdc, rect->right, y, NULL);
}
}
and some other not compiled code...
void HitTest(int x, int y, const RECT* rect, int *row, int *col)
{
*col = MulDiv(x, COLS, rect->right);
*row = MulDiv(y, ROWS, rect->bottom);
}
: I am creating a nice level editor for my game now, and I need to draw a 50x50 square grid in four of my child windows. How could I do this considering the fact that the window size could change on a different users computer? My current formula is below, but it will NOT work!
:
: RECT pr;
: GetClientRect(GetDlgItem(pwnd, ID_DATAVIEW), &pr);
:
: for(int loop = 1; loop < 51; loop++)
: {
: MoveToEx(screen, (pr.right / 50) * loop, 0, NULL);
: LineTo(screen, (pr.right / 50) * loop, pr.bottom);
: MoveToEx(screen, 0, (pr.bottom / 50) * loop, NULL);
: LineTo(screen, pr.right, (pr.bottom / 50) * loop);
: }
:
: I thought that would work, but it doesn't. Any ideas? Thanks to any and all who help.
:
: -Sephiroth
: