Author Topic: Touchbegin  (Read 2854 times)

StefanVanDerHeijden

  • Guest
Touchbegin
« on: December 06, 2013, 09:26:25 AM »
Dear All,

We bougth NGUI a few month ago to develop touch based games on windows machines.
Great stuff NGUI, quick, easy, usable.
So far, so good.
but now we need pressed states to work on UISprite.
so i added a OnPress function to toggle the texture.
Works great with the mouse!
But when we use touch the OnPress if only called when 1 move my touch on the UISprite.
Is there a way to get the OnPress directly?
Tried playing with the threshold values, but that doesn't seem to work.
Anyone got a idea?

Thanx in Advance

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Touchbegin
« Reply #1 on: December 06, 2013, 01:56:55 PM »
OnPress is called when you press on something. No movement required. But keep in mind OnPress has a boolean parameter that tells you whether the press state started or ended.

StefanVanDerHeijden

  • Guest
Re: Touchbegin
« Reply #2 on: December 06, 2013, 07:22:09 PM »
thanx for your reply arenmook
I do not need the move, but the onpress is not called when touching the screen before i move my touchpoint.
I wanted the call the onpress directly on the first touch.
That is exactly the problem :)
hope you can help

tia

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Touchbegin
« Reply #3 on: December 07, 2013, 12:29:50 AM »
I'm not sure what you're saying. OnPress is always called when you press on a collider. If you press on nothing, then it won't be, because there is nothing to call OnPress on. If you want to get OnPress notifications when you press on nothing, then you need to set UICamera.fallThrough to the object that will receive your events if nothing else handles them.

StefanVanDerHeijden

  • Guest
Re: Touchbegin
« Reply #4 on: December 07, 2013, 08:11:14 AM »
i have a ngui button with a uisprite and a collider.
When i press it with the mouse i indeed get onpress with true and false.
But when i press it with touch (normal touchscreen under win7) i do not recieve the onpress.
This is only fired after i move my finger. When i moved a certain distance i recieve the onPress indeed, but them the onclick in not fired (since i moved) and i would like to recieve the onpress directly.
perhaps some settings in uicamera need to be changed?

tia.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Touchbegin
« Reply #5 on: December 07, 2013, 03:27:58 PM »
As far as I know, Win7 has no native touch functionality. Only touch functionality was added by plug-ins. Win8 has native touch functionality.

P.S. What version of NGUI do you have?

StefanVanDerHeijden

  • Guest
Re: Touchbegin
« Reply #6 on: December 09, 2013, 03:34:57 AM »
we are working with 3.02 now.
Will try the game on win8 native and see if touch works like i would expect :)

Thanx sofar