Dragging is different when dealing with tablets?

Hi,

I’m writing a game that player can drag around objects and objects continue to move in the drag direction when released. I’ve done it via gameUI’s drag code (from Corona samples) and runs (almost) fine in the simulator.

I can’t test it on a phone yet but when I tested it on a Galaxy Tab 10" with Android 3, I noticed that since the tablet is bigger than the phone, player has to move his finer much more comparing on doing the same thing with a phone.

So how I can solve this? [import]uid: 206803 topic_id: 34492 reply_id: 334492[/import]

Hi Aidin, I’m not sure I’m clear on your intention, but let me try: you want to basically simulate the same touch sensitivity on a tablet, using the same scale as the phone? As in, if the user drags the object 20 pixels in a horizontal line, that equates to maybe 1 centimeter on the phone’s screen surface, but 3 centimeters on the tablet? That could be tricky… but you could sense the type of device it’s running on and then adjust how sensitive your drag motion and response is.

Is that what you’re going for, or something else?

Brent [import]uid: 200026 topic_id: 34492 reply_id: 137243[/import]

Hi Brent, thanks for the reply.

I think that would do it. AFAIK, Corona just gives resolution of the screen that it’s running on, but I’m interested to know actual size of the display, how I can achieve this?

Another method would be to somehow make it work on both sizes. If somehow I could make the physic engine throw balls at a constant speed, that works on both sizes, I think I may achieve this.

I’m open to your suggestions on any of said suggestions or anything else.

Thanks again. [import]uid: 206803 topic_id: 34492 reply_id: 137435[/import]

Hi Aidin,
By “size of the display”, do you mean the pixel height and width of the screen? This can be read with the following two display properties: display.pixelWidth and display.pixelHeight
http://docs.coronalabs.com/api/library/display/pixelWidth.html
http://docs.coronalabs.com/api/library/display/pixelHeight.html

If you want to detect something like the physical size of a device screen… 3.8 inches, 7 inches, 10 inches, etc. you’ll probably need to do it semi-manually, as in, detect the device as best as you can and then create some kind of cross-reference table that you input the known/possible device sizes into (and as you know, there are a lot of devices now :slight_smile: ).

Here’s Rob Miracle’s tutorial on device detection:
http://www.coronalabs.com/blog/2012/12/11/device-detection-on-steroids/

Brent [import]uid: 200026 topic_id: 34492 reply_id: 137509[/import]

Thanks:

  1. That link doesn’t have info for other brands and tablets, for example info regarding finding out about Galaxy Tab or Nexus 7.

  2. Let’s assume that I find out when my app is running on an tablet How I can make my dragging put more force into the objects when I drag less?

  3. Something odd, when I drag my objects not that much, when I release them, they do not get thrown at all. How can I make it more sensitive?

(I’m using gameUI.lua for my drag and drops, from Corona’s Sample Code directory)

Thanks again. [import]uid: 206803 topic_id: 34492 reply_id: 137537[/import]

Hi Aidin,
The link (device detection) might not be tailored specifically to Galaxy Tab or Nexus 7, but it should show you the methods how you could detect those devices. I can ask Rob to help you with that if you need.

Where is this “gameUI.lua” project you’re using? I’m browsing my Corona “SampleCode” directory now and I can’t seem to locate it. Can you give me a complete file/directory path to it? I’ll check out what it’s doing and hopefully figure out your issue.

Brent [import]uid: 200026 topic_id: 34492 reply_id: 137592[/import]

Thanks.

For the gemaUI, you can get it from any of the directories below:

1)Corona Labs\Corona SDK\Sample Code\Physics\DebugDraw\gameUI.lua

2)Corona Labs\Corona SDK\Sample Code\Physics\MultiPuck\gameUI.lua

3)Corona Labs\Corona SDK\Sample Code\Physics\RagDoll\gameUI.lua [import]uid: 206803 topic_id: 34492 reply_id: 137614[/import]

Hi Aidin, I’m not sure I’m clear on your intention, but let me try: you want to basically simulate the same touch sensitivity on a tablet, using the same scale as the phone? As in, if the user drags the object 20 pixels in a horizontal line, that equates to maybe 1 centimeter on the phone’s screen surface, but 3 centimeters on the tablet? That could be tricky… but you could sense the type of device it’s running on and then adjust how sensitive your drag motion and response is.

Is that what you’re going for, or something else?

Brent [import]uid: 200026 topic_id: 34492 reply_id: 137243[/import]

Hi Brent, thanks for the reply.

I think that would do it. AFAIK, Corona just gives resolution of the screen that it’s running on, but I’m interested to know actual size of the display, how I can achieve this?

Another method would be to somehow make it work on both sizes. If somehow I could make the physic engine throw balls at a constant speed, that works on both sizes, I think I may achieve this.

I’m open to your suggestions on any of said suggestions or anything else.

Thanks again. [import]uid: 206803 topic_id: 34492 reply_id: 137435[/import]

Hi Aidin,
By “size of the display”, do you mean the pixel height and width of the screen? This can be read with the following two display properties: display.pixelWidth and display.pixelHeight
http://docs.coronalabs.com/api/library/display/pixelWidth.html
http://docs.coronalabs.com/api/library/display/pixelHeight.html

If you want to detect something like the physical size of a device screen… 3.8 inches, 7 inches, 10 inches, etc. you’ll probably need to do it semi-manually, as in, detect the device as best as you can and then create some kind of cross-reference table that you input the known/possible device sizes into (and as you know, there are a lot of devices now :slight_smile: ).

Here’s Rob Miracle’s tutorial on device detection:
http://www.coronalabs.com/blog/2012/12/11/device-detection-on-steroids/

Brent [import]uid: 200026 topic_id: 34492 reply_id: 137509[/import]

Thanks:

  1. That link doesn’t have info for other brands and tablets, for example info regarding finding out about Galaxy Tab or Nexus 7.

  2. Let’s assume that I find out when my app is running on an tablet How I can make my dragging put more force into the objects when I drag less?

  3. Something odd, when I drag my objects not that much, when I release them, they do not get thrown at all. How can I make it more sensitive?

(I’m using gameUI.lua for my drag and drops, from Corona’s Sample Code directory)

Thanks again. [import]uid: 206803 topic_id: 34492 reply_id: 137537[/import]

Hi Aidin,
The link (device detection) might not be tailored specifically to Galaxy Tab or Nexus 7, but it should show you the methods how you could detect those devices. I can ask Rob to help you with that if you need.

Where is this “gameUI.lua” project you’re using? I’m browsing my Corona “SampleCode” directory now and I can’t seem to locate it. Can you give me a complete file/directory path to it? I’ll check out what it’s doing and hopefully figure out your issue.

Brent [import]uid: 200026 topic_id: 34492 reply_id: 137592[/import]

Thanks.

For the gemaUI, you can get it from any of the directories below:

1)Corona Labs\Corona SDK\Sample Code\Physics\DebugDraw\gameUI.lua

2)Corona Labs\Corona SDK\Sample Code\Physics\MultiPuck\gameUI.lua

3)Corona Labs\Corona SDK\Sample Code\Physics\RagDoll\gameUI.lua [import]uid: 206803 topic_id: 34492 reply_id: 137614[/import]