You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

74 lines
2.2 KiB

  1. /*
  2. * Test .NET bindings test program
  3. * Copyright (c) 2006 Jean-Yves Lamoureux <jylam@lnxscene.org>
  4. * All Rights Reserved
  5. *
  6. * $Id$
  7. *
  8. * This library is free software; you can redistribute it and/or
  9. * modify it under the terms of the Do What The Fuck You Want To
  10. * Public License, Version 2, as published by Sam Hocevar. See
  11. * http://sam.zoy.org/wtfpl/COPYING for more details.
  12. */
  13. using System;
  14. using libCucul;
  15. using libCaca;
  16. class Test {
  17. public static void Main() {
  18. Console.WriteLine("libcaca .NET test");
  19. Console.WriteLine("(c) 2006 Jean-Yves Lamoureux <jylam@lnxscene.org>");
  20. /* Instanciate a cucul canvas */
  21. Cucul qq = new Cucul();
  22. /* Get size, and change it */
  23. Console.WriteLine("Old size : {0}x{1}", qq.getWidth(), qq.getHeight());
  24. qq.setSize(80,50);
  25. Console.WriteLine("Newsize : {0}x{1}", qq.getWidth(), qq.getHeight());
  26. /* Random number. This is a static method,
  27. not to be used with previous instance */
  28. Console.WriteLine("A random number : {0}", Cucul.Rand(0, 1337));
  29. /* Draw stuff on our canvas */
  30. qq.putChar(0,0, 'J');
  31. qq.setColor(Cucul.CUCUL_BLUE, Cucul.CUCUL_RED);
  32. qq.drawLine(10, 15, 45, 27, "#");
  33. qq.putStr(10, 10, "Hello from .NET");
  34. Console.WriteLine("Char at 0,0 : {0}", qq.getChar(0,0));
  35. qq.Flip();
  36. /* Create a Dither instance */
  37. Dither dither = new Dither(32, 320, 200, 320, 0x00FF0000, 0x0000FF00, 0x000000FF, 0xFF000000);
  38. dither.setBrightness((float)0.7);
  39. string[] aalist = dither.getAntialiasList();
  40. Console.WriteLine("List : '{0}'", aalist[1]);
  41. /* We have a proper canvas, let's display it using Caca */
  42. Caca kk = new Caca(qq);
  43. kk.setDisplayTime(2000000); // Refresh every 2 seconds
  44. kk.setDisplayTitle("libcaca .NET Bindings test suite");
  45. Event e = new Event();
  46. int startTime = kk.getDisplayTime();
  47. while(kk.getEvent(Event.type.KEY_RELEASE, e, 10) == 0)
  48. {
  49. kk.Refresh();
  50. Console.WriteLine("Render time : {0}", kk.getDisplayTime()-startTime);
  51. }
  52. /* Force deletion of our instance for fun */
  53. qq.Dispose();
  54. }
  55. }