How would i get this so i could click anywhere within the grid with this functions?
void CGrid::cellHit(int x, int y, int &row, int &col)
{
//fix it so that we correctly know which item is hit
//you have access to the following member variables
m_rows, m_cols;
m_origin_x, m_origin_y;//left, bottom grid
m_height, m_width;
void CGrid::cellHit(int x, int y, int &row, int &col)
{
//fix it so that we correctly know which item is hit
//you have access to the following member variables
/*
m_rows, m_cols;
m_origin_x, m_origin_y ;//left, bottom grid
m_height, m_width;
*/
col = -1;
row =- 1;
if( x > m_origin_x && y > m_origin_y && x <= m_origin_x + m_cols * m_width && y <= m_origin_y + m_rows * m_height)
{
col = ;
row = ;