25'ten fazla konu seçemezsiniz Konular bir harf veya rakamla başlamalı, kısa çizgiler ('-') içerebilir ve en fazla 35 karakter uzunluğunda olabilir.
 
 
 
 
 
 

71 satır
1.9 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.setColor(Cucul.CUCUL_BLUE, Cucul.CUCUL_RED);
  31. qq.drawLine(10, 15, 45, 27, "#");
  32. qq.putStr(10, 10, "Hello from .NET");
  33. Console.WriteLine("Char at 0,0 : {0}", qq.getChar(0,0));
  34. qq.Flip();
  35. /* We have a proper canvas, let's display it using Caca */
  36. Caca kk = new Caca(qq);
  37. kk.setDisplayTime(2000000); // Refresh every 2 seconds
  38. kk.setDisplayTitle("libcaca .NET Bindings test suite");
  39. Event e = new Event();
  40. int startTime = kk.getDisplayTime();
  41. while(kk.getEvent(Event.type.KEY_RELEASE, e, 10) == 0)
  42. {
  43. kk.Refresh();
  44. Console.WriteLine("Render time : {0}", kk.getDisplayTime()-startTime);
  45. }
  46. /* Force deletion of our instance for fun */
  47. qq.Dispose();
  48. }
  49. }