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