Преглед изворни кода

* Some mass-renaming in the C# bindings:

+ Renamed the dlls so that the C# versions do not have the same name
      as the C DLLs on Win32. It's now "cucul-sharp.dll", mimicking GTK#.
    + Renamed namespaces: "using Cucul" instead of "using libCucul".
    + Renamed the Cucul class into CuculCanvas to avoid namespace/class
      name collisions.
    + Renamed old-fashioned "kk"/"qq" names into "dp"/"cv".
tags/v0.99.beta14
Sam Hocevar sam пре 17 година
родитељ
комит
16587a464e
8 измењених фајлова са 513 додато и 473 уклоњено
  1. +45
    -50
      csharp/Caca.cs
  2. +430
    -386
      csharp/Cucul.cs
  3. +8
    -8
      csharp/Makefile.am
  4. +3
    -0
      csharp/caca-sharp.dll.config
  5. +3
    -0
      csharp/cucul-sharp.dll.config
  6. +0
    -3
      csharp/libCaca.dll.config
  7. +0
    -3
      csharp/libCucul.dll.config
  8. +24
    -23
      csharp/test.cs

+ 45
- 50
csharp/Caca.cs Прегледај датотеку

@@ -1,5 +1,5 @@
/*
* CacaSharp .NET bindings for libcaca
* libcaca .NET bindings for libcaca
* Copyright (c) 2006 Jean-Yves Lamoureux <jylam@lnxscene.org>
* All Rights Reserved
*
@@ -12,17 +12,14 @@
* http://sam.zoy.org/wtfpl/COPYING for more details.
*/



using System;
using System.Runtime.InteropServices;
using System.Security;

using libCucul;
using Cucul;


namespace libCaca
{
namespace Caca
{

enum Keys
{
@@ -85,31 +82,31 @@ namespace libCaca
}


public unsafe class Caca : IDisposable
public unsafe class Display : IDisposable
{
[DllImport("libCaca.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
[DllImport("libcaca.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
public static extern IntPtr caca_create_display(IntPtr qq);
[DllImport("libCaca.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
[DllImport("libcaca.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
public static extern void caca_free_display(IntPtr kk);
[DllImport("libCaca.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
[DllImport("libcaca.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
public static extern void caca_refresh_display(IntPtr kk);
[DllImport("libCaca.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
[DllImport("libcaca.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
public static extern void caca_set_display_time(IntPtr kk, Int32 d);
[DllImport("libCaca.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
[DllImport("libcaca.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
public static extern Int32 caca_get_display_time(IntPtr kk);
[DllImport("libCaca.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
[DllImport("libcaca.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
public static extern Int32 caca_get_display_width(IntPtr kk);
[DllImport("libCaca.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
[DllImport("libcaca.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
public static extern Int32 caca_get_display_height(IntPtr kk);
[DllImport("libCaca.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
[DllImport("libcaca.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
public static extern Int32 caca_set_display_title(IntPtr kk, string t);
[DllImport("libCaca.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
[DllImport("libcaca.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
public static extern Int32 caca_get_event(IntPtr k, Event.type t, Event e, Int32 timeout);
[DllImport("libCaca.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
[DllImport("libcaca.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
public static extern Int32 caca_get_mouse_x(IntPtr k);
[DllImport("libCaca.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
[DllImport("libcaca.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
public static extern Int32 caca_get_mouse_y(IntPtr k);
[DllImport("libCaca.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
[DllImport("libcaca.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
public static extern void caca_set_mouse(IntPtr k, bool status);


@@ -119,56 +116,56 @@ namespace libCaca
IntPtr qq;
IntPtr kk;

public Caca(Cucul qqt)
{
public Display(CuculCanvas qqt)
{
qq = qqt.get_cucul_t();
kk = caca_create_display(qq);
}
}
public void Dispose()
{
{
caca_free_display(kk);
GC.SuppressFinalize(this);
}
}
public void Refresh()
{
{
caca_refresh_display(kk);
}
}
public void setDisplayTime(Int32 d)
{
{
caca_set_display_time(kk, d);
}
}
public Int32 getDisplayTime()
{
{
return caca_get_display_time(kk);
}
}
public Int32 getDisplayWidth()
{
{
return caca_get_display_width(kk);
}
}
public Int32 getDisplayHeight()
{
{
return caca_get_display_height(kk);
}
}
public Int32 setDisplayTitle(string t)
{
{
return caca_set_display_title(kk, t);
}
}
public Int32 getEvent(Event.type t, Event e, Int32 timeout)
{
{
return caca_get_event(kk, t, e, timeout);
}
}
public Int32 getMouseX()
{
{
return caca_get_mouse_x(kk);
}
}
public Int32 getMouseY()
{
{
return caca_get_mouse_y(kk);
}
}
public void caca_set_mouse(bool status)
{
{
caca_set_mouse(kk, status);
}
}



@@ -177,10 +174,8 @@ namespace libCaca


public IntPtr get_caca_t()
{
{
return kk;
}


}
}
}
}

+ 430
- 386
csharp/Cucul.cs Прегледај датотеку

@@ -1,5 +1,5 @@
/*
* CuculSharp .NET bindings for libcucul
* libcucul .NET bindings for libcucul
* Copyright (c) 2006 Jean-Yves Lamoureux <jylam@lnxscene.org>
* All Rights Reserved
*
@@ -18,441 +18,485 @@ using System;
using System.Runtime.InteropServices;
using System.Security;

namespace Cucul
{
public static class Libcucul
{
[DllImport("libcucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
public static extern int cucul_rand(int min, int max);

namespace libCucul
{
public unsafe class Cucul : IDisposable
public static int Rand(int min, int max)
{
return cucul_rand(min, max);
}

/* Constants */
public const int BLACK = 0x00;
public const int BLUE = 0x01;
public const int GREEN = 0x02;
public const int CYAN = 0x03;
public const int RED = 0x04;
public const int MAGENTA = 0x05;
public const int BROWN = 0x06;
public const int LIGHTGRAY = 0x07;
public const int DARKGRAY = 0x08;
public const int LIGHTBLUE = 0x09;
public const int LIGHTGREEN = 0x0a;
public const int LIGHTCYAN = 0x0b;
public const int LIGHTRED = 0x0c;
public const int LIGHTMAGENTA = 0x0d;
public const int YELLOW = 0x0e;
public const int WHITE = 0x0f;
public const int DEFAULT = 0x10;
public const int TRANSPARENT = 0x20;

public const int BOLD = 0x01;
public const int ITALICS = 0x02;
public const int UNDERLINE = 0x04;
public const int BLINK = 0x08;
}

public unsafe class CuculCanvas : IDisposable
{
/* Fixme */
[DllImport("libCucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
public static extern IntPtr cucul_create_canvas(int w, int h);
[DllImport("libCucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
public static extern Int32 cucul_get_canvas_width(IntPtr qq);
[DllImport("libCucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
public static extern Int32 cucul_get_canvas_height(IntPtr qq);
[DllImport("libCucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
public static extern Int32 cucul_set_canvas_size(IntPtr qq, int w, int h);
[DllImport("libCucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
public static extern Int32 cucul_rand(int min, int max);
[DllImport("libCucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
public static extern Int32 cucul_free_canvas(IntPtr qq);
[DllImport("libCucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
public static extern Int32 cucul_set_color(IntPtr qq, int fg, int bg);
[DllImport("libCucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
public static extern Int32 cucul_set_truecolor(IntPtr qq, Int32 fg, Int32 bg);
[DllImport("libCucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
public static extern Int32 cucul_putchar(IntPtr qq, int x, int y, char c);
[DllImport("libCucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
public static extern Int32 cucul_putstr(IntPtr qq, int x , int y, String c);

[DllImport("libCucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
public static extern Int32 cucul_clear_canvas(IntPtr qq);
[DllImport("libCucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
public static extern Int32 cucul_blit(IntPtr qq, Int32 x, Int32 y, IntPtr qq1, IntPtr qq2);
[DllImport("libCucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
public static extern Int32 cucul_draw_line(IntPtr qq, Int32 x1, Int32 y1, Int32 x2, Int32 y2, Int32 c);
[DllImport("libCucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
public static extern Int32 cucul_draw_polyline(IntPtr qq, Int32[] x, Int32[] y, Int32 n, IntPtr c);
[DllImport("libCucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
public static extern Int32 cucul_draw_thin_line(IntPtr qq, Int32 x1, Int32 y1, Int32 x2, Int32 y2);
[DllImport("libCucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
public static extern Int32 cucul_draw_thin_polyline(IntPtr qq, Int32[] x, Int32[] y, Int32 n);

[DllImport("libCucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
public static extern Int32 cucul_gotoxy(IntPtr qq, Int32 x, Int32 y);
[DllImport("libCucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
public static extern Int32 cucul_get_cursor_x(IntPtr qq);
[DllImport("libCucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
public static extern Int32 cucul_get_cursor_y(IntPtr qq);
[DllImport("libCucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
public static extern Int32 cucul_put_char(IntPtr qq, Int32 x, Int32 y, Int32 c);
[DllImport("libCucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
public static extern Int32 cucul_get_char(IntPtr qq, Int32 x, Int32 y);
[DllImport("libCucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
public static extern Int32 cucul_put_str(IntPtr qq, Int32 x, Int32 y, string c);
[DllImport("libCucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
public static extern Int32 cucul_get_attr(IntPtr qq, Int32 x, Int32 y);
[DllImport("libCucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
public static extern Int32 cucul_set_attr(IntPtr qq, Int32 a);
[DllImport("libCucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
public static extern Int32 cucul_put_attr(IntPtr qq, Int32 x, Int32 y, Int32 a);
[DllImport("libCucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
public static extern Int32 cucul_set_color_ansi(IntPtr qq, Int32 fg, Int32 bg);
[DllImport("libCucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
public static extern Int32 cucul_set_color_argb(IntPtr qq, Int32 fg, Int32 bg);
[DllImport("libCucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
public static extern Int32 cucul_set_canvas_handle(IntPtr qq, Int32 x, Int32 y);
[DllImport("libCucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
public static extern Int32 cucul_get_canvas_handle_x(IntPtr qq);
[DllImport("libCucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
public static extern Int32 cucul_get_canvas_handle_y(IntPtr qq);
[DllImport("libCucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
public static extern Int32 cucul_set_canvas_boundaries(IntPtr qq, Int32 x, Int32 y,
Int32 h, Int32 w);

[DllImport("libCucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
public static extern Int32 cucul_invert(IntPtr qq);
[DllImport("libCucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
public static extern Int32 cucul_flip(IntPtr qq);
[DllImport("libCucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
public static extern Int32 cucul_flop(IntPtr qq);
[DllImport("libCucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
public static extern Int32 cucul_rotate(IntPtr qq);

[DllImport("libCucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
public static extern Int32 cucul_attr_to_ansi(Int64 a);
[DllImport("libCucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
public static extern Int32 cucul_attr_to_ansi_fg(Int64 a);
[DllImport("libCucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
public static extern Int32 cucul_attr_to_ansi_bg(Int64 a);

[DllImport("libCucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
public static extern Int32 cucul_get_frame_count(IntPtr qq);
[DllImport("libCucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
public static extern Int32 cucul_set_frame(IntPtr qq, Int32 f);
[DllImport("libCucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
public static extern string cucul_get_frame_name(IntPtr qq);
[DllImport("libCucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
public static extern Int32 cucul_set_frame_name(IntPtr qq, string n);
[DllImport("libCucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
public static extern Int32 cucul_create_frame(IntPtr qq, Int32 f);
[DllImport("libCucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
public static extern Int32 cucul_free_frame(IntPtr qq, Int32 f);


/* Constants */

public const Int32 CUCUL_BLACK = 0x00; /**< The colour index for black. */
public const Int32 CUCUL_BLUE = 0x01; /**< The colour index for blue. */
public const Int32 CUCUL_GREEN = 0x02; /**< The colour index for green. */
public const Int32 CUCUL_CYAN = 0x03; /**< The colour index for cyan. */
public const Int32 CUCUL_RED = 0x04; /**< The colour index for red. */
public const Int32 CUCUL_MAGENTA = 0x05; /**< The colour index for magenta. */
public const Int32 CUCUL_BROWN = 0x06; /**< The colour index for brown. */
public const Int32 CUCUL_LIGHTGRAY = 0x07; /**< The colour index for light gray. */
public const Int32 CUCUL_DARKGRAY = 0x08; /**< The colour index for dark gray. */
public const Int32 CUCUL_LIGHTBLUE = 0x09; /**< The colour index for blue. */
public const Int32 CUCUL_LIGHTGREEN = 0x0a; /**< The colour index for light green. */
public const Int32 CUCUL_LIGHTCYAN = 0x0b; /**< The colour index for light cyan. */
public const Int32 CUCUL_LIGHTRED = 0x0c; /**< The colour index for light red. */
public const Int32 CUCUL_LIGHTMAGENTA = 0x0d; /**< The colour index for light magenta. */
public const Int32 CUCUL_YELLOW = 0x0e; /**< The colour index for yellow. */
public const Int32 CUCUL_WHITE = 0x0f; /**< The colour index for white. */
public const Int32 CUCUL_DEFAULT = 0x10; /**< The output driver's default colour. */
public const Int32 CUCUL_TRANSPARENT = 0x20; /**< The transparent colour. */

public const Int32 CUCUL_BOLD = 0x01; /**< The style mask for bold. */
public const Int32 CUCUL_ITALICS = 0x02; /**< The style mask for italics. */
public const Int32 CUCUL_UNDERLINE = 0x04; /**< The style mask for underline. */
public const Int32 CUCUL_BLINK = 0x08; /**< The style mask for blink. */


IntPtr qq;

public Cucul()
{
qq = cucul_create_canvas(0, 0);
}
/* Fixme */
[DllImport("libcucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
public static extern IntPtr cucul_create_canvas(int w, int h);
[DllImport("libcucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
public static extern int cucul_get_canvas_width(IntPtr cv);
[DllImport("libcucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
public static extern int cucul_get_canvas_height(IntPtr cv);
[DllImport("libcucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
public static extern int cucul_set_canvas_size(IntPtr cv, int w, int h);
[DllImport("libcucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
public static extern int cucul_free_canvas(IntPtr cv);
[DllImport("libcucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
public static extern int cucul_set_color(IntPtr cv, int fg, int bg);
[DllImport("libcucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
public static extern int cucul_set_truecolor(IntPtr cv, int fg, int bg);
[DllImport("libcucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
public static extern int cucul_putchar(IntPtr cv, int x, int y, char c);
[DllImport("libcucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
public static extern int cucul_putstr(IntPtr cv, int x , int y, String c);

[DllImport("libcucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
public static extern int cucul_clear_canvas(IntPtr cv);
[DllImport("libcucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
public static extern int cucul_blit(IntPtr cv, int x, int y, IntPtr cv1, IntPtr cv2);
[DllImport("libcucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
public static extern int cucul_draw_line(IntPtr cv, int x1, int y1, int x2, int y2, int c);
[DllImport("libcucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
public static extern int cucul_draw_polyline(IntPtr cv, int[] x, int[] y, int n, IntPtr c);
[DllImport("libcucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
public static extern int cucul_draw_thin_line(IntPtr cv, int x1, int y1, int x2, int y2);
[DllImport("libcucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
public static extern int cucul_draw_thin_polyline(IntPtr cv, int[] x, int[] y, int n);
[DllImport("libcucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
public static extern int cucul_gotoxy(IntPtr cv, int x, int y);
[DllImport("libcucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
public static extern int cucul_get_cursor_x(IntPtr cv);
[DllImport("libcucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
public static extern int cucul_get_cursor_y(IntPtr cv);
[DllImport("libcucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
public static extern int cucul_put_char(IntPtr cv, int x, int y, int c);
[DllImport("libcucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
public static extern int cucul_get_char(IntPtr cv, int x, int y);
[DllImport("libcucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
public static extern int cucul_put_str(IntPtr cv, int x, int y, string c);
[DllImport("libcucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
public static extern int cucul_get_attr(IntPtr cv, int x, int y);
[DllImport("libcucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
public static extern int cucul_set_attr(IntPtr cv, int a);
[DllImport("libcucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
public static extern int cucul_put_attr(IntPtr cv, int x, int y, int a);
[DllImport("libcucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
public static extern int cucul_set_color_ansi(IntPtr cv, int fg, int bg);
[DllImport("libcucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
public static extern int cucul_set_color_argb(IntPtr cv, int fg, int bg);
[DllImport("libcucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
public static extern int cucul_set_canvas_handle(IntPtr cv, int x, int y);
[DllImport("libcucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
public static extern int cucul_get_canvas_handle_x(IntPtr cv);
[DllImport("libcucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
public static extern int cucul_get_canvas_handle_y(IntPtr cv);
[DllImport("libcucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
public static extern int cucul_set_canvas_boundaries(IntPtr cv, int x, int y,
int h, int w);

[DllImport("libcucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
public static extern int cucul_invert(IntPtr cv);
[DllImport("libcucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
public static extern int cucul_flip(IntPtr cv);
[DllImport("libcucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
public static extern int cucul_flop(IntPtr cv);
[DllImport("libcucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
public static extern int cucul_rotate(IntPtr cv);

[DllImport("libcucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
public static extern int cucul_attr_to_ansi(Int64 a);
[DllImport("libcucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
public static extern int cucul_attr_to_ansi_fg(Int64 a);
[DllImport("libcucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
public static extern int cucul_attr_to_ansi_bg(Int64 a);

[DllImport("libcucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
public static extern int cucul_get_frame_count(IntPtr cv);
[DllImport("libcucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
public static extern int cucul_set_frame(IntPtr cv, int f);
[DllImport("libcucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
public static extern string cucul_get_frame_name(IntPtr cv);
[DllImport("libcucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
public static extern int cucul_set_frame_name(IntPtr cv, string n);
[DllImport("libcucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
public static extern int cucul_create_frame(IntPtr cv, int f);
[DllImport("libcucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
public static extern int cucul_free_frame(IntPtr cv, int f);

IntPtr cv;

public CuculCanvas()
{
cv = cucul_create_canvas(0, 0);
}

public void Dispose()
{
cucul_free_canvas(qq);
GC.SuppressFinalize(this);
}
public Cucul(Int32 w, Int32 h)
{
qq = cucul_create_canvas(w, h);
}
public Int32 getWidth()
{
return cucul_get_canvas_width(qq);
}
public Int32 getHeight()
{
return cucul_get_canvas_height(qq);
}
public Int32 setSize(Int32 w, Int32 h)
{
return cucul_set_canvas_size(qq, w, h);
}
public static Int32 Rand(Int32 min, Int32 max)
{
return cucul_rand(min, max);
}
public Int32 setColor(int fg, int bg)
{
return cucul_set_color(qq, fg, bg);
}
public Int32 setTruecolor(Int32 fg, Int32 bg)
{
return cucul_set_truecolor(qq, fg, bg);
}
public Int32 putChar(int x, int y, char c)
{
return cucul_putchar(qq, x, y, c);
}
public Int32 Clear()
{
return cucul_clear_canvas(qq);
}
public Int32 Blit(int x, int y, Cucul qq1, Cucul qq2)
{
return cucul_blit(qq, x, y, qq1.get_cucul_t(), qq2.get_cucul_t());
}
public Int32 drawLine(Int32 x1, Int32 y1, Int32 x2, Int32 y2, Int32 c)
{
return cucul_draw_line(qq, x1, y1, x2, y2, c);
}
public Int32 putStr(Int32 x, Int32 y, string c)
{
return cucul_putstr(qq, x, y, c);
}
public Int32 gotoXY(Int32 x, Int32 y)
{
return cucul_gotoxy(qq, x, y);
}
public Int32 getCursorX()
{
return cucul_get_cursor_x(qq);
}
public Int32 getCursorY()
{
return cucul_get_cursor_y(qq);
}
public Int32 getChar(Int32 x, Int32 y)
{
return cucul_get_char(qq, x, y);
}
public Int32 getAttr(Int32 x, Int32 y)
{
return cucul_get_attr(qq, x, y);
}
public Int32 setAttr(Int32 a)
{
return cucul_set_attr(qq, a);
}
public Int32 setAttr(Int32 x, Int32 y, Int32 a)
{
return cucul_put_attr(qq, x, y, a);
}
public Int32 setColorANSI(Int32 fg, Int32 bg)
{
return cucul_set_color_ansi(qq, fg, bg);
}
public Int32 setColorARGB(Int32 fg, Int32 bg)
{
return cucul_set_color_ansi(qq, fg, bg);
}
public Int32 setCanvasHandle(Int32 x, Int32 y)
{
return cucul_set_canvas_handle(qq, x, y);
}
public Int32 getCanvasHandleX()
{
return cucul_get_canvas_handle_x(qq);
}
public Int32 getCanvasHandleY()
{
return cucul_get_canvas_handle_y(qq);
}
public Int32 setCanvasHandleY(Int32 x, Int32 y, Int32 h, Int32 w)
{
return cucul_set_canvas_boundaries(qq, x, y, h, w);
}
{
cucul_free_canvas(cv);
GC.SuppressFinalize(this);
}

public CuculCanvas(int w, int h)
{
cv = cucul_create_canvas(w, h);
}

public int getWidth()
{
return cucul_get_canvas_width(cv);
}

public int getHeight()
{
return cucul_get_canvas_height(cv);
}

public int setSize(int w, int h)
{
return cucul_set_canvas_size(cv, w, h);
}

public int setColor(int fg, int bg)
{
return cucul_set_color(cv, fg, bg);
}

public int setTruecolor(int fg, int bg)
{
return cucul_set_truecolor(cv, fg, bg);
}

public int putChar(int x, int y, char c)
{
return cucul_putchar(cv, x, y, c);
}

public int Clear()
{
return cucul_clear_canvas(cv);
}

public int Blit(int x, int y, CuculCanvas cv1, CuculCanvas cv2)
{
return cucul_blit(cv, x, y, cv1.get_cucul_t(), cv2.get_cucul_t());
}

public int drawLine(int x1, int y1, int x2, int y2, int c)
{
return cucul_draw_line(cv, x1, y1, x2, y2, c);
}

public int putStr(int x, int y, string c)
{
return cucul_putstr(cv, x, y, c);
}

public int gotoXY(int x, int y)
{
return cucul_gotoxy(cv, x, y);
}

public int getCursorX()
{
return cucul_get_cursor_x(cv);
}

public int getCursorY()
{
return cucul_get_cursor_y(cv);
}

public int getChar(int x, int y)
{
return cucul_get_char(cv, x, y);
}

public int getAttr(int x, int y)
{
return cucul_get_attr(cv, x, y);
}

public int setAttr(int a)
{
return cucul_set_attr(cv, a);
}

public int setAttr(int x, int y, int a)
{
return cucul_put_attr(cv, x, y, a);
}

public int setColorANSI(int fg, int bg)
{
return cucul_set_color_ansi(cv, fg, bg);
}

public int setColorARGB(int fg, int bg)
{
return cucul_set_color_ansi(cv, fg, bg);
}

public int setCanvasHandle(int x, int y)
{
return cucul_set_canvas_handle(cv, x, y);
}

public int getCanvasHandleX()
{
return cucul_get_canvas_handle_x(cv);
}

public int getCanvasHandleY()
{
return cucul_get_canvas_handle_y(cv);
}

public int setCanvasHandleY(int x, int y, int h, int w)
{
return cucul_set_canvas_boundaries(cv, x, y, h, w);
}


public Int32 Invert()
{
return cucul_invert(qq);
}
public Int32 Flip()
{
return cucul_flip(qq);
}
public Int32 Flop()
{
return cucul_flop(qq);
}
public Int32 Rotate()
{
return cucul_rotate(qq);
}

public Int32 AttrToANSI(Int64 a)
{
public int Invert()
{
return cucul_invert(cv);
}

public int Flip()
{
return cucul_flip(cv);
}

public int Flop()
{
return cucul_flop(cv);
}

public int Rotate()
{
return cucul_rotate(cv);
}


public int AttrToANSI(Int64 a)
{
return cucul_attr_to_ansi(a);
}
public Int32 AttrToANSIFg(Int64 a)
{
}

public int AttrToANSIFg(Int64 a)
{
return cucul_attr_to_ansi_fg(a);
}
public Int32 AttrToANSIBg(Int64 a)
{
}

public int AttrToANSIBg(Int64 a)
{
return cucul_attr_to_ansi_bg(a);
}
}





public int getFrameCount()
{
return cucul_get_frame_count(cv);
}

public int setFrame(int f)
{
return cucul_set_frame(cv, f);
}

public Int32 getFrameCount()
{
return cucul_get_frame_count(qq);
}
public Int32 setFrame(Int32 f)
{
return cucul_set_frame(qq, f);
}
public string getFrameName()
{
return cucul_get_frame_name(qq);
}
public Int32 setFrameName(string n)
{
return cucul_set_frame_name(qq, n);
}
public Int32 createFrame(Int32 f)
{
return cucul_create_frame(qq, f);
}
public Int32 freeFrame(Int32 f)
{
return cucul_free_frame(qq, f);
}
{
return cucul_get_frame_name(cv);
}

public int setFrameName(string n)
{
return cucul_set_frame_name(cv, n);
}

public int createFrame(int f)
{
return cucul_create_frame(cv, f);
}

public int freeFrame(int f)
{
return cucul_free_frame(cv, f);
}



/* Privates methods, are not meant to be called by user*/
public IntPtr get_cucul_t()
{
return qq;
}
{
return cv;
}

}



public unsafe class Dither : IDisposable

public unsafe class CuculDither : IDisposable
{
[DllImport("libCucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
public static extern IntPtr cucul_create_dither(Int32 bpp, Int32 w,
Int32 h, Int32 pitch,
[DllImport("libcucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
public static extern IntPtr cucul_create_dither(int bpp, int w,
int h, int pitch,
Int64 rmask,
Int64 gmask,
Int64 bmask,
Int64 amask);


[DllImport("libCucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
public static extern Int32 cucul_set_dither_palette(IntPtr d,
Int32[] r, Int32[] g,
Int32[] b, Int32[] a);
[DllImport("libCucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
public static extern Int32 cucul_set_dither_brightness(IntPtr d, float b);
[DllImport("libCucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
public static extern Int32 cucul_set_dither_gamma(IntPtr d, float g);
[DllImport("libCucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
public static extern Int32 cucul_set_dither_contrast(IntPtr d, float c);
[DllImport("libCucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
public static extern Int32 cucul_set_dither_invert(IntPtr d, int i);
[DllImport("libCucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
public static extern Int32 cucul_set_dither_antialias(IntPtr d, string s);
[DllImport("libCucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
[DllImport("libcucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
public static extern int cucul_set_dither_palette(IntPtr d,
int[] r, int[] g,
int[] b, int[] a);
[DllImport("libcucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
public static extern int cucul_set_dither_brightness(IntPtr d, float b);
[DllImport("libcucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
public static extern int cucul_set_dither_gamma(IntPtr d, float g);
[DllImport("libcucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
public static extern int cucul_set_dither_contrast(IntPtr d, float c);
[DllImport("libcucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
public static extern int cucul_set_dither_invert(IntPtr d, int i);
[DllImport("libcucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
public static extern int cucul_set_dither_antialias(IntPtr d, string s);
[DllImport("libcucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
public static extern string[] cucul_get_dither_antialias_list(IntPtr d);
[DllImport("libCucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
public static extern Int32 cucul_set_dither_color(IntPtr d, string s);
[DllImport("libCucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
[DllImport("libcucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
public static extern int cucul_set_dither_color(IntPtr d, string s);
[DllImport("libcucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
public static extern string[] cucul_get_dither_color_list(IntPtr d);
[DllImport("libCucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
public static extern Int32 cucul_set_dither_charset(IntPtr d, string s);
[DllImport("libCucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
[DllImport("libcucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
public static extern int cucul_set_dither_charset(IntPtr d, string s);
[DllImport("libcucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
public static extern string[] cucul_get_dither_charset_list(IntPtr d);
[DllImport("libCucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
public static extern Int32 cucul_set_dither_mode(IntPtr d, string s);
[DllImport("libCucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
[DllImport("libcucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
public static extern int cucul_set_dither_mode(IntPtr d, string s);
[DllImport("libcucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
public static extern string[] cucul_get_dither_mode_list(IntPtr d);
[DllImport("libCucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
public static extern Int32 cucul_free_dither(IntPtr d);
[DllImport("libcucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
public static extern int cucul_free_dither(IntPtr d);

/* FIXME [DllImport("libCucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
Int32 cucul_dither_bitmap(Cucul c,Int32 x, Int32 y, Int32 w , Int32 y,
/* FIXME [DllImport("libcucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
int cucul_dither_bitmap(Canvas c,int x, int y, int w , int y,
IntPtr d2, void *);*/



IntPtr dither;

public Dither(Int32 bpp, Int32 w,Int32 h, Int32 pitch,
Int64 rmask, Int64 gmask,Int64 bmask, Int64 amask)
{
dither = cucul_create_dither(bpp, w, h, pitch, rmask, gmask, bmask, amask);
}
public CuculDither(int bpp, int w,int h, int pitch,
Int64 rmask, Int64 gmask,Int64 bmask, Int64 amask)
{
dither = cucul_create_dither(bpp, w, h, pitch, rmask, gmask, bmask, amask);
}

public void Dispose()
{
cucul_free_dither(dither);
GC.SuppressFinalize(this);
}
public Int32 setBrightness(float b)
{
{
cucul_free_dither(dither);
GC.SuppressFinalize(this);
}

public int setBrightness(float b)
{
return cucul_set_dither_brightness(dither, b);
}
public Int32 setGamma(float g)
{
}

public int setGamma(float g)
{
return cucul_set_dither_gamma(dither, g);
}
public Int32 setContrast(float c)
{
}

public int setContrast(float c)
{
return cucul_set_dither_contrast(dither, c);
}
public Int32 setInvert(Int32 i)
{
}

public int setInvert(int i)
{
return cucul_set_dither_invert(dither, i);
}
public Int32 setAntialias(string s)
{
}

public int setAntialias(string s)
{
return cucul_set_dither_antialias(dither, s);
}
public Int32 setColor(string s)
{
}

public int setColor(string s)
{
return cucul_set_dither_color(dither, s);
}
public Int32 setCharset(string s)
{
}

public int setCharset(string s)
{
return cucul_set_dither_charset(dither, s);
}
public Int32 setMode(string s)
{
return cucul_set_dither_mode(dither, s);
}
/* <FIXME> */
public string[] getAntialiasList()
{
return cucul_get_dither_antialias_list(dither);
}
public string[] getColorList()
{
return cucul_get_dither_color_list(dither);
}
public string[] getCharsetList()
{
return cucul_get_dither_charset_list(dither);
}
public string[] getModeList()
{
return cucul_get_dither_mode_list(dither);
}
/* </FIXME> */
}

public int setMode(string s)
{
return cucul_set_dither_mode(dither, s);
}

/* <FIXME> */
public string[] getAntialiasList()
{
return cucul_get_dither_antialias_list(dither);
}

public string[] getColorList()
{
return cucul_get_dither_color_list(dither);
}

public string[] getCharsetList()
{
return cucul_get_dither_charset_list(dither);
}

public string[] getModeList()
{
return cucul_get_dither_mode_list(dither);
}

/* </FIXME> */
}

}











}


+ 8
- 8
csharp/Makefile.am Прегледај датотеку

@@ -1,24 +1,24 @@
# $Id: $

if USE_CSHARP
noinst_DATA = libCucul.dll libCaca.dll test.exe
noinst_DATA = cucul-sharp.dll caca-sharp.dll test.exe
endif

EXTRA_DIST = AssemblyInfo.cs \
Cucul.cs \
Caca.cs \
libCucul.dll.config \
libCaca.dll.config \
cucul-sharp.dll.config \
caca-sharp.dll.config \
test.cs

libCucul.dll: AssemblyInfo.cs Cucul.cs
cucul-sharp.dll: AssemblyInfo.cs Cucul.cs
gmcs $^ -out:$@ -target:library -unsafe

libCaca.dll: AssemblyInfo.cs Caca.cs
gmcs $^ -out:$@ -target:library -r:./libCucul.dll -lib:./ -unsafe
caca-sharp.dll: AssemblyInfo.cs Caca.cs
gmcs $^ -out:$@ -target:library -r:./cucul-sharp.dll -lib:./ -unsafe

test.exe: test.cs libCaca.dll libCucul.dll
gmcs test.cs -out:$@ -r:./libCucul.dll -r:./libCaca.dll -lib:./ -unsafe
test.exe: test.cs caca-sharp.dll cucul-sharp.dll
gmcs test.cs -out:$@ -r:./cucul-sharp.dll -r:./caca-sharp.dll -lib:./ -unsafe

clean-local:
rm -f *.exe *.dll


+ 3
- 0
csharp/caca-sharp.dll.config Прегледај датотеку

@@ -0,0 +1,3 @@
<configuration>
<dllmap dll="libcaca.dll" target="libcaca.so" />
</configuration>

+ 3
- 0
csharp/cucul-sharp.dll.config Прегледај датотеку

@@ -0,0 +1,3 @@
<configuration>
<dllmap dll="libcucul.dll" target="libcucul.so" />
</configuration>

+ 0
- 3
csharp/libCaca.dll.config Прегледај датотеку

@@ -1,3 +0,0 @@
<configuration>
<dllmap dll="libCaca.dll" target="libcaca.so" />
</configuration>

+ 0
- 3
csharp/libCucul.dll.config Прегледај датотеку

@@ -1,3 +0,0 @@
<configuration>
<dllmap dll="libCucul.dll" target="libcucul.so" />
</configuration>

+ 24
- 23
csharp/test.cs Прегледај датотеку

@@ -14,8 +14,9 @@


using System;
using libCucul;
using libCaca;

using Cucul;
using Caca;

class Test {

@@ -27,20 +28,20 @@ class Test {
Console.WriteLine("(c) 2006 Jean-Yves Lamoureux <jylam@lnxscene.org>");
/* Instanciate a cucul canvas */
Cucul qq = new Cucul();
CuculCanvas cv = new CuculCanvas();

/* Random number. This is a static method,
not to be used with previous instance */
Console.WriteLine("A random number : {0}", Cucul.Rand(0, 1337));
Console.WriteLine("A random number : {0}", Libcucul.Rand(0, 1337));



/* We have a proper canvas, let's display it using Caca */
Caca kk = new Caca(qq);
kk.setDisplayTime(20000); // Refresh every 20 ms
Display dp = new Display(cv);
dp.setDisplayTime(20000); // Refresh every 20 ms

kk.setDisplayTitle("libcaca .NET Bindings test suite");
dp.setDisplayTitle("libcaca .NET Bindings test suite");

double v;
Int32 y = 0;
@@ -48,40 +49,40 @@ class Test {
Int32 i;
DateTime startTime = DateTime.Now;
while(kk.getEvent(Event.type.KEY_RELEASE, e, 10) == 0)
while(dp.getEvent(Event.type.KEY_RELEASE, e, 10) == 0)
{
TimeSpan curTime = DateTime.Now - startTime;
double t = curTime.TotalMilliseconds;
qq.setColor(Cucul.CUCUL_WHITE, Cucul.CUCUL_BLACK);
cv.setColor(Libcucul.WHITE, Libcucul.BLACK);
for(i=0; i<barCount;i++)
{
v = ((Math.Sin((t/500.0)+(i/((double)barCount)))+1)/2)*qq.getHeight();
v = ((Math.Sin((t/500.0)+(i/((double)barCount)))+1)/2)*cv.getHeight();
y = (Int32) v;


qq.setColor(i+9, Cucul.CUCUL_BLACK);
cv.setColor(i+9, Libcucul.BLACK);
/* drawLine is already clipped, we don't care about overflows */
qq.drawLine(0, y-2, qq.getWidth(), y-2, '-');
qq.drawLine(0, y-1, qq.getWidth(), y-1, '*');
qq.drawLine(0, y, qq.getWidth(), y, '#');
qq.drawLine(0, y+1, qq.getWidth(), y+1, '*');
qq.drawLine(0, y+2, qq.getWidth(), y+2, '-');
cv.drawLine(0, y-2, cv.getWidth(), y-2, '-');
cv.drawLine(0, y-1, cv.getWidth(), y-1, '*');
cv.drawLine(0, y, cv.getWidth(), y, '#');
cv.drawLine(0, y+1, cv.getWidth(), y+1, '*');
cv.drawLine(0, y+2, cv.getWidth(), y+2, '-');
}

qq.setColor(Cucul.CUCUL_WHITE, Cucul.CUCUL_BLUE);
qq.putStr(qq.getWidth() - 30,qq.getHeight() - 2," -=[ Powered by libcaca ]=- ");
qq.setColor(Cucul.CUCUL_WHITE, Cucul.CUCUL_BLACK);
cv.setColor(Libcucul.WHITE, Libcucul.BLUE);
cv.putStr(cv.getWidth() - 30,cv.getHeight() - 2," -=[ Powered by libcaca ]=- ");
cv.setColor(Libcucul.WHITE, Libcucul.BLACK);

kk.Refresh();
qq.Clear();
dp.Refresh();
cv.Clear();
}

/* Force deletion of our instances for fun */
qq.Dispose();
kk.Dispose();
dp.Dispose();
cv.Dispose();
}

}

Loading…
Откажи
Сачувај