Changeset 2045 for libcaca/trunk/csharp
- Timestamp:
- Nov 24, 2007, 2:26:33 PM (13 years ago)
- Location:
- libcaca/trunk/csharp
- Files:
-
- 2 added
- 2 deleted
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
libcaca/trunk/csharp/Caca.cs
r2044 r2045 1 1 /* 2 * CacaSharp.NET bindings for libcaca2 * libcaca .NET bindings for libcaca 3 3 * Copyright (c) 2006 Jean-Yves Lamoureux <jylam@lnxscene.org> 4 4 * All Rights Reserved … … 13 13 */ 14 14 15 16 17 15 using System; 18 16 using System.Runtime.InteropServices; 19 17 using System.Security; 20 18 21 using libCucul;19 using Cucul; 22 20 23 24 namespace libCaca 25 { 21 namespace Caca 22 { 26 23 27 24 enum Keys … … 86 83 87 84 88 public unsafe class Caca: IDisposable85 public unsafe class Display : IDisposable 89 86 { 90 [DllImport("lib Caca.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]87 [DllImport("libcaca.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 91 88 public static extern IntPtr caca_create_display(IntPtr qq); 92 [DllImport("lib Caca.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]89 [DllImport("libcaca.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 93 90 public static extern void caca_free_display(IntPtr kk); 94 [DllImport("lib Caca.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]91 [DllImport("libcaca.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 95 92 public static extern void caca_refresh_display(IntPtr kk); 96 [DllImport("lib Caca.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]93 [DllImport("libcaca.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 97 94 public static extern void caca_set_display_time(IntPtr kk, Int32 d); 98 [DllImport("lib Caca.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]95 [DllImport("libcaca.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 99 96 public static extern Int32 caca_get_display_time(IntPtr kk); 100 [DllImport("lib Caca.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]97 [DllImport("libcaca.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 101 98 public static extern Int32 caca_get_display_width(IntPtr kk); 102 [DllImport("lib Caca.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]99 [DllImport("libcaca.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 103 100 public static extern Int32 caca_get_display_height(IntPtr kk); 104 [DllImport("lib Caca.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]101 [DllImport("libcaca.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 105 102 public static extern Int32 caca_set_display_title(IntPtr kk, string t); 106 [DllImport("lib Caca.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]103 [DllImport("libcaca.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 107 104 public static extern Int32 caca_get_event(IntPtr k, Event.type t, Event e, Int32 timeout); 108 [DllImport("lib Caca.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]105 [DllImport("libcaca.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 109 106 public static extern Int32 caca_get_mouse_x(IntPtr k); 110 [DllImport("lib Caca.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]107 [DllImport("libcaca.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 111 108 public static extern Int32 caca_get_mouse_y(IntPtr k); 112 [DllImport("lib Caca.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]109 [DllImport("libcaca.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 113 110 public static extern void caca_set_mouse(IntPtr k, bool status); 114 111 … … 120 117 IntPtr kk; 121 118 122 public Caca(Cuculqqt)123 119 public Display(CuculCanvas qqt) 120 { 124 121 qq = qqt.get_cucul_t(); 125 122 kk = caca_create_display(qq); 126 123 } 127 124 public void Dispose() 128 125 { 129 126 caca_free_display(kk); 130 127 GC.SuppressFinalize(this); 131 128 } 132 129 public void Refresh() 133 130 { 134 131 caca_refresh_display(kk); 135 132 } 136 133 public void setDisplayTime(Int32 d) 137 134 { 138 135 caca_set_display_time(kk, d); 139 136 } 140 137 public Int32 getDisplayTime() 141 138 { 142 139 return caca_get_display_time(kk); 143 140 } 144 141 public Int32 getDisplayWidth() 145 142 { 146 143 return caca_get_display_width(kk); 147 144 } 148 145 public Int32 getDisplayHeight() 149 146 { 150 147 return caca_get_display_height(kk); 151 148 } 152 149 public Int32 setDisplayTitle(string t) 153 150 { 154 151 return caca_set_display_title(kk, t); 155 152 } 156 153 public Int32 getEvent(Event.type t, Event e, Int32 timeout) 157 154 { 158 155 return caca_get_event(kk, t, e, timeout); 159 156 } 160 157 public Int32 getMouseX() 161 158 { 162 159 return caca_get_mouse_x(kk); 163 160 } 164 161 public Int32 getMouseY() 165 162 { 166 163 return caca_get_mouse_y(kk); 167 164 } 168 165 public void caca_set_mouse(bool status) 169 166 { 170 167 caca_set_mouse(kk, status); 171 168 } 172 169 173 170 … … 178 175 179 176 public IntPtr get_caca_t() 180 177 { 181 178 return kk; 182 }183 184 185 179 } 186 } 180 } 181 } -
libcaca/trunk/csharp/Cucul.cs
r2044 r2045 1 1 /* 2 * CuculSharp.NET bindings for libcucul2 * libcucul .NET bindings for libcucul 3 3 * Copyright (c) 2006 Jean-Yves Lamoureux <jylam@lnxscene.org> 4 4 * All Rights Reserved … … 19 19 using System.Security; 20 20 21 22 namespace libCucul 23 { 21 namespace Cucul 22 { 23 public static class Libcucul 24 { 25 [DllImport("libcucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 26 public static extern int cucul_rand(int min, int max); 27 28 public static int Rand(int min, int max) 29 { 30 return cucul_rand(min, max); 31 } 32 33 /* Constants */ 34 public const int BLACK = 0x00; 35 public const int BLUE = 0x01; 36 public const int GREEN = 0x02; 37 public const int CYAN = 0x03; 38 public const int RED = 0x04; 39 public const int MAGENTA = 0x05; 40 public const int BROWN = 0x06; 41 public const int LIGHTGRAY = 0x07; 42 public const int DARKGRAY = 0x08; 43 public const int LIGHTBLUE = 0x09; 44 public const int LIGHTGREEN = 0x0a; 45 public const int LIGHTCYAN = 0x0b; 46 public const int LIGHTRED = 0x0c; 47 public const int LIGHTMAGENTA = 0x0d; 48 public const int YELLOW = 0x0e; 49 public const int WHITE = 0x0f; 50 public const int DEFAULT = 0x10; 51 public const int TRANSPARENT = 0x20; 52 53 public const int BOLD = 0x01; 54 public const int ITALICS = 0x02; 55 public const int UNDERLINE = 0x04; 56 public const int BLINK = 0x08; 57 } 58 59 public unsafe class CuculCanvas : IDisposable 60 { 61 /* Fixme */ 62 [DllImport("libcucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 63 public static extern IntPtr cucul_create_canvas(int w, int h); 64 [DllImport("libcucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 65 public static extern int cucul_get_canvas_width(IntPtr cv); 66 [DllImport("libcucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 67 public static extern int cucul_get_canvas_height(IntPtr cv); 68 [DllImport("libcucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 69 public static extern int cucul_set_canvas_size(IntPtr cv, int w, int h); 70 [DllImport("libcucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 71 public static extern int cucul_free_canvas(IntPtr cv); 72 [DllImport("libcucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 73 public static extern int cucul_set_color(IntPtr cv, int fg, int bg); 74 [DllImport("libcucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 75 public static extern int cucul_set_truecolor(IntPtr cv, int fg, int bg); 76 [DllImport("libcucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 77 public static extern int cucul_putchar(IntPtr cv, int x, int y, char c); 78 [DllImport("libcucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 79 public static extern int cucul_putstr(IntPtr cv, int x , int y, String c); 80 81 [DllImport("libcucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 82 public static extern int cucul_clear_canvas(IntPtr cv); 83 [DllImport("libcucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 84 public static extern int cucul_blit(IntPtr cv, int x, int y, IntPtr cv1, IntPtr cv2); 85 [DllImport("libcucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 86 public static extern int cucul_draw_line(IntPtr cv, int x1, int y1, int x2, int y2, int c); 87 [DllImport("libcucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 88 public static extern int cucul_draw_polyline(IntPtr cv, int[] x, int[] y, int n, IntPtr c); 89 [DllImport("libcucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 90 public static extern int cucul_draw_thin_line(IntPtr cv, int x1, int y1, int x2, int y2); 91 [DllImport("libcucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 92 public static extern int cucul_draw_thin_polyline(IntPtr cv, int[] x, int[] y, int n); 24 93 25 public unsafe class Cucul : IDisposable 26 { 27 /* Fixme */ 28 [DllImport("libCucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 29 public static extern IntPtr cucul_create_canvas(int w, int h); 30 [DllImport("libCucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 31 public static extern Int32 cucul_get_canvas_width(IntPtr qq); 32 [DllImport("libCucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 33 public static extern Int32 cucul_get_canvas_height(IntPtr qq); 34 [DllImport("libCucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 35 public static extern Int32 cucul_set_canvas_size(IntPtr qq, int w, int h); 36 [DllImport("libCucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 37 public static extern Int32 cucul_rand(int min, int max); 38 [DllImport("libCucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 39 public static extern Int32 cucul_free_canvas(IntPtr qq); 40 [DllImport("libCucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 41 public static extern Int32 cucul_set_color(IntPtr qq, int fg, int bg); 42 [DllImport("libCucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 43 public static extern Int32 cucul_set_truecolor(IntPtr qq, Int32 fg, Int32 bg); 44 [DllImport("libCucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 45 public static extern Int32 cucul_putchar(IntPtr qq, int x, int y, char c); 46 [DllImport("libCucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 47 public static extern Int32 cucul_putstr(IntPtr qq, int x , int y, String c); 48 49 [DllImport("libCucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 50 public static extern Int32 cucul_clear_canvas(IntPtr qq); 51 [DllImport("libCucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 52 public static extern Int32 cucul_blit(IntPtr qq, Int32 x, Int32 y, IntPtr qq1, IntPtr qq2); 53 [DllImport("libCucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 54 public static extern Int32 cucul_draw_line(IntPtr qq, Int32 x1, Int32 y1, Int32 x2, Int32 y2, Int32 c); 55 [DllImport("libCucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 56 public static extern Int32 cucul_draw_polyline(IntPtr qq, Int32[] x, Int32[] y, Int32 n, IntPtr c); 57 [DllImport("libCucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 58 public static extern Int32 cucul_draw_thin_line(IntPtr qq, Int32 x1, Int32 y1, Int32 x2, Int32 y2); 59 [DllImport("libCucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 60 public static extern Int32 cucul_draw_thin_polyline(IntPtr qq, Int32[] x, Int32[] y, Int32 n); 61 62 [DllImport("libCucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 63 public static extern Int32 cucul_gotoxy(IntPtr qq, Int32 x, Int32 y); 64 [DllImport("libCucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 65 public static extern Int32 cucul_get_cursor_x(IntPtr qq); 66 [DllImport("libCucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 67 public static extern Int32 cucul_get_cursor_y(IntPtr qq); 68 [DllImport("libCucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 69 public static extern Int32 cucul_put_char(IntPtr qq, Int32 x, Int32 y, Int32 c); 70 [DllImport("libCucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 71 public static extern Int32 cucul_get_char(IntPtr qq, Int32 x, Int32 y); 72 [DllImport("libCucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 73 public static extern Int32 cucul_put_str(IntPtr qq, Int32 x, Int32 y, string c); 74 [DllImport("libCucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 75 public static extern Int32 cucul_get_attr(IntPtr qq, Int32 x, Int32 y); 76 [DllImport("libCucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 77 public static extern Int32 cucul_set_attr(IntPtr qq, Int32 a); 78 [DllImport("libCucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 79 public static extern Int32 cucul_put_attr(IntPtr qq, Int32 x, Int32 y, Int32 a); 80 [DllImport("libCucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 81 public static extern Int32 cucul_set_color_ansi(IntPtr qq, Int32 fg, Int32 bg); 82 [DllImport("libCucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 83 public static extern Int32 cucul_set_color_argb(IntPtr qq, Int32 fg, Int32 bg); 84 [DllImport("libCucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 85 public static extern Int32 cucul_set_canvas_handle(IntPtr qq, Int32 x, Int32 y); 86 [DllImport("libCucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 87 public static extern Int32 cucul_get_canvas_handle_x(IntPtr qq); 88 [DllImport("libCucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 89 public static extern Int32 cucul_get_canvas_handle_y(IntPtr qq); 90 [DllImport("libCucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 91 public static extern Int32 cucul_set_canvas_boundaries(IntPtr qq, Int32 x, Int32 y, 92 Int32 h, Int32 w); 93 94 [DllImport("libCucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 95 public static extern Int32 cucul_invert(IntPtr qq); 96 [DllImport("libCucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 97 public static extern Int32 cucul_flip(IntPtr qq); 98 [DllImport("libCucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 99 public static extern Int32 cucul_flop(IntPtr qq); 100 [DllImport("libCucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 101 public static extern Int32 cucul_rotate(IntPtr qq); 102 103 [DllImport("libCucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 104 public static extern Int32 cucul_attr_to_ansi(Int64 a); 105 [DllImport("libCucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 106 public static extern Int32 cucul_attr_to_ansi_fg(Int64 a); 107 [DllImport("libCucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 108 public static extern Int32 cucul_attr_to_ansi_bg(Int64 a); 109 110 [DllImport("libCucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 111 public static extern Int32 cucul_get_frame_count(IntPtr qq); 112 [DllImport("libCucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 113 public static extern Int32 cucul_set_frame(IntPtr qq, Int32 f); 114 [DllImport("libCucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 115 public static extern string cucul_get_frame_name(IntPtr qq); 116 [DllImport("libCucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 117 public static extern Int32 cucul_set_frame_name(IntPtr qq, string n); 118 [DllImport("libCucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 119 public static extern Int32 cucul_create_frame(IntPtr qq, Int32 f); 120 [DllImport("libCucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 121 public static extern Int32 cucul_free_frame(IntPtr qq, Int32 f); 122 123 124 /* Constants */ 125 126 public const Int32 CUCUL_BLACK = 0x00; /**< The colour index for black. */ 127 public const Int32 CUCUL_BLUE = 0x01; /**< The colour index for blue. */ 128 public const Int32 CUCUL_GREEN = 0x02; /**< The colour index for green. */ 129 public const Int32 CUCUL_CYAN = 0x03; /**< The colour index for cyan. */ 130 public const Int32 CUCUL_RED = 0x04; /**< The colour index for red. */ 131 public const Int32 CUCUL_MAGENTA = 0x05; /**< The colour index for magenta. */ 132 public const Int32 CUCUL_BROWN = 0x06; /**< The colour index for brown. */ 133 public const Int32 CUCUL_LIGHTGRAY = 0x07; /**< The colour index for light gray. */ 134 public const Int32 CUCUL_DARKGRAY = 0x08; /**< The colour index for dark gray. */ 135 public const Int32 CUCUL_LIGHTBLUE = 0x09; /**< The colour index for blue. */ 136 public const Int32 CUCUL_LIGHTGREEN = 0x0a; /**< The colour index for light green. */ 137 public const Int32 CUCUL_LIGHTCYAN = 0x0b; /**< The colour index for light cyan. */ 138 public const Int32 CUCUL_LIGHTRED = 0x0c; /**< The colour index for light red. */ 139 public const Int32 CUCUL_LIGHTMAGENTA = 0x0d; /**< The colour index for light magenta. */ 140 public const Int32 CUCUL_YELLOW = 0x0e; /**< The colour index for yellow. */ 141 public const Int32 CUCUL_WHITE = 0x0f; /**< The colour index for white. */ 142 public const Int32 CUCUL_DEFAULT = 0x10; /**< The output driver's default colour. */ 143 public const Int32 CUCUL_TRANSPARENT = 0x20; /**< The transparent colour. */ 144 145 public const Int32 CUCUL_BOLD = 0x01; /**< The style mask for bold. */ 146 public const Int32 CUCUL_ITALICS = 0x02; /**< The style mask for italics. */ 147 public const Int32 CUCUL_UNDERLINE = 0x04; /**< The style mask for underline. */ 148 public const Int32 CUCUL_BLINK = 0x08; /**< The style mask for blink. */ 149 150 151 IntPtr qq; 152 153 public Cucul() 154 { 155 qq = cucul_create_canvas(0, 0); 156 } 94 [DllImport("libcucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 95 public static extern int cucul_gotoxy(IntPtr cv, int x, int y); 96 [DllImport("libcucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 97 public static extern int cucul_get_cursor_x(IntPtr cv); 98 [DllImport("libcucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 99 public static extern int cucul_get_cursor_y(IntPtr cv); 100 [DllImport("libcucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 101 public static extern int cucul_put_char(IntPtr cv, int x, int y, int c); 102 [DllImport("libcucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 103 public static extern int cucul_get_char(IntPtr cv, int x, int y); 104 [DllImport("libcucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 105 public static extern int cucul_put_str(IntPtr cv, int x, int y, string c); 106 [DllImport("libcucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 107 public static extern int cucul_get_attr(IntPtr cv, int x, int y); 108 [DllImport("libcucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 109 public static extern int cucul_set_attr(IntPtr cv, int a); 110 [DllImport("libcucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 111 public static extern int cucul_put_attr(IntPtr cv, int x, int y, int a); 112 [DllImport("libcucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 113 public static extern int cucul_set_color_ansi(IntPtr cv, int fg, int bg); 114 [DllImport("libcucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 115 public static extern int cucul_set_color_argb(IntPtr cv, int fg, int bg); 116 [DllImport("libcucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 117 public static extern int cucul_set_canvas_handle(IntPtr cv, int x, int y); 118 [DllImport("libcucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 119 public static extern int cucul_get_canvas_handle_x(IntPtr cv); 120 [DllImport("libcucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 121 public static extern int cucul_get_canvas_handle_y(IntPtr cv); 122 [DllImport("libcucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 123 public static extern int cucul_set_canvas_boundaries(IntPtr cv, int x, int y, 124 int h, int w); 125 126 [DllImport("libcucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 127 public static extern int cucul_invert(IntPtr cv); 128 [DllImport("libcucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 129 public static extern int cucul_flip(IntPtr cv); 130 [DllImport("libcucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 131 public static extern int cucul_flop(IntPtr cv); 132 [DllImport("libcucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 133 public static extern int cucul_rotate(IntPtr cv); 134 135 [DllImport("libcucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 136 public static extern int cucul_attr_to_ansi(Int64 a); 137 [DllImport("libcucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 138 public static extern int cucul_attr_to_ansi_fg(Int64 a); 139 [DllImport("libcucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 140 public static extern int cucul_attr_to_ansi_bg(Int64 a); 141 142 [DllImport("libcucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 143 public static extern int cucul_get_frame_count(IntPtr cv); 144 [DllImport("libcucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 145 public static extern int cucul_set_frame(IntPtr cv, int f); 146 [DllImport("libcucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 147 public static extern string cucul_get_frame_name(IntPtr cv); 148 [DllImport("libcucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 149 public static extern int cucul_set_frame_name(IntPtr cv, string n); 150 [DllImport("libcucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 151 public static extern int cucul_create_frame(IntPtr cv, int f); 152 [DllImport("libcucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 153 public static extern int cucul_free_frame(IntPtr cv, int f); 154 155 IntPtr cv; 156 157 public CuculCanvas() 158 { 159 cv = cucul_create_canvas(0, 0); 160 } 161 157 162 public void Dispose() 158 { 159 cucul_free_canvas(qq); 160 GC.SuppressFinalize(this); 161 } 162 public Cucul(Int32 w, Int32 h) 163 { 164 qq = cucul_create_canvas(w, h); 165 } 166 public Int32 getWidth() 167 { 168 return cucul_get_canvas_width(qq); 169 } 170 public Int32 getHeight() 171 { 172 return cucul_get_canvas_height(qq); 173 } 174 public Int32 setSize(Int32 w, Int32 h) 175 { 176 return cucul_set_canvas_size(qq, w, h); 177 } 178 public static Int32 Rand(Int32 min, Int32 max) 179 { 180 return cucul_rand(min, max); 181 } 182 public Int32 setColor(int fg, int bg) 183 { 184 return cucul_set_color(qq, fg, bg); 185 } 186 public Int32 setTruecolor(Int32 fg, Int32 bg) 187 { 188 return cucul_set_truecolor(qq, fg, bg); 189 } 190 public Int32 putChar(int x, int y, char c) 191 { 192 return cucul_putchar(qq, x, y, c); 193 } 194 public Int32 Clear() 195 { 196 return cucul_clear_canvas(qq); 197 } 198 public Int32 Blit(int x, int y, Cucul qq1, Cucul qq2) 199 { 200 return cucul_blit(qq, x, y, qq1.get_cucul_t(), qq2.get_cucul_t()); 201 } 202 public Int32 drawLine(Int32 x1, Int32 y1, Int32 x2, Int32 y2, Int32 c) 203 { 204 return cucul_draw_line(qq, x1, y1, x2, y2, c); 205 } 206 public Int32 putStr(Int32 x, Int32 y, string c) 207 { 208 return cucul_putstr(qq, x, y, c); 209 } 210 public Int32 gotoXY(Int32 x, Int32 y) 211 { 212 return cucul_gotoxy(qq, x, y); 213 } 214 public Int32 getCursorX() 215 { 216 return cucul_get_cursor_x(qq); 217 } 218 public Int32 getCursorY() 219 { 220 return cucul_get_cursor_y(qq); 221 } 222 public Int32 getChar(Int32 x, Int32 y) 223 { 224 return cucul_get_char(qq, x, y); 225 } 226 public Int32 getAttr(Int32 x, Int32 y) 227 { 228 return cucul_get_attr(qq, x, y); 229 } 230 public Int32 setAttr(Int32 a) 231 { 232 return cucul_set_attr(qq, a); 233 } 234 public Int32 setAttr(Int32 x, Int32 y, Int32 a) 235 { 236 return cucul_put_attr(qq, x, y, a); 237 } 238 public Int32 setColorANSI(Int32 fg, Int32 bg) 239 { 240 return cucul_set_color_ansi(qq, fg, bg); 241 } 242 public Int32 setColorARGB(Int32 fg, Int32 bg) 243 { 244 return cucul_set_color_ansi(qq, fg, bg); 245 } 246 public Int32 setCanvasHandle(Int32 x, Int32 y) 247 { 248 return cucul_set_canvas_handle(qq, x, y); 249 } 250 public Int32 getCanvasHandleX() 251 { 252 return cucul_get_canvas_handle_x(qq); 253 } 254 public Int32 getCanvasHandleY() 255 { 256 return cucul_get_canvas_handle_y(qq); 257 } 258 public Int32 setCanvasHandleY(Int32 x, Int32 y, Int32 h, Int32 w) 259 { 260 return cucul_set_canvas_boundaries(qq, x, y, h, w); 261 } 163 { 164 cucul_free_canvas(cv); 165 GC.SuppressFinalize(this); 166 } 167 168 public CuculCanvas(int w, int h) 169 { 170 cv = cucul_create_canvas(w, h); 171 } 172 173 public int getWidth() 174 { 175 return cucul_get_canvas_width(cv); 176 } 177 178 public int getHeight() 179 { 180 return cucul_get_canvas_height(cv); 181 } 182 183 public int setSize(int w, int h) 184 { 185 return cucul_set_canvas_size(cv, w, h); 186 } 187 188 public int setColor(int fg, int bg) 189 { 190 return cucul_set_color(cv, fg, bg); 191 } 192 193 public int setTruecolor(int fg, int bg) 194 { 195 return cucul_set_truecolor(cv, fg, bg); 196 } 197 198 public int putChar(int x, int y, char c) 199 { 200 return cucul_putchar(cv, x, y, c); 201 } 202 203 public int Clear() 204 { 205 return cucul_clear_canvas(cv); 206 } 207 208 public int Blit(int x, int y, CuculCanvas cv1, CuculCanvas cv2) 209 { 210 return cucul_blit(cv, x, y, cv1.get_cucul_t(), cv2.get_cucul_t()); 211 } 212 213 public int drawLine(int x1, int y1, int x2, int y2, int c) 214 { 215 return cucul_draw_line(cv, x1, y1, x2, y2, c); 216 } 217 218 public int putStr(int x, int y, string c) 219 { 220 return cucul_putstr(cv, x, y, c); 221 } 222 223 public int gotoXY(int x, int y) 224 { 225 return cucul_gotoxy(cv, x, y); 226 } 227 228 public int getCursorX() 229 { 230 return cucul_get_cursor_x(cv); 231 } 232 233 public int getCursorY() 234 { 235 return cucul_get_cursor_y(cv); 236 } 237 238 public int getChar(int x, int y) 239 { 240 return cucul_get_char(cv, x, y); 241 } 242 243 public int getAttr(int x, int y) 244 { 245 return cucul_get_attr(cv, x, y); 246 } 247 248 public int setAttr(int a) 249 { 250 return cucul_set_attr(cv, a); 251 } 252 253 public int setAttr(int x, int y, int a) 254 { 255 return cucul_put_attr(cv, x, y, a); 256 } 257 258 public int setColorANSI(int fg, int bg) 259 { 260 return cucul_set_color_ansi(cv, fg, bg); 261 } 262 263 public int setColorARGB(int fg, int bg) 264 { 265 return cucul_set_color_ansi(cv, fg, bg); 266 } 267 268 public int setCanvasHandle(int x, int y) 269 { 270 return cucul_set_canvas_handle(cv, x, y); 271 } 272 273 public int getCanvasHandleX() 274 { 275 return cucul_get_canvas_handle_x(cv); 276 } 277 278 public int getCanvasHandleY() 279 { 280 return cucul_get_canvas_handle_y(cv); 281 } 282 283 public int setCanvasHandleY(int x, int y, int h, int w) 284 { 285 return cucul_set_canvas_boundaries(cv, x, y, h, w); 286 } 287 262 288 263 289 264 public Int32 Invert() 265 { 266 return cucul_invert(qq); 267 } 268 public Int32 Flip() 269 { 270 return cucul_flip(qq); 271 } 272 public Int32 Flop() 273 { 274 return cucul_flop(qq); 275 } 276 public Int32 Rotate() 277 { 278 return cucul_rotate(qq); 279 } 280 281 public Int32 AttrToANSI(Int64 a) 282 { 290 public int Invert() 291 { 292 return cucul_invert(cv); 293 } 294 295 public int Flip() 296 { 297 return cucul_flip(cv); 298 } 299 300 public int Flop() 301 { 302 return cucul_flop(cv); 303 } 304 305 public int Rotate() 306 { 307 return cucul_rotate(cv); 308 } 309 310 311 public int AttrToANSI(Int64 a) 312 { 283 313 return cucul_attr_to_ansi(a); 284 } 285 public Int32 AttrToANSIFg(Int64 a) 286 { 314 } 315 316 public int AttrToANSIFg(Int64 a) 317 { 287 318 return cucul_attr_to_ansi_fg(a); 288 } 289 public Int32 AttrToANSIBg(Int64 a) 290 { 319 } 320 321 public int AttrToANSIBg(Int64 a) 322 { 291 323 return cucul_attr_to_ansi_bg(a); 292 } 293 294 295 296 297 public Int32 getFrameCount() 298 { 299 return cucul_get_frame_count(qq); 300 } 301 public Int32 setFrame(Int32 f) 302 { 303 return cucul_set_frame(qq, f); 304 } 324 } 325 326 327 328 329 330 public int getFrameCount() 331 { 332 return cucul_get_frame_count(cv); 333 } 334 335 public int setFrame(int f) 336 { 337 return cucul_set_frame(cv, f); 338 } 339 305 340 public string getFrameName() 306 { 307 return cucul_get_frame_name(qq); 308 } 309 public Int32 setFrameName(string n) 310 { 311 return cucul_set_frame_name(qq, n); 312 } 313 public Int32 createFrame(Int32 f) 314 { 315 return cucul_create_frame(qq, f); 316 } 317 public Int32 freeFrame(Int32 f) 318 { 319 return cucul_free_frame(qq, f); 320 } 341 { 342 return cucul_get_frame_name(cv); 343 } 344 345 public int setFrameName(string n) 346 { 347 return cucul_set_frame_name(cv, n); 348 } 349 350 public int createFrame(int f) 351 { 352 return cucul_create_frame(cv, f); 353 } 354 355 public int freeFrame(int f) 356 { 357 return cucul_free_frame(cv, f); 358 } 359 321 360 322 361 … … 324 363 325 364 public IntPtr get_cucul_t() 326 { 327 return qq; 328 } 365 { 366 return cv; 367 } 368 329 369 } 330 370 331 371 332 372 333 public unsafe class Dither : IDisposable 373 374 public unsafe class CuculDither : IDisposable 334 375 { 335 [DllImport("lib Cucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]336 public static extern IntPtr cucul_create_dither( Int32 bpp, Int32w,337 Int32 h, Int32pitch,376 [DllImport("libcucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 377 public static extern IntPtr cucul_create_dither(int bpp, int w, 378 int h, int pitch, 338 379 Int64 rmask, 339 380 Int64 gmask, … … 342 383 343 384 344 [DllImport("lib Cucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]345 public static extern Int32cucul_set_dither_palette(IntPtr d,346 Int32[] r, Int32[] g,347 Int32[] b, Int32[] a);348 [DllImport("lib Cucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]349 public static extern Int32cucul_set_dither_brightness(IntPtr d, float b);350 [DllImport("lib Cucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]351 public static extern Int32cucul_set_dither_gamma(IntPtr d, float g);352 [DllImport("lib Cucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]353 public static extern Int32cucul_set_dither_contrast(IntPtr d, float c);354 [DllImport("lib Cucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]355 public static extern Int32cucul_set_dither_invert(IntPtr d, int i);356 [DllImport("lib Cucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]357 public static extern Int32cucul_set_dither_antialias(IntPtr d, string s);358 [DllImport("lib Cucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]385 [DllImport("libcucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 386 public static extern int cucul_set_dither_palette(IntPtr d, 387 int[] r, int[] g, 388 int[] b, int[] a); 389 [DllImport("libcucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 390 public static extern int cucul_set_dither_brightness(IntPtr d, float b); 391 [DllImport("libcucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 392 public static extern int cucul_set_dither_gamma(IntPtr d, float g); 393 [DllImport("libcucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 394 public static extern int cucul_set_dither_contrast(IntPtr d, float c); 395 [DllImport("libcucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 396 public static extern int cucul_set_dither_invert(IntPtr d, int i); 397 [DllImport("libcucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 398 public static extern int cucul_set_dither_antialias(IntPtr d, string s); 399 [DllImport("libcucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 359 400 public static extern string[] cucul_get_dither_antialias_list(IntPtr d); 360 [DllImport("lib Cucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]361 public static extern Int32cucul_set_dither_color(IntPtr d, string s);362 [DllImport("lib Cucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]401 [DllImport("libcucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 402 public static extern int cucul_set_dither_color(IntPtr d, string s); 403 [DllImport("libcucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 363 404 public static extern string[] cucul_get_dither_color_list(IntPtr d); 364 [DllImport("lib Cucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]365 public static extern Int32cucul_set_dither_charset(IntPtr d, string s);366 [DllImport("lib Cucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]405 [DllImport("libcucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 406 public static extern int cucul_set_dither_charset(IntPtr d, string s); 407 [DllImport("libcucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 367 408 public static extern string[] cucul_get_dither_charset_list(IntPtr d); 368 [DllImport("lib Cucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]369 public static extern Int32cucul_set_dither_mode(IntPtr d, string s);370 [DllImport("lib Cucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]409 [DllImport("libcucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 410 public static extern int cucul_set_dither_mode(IntPtr d, string s); 411 [DllImport("libcucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 371 412 public static extern string[] cucul_get_dither_mode_list(IntPtr d); 372 [DllImport("lib Cucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]373 public static extern Int32cucul_free_dither(IntPtr d);374 375 /* FIXME [DllImport("lib Cucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]376 Int32 cucul_dither_bitmap(Cucul c,Int32 x, Int32 y, Int32 w , Int32y,413 [DllImport("libcucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 414 public static extern int cucul_free_dither(IntPtr d); 415 416 /* FIXME [DllImport("libcucul.dll", CallingConvention=CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] 417 int cucul_dither_bitmap(Canvas c,int x, int y, int w , int y, 377 418 IntPtr d2, void *);*/ 378 419 … … 381 422 IntPtr dither; 382 423 383 public Dither(Int32 bpp, Int32 w,Int32 h, Int32 pitch, 384 Int64 rmask, Int64 gmask,Int64 bmask, Int64 amask) 385 { 386 dither = cucul_create_dither(bpp, w, h, pitch, rmask, gmask, bmask, amask); 387 } 424 public CuculDither(int bpp, int w,int h, int pitch, 425 Int64 rmask, Int64 gmask,Int64 bmask, Int64 amask) 426 { 427 dither = cucul_create_dither(bpp, w, h, pitch, rmask, gmask, bmask, amask); 428 } 429 388 430 public void Dispose() 389 { 390 cucul_free_dither(dither); 391 GC.SuppressFinalize(this); 392 } 393 public Int32 setBrightness(float b) 394 { 431 { 432 cucul_free_dither(dither); 433 GC.SuppressFinalize(this); 434 } 435 436 public int setBrightness(float b) 437 { 395 438 return cucul_set_dither_brightness(dither, b); 396 } 397 public Int32 setGamma(float g) 398 { 439 } 440 441 public int setGamma(float g) 442 { 399 443 return cucul_set_dither_gamma(dither, g); 400 } 401 public Int32 setContrast(float c) 402 { 444 } 445 446 public int setContrast(float c) 447 { 403 448 return cucul_set_dither_contrast(dither, c); 404 } 405 public Int32 setInvert(Int32 i) 406 { 449 } 450 451 public int setInvert(int i) 452 { 407 453 return cucul_set_dither_invert(dither, i); 408 } 409 public Int32 setAntialias(string s) 410 { 454 } 455 456 public int setAntialias(string s) 457 { 411 458 return cucul_set_dither_antialias(dither, s); 412 } 413 public Int32 setColor(string s) 414 { 459 } 460 461 public int setColor(string s) 462 { 415 463 return cucul_set_dither_color(dither, s); 416 } 417 public Int32 setCharset(string s) 418 { 464 } 465 466 public int setCharset(string s) 467 { 419 468 return cucul_set_dither_charset(dither, s); 420 } 421 public Int32 setMode(string s) 422 { 469 } 470 471 public int setMode(string s) 472 { 423 473 return cucul_set_dither_mode(dither, s); 424 } 425 /* <FIXME> */ 426 public string[] getAntialiasList() 427 { 428 return cucul_get_dither_antialias_list(dither); 429 } 430 public string[] getColorList() 431 { 432 return cucul_get_dither_color_list(dither); 433 } 434 public string[] getCharsetList() 435 { 436 return cucul_get_dither_charset_list(dither); 437 } 438 public string[] getModeList() 439 { 440 return cucul_get_dither_mode_list(dither); 441 } 442 /* </FIXME> */ 443 474 } 475 476 /* <FIXME> */ 477 public string[] getAntialiasList() 478 { 479 return cucul_get_dither_antialias_list(dither); 480 } 481 482 public string[] getColorList() 483 { 484 return cucul_get_dither_color_list(dither); 485 } 486 487 public string[] getCharsetList() 488 { 489 return cucul_get_dither_charset_list(dither); 490 } 491 492 public string[] getModeList() 493 { 494 return cucul_get_dither_mode_list(dither); 495 } 496 497 /* </FIXME> */ 444 498 } 445 499 446 447 448 449 450 451 452 453 454 455 456 457 } 458 500 } 501 502 -
libcaca/trunk/csharp/Makefile.am
r2044 r2045 2 2 3 3 if USE_CSHARP 4 noinst_DATA = libCucul.dll libCaca.dll test.exe4 noinst_DATA = cucul-sharp.dll caca-sharp.dll test.exe 5 5 endif 6 6 … … 8 8 Cucul.cs \ 9 9 Caca.cs \ 10 libCucul.dll.config \11 libCaca.dll.config \10 cucul-sharp.dll.config \ 11 caca-sharp.dll.config \ 12 12 test.cs 13 13 14 libCucul.dll: AssemblyInfo.cs Cucul.cs14 cucul-sharp.dll: AssemblyInfo.cs Cucul.cs 15 15 gmcs $^ -out:$@ -target:library -unsafe 16 16 17 libCaca.dll: AssemblyInfo.cs Caca.cs18 gmcs $^ -out:$@ -target:library -r:./ libCucul.dll -lib:./ -unsafe17 caca-sharp.dll: AssemblyInfo.cs Caca.cs 18 gmcs $^ -out:$@ -target:library -r:./cucul-sharp.dll -lib:./ -unsafe 19 19 20 test.exe: test.cs libCaca.dll libCucul.dll21 gmcs test.cs -out:$@ -r:./ libCucul.dll -r:./libCaca.dll -lib:./ -unsafe20 test.exe: test.cs caca-sharp.dll cucul-sharp.dll 21 gmcs test.cs -out:$@ -r:./cucul-sharp.dll -r:./caca-sharp.dll -lib:./ -unsafe 22 22 23 23 clean-local: -
libcaca/trunk/csharp/test.cs
r2044 r2045 15 15 16 16 using System; 17 using libCucul; 18 using libCaca; 17 18 using Cucul; 19 using Caca; 19 20 20 21 class Test { … … 28 29 29 30 /* Instanciate a cucul canvas */ 30 Cucul qq = new Cucul();31 CuculCanvas cv = new CuculCanvas(); 31 32 32 33 33 34 /* Random number. This is a static method, 34 35 not to be used with previous instance */ 35 Console.WriteLine("A random number : {0}", Cucul.Rand(0, 1337));36 Console.WriteLine("A random number : {0}", Libcucul.Rand(0, 1337)); 36 37 37 38 38 39 39 40 /* We have a proper canvas, let's display it using Caca */ 40 Caca kk = new Caca(qq);41 kk.setDisplayTime(20000); // Refresh every 20 ms41 Display dp = new Display(cv); 42 dp.setDisplayTime(20000); // Refresh every 20 ms 42 43 43 kk.setDisplayTitle("libcaca .NET Bindings test suite");44 dp.setDisplayTitle("libcaca .NET Bindings test suite"); 44 45 45 46 double v; … … 49 50 50 51 DateTime startTime = DateTime.Now; 51 while( kk.getEvent(Event.type.KEY_RELEASE, e, 10) == 0)52 while(dp.getEvent(Event.type.KEY_RELEASE, e, 10) == 0) 52 53 { 53 54 TimeSpan curTime = DateTime.Now - startTime; 54 55 double t = curTime.TotalMilliseconds; 55 qq.setColor(Cucul.CUCUL_WHITE, Cucul.CUCUL_BLACK);56 cv.setColor(Libcucul.WHITE, Libcucul.BLACK); 56 57 for(i=0; i<barCount;i++) 57 58 { 58 v = ((Math.Sin((t/500.0)+(i/((double)barCount)))+1)/2)* qq.getHeight();59 v = ((Math.Sin((t/500.0)+(i/((double)barCount)))+1)/2)*cv.getHeight(); 59 60 y = (Int32) v; 60 61 61 62 62 63 63 qq.setColor(i+9, Cucul.CUCUL_BLACK);64 cv.setColor(i+9, Libcucul.BLACK); 64 65 /* drawLine is already clipped, we don't care about overflows */ 65 qq.drawLine(0, y-2, qq.getWidth(), y-2, '-');66 qq.drawLine(0, y-1, qq.getWidth(), y-1, '*');67 qq.drawLine(0, y, qq.getWidth(), y, '#');68 qq.drawLine(0, y+1, qq.getWidth(), y+1, '*');69 qq.drawLine(0, y+2, qq.getWidth(), y+2, '-');66 cv.drawLine(0, y-2, cv.getWidth(), y-2, '-'); 67 cv.drawLine(0, y-1, cv.getWidth(), y-1, '*'); 68 cv.drawLine(0, y, cv.getWidth(), y, '#'); 69 cv.drawLine(0, y+1, cv.getWidth(), y+1, '*'); 70 cv.drawLine(0, y+2, cv.getWidth(), y+2, '-'); 70 71 } 71 72 72 qq.setColor(Cucul.CUCUL_WHITE, Cucul.CUCUL_BLUE);73 qq.putStr(qq.getWidth() - 30,qq.getHeight() - 2," -=[ Powered by libcaca ]=- ");74 qq.setColor(Cucul.CUCUL_WHITE, Cucul.CUCUL_BLACK);73 cv.setColor(Libcucul.WHITE, Libcucul.BLUE); 74 cv.putStr(cv.getWidth() - 30,cv.getHeight() - 2," -=[ Powered by libcaca ]=- "); 75 cv.setColor(Libcucul.WHITE, Libcucul.BLACK); 75 76 76 77 77 kk.Refresh();78 qq.Clear();78 dp.Refresh(); 79 cv.Clear(); 79 80 80 81 } 81 82 82 83 /* Force deletion of our instances for fun */ 83 qq.Dispose();84 kk.Dispose();84 dp.Dispose(); 85 cv.Dispose(); 85 86 } 86 87
Note: See TracChangeset
for help on using the changeset viewer.