source: libcaca/trunk/DotNet/test.cs @ 943

Last change on this file since 943 was 943, checked in by Sam Hocevar, 14 years ago
  • Set svn properties on the .NET files.
  • Property svn:keywords set to Id
File size: 1.7 KB
Line 
1/*
2 *  Test      .NET bindings test program
3 *  Copyright (c) 2006 Jean-Yves Lamoureux <jylam@lnxscene.org>
4 *                All Rights Reserved
5 *
6 *  $Id: test.cs 943 2006-05-09 00:59:29Z sam $
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
14
15using System;
16using libCucul;
17using libCaca;
18
19class Test {
20
21
22
23        public static void Main() {
24        Console.WriteLine("libcaca .NET test");
25                Console.WriteLine("(c) 2006 Jean-Yves Lamoureux <jylam@lnxscene.org>");
26       
27        /* Instanciate a cucul canvas */
28        Cucul qq = new Cucul();
29       
30        /* Get size, and change it */
31        Console.WriteLine("Old size : {0}x{1}", qq.getWidth(), qq.getHeight());
32        qq.setSize(80,50);
33        Console.WriteLine("Newsize  : {0}x{1}", qq.getWidth(), qq.getHeight());
34
35        /* Random number. This is a static method,
36           not to be used with previous instance */
37        Console.WriteLine("A random number : {0}", Cucul.Rand(0, 1337));
38
39
40        qq.putChar(0,0, 'J');
41
42        qq.drawLine(10, 15, 45, 27, "#");
43
44
45
46        /* We have a proper canvas, let's display it using Caca */
47        Caca kk = new Caca(qq);
48        kk.setDelay(2000000); // Refresh every 2 seconds
49
50        kk.setDisplayTitle("libcaca .NET Bindings test suite");
51
52        Event e = new Event();
53        int startTime = kk.getRendertime();
54        while(kk.getEvent(Event.type.KEY_RELEASE, e, 10) == 0)
55          {
56          kk.Refresh();
57          Console.WriteLine("Render time : {0}", kk.getRendertime()-startTime);
58          }
59
60
61        /* Force deletion of our instance for fun */
62        qq.Dispose();
63        }
64
65}
Note: See TracBrowser for help on using the repository browser.