選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

Caca.cs 1.3 KiB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  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$
  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. using System;
  16. using System.Runtime.InteropServices;
  17. using System.Security;
  18. using System.Drawing;
  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. [DllImport("libcaca.dll", CallingConvention=CallingConvention.Cdecl),
  32. SuppressUnmanagedCodeSecurity]
  33. private static extern IntPtr caca_get_version();
  34. public static string getVersion()
  35. {
  36. return Marshal.PtrToStringAnsi(caca_get_version());
  37. }
  38. }
  39. }