/** An implementation of the {@link Input} interface for Android.\r
* \r
* @author mzechner */\r
-/**\r
- * @author jshapcot\r
- *\r
- */\r
+/** @author jshapcot */\r
public final class AndroidInput implements Input, OnKeyListener, OnTouchListener {\r
class KeyEvent {\r
static final int KEY_DOWN = 0;\r
\r
private SensorEventListener accelerometerListener;\r
private SensorEventListener compassListener;\r
- \r
+\r
public AndroidInput (AndroidApplication activity, View view, AndroidApplicationConfiguration config) {\r
view.setOnKeyListener(this);\r
view.setOnTouchListener(this);\r
});\r
}\r
\r
+ public void getPlaceholderTextInput (final TextInputListener listener, final String title, final String placeholder) {\r
+ handle.post(new Runnable() {\r
+ public void run () {\r
+ AlertDialog.Builder alert = new AlertDialog.Builder(AndroidInput.this.app);\r
+ alert.setTitle(title);\r
+ final EditText input = new EditText(AndroidInput.this.app);\r
+ input.setHint(placeholder);\r
+ input.setSingleLine();\r
+ alert.setView(input);\r
+ alert.setPositiveButton("Ok", new DialogInterface.OnClickListener() {\r
+ public void onClick (DialogInterface dialog, int whichButton) {\r
+ listener.input(input.getText().toString());\r
+ }\r
+ });\r
+ alert.setOnCancelListener(new OnCancelListener() {\r
+ @Override\r
+ public void onCancel (DialogInterface arg0) {\r
+ listener.canceled();\r
+ }\r
+ });\r
+ alert.show();\r
+ }\r
+ });\r
+ }\r
+\r
@Override\r
public int getX () {\r
synchronized (this) {\r
}\r
}\r
\r
-\r
void processEvents () {\r
synchronized (this) {\r
justTouched = false;\r
app.getGraphics().requestRendering();\r
}\r
\r
- //circle button on Xperia Play shouldn't need catchBack == true\r
- if (keyCode == Keys.BUTTON_CIRCLE) return true; \r
+ // circle button on Xperia Play shouldn't need catchBack == true\r
+ if (keyCode == Keys.BUTTON_CIRCLE) return true;\r
if (catchBack && keyCode == android.view.KeyEvent.KEYCODE_BACK) return true;\r
if (catchMenu && keyCode == android.view.KeyEvent.KEYCODE_MENU) return true;\r
return false;\r
\r
@Override\r
public void setOnscreenKeyboardVisible (final boolean visible) {\r
-// onscreenKeyboard.setVisible(visible);\r
+// onscreenKeyboard.setVisible(visible);\r
handle.post(new Runnable() {\r
public void run () {\r
InputMethodManager manager = (InputMethodManager)app.getSystemService(Context.INPUT_METHOD_SERVICE);\r
}\r
}\r
\r
- /**\r
- * Returns the rotation matrix describing the devices rotation as per <a href="http://developer.android.com/reference/android/hardware/SensorManager.html#getRotationMatrix(float[], float[], float[], float[])">SensorManager#getRotationMatrix(float[], float[], float[], float[])</a>.\r
- * Does not manipulate the matrix if the platform does not have an accelerometer.\r
- * @param matrix\r
- */\r
- public void getRotationMatrix(float[] matrix) {\r
+ /** Returns the rotation matrix describing the devices rotation as per <a href=\r
+ * "http://developer.android.com/reference/android/hardware/SensorManager.html#getRotationMatrix(float[], float[], float[], float[])"\r
+ * >SensorManager#getRotationMatrix(float[], float[], float[], float[])</a>. Does not manipulate the matrix if the platform\r
+ * does not have an accelerometer.\r
+ * @param matrix */\r
+ public void getRotationMatrix (float[] matrix) {\r
SensorManager.getRotationMatrix(matrix, null, accelerometerValues, magneticFieldValues);\r
}\r
- \r
+\r
@Override\r
public float getAzimuth () {\r
if (!compassAvailable) return 0;\r
} else {\r
Sensor accelerometer = manager.getSensorList(Sensor.TYPE_ACCELEROMETER).get(0);\r
accelerometerListener = new SensorListener(this.nativeOrientation, this.accelerometerValues, this.magneticFieldValues);\r
- accelerometerAvailable = manager.registerListener(accelerometerListener, accelerometer, SensorManager.SENSOR_DELAY_GAME);\r
+ accelerometerAvailable = manager.registerListener(accelerometerListener, accelerometer,\r
+ SensorManager.SENSOR_DELAY_GAME);\r
}\r
} else\r
accelerometerAvailable = false;\r
return currentEventTimeStamp;\r
}\r
\r
- /** Our implementation of SensorEventListener. Because Android doesn't like it\r
- * when we register more than one Sensor to a single SensorEventListener,\r
- * we add one of these for each Sensor. Could use an anonymous class,\r
- * but I don't see any harm in explicitly defining it here.\r
- * Correct me if I am wrong.\r
- */ \r
- private class SensorListener implements SensorEventListener\r
- {\r
+ /** Our implementation of SensorEventListener. Because Android doesn't like it when we register more than one Sensor to a single\r
+ * SensorEventListener, we add one of these for each Sensor. Could use an anonymous class, but I don't see any harm in\r
+ * explicitly defining it here. Correct me if I am wrong. */\r
+ private class SensorListener implements SensorEventListener {\r
final float[] accelerometerValues;\r
final float[] magneticFieldValues;\r
final Orientation nativeOrientation;\r
- \r
- SensorListener(Orientation nativeOrientation, float[] accelerometerValues, float[] magneticFieldValues)\r
- {\r
+\r
+ SensorListener (Orientation nativeOrientation, float[] accelerometerValues, float[] magneticFieldValues) {\r
this.accelerometerValues = accelerometerValues;\r
this.magneticFieldValues = magneticFieldValues;\r
this.nativeOrientation = nativeOrientation;\r
}\r
- \r
+\r
@Override\r
public void onAccuracyChanged (Sensor arg0, int arg1) {\r
\r
if (event.sensor.getType() == Sensor.TYPE_MAGNETIC_FIELD) {\r
System.arraycopy(event.values, 0, magneticFieldValues, 0, magneticFieldValues.length);\r
}\r
- } \r
+ }\r
}\r
}\r
package com.badlogic.gdx.backends.jogl;\r
\r
import java.awt.AWTException;\r
+import java.awt.Color;\r
import java.awt.Cursor;\r
+import java.awt.FlowLayout;\r
import java.awt.GraphicsEnvironment;\r
import java.awt.HeadlessException;\r
import java.awt.Image;\r
import java.awt.event.MouseMotionListener;\r
import java.awt.event.MouseWheelEvent;\r
import java.awt.event.MouseWheelListener;\r
+import java.awt.event.WindowEvent;\r
+import java.awt.event.WindowFocusListener;\r
import java.awt.image.BufferedImage;\r
import java.util.ArrayList;\r
import java.util.HashSet;\r
import java.util.Set;\r
\r
import javax.media.opengl.GLCanvas;\r
+import javax.swing.JDialog;\r
import javax.swing.JFrame;\r
+import javax.swing.JLabel;\r
import javax.swing.JOptionPane;\r
+import javax.swing.JPanel;\r
+import javax.swing.JTextField;\r
+import javax.swing.OverlayLayout;\r
import javax.swing.SwingUtilities;\r
+import javax.swing.border.Border;\r
+import javax.swing.border.EmptyBorder;\r
+import javax.swing.event.DocumentEvent;\r
+import javax.swing.event.DocumentListener;\r
\r
import com.badlogic.gdx.Gdx;\r
import com.badlogic.gdx.Input;\r
Robot robot = null;\r
long currentEventTimeStamp;\r
\r
-\r
public JoglInput (GLCanvas canvas) {\r
setListeners(canvas);\r
try {\r
});\r
}\r
\r
+ public void getPlaceholderTextInput (final TextInputListener listener, final String title, final String placeholder) {\r
+ SwingUtilities.invokeLater(new Runnable() {\r
+ @Override\r
+ public void run () {\r
+ JPanel panel = new JPanel(new FlowLayout());\r
+\r
+ JPanel textPanel = new JPanel() {\r
+ public boolean isOptimizedDrawingEnabled () {\r
+ return false;\r
+ };\r
+ };\r
+\r
+ textPanel.setLayout(new OverlayLayout(textPanel));\r
+ panel.add(textPanel);\r
+\r
+ final JTextField textField = new JTextField(20);\r
+ textField.setAlignmentX(0.0f);\r
+ textPanel.add(textField);\r
+\r
+ final JLabel placeholderLabel = new JLabel(placeholder);\r
+ placeholderLabel.setForeground(Color.GRAY);\r
+ placeholderLabel.setAlignmentX(0.0f);\r
+ textPanel.add(placeholderLabel, 0);\r
+\r
+ textField.getDocument().addDocumentListener(new DocumentListener() {\r
+\r
+ @Override\r
+ public void removeUpdate (DocumentEvent arg0) {\r
+ this.updated();\r
+ }\r
+\r
+ @Override\r
+ public void insertUpdate (DocumentEvent arg0) {\r
+ this.updated();\r
+ }\r
+\r
+ @Override\r
+ public void changedUpdate (DocumentEvent arg0) {\r
+ this.updated();\r
+ }\r
+\r
+ private void updated () {\r
+ if (textField.getText().length() == 0)\r
+ placeholderLabel.setVisible(true);\r
+ else\r
+ placeholderLabel.setVisible(false);\r
+ }\r
+ });\r
+\r
+ JOptionPane pane = new JOptionPane(panel, JOptionPane.QUESTION_MESSAGE, JOptionPane.OK_CANCEL_OPTION, null, null,\r
+ null);\r
+\r
+ pane.setInitialValue(null);\r
+ pane.setComponentOrientation(JOptionPane.getRootFrame().getComponentOrientation());\r
+\r
+ Border border = textField.getBorder();\r
+ placeholderLabel.setBorder(new EmptyBorder(border.getBorderInsets(textField)));\r
+\r
+ JDialog dialog = pane.createDialog(null, title);\r
+ pane.selectInitialValue();\r
+\r
+ dialog.addWindowFocusListener(new WindowFocusListener() {\r
+\r
+ @Override\r
+ public void windowLostFocus (WindowEvent arg0) {\r
+ }\r
+\r
+ @Override\r
+ public void windowGainedFocus (WindowEvent arg0) {\r
+ textField.requestFocusInWindow();\r
+ }\r
+ });\r
+\r
+ dialog.setVisible(true);\r
+ dialog.dispose();\r
+\r
+ Object selectedValue = pane.getValue();\r
+\r
+ if (selectedValue != null && (selectedValue instanceof Integer)\r
+ && ((Integer)selectedValue).intValue() == JOptionPane.OK_OPTION) {\r
+ listener.input(textField.getText());\r
+ } else {\r
+ listener.canceled();\r
+ }\r
+\r
+ }\r
+ });\r
+ }\r
+\r
@Override\r
public int getX () {\r
return touchX;\r
@Override\r
public void getRotationMatrix (float[] matrix) {\r
// TODO Auto-generated method stub\r
- \r
+\r
}\r
}\r
int lastHeight = graphics.getHeight();\r
\r
graphics.lastTime = System.nanoTime();\r
- while (running) {\r
+ while (running) { \r
+ Display.processMessages();\r
if (Display.isCloseRequested()) {\r
exit();\r
}\r
-\r
- graphics.updateTime();\r
- if (graphics.resize) {\r
- graphics.resize = false;\r
- listener.resize(graphics.getWidth(), graphics.getHeight());\r
- }\r
+ \r
+ boolean shouldRender = false;\r
synchronized (runnables) {\r
executedRunnables.clear();\r
executedRunnables.addAll(runnables);\r
runnables.clear();\r
\r
for (int i = 0; i < executedRunnables.size(); i++) {\r
+ shouldRender = true;\r
try {\r
executedRunnables.get(i).run();\r
}\r
}\r
}\r
input.update();\r
+ shouldRender |= graphics.shouldRender();\r
\r
if (graphics.canvas != null) {\r
int width = graphics.canvas.getWidth();\r
lastHeight = height;\r
Gdx.gl.glViewport(0, 0, lastWidth, lastHeight);\r
listener.resize(lastWidth, lastHeight);\r
+ shouldRender = true;\r
+ }\r
+ } else {\r
+ if(Display.wasResized() || Display.getWidth() != graphics.config.width || Display.getHeight() != graphics.config.height) {\r
+ Gdx.gl.glViewport(0, 0, Display.getWidth(), Display.getHeight());\r
+ graphics.config.width = Display.getWidth();\r
+ graphics.config.height = Display.getHeight();\r
+ if(listener != null) listener.resize(Display.getWidth(), Display.getHeight());\r
+ graphics.requestRendering();\r
}\r
}\r
\r
input.processEvents();\r
- listener.render();\r
audio.update();\r
- Display.update();\r
- if(Display.wasResized()) {\r
- Gdx.gl.glViewport(0, 0, Display.getWidth(), Display.getHeight());\r
- graphics.config.width = Display.getWidth();\r
- graphics.config.height = Display.getHeight();\r
- if(listener != null) listener.resize(Display.getWidth(), Display.getHeight());\r
- }\r
- if (graphics.vsync && graphics.config.useCPUSynch) {\r
- Display.sync(60);\r
+ if(shouldRender) {\r
+ graphics.updateTime();\r
+ listener.render();\r
+ Display.update();\r
+ if (graphics.vsync && graphics.config.useCPUSynch) {\r
+ Display.sync(60);\r
+ }\r
}\r
}\r
\r
return config;\r
}\r
\r
+ volatile boolean isContinuous = true;\r
+ volatile boolean requestRendering = false;\r
+ \r
@Override\r
public void setContinuousRendering (boolean isContinuous) {\r
+ this.isContinuous = isContinuous;\r
}\r
\r
@Override\r
public boolean isContinuousRendering () {\r
- return false;\r
+ return isContinuous;\r
}\r
\r
@Override\r
public void requestRendering () {\r
+ synchronized(this) {\r
+ requestRendering = true;\r
+ }\r
+ }\r
+ \r
+ public boolean shouldRender() {\r
+ synchronized(this) {\r
+ boolean rq = requestRendering;\r
+ requestRendering = false;\r
+ return rq || isContinuous;\r
+ }\r
}\r
}\r
\r
package com.badlogic.gdx.backends.lwjgl;\r
\r
+import java.awt.Color;\r
+import java.awt.FlowLayout;\r
+import java.awt.event.WindowEvent;\r
+import java.awt.event.WindowFocusListener;\r
import java.util.ArrayList;\r
import java.util.HashSet;\r
import java.util.List;\r
import java.util.Set;\r
\r
+import javax.swing.JDialog;\r
+import javax.swing.JLabel;\r
import javax.swing.JOptionPane;\r
+import javax.swing.JPanel;\r
+import javax.swing.JTextField;\r
+import javax.swing.OverlayLayout;\r
import javax.swing.SwingUtilities;\r
+import javax.swing.border.Border;\r
+import javax.swing.border.EmptyBorder;\r
+import javax.swing.event.DocumentEvent;\r
+import javax.swing.event.DocumentListener;\r
\r
import org.lwjgl.input.Keyboard;\r
import org.lwjgl.input.Mouse;\r
import com.badlogic.gdx.Gdx;\r
import com.badlogic.gdx.Input;\r
import com.badlogic.gdx.InputProcessor;\r
+import com.badlogic.gdx.Input.TextInputListener;\r
import com.badlogic.gdx.utils.Pool;\r
\r
/** An implementation of the {@link Input} interface hooking a Jogl panel for input.\r
}\r
});\r
}\r
+ \r
+ public void getPlaceholderTextInput (final TextInputListener listener, final String title, final String placeholder) {\r
+ SwingUtilities.invokeLater(new Runnable() {\r
+ @Override\r
+ public void run () {\r
+ JPanel panel = new JPanel(new FlowLayout());\r
+\r
+ JPanel textPanel = new JPanel() {\r
+ public boolean isOptimizedDrawingEnabled () {\r
+ return false;\r
+ };\r
+ };\r
+\r
+ textPanel.setLayout(new OverlayLayout(textPanel));\r
+ panel.add(textPanel);\r
+\r
+ final JTextField textField = new JTextField(20);\r
+ textField.setAlignmentX(0.0f);\r
+ textPanel.add(textField);\r
+\r
+ final JLabel placeholderLabel = new JLabel(placeholder);\r
+ placeholderLabel.setForeground(Color.GRAY);\r
+ placeholderLabel.setAlignmentX(0.0f);\r
+ textPanel.add(placeholderLabel, 0);\r
+\r
+ textField.getDocument().addDocumentListener(new DocumentListener() {\r
+\r
+ @Override\r
+ public void removeUpdate (DocumentEvent arg0) {\r
+ this.updated();\r
+ }\r
+\r
+ @Override\r
+ public void insertUpdate (DocumentEvent arg0) {\r
+ this.updated();\r
+ }\r
+\r
+ @Override\r
+ public void changedUpdate (DocumentEvent arg0) {\r
+ this.updated();\r
+ }\r
+\r
+ private void updated () {\r
+ if (textField.getText().length() == 0)\r
+ placeholderLabel.setVisible(true);\r
+ else\r
+ placeholderLabel.setVisible(false);\r
+ }\r
+ });\r
+\r
+ JOptionPane pane = new JOptionPane(panel, JOptionPane.QUESTION_MESSAGE, JOptionPane.OK_CANCEL_OPTION, null, null,\r
+ null);\r
+\r
+ pane.setInitialValue(null);\r
+ pane.setComponentOrientation(JOptionPane.getRootFrame().getComponentOrientation());\r
+\r
+ Border border = textField.getBorder();\r
+ placeholderLabel.setBorder(new EmptyBorder(border.getBorderInsets(textField)));\r
+\r
+ JDialog dialog = pane.createDialog(null, title);\r
+ pane.selectInitialValue();\r
+\r
+ dialog.addWindowFocusListener(new WindowFocusListener() {\r
+\r
+ @Override\r
+ public void windowLostFocus (WindowEvent arg0) {\r
+ }\r
+\r
+ @Override\r
+ public void windowGainedFocus (WindowEvent arg0) {\r
+ textField.requestFocusInWindow();\r
+ }\r
+ });\r
+\r
+ dialog.setVisible(true);\r
+ dialog.dispose();\r
+\r
+ Object selectedValue = pane.getValue();\r
+\r
+ if (selectedValue != null && (selectedValue instanceof Integer)\r
+ && ((Integer)selectedValue).intValue() == JOptionPane.OK_OPTION) {\r
+ listener.input(textField.getText());\r
+ } else {\r
+ listener.canceled();\r
+ }\r
+\r
+ }\r
+ });\r
+ }\r
\r
public int getX () {\r
return Mouse.getX();\r
if (events == 0) {\r
deltaX = 0;\r
deltaY = 0;\r
+ } else {\r
+ Gdx.graphics.requestRendering();\r
}\r
}\r
}\r
event.type = KeyEvent.KEY_TYPED;\r
event.timeStamp = System.nanoTime(); // FIXME this should use the repeat time plus the timestamp of the original\r
keyEvents.add(event);\r
+ Gdx.graphics.requestRendering();\r
}\r
}\r
\r
pressedKeys--;\r
lastKeyCharPressed = 0;\r
}\r
+ Gdx.graphics.requestRendering();\r
}\r
}\r
}\r
public boolean supportsExtension (String extension);\r
\r
/**\r
- * @param isContinuous whether the rendering should be continuous or not. Use {@link #requestRendering()} in the later case to trigger frames.\r
+ * Sets whether to render continuously. In case rendering is performed non-continuously, the\r
+ * following events will trigger a redraw:\r
+ * \r
+ * <ul>\r
+ * <li>A call to {@link #requestRendering()}</li>\r
+ * <li>Input events from the touch screen/mouse or keyboard</li>\r
+ * <li>A {@link Runnable} is posted to the rendering thread via {@link Application#postRunnable(Runnable)}</li>\r
+ * </ul>\r
+ * \r
+ * Life-cycle events will also be reported as usual, see {@link ApplicationListener}. \r
+ * This method can be called from any thread.\r
+ * \r
+ * @param isContinuous whether the rendering should be continuous or not.\r
*/\r
public void setContinuousRendering(boolean isContinuous);\r
\r
public boolean isContinuousRendering();\r
\r
/**\r
- * requests a new frame to be rendered if the rendering mode is non-continuous.\r
+ * Requests a new frame to be rendered if the rendering mode is non-continuous. This method\r
+ * can be called from any thread.\r
*/\r
public void requestRendering();\r
\r
* @param title The title of the text input dialog.\r
* @param text The message presented to the user. */\r
public void getTextInput (TextInputListener listener, String title, String text);\r
+ \r
+ /** System dependent method to input a string of text. A dialog box will be created with the given title and the given text as a\r
+ * hint message for the user. Once the dialog has been closed the provided {@link TextInputListener} will be called but not\r
+ * necessarily in the rendering thread in which all the {@link ApplicationListener} methods are called. You have to synchronize\r
+ * this yourself.\r
+ * \r
+ * @param listener The TextInputListener.\r
+ * @param title The title of the text input dialog.\r
+ * @param text The placeholder text presented to the user. */\r
+ public void getPlaceholderTextInput (TextInputListener listener, String title, String placeholder);\r
\r
/** Sets the on-screen keyboard visible if available.\r
* \r
public void getTextInput (TextInputListener listener, String title, String text) {\r
Gdx.app.getInput().getTextInput(listener, title, text);\r
}\r
+ \r
+ @Override\r
+ public void getPlaceholderTextInput (TextInputListener listener, String title, String placeholder) {\r
+ Gdx.app.getInput().getPlaceholderTextInput(listener, title, placeholder);\r
+ }\r
\r
@Override\r
public void setOnscreenKeyboardVisible (boolean visible) {\r
public boolean isPanning () {\r
return gestureDetector.isPanning();\r
}\r
+ \r
+ public boolean isFlinging () {\r
+ return flingTimer > 0;\r
+ }\r
\r
public void setVelocityX (float velocityX) {\r
this.velocityX = velocityX;\r
\r
import com.badlogic.gdx.backends.jogl.JoglApplication;\r
import com.badlogic.gdx.backends.jogl.JoglApplicationConfiguration;\r
+import com.badlogic.gdx.tests.DirtyRenderingTest;\r
import com.badlogic.gdx.tests.utils.GdxTest;\r
import com.badlogic.gdx.utils.SharedLibraryLoader;\r
\r
// this is only here for me to debug native code faster\r
new SharedLibraryLoader("../../gdx/libs/gdx-natives.jar").load("gdx");\r
\r
- GdxTest test = new com.badlogic.gdx.tests.ImmediateModeRendererTest();\r
+ GdxTest test = new DirtyRenderingTest();\r
JoglApplicationConfiguration config = new JoglApplicationConfiguration();\r
config.useGL20 = test.needsGL20();\r
new JoglApplication(test, config);\r
import com.badlogic.gdx.tests.Box2DTest;\r
import com.badlogic.gdx.tests.CustomShaderSpriteBatchTest;\r
import com.badlogic.gdx.tests.DecalTest;\r
+import com.badlogic.gdx.tests.DirtyRenderingTest;\r
import com.badlogic.gdx.tests.FrameBufferTest;\r
import com.badlogic.gdx.tests.InterpolationTest;\r
import com.badlogic.gdx.tests.ParallaxTest;\r
new SharedLibraryLoader("../../extensions/gdx-audio/libs/gdx-audio-natives.jar").load("gdx-audio");\r
new SharedLibraryLoader("../../extensions/gdx-stb-truetype/libs/gdx-stb-truetype-natives.jar").load("gdx-stb-truetype");\r
\r
- GdxTest test = new ParallaxTest();\r
+ GdxTest test = new DirtyRenderingTest();\r
LwjglApplicationConfiguration config = new LwjglApplicationConfiguration();\r
config.useGL20 = test.needsGL20();\r
config.vSyncEnabled = true;\r
--- /dev/null
+package com.badlogic.gdx.tests;\r
+\r
+import com.badlogic.gdx.ApplicationAdapter;\r
+import com.badlogic.gdx.Gdx;\r
+import com.badlogic.gdx.graphics.GL10;\r
+import com.badlogic.gdx.math.MathUtils;\r
+import com.badlogic.gdx.tests.utils.GdxTest;\r
+\r
+/**\r
+ * Demonstrates how to use non-continuous (aka dirty-only) rendering. The\r
+ * application will clear the screen with a random color every frame it\r
+ * renders. Rendering requests are issued automatically if new input\r
+ * events arrive.\r
+ * \r
+ * @author mzechner\r
+ *\r
+ */\r
+public class DirtyRenderingTest extends GdxTest {\r
+ @Override\r
+ public void create () {\r
+ // disable continuous rendering\r
+ Gdx.graphics.setContinuousRendering(false);\r
+ Gdx.app.log("DirtyRenderingTest", "created");\r
+ }\r
+\r
+ @Override\r
+ public boolean needsGL20 () {\r
+ return true;\r
+ }\r
+\r
+ @Override\r
+ public void resume () {\r
+ Gdx.app.log("DirtyRenderingTest", "resumed");\r
+ }\r
+\r
+ @Override\r
+ public void resize (int width, int height) {\r
+ Gdx.app.log("DirtyRenderingTest", "resized");\r
+ }\r
+\r
+ @Override\r
+ public void pause () {\r
+ Gdx.app.log("DirtyRenderingTest", "paused");\r
+ }\r
+\r
+ @Override\r
+ public void dispose () {\r
+ Gdx.app.log("DirtyRenderingTest", "disposed");\r
+ }\r
+\r
+ @Override\r
+ public void render () {\r
+ Gdx.gl.glClearColor(MathUtils.random(), MathUtils.random(), MathUtils.random(), MathUtils.random());\r
+ Gdx.gl.glClear(GL10.GL_COLOR_BUFFER_BIT);\r
+ }\r
+}\r
SimpleVertexShader.class, ShapeRendererTest.class,\r
MoveSpriteExample.class, StbTrueTypeTest.class, SoundTouchTest.class, Mpg123Test.class, WavTest.class,\r
TextButtonTest.class, TextButtonTestGL2.class, TextureBindTest.class, TextureBindTestGL2.class,\r
- SortedSpriteTest.class, ExternalMusicTest.class, SoftKeyboardTest.class};\r
+ SortedSpriteTest.class, ExternalMusicTest.class, SoftKeyboardTest.class, \r
+ DirtyRenderingTest.class};\r
\r
public static String[] getNames() {\r
List<String> names = new ArrayList<String>();\r