It is, I will post my real code for clarity.
heres the function thats starting from
Code:
void menus::Mouse(short type, int x, int y) {
float *sel = new float[3];
glh.Selectf(sel);
if(glh.Checkf(sel,skm_btn->col)) battle.Start();
if(glh.Checkf(sel,ted_btn->col)) ted.Start();
delete[] sel;
}
void glhs::Selectf(float sel[]) {
float r,g,b;
if(selectmode == false) {
display(GLH_SELECT);
selectmode = true;
}
glReadPixels(curx,tempy,1,1,GL_RED,GL_FLOAT,&r);
glReadPixels(curx,tempy,1,1,GL_GREEN,GL_FLOAT,&g);
glReadPixels(curx,tempy,1,1,GL_BLUE,GL_FLOAT,&b);
sel[0] = r;
sel[1] = g;
sel[2] = b;
}
bool glhs::Checkf(float *sel, float *colors) {
bool stater = false, stateg = false, stateb = false;
if(sel[0] > colors[0]-0.049 && sel[0] < colors[0]+0.049) stater = true;
if(sel[1] > colors[1]-0.049 && sel[1] < colors[1]+0.049) stateg = true;
if(sel[2] > colors[2]-0.049 && sel[2] < colors[2]+0.049) stateb = true;
if(stater == true && stateg == true && stateb == true) return true;
else return false;
}
I know that the r,g,b variables int selectf have the right values, but those values never make it to the checkf function? I can make it work without arrays, but I really want to use them here.