Browse Source

Detect touch screen in sample (#944)

Christian Zommerfelds 4 years ago
parent
commit
a779f6f1aa
1 changed files with 3 additions and 2 deletions
  1. 3 2
      samples/Input.hx

+ 3 - 2
samples/Input.hx

@@ -12,6 +12,7 @@ class Input extends hxd.App {
 		console.addCommand("hello", "Prints the correct answer", [], function() console.log("World", 0xFF00FF));
 
 		debug = new h2d.Text(font, s2d);
+		debug.scale(2);
 		debug.x = debug.y = 5;
 
 		input = new h2d.TextInput(font, s2d);
@@ -45,11 +46,11 @@ class Input extends hxd.App {
 
 	override function update(dt:Float) {
 		// check special keys state
-		debug.text = "Cursor: " + input.cursorIndex + ", Sel: " + input.getSelectedText()+", Down: "+[for( i in 0...1024 ) if( hxd.Key.isDown(i) ) getKeyName(i)].join(",");
+		debug.text = "Cursor: " + input.cursorIndex + ", Sel: " + input.getSelectedText()+", Touch screen: " + hxd.System.getValue(IsTouch) + ", Down: "+[for( i in 0...1024 ) if( hxd.Key.isDown(i) ) getKeyName(i)].join(",");
 	}
 
 	static function main() {
 		new Input();
 	}
 
-}
+}