source: libcaca/trunk/ruby/caca.c @ 2821

Last change on this file since 2821 was 2821, checked in by Sam Hocevar, 11 years ago

Starting refactoring to get rid of libcucul. The initial reason for the
split is rendered moot by the plugin system: when enabled, binaries do
not link directly with libX11 or libGL. I hope this is a step towards
more consisteny and clarity.

  • Property svn:eol-style set to native
File size: 2.3 KB
Line 
1/*
2 *  libcaca Ruby bindings
3 *  Copyright (c) 2007 Pascal Terjan <pterjan@linuxfr.org>
4 *
5 *  This library is free software. It comes without any warranty, to
6 *  the extent permitted by applicable law. You can redistribute it
7 *  and/or modify it under the terms of the Do What The Fuck You Want
8 *  To Public License, Version 2, as published by Sam Hocevar. See
9 *  http://sam.zoy.org/wtfpl/COPYING for more details.
10 */
11
12#include <ruby.h>
13#include <caca.h>
14
15#include "caca-canvas.h"
16#include "caca-dither.h"
17#include "caca-font.h"
18#include "caca-display.h"
19#include "caca-event.h"
20
21static VALUE get_version(VALUE self)
22{
23    return rb_str_new2(caca_get_version());
24}
25
26void Init_caca()
27{
28    VALUE mCaca = rb_define_module("Caca");
29
30    rb_define_singleton_method(mCaca, "version", get_version, 0);
31
32    rb_define_const(mCaca, "BLACK", INT2FIX(CACA_BLACK));
33    rb_define_const(mCaca, "BLUE", INT2FIX(CACA_BLUE));
34    rb_define_const(mCaca, "GREEN", INT2FIX(CACA_GREEN));
35    rb_define_const(mCaca, "CYAN", INT2FIX(CACA_CYAN));
36    rb_define_const(mCaca, "RED", INT2FIX(CACA_RED));
37    rb_define_const(mCaca, "MAGENTA", INT2FIX(CACA_MAGENTA));
38    rb_define_const(mCaca, "BROWN", INT2FIX(CACA_BROWN));
39    rb_define_const(mCaca, "LIGHTGRAY", INT2FIX(CACA_LIGHTGRAY));
40    rb_define_const(mCaca, "DARKGRAY", INT2FIX(CACA_DARKGRAY));
41    rb_define_const(mCaca, "LIGHTBLUE", INT2FIX(CACA_LIGHTBLUE));
42    rb_define_const(mCaca, "LIGHTGREEN", INT2FIX(CACA_LIGHTGREEN));
43    rb_define_const(mCaca, "LIGHTCYAN", INT2FIX(CACA_LIGHTCYAN));
44    rb_define_const(mCaca, "LIGHTRED", INT2FIX(CACA_LIGHTRED));
45    rb_define_const(mCaca, "LIGHTMAGENTA", INT2FIX(CACA_LIGHTMAGENTA));
46    rb_define_const(mCaca, "YELLOW", INT2FIX(CACA_YELLOW));
47    rb_define_const(mCaca, "WHITE", INT2FIX(CACA_WHITE));
48    rb_define_const(mCaca, "DEFAULT", INT2FIX(CACA_DEFAULT));
49    rb_define_const(mCaca, "TRANSPARENT", INT2FIX(CACA_TRANSPARENT));
50
51    rb_define_const(mCaca, "BOLD", INT2FIX(CACA_BOLD));
52    rb_define_const(mCaca, "ITALICS", INT2FIX(CACA_ITALICS));
53    rb_define_const(mCaca, "UNDERLINE", INT2FIX(CACA_UNDERLINE));
54    rb_define_const(mCaca, "BLINK", INT2FIX(CACA_BLINK));
55
56    Init_caca_canvas(mCaca);
57    Init_caca_dither(mCaca);
58    Init_caca_font(mCaca);
59    Init_caca_display(mCaca);
60    Init_caca_event(mCaca);
61}
Note: See TracBrowser for help on using the repository browser.