Instantly share code, notes, and snippets.

Embed
What would you like to do?
"AndroidJmeDebug"

I'm using logcat in windows command line (adb logcat AndroidJmeDebug:* *:S)

After pressing 'ß':

I/AndroidJmeDebug( 9828): INFO attached black box
I/AndroidJmeDebug( 9828): INFO On Touch: TouchEvent(PointerId=0, Type=KEY_DOWN, X=0.0, Y=0.0, DX=0.0, DY=0.0, ScaleSpan=0.0, dScaleSpan=0.0)
I/AndroidJmeDebug( 9828): INFO  - Touch characters: null
I/AndroidJmeDebug( 9828): INFO  - Touch keycode: 57
I/AndroidJmeDebug( 9828): INFO On Key: Key(CODE=56, PRESSED)
I/AndroidJmeDebug( 9828): INFO  - Key char: └Ç
I/AndroidJmeDebug( 9828): INFO  - Key code: 0x38
I/AndroidJmeDebug( 9828): INFO On Touch: TouchEvent(PointerId=0, Type=KEY_DOWN, X=0.0, Y=0.0, DX=0.0, DY=0.0, ScaleSpan=0.0, dScaleSpan=0.0)
I/AndroidJmeDebug( 9828): INFO  - Touch characters: null
I/AndroidJmeDebug( 9828): INFO  - Touch keycode: 47
I/AndroidJmeDebug( 9828): INFO On Key: Key(CODE=31, CHAR=ß, PRESSED)
I/AndroidJmeDebug( 9828): INFO  - Key char: ß
I/AndroidJmeDebug( 9828): INFO  - Key code: 0x1f
I/AndroidJmeDebug( 9828): INFO On Touch: TouchEvent(PointerId=0, Type=KEY_UP, X=0.0, Y=0.0, DX=0.0, DY=0.0, ScaleSpan=0.0, dScaleSpan=0.0)
I/AndroidJmeDebug( 9828): INFO  - Touch characters: null
I/AndroidJmeDebug( 9828): INFO  - Touch keycode: 47
I/AndroidJmeDebug( 9828): INFO On Key: Key(CODE=31, CHAR=ß, RELEASED)
I/AndroidJmeDebug( 9828): INFO  - Key char: ß
I/AndroidJmeDebug( 9828): INFO  - Key code: 0x1f
I/AndroidJmeDebug( 9828): INFO On Touch: TouchEvent(PointerId=0, Type=KEY_UP, X=0.0, Y=0.0, DX=0.0, DY=0.0, ScaleSpan=0.0, dScaleSpan=0.0)
I/AndroidJmeDebug( 9828): INFO  - Touch characters: null
I/AndroidJmeDebug( 9828): INFO  - Touch keycode: 57
I/AndroidJmeDebug( 9828): INFO On Key: Key(CODE=56, RELEASED)
I/AndroidJmeDebug( 9828): INFO  - Key char: └Ç
I/AndroidJmeDebug( 9828): INFO  - Key code: 0x38
import java.util.logging.Logger;
import com.jme3.input.RawInputListener;
import com.jme3.input.event.JoyAxisEvent;
import com.jme3.input.event.JoyButtonEvent;
import com.jme3.input.event.KeyInputEvent;
import com.jme3.input.event.MouseButtonEvent;
import com.jme3.input.event.MouseMotionEvent;
import com.jme3.input.event.TouchEvent;
public class LogInput implements RawInputListener {
private Logger log;
public LogInput() {
log = Logger.getLogger("AndroidJmeDebug");
}
@Override
public void beginInput() {
log.finer("Begin input");
}
@Override
public void endInput() {
log.finer("End input");
}
@Override
public void onJoyAxisEvent(JoyAxisEvent evt) {
}
@Override
public void onJoyButtonEvent(JoyButtonEvent evt) {
}
@Override
public void onMouseMotionEvent(MouseMotionEvent evt) {
}
@Override
public void onMouseButtonEvent(MouseButtonEvent evt) {
}
@Override
public void onKeyEvent(KeyInputEvent evt) {
log.info(String.format("On Key: %s", evt.toString()));
log.info(String.format(" - Key char: %c", evt.getKeyChar()));
log.info(String.format(" - Key code: 0x%02x", evt.getKeyCode()));
}
@Override
public void onTouchEvent(TouchEvent evt) {
log.info(String.format("On Touch: %s", evt.toString()));
log.info(String.format(" - Touch characters: %s", evt.getCharacters()));
log.info(String.format(" - Touch keycode: %d", evt.getKeyCode()));
}
}
import java.util.logging.Logger;
import com.jme3.app.SimpleApplication;
import com.jme3.material.Material;
import com.jme3.math.ColorRGBA;
import com.jme3.scene.Geometry;
import com.jme3.scene.shape.Box;
import com.jme3.system.JmeSystem;
public class Main extends SimpleApplication {
public static void main(String[] args) {
Main app = new Main();
app.start();
}
private Logger log;
public Main() {
log = Logger.getLogger("AndroidJmeDebug");
log.severe("Testing logger");
}
@Override
public void simpleInitApp() {
viewPort.setBackgroundColor(ColorRGBA.White);
log.fine("viewport color changed");
Box b = new Box(1, 1, 1);
Geometry geom = new Geometry("Box", b);
Material mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
mat.setColor("Color", ColorRGBA.Black);
geom.setMaterial(mat);
rootNode.attachChild(geom);
log.info("attached black box");
inputManager.addRawInputListener(new LogInput());
JmeSystem.showSoftKeyboard(true);
// Uncomment to test the soft text dialog
// SoftTextDialogInputListener l = new SoftTextDialogInputListener() {
// @Override
// public void onSoftText(int action, String text) {
// log.info("Softtext event: " + text);
// }
// };
// JmeSystem.getSoftTextDialogInput().requestDialog(SoftTextDialogInput.TEXT_ENTRY_DIALOG, "GIMME TEXT", "", l);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment