I have started logging my touch coordinates and noticed that towards the top and left the x and y coordinates become negative.
[lua]local logMouse = function( event )
print("Mouse/Touch x: "…event.x)
print("Mouse/Touch y: "…event.y)
end
objectGroup:addEventListener(“touch”, logMouse)[/lua]
I know its probably a problem with my config file.
[lua]application =
{
content =
{
width = 320,
height = 480,
scale = “Letterbox”,
fps = 30,
antialias = true,
},
}[/lua]
So what is the proper way to set up a dynamic/auto content height and width, or do I have to change it for every different device display? [import]uid: 54716 topic_id: 9272 reply_id: 309272[/import]
What device are you using? The behavior you describe makes sense on an iPad but not on iPhone. [import]uid: 12108 topic_id: 9272 reply_id: 33846[/import]
I have got to remember to say which device I am working on. I am working on the android phone emulator. [import]uid: 54716 topic_id: 9272 reply_id: 33858[/import]
You’re going to have to be more specific than that; there are several different Android simulators. Your base size is 320x480 so screens with different aspect ratios will have letterbox areas with negative coordinates. A given screen might go from -50 to 370 for example, with the base 0-320 area in the middle. [import]uid: 12108 topic_id: 9272 reply_id: 33880[/import]
this would help,
http://developer.anscamobile.com/content/configuring-projects#Dynamic_Content_Scaling
it will explain what happens when you develop for the resolution of 320*480 and see that in higher resolution devices [import]uid: 12482 topic_id: 9272 reply_id: 33884[/import]
I’m fairly certain too that when you click and drag in the simulator, the simulator captures the mouse even if it goes outside of the simulator window, and still transmits the mouse motions as touch events… that could be causing your problems with weird coordinates too.
[import]uid: 53578 topic_id: 9272 reply_id: 38717[/import]