moving to graphics 2.0 made touch event behave wierd

Hello

today i moved into graphics 2.0 from 1.0, i updated some of my code to fit and it seems all good

but now when i touch object on the screen that have “touch” event listener attached to them,

it seem to affect them in a wierd way:

some are pressed ok other need to be pressed several times before they get there affect happening.

the problem did not appear when i used graphics 1.0.

can someone please help?

Can you isolate it and make a runnable example for us to test?

Hey jonjonsson, thanks for the reply, i just figured out what was the problem

I use ‘Director’ script to manage my scene transitioning and that does not work well with Graphics 2.0.

There is however a line of code you can put into your config.lua to make it compatible to Graphic 1.0 mode.

that is:

graphicsCompatibility = 1,

I guess i have no choice but to start sinking my teeth into the ‘storyboard’ way to manage my scenes.

thanks anyway.

Nope storyboard is deprecated as well. Use Composer :slight_smile:

If you want to use director.lua with graphics 2.0, you have to make a few minor changes.

Look for the following line in director.lua ( should appear 3 times )

local bookBackground = display.newRect( 0, 0, _W, _H )

I think the problem you are having comes from the 0, 0 being the upper left corner in graphics 1.0 and being the center of the object in graphics 2.0.

There are a couple of ways to fix this, but one is to add these 2 lines immediately after the line above.

bookBackground.x = _W * 0.5

bookBackground.y = _H * 0.5

Make sure you make the change in 3 places, then retest with graphics 2.0.

Thanks for the reply prim oz and elbowroom, i think i still will have the touch problems that comes with the Director and Graphics 2.0.

And as i just realized thanks to prime oz, i actually need to go on and move to Composer. i did not realize they took their support from the storyboard.

Well a developer got to do what a developer got to do. :slight_smile:

thanks

Can you isolate it and make a runnable example for us to test?

Hey jonjonsson, thanks for the reply, i just figured out what was the problem

I use ‘Director’ script to manage my scene transitioning and that does not work well with Graphics 2.0.

There is however a line of code you can put into your config.lua to make it compatible to Graphic 1.0 mode.

that is:

graphicsCompatibility = 1,

I guess i have no choice but to start sinking my teeth into the ‘storyboard’ way to manage my scenes.

thanks anyway.

Nope storyboard is deprecated as well. Use Composer :slight_smile:

If you want to use director.lua with graphics 2.0, you have to make a few minor changes.

Look for the following line in director.lua ( should appear 3 times )

local bookBackground = display.newRect( 0, 0, _W, _H )

I think the problem you are having comes from the 0, 0 being the upper left corner in graphics 1.0 and being the center of the object in graphics 2.0.

There are a couple of ways to fix this, but one is to add these 2 lines immediately after the line above.

bookBackground.x = _W * 0.5

bookBackground.y = _H * 0.5

Make sure you make the change in 3 places, then retest with graphics 2.0.

Thanks for the reply prim oz and elbowroom, i think i still will have the touch problems that comes with the Director and Graphics 2.0.

And as i just realized thanks to prime oz, i actually need to go on and move to Composer. i did not realize they took their support from the storyboard.

Well a developer got to do what a developer got to do. :slight_smile:

thanks