FORUM CLOSED, PLEASE REGISTER AT FORUM.SIO2INTERACTIVE.COM
Would you like to react to this message? Create an account in a few clicks or log in to continue.

SIO2Widget _SIO2widgettap and _SIO2widgettouchmove issue

2 posters

Go down

SIO2Widget _SIO2widgettap and _SIO2widgettouchmove issue Empty SIO2Widget _SIO2widgettap and _SIO2widgettouchmove issue

Post  uprise78 Sat Dec 27, 2008 6:35 pm

I am working on a full options menu system to be integrated into the SDK and ran across a small issue with SIO2Widget. I wanted to add different images for when the widget it activated on touch down but if a touch down occurs and then a touch move slides outside of the widget the widget stays activated. Does anyone have a workaround or addition of something like _SIO2widgettouchupoutside? I basically just need some way to deactivate the widget when the user slider his/her finger off of the widget.

uprise78

Posts : 228
Join date : 2008-10-31

Back to top Go down

SIO2Widget _SIO2widgettap and _SIO2widgettouchmove issue Empty Re: SIO2Widget _SIO2widgettap and _SIO2widgettouchmove issue

Post  sio2interactive Sat Dec 27, 2008 6:54 pm

What Im doing is this under:

_SIO2widget->_SIO2widgettap = on_info_button_tap;


Code:


void on_info_button_tap( void         *_SIO2widget,
                   void         *_SIO2window,
                   unsigned char  _state )
{
   // Get the widget handle
   SIO2widget *ptr = ( SIO2widget * )_SIO2widget;

   // If we got a tap up
   if( _state == SIO2_WINDOW_TAP_UP )
   {
      // Restore the original info button texture
      ptr->_SIO2material->_SIO2image[ SIO2_MATERIAL_CHANNEL0 ] = sio2ResourceGetImage( sio2->_SIO2resource,
                                                                   "info_button" );
   
      // Hide / Show the info screen
      info_screen = !info_screen;
   }
   else
   {   
      // Assign the pressed texture on the info button.
      ptr->_SIO2material->_SIO2image[ SIO2_MATERIAL_CHANNEL0 ] = sio2ResourceGetImage( sio2->_SIO2resource,
                                                                   "info_button_g" );
   
   }
}

sio2interactive
sio2interactive

Posts : 1526
Join date : 2008-08-26
Age : 44
Location : Shanghai

http://sio2interactive.com

Back to top Go down

SIO2Widget _SIO2widgettap and _SIO2widgettouchmove issue Empty Re: SIO2Widget _SIO2widgettap and _SIO2widgettouchmove issue

Post  uprise78 Sat Dec 27, 2008 7:25 pm

I am doing something a bit different. I am trying to have a different image for the activated state to provide some feedback that the object is being pressed. The issue pops up when a SIO2_WINDOW_TAP_DOWN gets called then the user moves their finger outside of the widget and then lifts there finger. The SIO2_WINDOW_TAP_UP never gets called. Any workarounds?

Code:
void onWidgetDotTap( void *_ptr1, void *_ptr2, unsigned char _state )
{
   SIO2widget *touchedWidget = ( SIO2widget* )_ptr1;
   
   // If the widget is enabled, show the Up image
   if( _state == SIO2_WINDOW_TAP_DOWN )
   {
      touchedWidget->_SIO2material->_SIO2image[ SIO2_MATERIAL_CHANNEL0 ] = _SIO2imageDotDown;
   }
   else if( _state == SIO2_WINDOW_TAP_UP )
   {
      touchedWidget->_SIO2material->_SIO2image[ SIO2_MATERIAL_CHANNEL0 ] = _SIO2imageDot;
   }
}

uprise78

Posts : 228
Join date : 2008-10-31

Back to top Go down

SIO2Widget _SIO2widgettap and _SIO2widgettouchmove issue Empty Re: SIO2Widget _SIO2widgettap and _SIO2widgettouchmove issue

Post  sio2interactive Sat Dec 27, 2008 9:23 pm

Maybe try to check the SIO2_WIDGET_ACTIVATED state, it occurs when a widget is tap down / tap up or over... if this state is off it means that the users is not anywhere around it...

There's also the state SIO2_WIDGET_SELECTED that occurs when the user click down and is reset when the user release...
sio2interactive
sio2interactive

Posts : 1526
Join date : 2008-08-26
Age : 44
Location : Shanghai

http://sio2interactive.com

Back to top Go down

SIO2Widget _SIO2widgettap and _SIO2widgettouchmove issue Empty Re: SIO2Widget _SIO2widgettap and _SIO2widgettouchmove issue

Post  uprise78 Sat Dec 27, 2008 11:43 pm

I have tried both the SIO2_WIDGET_ACTIVATED and the SIO2_WIDGET_SELECTED but there is no event for when SIO2_WIDGET_ACTIVATED is disabled. The only way to reliably create a widget with one image for the untouched state and one for the touched state is to monitor the SIO2_WIDGET_ACTIVATED and SIO2_WIDGET_SELECTED state in the render loop.

So, to sum up the possible scenarios:

User touches down and then up:
- SIO2_WIDGET_SELECTED toggles on and then off
- SIO2_WIDGET_ACTIVATED goes on and stays on

User touches down and then moves off of the widget and than releases the touch:
- SIO2_WIDGET_SELECTED goes on and stays on
- SIO2_WIDGET_ACTIVATED toggles on and then off

Is there a need for both SIO2_WIDGET_SELECTED and SIO2_WIDGET_ACTIVATED? Perhaps they can be combined...

Perhaps in addition to the _SIO2widgettap and _SIO2widgettouchmoved events there could be an event and associated flag for user_activated (SIO2_WIDGET_USER_ACTIVATED). The flag would be defined as user_activated is enabled only if there is a touch down on the widget itself. At any point that the user moves their finger off of the widget the flag is disabled. An event with a callback function (_SIO2widgetactivated) can be fired with the current state of user_activated whenever it changes. So, it would be fired on touch down as enabled, then on either touch up or when touches moved outside of the bounds of the widget it could be fired as disabled.

What do you think?

uprise78

Posts : 228
Join date : 2008-10-31

Back to top Go down

SIO2Widget _SIO2widgettap and _SIO2widgettouchmove issue Empty Re: SIO2Widget _SIO2widgettap and _SIO2widgettouchmove issue

Post  sio2interactive Sun Dec 28, 2008 6:13 pm

You are totally right something doesn't add up here... I put that on my TODO list of fixes for v1.3.2, I'll check what is the best workflow and will keep you posted...

Cheers,
sio2interactive
sio2interactive

Posts : 1526
Join date : 2008-08-26
Age : 44
Location : Shanghai

http://sio2interactive.com

Back to top Go down

SIO2Widget _SIO2widgettap and _SIO2widgettouchmove issue Empty Re: SIO2Widget _SIO2widgettap and _SIO2widgettouchmove issue

Post  Sponsored content


Sponsored content


Back to top Go down

Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum