Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.
 
 
 
 
 
 

62 lignes
2.3 KiB

  1. /*
  2. * libcaca Ruby bindings
  3. * Copyright (c) 2007-2010 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. #include <ruby.h>
  12. #include <caca.h>
  13. #include "caca-canvas.h"
  14. #include "caca-dither.h"
  15. #include "caca-font.h"
  16. #include "caca-display.h"
  17. #include "caca-event.h"
  18. static VALUE get_version(VALUE self)
  19. {
  20. return rb_str_new2(caca_get_version());
  21. }
  22. void Init_caca()
  23. {
  24. VALUE mCaca = rb_define_module("Caca");
  25. rb_define_singleton_method(mCaca, "version", get_version, 0);
  26. rb_define_const(mCaca, "BLACK", INT2FIX(CACA_BLACK));
  27. rb_define_const(mCaca, "BLUE", INT2FIX(CACA_BLUE));
  28. rb_define_const(mCaca, "GREEN", INT2FIX(CACA_GREEN));
  29. rb_define_const(mCaca, "CYAN", INT2FIX(CACA_CYAN));
  30. rb_define_const(mCaca, "RED", INT2FIX(CACA_RED));
  31. rb_define_const(mCaca, "MAGENTA", INT2FIX(CACA_MAGENTA));
  32. rb_define_const(mCaca, "BROWN", INT2FIX(CACA_BROWN));
  33. rb_define_const(mCaca, "LIGHTGRAY", INT2FIX(CACA_LIGHTGRAY));
  34. rb_define_const(mCaca, "DARKGRAY", INT2FIX(CACA_DARKGRAY));
  35. rb_define_const(mCaca, "LIGHTBLUE", INT2FIX(CACA_LIGHTBLUE));
  36. rb_define_const(mCaca, "LIGHTGREEN", INT2FIX(CACA_LIGHTGREEN));
  37. rb_define_const(mCaca, "LIGHTCYAN", INT2FIX(CACA_LIGHTCYAN));
  38. rb_define_const(mCaca, "LIGHTRED", INT2FIX(CACA_LIGHTRED));
  39. rb_define_const(mCaca, "LIGHTMAGENTA", INT2FIX(CACA_LIGHTMAGENTA));
  40. rb_define_const(mCaca, "YELLOW", INT2FIX(CACA_YELLOW));
  41. rb_define_const(mCaca, "WHITE", INT2FIX(CACA_WHITE));
  42. rb_define_const(mCaca, "DEFAULT", INT2FIX(CACA_DEFAULT));
  43. rb_define_const(mCaca, "TRANSPARENT", INT2FIX(CACA_TRANSPARENT));
  44. rb_define_const(mCaca, "BOLD", INT2FIX(CACA_BOLD));
  45. rb_define_const(mCaca, "ITALICS", INT2FIX(CACA_ITALICS));
  46. rb_define_const(mCaca, "UNDERLINE", INT2FIX(CACA_UNDERLINE));
  47. rb_define_const(mCaca, "BLINK", INT2FIX(CACA_BLINK));
  48. Init_caca_canvas(mCaca);
  49. Init_caca_dither(mCaca);
  50. Init_caca_font(mCaca);
  51. Init_caca_display(mCaca);
  52. Init_caca_event(mCaca);
  53. }