public void run () { InputMethodManager manager = (InputMethodManager)context.getSystemService(Context.INPUT_METHOD_SERVICE); if (visible) { View view = ((AndroidGraphics)app.getGraphics()).getView(); view.setFocusable(true); view.setFocusableInTouchMode(true); manager.showSoftInput(((AndroidGraphics)app.getGraphics()).getView(), 0); } else { manager.hideSoftInputFromWindow(((AndroidGraphics)app.getGraphics()).getView().getWindowToken(), 0); } } });
public void run () { InputMethodManager manager = (InputMethodManager)context.getSystemService(Context.INPUT_METHOD_SERVICE); if (visible) { View view = ((AndroidGraphics)app.getGraphics()).getView(); view.setFocusable(true); view.setFocusableInTouchMode(true); manager.showSoftInput(((AndroidGraphics)app.getGraphics()).getView(), 0); } else { manager.hideSoftInputFromWindow(((AndroidGraphics)app.getGraphics()).getView().getWindowToken(), 0); } } });
protected void postTap (int x, int y) { synchronized (this) { TouchEvent event = usedTouchEvents.obtain(); event.timeStamp = System.nanoTime(); event.pointer = 0; event.x = x; event.y = y; event.type = TouchEvent.TOUCH_DOWN; touchEvents.add(event); event = usedTouchEvents.obtain(); event.timeStamp = System.nanoTime(); event.pointer = 0; event.x = x; event.y = y; event.type = TouchEvent.TOUCH_UP; touchEvents.add(event); } Gdx.app.getGraphics().requestRendering(); }
protected void postTap (int x, int y) { synchronized (this) { TouchEvent event = usedTouchEvents.obtain(); event.timeStamp = System.nanoTime(); event.pointer = 0; event.x = x; event.y = y; event.type = TouchEvent.TOUCH_DOWN; touchEvents.add(event); event = usedTouchEvents.obtain(); event.timeStamp = System.nanoTime(); event.pointer = 0; event.x = x; event.y = y; event.type = TouchEvent.TOUCH_UP; touchEvents.add(event); } Gdx.app.getGraphics().requestRendering(); }
public boolean onGenericMotion (MotionEvent event, AndroidInput input) { if ((event.getSource() & InputDevice.SOURCE_CLASS_POINTER) == 0) return false; final int action = event.getAction() & MotionEvent.ACTION_MASK; int x = 0, y = 0; int scrollAmount = 0; long timeStamp = System.nanoTime(); synchronized (input) { switch (action) { case MotionEvent.ACTION_HOVER_MOVE: x = (int)event.getX(); y = (int)event.getY(); if ((x != deltaX) || (y != deltaY)) { // Avoid garbage events postTouchEvent(input, TouchEvent.TOUCH_MOVED, x, y, 0, timeStamp); deltaX = x; deltaY = y; } break; case MotionEvent.ACTION_SCROLL: scrollAmount = (int)-Math.signum(event.getAxisValue(MotionEvent.AXIS_VSCROLL)); postTouchEvent(input, TouchEvent.TOUCH_SCROLLED, 0, 0, scrollAmount, timeStamp); } } Gdx.app.getGraphics().requestRendering(); return true; }
public boolean onGenericMotion (MotionEvent event, AndroidInput input) { if ((event.getSource() & InputDevice.SOURCE_CLASS_POINTER) == 0) return false; final int action = event.getAction() & MotionEvent.ACTION_MASK; int x = 0, y = 0; int scrollAmount = 0; long timeStamp = System.nanoTime(); synchronized (input) { switch (action) { case MotionEvent.ACTION_HOVER_MOVE: x = (int)event.getX(); y = (int)event.getY(); if ((x != deltaX) || (y != deltaY)) { // Avoid garbage events postTouchEvent(input, TouchEvent.TOUCH_MOVED, x, y, 0, timeStamp); deltaX = x; deltaY = y; } break; case MotionEvent.ACTION_SCROLL: scrollAmount = (int)-Math.signum(event.getAxisValue(MotionEvent.AXIS_VSCROLL)); postTouchEvent(input, TouchEvent.TOUCH_SCROLLED, 0, 0, scrollAmount, timeStamp); } } Gdx.app.getGraphics().requestRendering(); return true; }
DisplayMode mode = app.getGraphics().getDisplayMode(); if (((rotation == 0 || rotation == 180) && (mode.width >= mode.height)) || ((rotation == 90 || rotation == 270) && (mode.width <= mode.height))) {
app.getGraphics().requestRendering();
app.getGraphics().requestRendering();
DisplayMode mode = app.getGraphics().getDisplayMode(); if (((rotation == 0 || rotation == 180) && (mode.width >= mode.height)) || ((rotation == 90 || rotation == 270) && (mode.width <= mode.height))) {
Gdx.app.getGraphics().requestRendering();
Gdx.app.getGraphics().requestRendering();
@Override public void render () { // update the world with a fixed time step long startTime = TimeUtils.nanoTime(); world.step(Gdx.app.getGraphics().getDeltaTime(), 3, 3); float updateTime = (TimeUtils.nanoTime() - startTime) / 1000000000.0f; startTime = TimeUtils.nanoTime(); // clear the screen and setup the projection matrix Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT); camera.update(); // render the world using the debug renderer renderer.render(world, camera.combined); float renderTime = (TimeUtils.nanoTime() - startTime) / 1000000000.0f; batch.begin(); font.draw(batch, "fps:" + Gdx.graphics.getFramesPerSecond() + ", update: " + updateTime + ", render: " + renderTime, 0, 20); batch.end(); }
@Override public void create() { if (params.debug) { Gdx.app.log(TAG, "Application is running in DEBUG mode."); } Gdx.app.getGraphics().setContinuousRendering(false); Gdx.input.setInputProcessor(inputMultiplexer); initiateContext(); FileChooser.setSaveLastDirectory(true); FileChooser.setDefaultPrefsName("file_chooser.xml"); // Uncomment to update project's LML DTD schema // LmlUtils.saveDtdSchema(interfaceService.getParser(), Gdx.files.local("../lml.dtd")); }