Need Help

closed account (Doj23TCk)
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;

col = x;
row = y;
}
not much information..
but taking a guess i would say

grid【row】【col】.m_origin_x=x;
grid【row】【col】.m_origin_y=y;
closed account (Doj23TCk)
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 = ;

}


}
Last edited on
closed account (Doj23TCk)
okay i got more
Last edited on
closed account (Doj23TCk)
hmmm
Last edited on
Topic archived. No new replies allowed.