I have a user button ( 2 images) and am trying to implement the objTouched := img_Touched function but with out any success.
img_ClearAttributes(hndl, iUserbutton8, I_TOUCH_DISABLE);
img_Show(hndl,iUserbutton8); //display button
repeat
var touchx, touchy;
var touchState, objTouched;
touchState := touch_Get(TOUCH_STATUS);
objTouched := img_Touched(hndl, -1);
touchx := touch_Get(TOUCH_GETX);
touchy := touch_Get(TOUCH_GETY);
if(touchState == TOUCH_PRESSED)
if(objTouched == iUserbutton8)
img_SetWord(hndl, iUserbutton8, IMAGE_INDEX, 1); // if button touched the show pressed image
img_Show(hndl,iUserbutton8) ;
endif
else if(touchState == TOUCH_RELEASED);
if(objTouched == iUserbutton8)
img_SetWord(hndl,iUserbutton8, IMAGE_INDEX, 0); // if button release show unpressed image
img_Show(hndl,iUserbutton8) ;
break ;
endif
endif
I just cant get the objTouched := img_Touched to recognise my button being pressed
Comment