No puede seleccionar más de 25 temas Los temas deben comenzar con una letra o número, pueden incluir guiones ('-') y pueden tener hasta 35 caracteres de largo.
 
 
 
 
 
 

66 líneas
1.7 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. qq.putChar(0,0, 'J');
  30. qq.drawLine(10, 15, 45, 27, "#");
  31. /* We have a proper canvas, let's display it using Caca */
  32. Caca kk = new Caca(qq);
  33. kk.setDelay(2000000); // Refresh every 2 seconds
  34. kk.setDisplayTitle("libcaca .NET Bindings test suite");
  35. Event e = new Event();
  36. int startTime = kk.getRendertime();
  37. while(kk.getEvent(Event.type.KEY_RELEASE, e, 10) == 0)
  38. {
  39. kk.Refresh();
  40. Console.WriteLine("Render time : {0}", kk.getRendertime()-startTime);
  41. }
  42. /* Force deletion of our instance for fun */
  43. qq.Dispose();
  44. }
  45. }