| 1 |
/* |
| 2 |
* libcaca .NET bindings for libcaca |
| 3 |
* Copyright (c) 2006 Jean-Yves Lamoureux <[email protected]> |
| 4 |
* 2007 Sam Hocevar <sam@@hocevar.net> |
| 5 |
* All Rights Reserved |
| 6 |
* |
| 7 |
* This library is free software. It comes without any warranty, to |
| 8 |
* the extent permitted by applicable law. You can redistribute it |
| 9 |
* and/or modify it under the terms of the Do What the Fuck You Want |
| 10 |
* to Public License, Version 2, as published by Sam Hocevar. See |
| 11 |
* http://www.wtfpl.net/ for more details. |
| 12 |
*/ |
| 13 |
|
| 14 |
using System; |
| 15 |
using System.Runtime.InteropServices; |
| 16 |
using System.Security; |
| 17 |
using System.Drawing; |
| 18 |
|
| 19 |
namespace Caca |
| 20 |
{ |
| 21 |
/* Static libcaca stuff that does not fit in any object */ |
| 22 |
public static class Libcaca |
| 23 |
{ |
| 24 |
[DllImport("libcaca.dll", CallingConvention=CallingConvention.Cdecl), |
| 25 |
SuppressUnmanagedCodeSecurity] |
| 26 |
private static extern int caca_rand(int min, int max); |
| 27 |
public static int Rand(int min, int max) |
| 28 |
{ |
| 29 |
return caca_rand(min, max); |
| 30 |
} |
| 31 |
|
| 32 |
[DllImport("libcaca.dll", CallingConvention=CallingConvention.Cdecl), |
| 33 |
SuppressUnmanagedCodeSecurity] |
| 34 |
private static extern IntPtr caca_get_version(); |
| 35 |
public static string getVersion() |
| 36 |
{ |
| 37 |
return Marshal.PtrToStringAnsi(caca_get_version()); |
| 38 |
} |
| 39 |
} |
| 40 |
} |
| 41 |
|