@Override public void vibrate (int milliseconds) {\r
vibrator.vibrate(milliseconds);\r
}\r
+ \r
+ @Override public void vibrate (long[] pattern, int repeat) {\r
+ vibrator.vibrate(pattern, repeat);\r
+ }\r
+\r
+ @Override public void cancelVibrate () {\r
+ vibrator.cancel();\r
+ }\r
\r
@Override public boolean justTouched () {\r
return justTouched;\r
vibrator.vibrate(milliseconds);\r
}\r
\r
+ @Override public void vibrate (long[] pattern, int repeat) {\r
+ vibrator.vibrate(pattern, repeat);\r
+ }\r
+\r
+ @Override public void cancelVibrate () {\r
+ vibrator.cancel();\r
+ }\r
+ \r
@Override public boolean supportsVibrator () {\r
return true;\r
}\r
@Override public boolean isButtonPressed (int button) {\r
return pressedButtons.contains(button);\r
}\r
+\r
+ @Override public void vibrate (long[] pattern, int repeat) {\r
+ }\r
+\r
+ @Override public void cancelVibrate () {\r
+ }\r
}\r
@Override public boolean isButtonPressed (int button) {\r
return Mouse.isButtonDown(toLwjglButton(button));\r
}\r
+\r
+ @Override public void vibrate (long[] pattern, int repeat) {\r
+ }\r
+\r
+ @Override public void cancelVibrate () {\r
+ }\r
}\r
@Override public boolean isButtonPressed (int button) {\r
return false;\r
}\r
+\r
+ @Override public void vibrate (long[] pattern, int repeat) {\r
+ }\r
+\r
+ @Override public void cancelVibrate () {\r
+ }\r
}\r
* @param milliseconds the number of milliseconds to vibrate.\r
*/\r
public void vibrate (int milliseconds);\r
+ \r
+ /**\r
+ * Vibrate with a given pattern.\r
+ * Pass in an array of ints that are the times at which to turn on or off the vibrator. The first one is how long to wait before turning it on, and then after that it alternates. If you want to repeat, pass the index into the pattern at which to start the repeat.\r
+ * @param pattern an array of longs of times to turn the vibrator on or off.\r
+ * @param the index into pattern at which to repeat, or -1 if you don't want to repeat.\r
+ */\r
+ public void vibrate (long[] pattern, int repeat);\r
+ \r
+ /**\r
+ * Stops the vibrator\r
+ */\r
+ public void cancelVibrate();\r
\r
/**\r
* Sets whether the BACK button on Android should be caught. This will prevent the app from being paused. Will have no effect\r
<uses-sdk android:minSdkVersion="3" android:targetSdkVersion="5"/>
<uses-permission android:name="android.permission.RECORD_AUDIO"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
+ <uses-permission android:name="android.permission.VIBRATE"/>
</manifest>
--- /dev/null
+package com.badlogic.gdx.tests;\r
+\r
+import com.badlogic.gdx.Gdx;\r
+import com.badlogic.gdx.graphics.GL10;\r
+import com.badlogic.gdx.graphics.g2d.BitmapFont;\r
+import com.badlogic.gdx.graphics.g2d.SpriteBatch;\r
+import com.badlogic.gdx.tests.utils.GdxTest;\r
+\r
+public class VibratorTest extends GdxTest {\r
+\r
+ @Override public boolean needsGL20 () {\r
+ return false;\r
+ }\r
+\r
+ SpriteBatch batch;\r
+ BitmapFont font;\r
+ \r
+ @Override\r
+ public void create() {\r
+ batch = new SpriteBatch();\r
+ font = new BitmapFont();\r
+ }\r
+ \r
+ @Override \r
+ public void render() {\r
+ Gdx.gl.glClear(GL10.GL_COLOR_BUFFER_BIT);\r
+ batch.begin();\r
+ font.draw(batch, "Touch screen to vibrate", 100, 100);\r
+ batch.end();\r
+ \r
+ if(Gdx.input.justTouched())\r
+ Gdx.input.vibrate(100); \r
+ }\r
+}\r