Widget _SIO2widgettapdown area
5 posters
Widget _SIO2widgettapdown area
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
Re: Widget _SIO2widgettapdown area
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
sw- Posts : 73
Join date : 2008-10-12
Re: Widget _SIO2widgettapdown area
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
Re: Widget _SIO2widgettapdown area
landscape will flip your x/y coors.
uprise78- Posts : 228
Join date : 2008-10-31
Re: Widget _SIO2widgettapdown area
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
Re: Widget _SIO2widgettapdown area
you might have landscape left instead of landscape y as your orientation??
uprise78- Posts : 228
Join date : 2008-10-31
Re: Widget _SIO2widgettapdown area
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
Re: Widget _SIO2widgettapdown area
Check in EAGLview.mm:
Example:
The tutorials are mostly running in landscape mode, if you are in portrait, just switch back the x & y on the touches functions.
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.
Re: Widget _SIO2widgettapdown area
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
Re: Widget _SIO2widgettapdown area
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...
sio2ResourceUpdateAllWidgetBoundaries( sio2->_SIO2resource,
sio2->_SIO2window );
This will calculate / refresh the screen bounds (the pickable area in screen) of every widgets that are visible & enabled...
Re: Widget _SIO2widgettapdown area
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
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
Re: Widget _SIO2widgettapdown area
Ok so just do like:
sio2->_SIO2window->touch[ 0 ].y = sio2->_SIO2window->scl.y - sio2->_SIO2window->touch[ 0 ].y;
sio2->_SIO2window->touch[ 0 ].y = sio2->_SIO2window->scl.y - sio2->_SIO2window->touch[ 0 ].y;
Re: Widget _SIO2widgettapdown area
that worked great, thanks! I'm still wondering why its reversed in the first place...
jonusx- Posts : 16
Join date : 2009-03-13
Re: Widget _SIO2widgettapdown area
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
Re: Widget _SIO2widgettapdown area
Check tutorial04, Im showing how to switch the controls between a landscape & portrait mode... simply double tap on the screen to invert.
Re: Widget _SIO2widgettapdown area
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.
EDIT: As always stiupid mistake - I forgot about sio2WindowEnterLandscape2D.
_-MADMAN-_- Posts : 52
Join date : 2009-04-23
Permissions in this forum:
You cannot reply to topics in this forum