Cursor.hx 961 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. class Cursor extends hxd.App {
  2. override function init() {
  3. engine.backgroundColor = 0xFF202020;
  4. var bmp = new hxd.BitmapData(32, 32);
  5. bmp.clear(0x80FF0000);
  6. bmp.line(0, 0, 31, 0, 0xFFFFFFFF);
  7. bmp.line(0, 0, 0, 31, 0xFF0000FF);
  8. bmp.line(0, 31, 31, 31, 0xFFFF0000);
  9. bmp.line(31, 0, 31, 31, 0xFF00FF00);
  10. var cursors : Array<hxd.Cursor> = [Default,Button,Move,TextInput,Hide,Custom(new hxd.Cursor.CustomCursor([bmp],0.,16,16))];
  11. var pos = 0;
  12. for( c in cursors ) {
  13. var i = new h2d.Interactive(100, 20, s2d);
  14. var tf = new h2d.Text(hxd.res.DefaultFont.get(), i);
  15. tf.text = c.getName();
  16. tf.x = 5;
  17. i.x = 0;
  18. i.y = pos++ * 20;
  19. i.cursor = c;
  20. i.backgroundColor = Std.random(0x1000000) | 0xFF000000;
  21. var supported = true;
  22. #if js
  23. if( c.match(Custom(_)) ) supported = false;
  24. #end
  25. if( !supported ) {
  26. tf.textColor = 0xFF0000;
  27. i.cursor = Default;
  28. }
  29. }
  30. }
  31. static function main() {
  32. new Cursor();
  33. }
  34. }