Jump to content

[TOPIC: topicViewTemplate]
[GLOBAL: userSmallPhoto]
Photo

tap/touch detection empty space
Started by equesyova Oct 23 2018 01:03 AM

3 replies to this topic
tap touch detection

Best Answer davebollinger , 23 October 2018 - 08:01 AM

just a rect with .isVisible=false and .isHitTestable=true -- far less load on the GPU than rendering full-screen alpha (from either source, ie .alpha=0.01 or RGBA=???0)

[TOPIC CONTROLS]
[/TOPIC CONTROLS]
[modOptionsDropdown]
[/modOptionsDropdown]
[reputationFilter]
[TOPIC: post.html]
#1

equesyova

[GLOBAL: userInfoPane.html]
equesyova
  • Observer

  • 15 posts
  • Corona SDK

There are some areas of "empty space" where I need a tap detection to occur. I placed an object there with the intention of making it invisible (alpha = 0).

 

I can make it work by putting an alpha of 0.01 (which looks invisible on the Corona Simulator). But as soon as I put the alpha to 0, tap detection no longer works.

 

Is that normal? And is there a more elegant way than an alpha of 0.01 to make it invisible yet detectable?



[TOPIC: post.html]
#2

XeduR @Spyric

[GLOBAL: userInfoPane.html]
XeduR @Spyric
  • Contributor

  • 293 posts
  • Corona SDK

You can use that 0.01 alpha trick, or you can set object.isHitTestable = true and then you can also touch fully invisible objects.



[TOPIC: post.html]
#3

roaminggamer

[GLOBAL: userInfoPane.html]
roaminggamer
  • Corona Geek

  • 7,286 posts
  • Corona SDK

I use a newImageRect() with a transparent texture.

 

I keep two textures in all my projects:

  • fillT.png  - 16x16 transparent texture (for this and other purposes)
  • fillW.png - 16x16 white texture.


[TOPIC: post.html]
#4

davebollinger

[GLOBAL: userInfoPane.html]
davebollinger
  • Corona Geek

  • 1,236 posts
  • Enterprise

  Best Answer

just a rect with .isVisible=false and .isHitTestable=true -- far less load on the GPU than rendering full-screen alpha (from either source, ie .alpha=0.01 or RGBA=???0)




[topic_controls]
[/topic_controls]