Impact

This forum is read only and just serves as an archive. If you have any questions, please post them on github.com/phoboslab/impact

1 decade ago by stahlmanDesign

I have a test where the accelerometer works, but when you rotate the iPad, the accelerometer doesn't change direction. Is it possible to detect device orientation in Impact?

1 decade ago by Ashkettle

Are you planning on wrapping the game as a native app? If so, all the wrappers out there that I've seen have that functionality already available (AppMobi and Titanium both do).

1 decade ago by stahlmanDesign

No, I want to see if it can be made to work when you visit the website with the iPad. What I am making is not stand-alone and must exist in the contexte of a website.

1 decade ago by Drakmir

You should be able to use standard javascript for this. The solution may be different in iPhone and Android:

Here is what looks to be a decent write up of this:

http://stackoverflow.com/questions/1649086/detect-rotation-of-android-phone-in-the-browser-with-javascript

1 decade ago by fugufish

here's what I used.


		window.onorientationchange = function() {
		  var orientation = window.orientation;
		  switch(orientation) {
		    case 0:
		       // portrait - do something		
				break; 
       
		    case 90:
				// landscape - do something
		        break;
   
		    case -90: 
				// landscape - do something
				break;
		  }
		}

Page 1 of 1
« first « previous next › last »