Widget _SIO2widgettapdown area

View previous topic View next topic Go down

Widget _SIO2widgettapdown area

Post  jonusx on Fri Mar 27, 2009 10:58 am

I'm having trouble with the tap area of my widget. I have to set the widget area to a large amount to register a tap. It actually doesn't even use the widget as the area for the bounds. I have to tap the right side of the screen. If I tap the widget itself, nothing happens. Also my widget image is very dark, is there any way to brighten it up? Any help will be greatly appreciated. Thanks!!!

jonusx

Posts : 16
Join date : 2009-03-13

View user profile

Back to top Go down

Re: Widget _SIO2widgettapdown area

Post  sw on Fri Mar 27, 2009 12:17 pm

jonusx wrote:I'm having trouble with the tap area of my widget. I have to set the widget area to a large amount to register a tap. It actually doesn't even use the widget as the area for the bounds. I have to tap the right side of the screen. If I tap the widget itself, nothing happens. Also my widget image is very dark, is there any way to brighten it up? Any help will be greatly appreciated. Thanks!!!

step 1. after you rendered all other object.
step 2. then diable the lamp,
step 3. and render your widget
avatar
sw

Posts : 73
Join date : 2008-10-12

View user profile

Back to top Go down

Re: Widget _SIO2widgettapdown area

Post  jonusx on Fri Mar 27, 2009 12:46 pm

That worked for the dark widget, I didn't know that widgets were effected by lighting. Thanks! I did find out whats causing my other problem, the widget bounds are working properly as I found out from debug_widget. My touch coordinates are wrong for some reason. My y-axis is moving the opposite way. I don't know whats causing it. Anyone know how to fix that?

jonusx

Posts : 16
Join date : 2009-03-13

View user profile

Back to top Go down

Re: Widget _SIO2widgettapdown area

Post  uprise78 on Fri Mar 27, 2009 1:10 pm

landscape will flip your x/y coors.

uprise78

Posts : 228
Join date : 2008-10-31

View user profile

Back to top Go down

Re: Widget _SIO2widgettapdown area

Post  jonusx on Fri Mar 27, 2009 1:32 pm

Its actually just the y coords. When I move up, the touch circle moves down and vice versa. The x coords are fine. I don't know why its flipped. In the console it shows the correct y coords, but sio2 is flipping the y. I don't get it.

jonusx

Posts : 16
Join date : 2009-03-13

View user profile

Back to top Go down

Re: Widget _SIO2widgettapdown area

Post  uprise78 on Fri Mar 27, 2009 1:39 pm

you might have landscape left instead of landscape y as your orientation??

uprise78

Posts : 228
Join date : 2008-10-31

View user profile

Back to top Go down

Re: Widget _SIO2widgettapdown area

Post  jonusx on Fri Mar 27, 2009 1:52 pm

What do you mean by that? My app is in portrait mode and I only called sio2WindowEnter2D

jonusx

Posts : 16
Join date : 2009-03-13

View user profile

Back to top Go down

Re: Widget _SIO2widgettapdown area

Post  sio2interactive on Fri Mar 27, 2009 5:09 pm

Check in EAGLview.mm:

Example:

Code:



- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
   UITouch *touch;
   CGPoint pos;
   
   sio2->_SIO2window->n_touch = 0;
   
   for( touch in touches )
   {
      pos = [ touch locationInView:self ];

                // This is why the touch x & y is flipped...
      sio2->_SIO2window->touch[ sio2->_SIO2window->n_touch ].x = pos.y;
      sio2->_SIO2window->touch[ sio2->_SIO2window->n_touch ].y = pos.x;
      
      ++sio2->_SIO2window->n_touch;
   }      
   
   sio2->_SIO2window->n_tap = [ [ touches anyObject ] tapCount ];
   
   sio2ResourceDispatchEvents( sio2->_SIO2resource,
                        sio2->_SIO2window,
                        SIO2_WINDOW_TAP,
                        SIO2_WINDOW_TAP_DOWN );
}

The tutorials are mostly running in landscape mode, if you are in portrait, just switch back the x & y on the touches functions.

_________________
SIO2 Interactive
Free Open Source 3D Game Engine for iPhone and iPod Touch
http://sio2interactive.com
avatar
sio2interactive

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

View user profile http://sio2interactive.com

Back to top Go down

Re: Widget _SIO2widgettapdown area

Post  jonusx on Fri Mar 27, 2009 5:34 pm

I actually did switch touchesEnded, touchesMoved, and touchesBegan to that and the y is still flipped. Does blender export have anything to do with it?

jonusx

Posts : 16
Join date : 2009-03-13

View user profile

Back to top Go down

Re: Widget _SIO2widgettapdown area

Post  sio2interactive on Fri Mar 27, 2009 6:00 pm

Have you called:

sio2ResourceUpdateAllWidgetBoundaries( sio2->_SIO2resource,
sio2->_SIO2window );

This will calculate / refresh the screen bounds (the pickable area in screen) of every widgets that are visible & enabled...

_________________
SIO2 Interactive
Free Open Source 3D Game Engine for iPhone and iPod Touch
http://sio2interactive.com
avatar
sio2interactive

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

View user profile http://sio2interactive.com

Back to top Go down

Re: Widget _SIO2widgettapdown area

Post  jonusx on Fri Mar 27, 2009 6:08 pm

The problem seems to be just the y-axis. Say my widget is at the top of the screen at the center. If I tap the bottom center of the screen, the widget is tapped. The widget bounds are working and so is the x-axis, as I've seen from using
sio2WidgetDebug( ); and sio2WindowDebugTouch( sio2->_SIO2window );. The touch pointer follows the x-axis properly but the y axis is flipped. The coords are correct as shown by showing printf("x:%f y:%f\n", sio2->_SIO2window->touch[ 0 ].x, sio2->_SIO2window->touch[ 0 ].y ); in the console. The console will show y: 470 but the debug touch location will be at the top of the screen. I just don't get it

jonusx

Posts : 16
Join date : 2009-03-13

View user profile

Back to top Go down

Re: Widget _SIO2widgettapdown area

Post  sio2interactive on Fri Mar 27, 2009 6:42 pm

Ok so just do like:

sio2->_SIO2window->touch[ 0 ].y = sio2->_SIO2window->scl.y - sio2->_SIO2window->touch[ 0 ].y;

_________________
SIO2 Interactive
Free Open Source 3D Game Engine for iPhone and iPod Touch
http://sio2interactive.com
avatar
sio2interactive

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

View user profile http://sio2interactive.com

Back to top Go down

Re: Widget _SIO2widgettapdown area

Post  jonusx on Fri Mar 27, 2009 10:18 pm

that worked great, thanks! I'm still wondering why its reversed in the first place...

jonusx

Posts : 16
Join date : 2009-03-13

View user profile

Back to top Go down

Re: Widget _SIO2widgettapdown area

Post  _-MADMAN-_ on Mon May 25, 2009 3:24 pm

Okey, have the same problem. My application is in landscape mode, so x,y are flipped in EAGLView - as in tut7, but there is still problem with flipped axis. When I set x=x and y=y only x works well (x in landscape, so y in portrait), but second axis still have reversed value. Have tried to set y to -y, but marker disappear with that value. What tut7 have that my app don't? Just for test I replaced sio2_widget and EAGLView with files from tutorial, but nothing happend.

_-MADMAN-_

Posts : 52
Join date : 2009-04-23

View user profile

Back to top Go down

Re: Widget _SIO2widgettapdown area

Post  sio2interactive on Mon May 25, 2009 5:17 pm

Check tutorial04, Im showing how to switch the controls between a landscape & portrait mode... simply double tap on the screen to invert.

_________________
SIO2 Interactive
Free Open Source 3D Game Engine for iPhone and iPod Touch
http://sio2interactive.com
avatar
sio2interactive

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

View user profile http://sio2interactive.com

Back to top Go down

Re: Widget _SIO2widgettapdown area

Post  _-MADMAN-_ on Tue May 26, 2009 7:14 am

No no - You missed understand me. I do not want to switch between landscape and portrait, I'm always in landscape mode. I'm not using templetascreentap and touch - only accelerometer and widgets. Everything is ok except of windowdebugtouch dot. If I want tap my widget I have to tap opposite corner of the screen (becouse x and y are always wrong). I see that tutorial 7 don't have this problem and I cant figure out why?

EDIT: As always stiupid mistake - I forgot about sio2WindowEnterLandscape2D.

_-MADMAN-_

Posts : 52
Join date : 2009-04-23

View user profile

Back to top Go down

Re: Widget _SIO2widgettapdown area

Post  Sponsored content


Sponsored content


Back to top Go down

View previous topic View next topic Back to top

- Similar topics

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