Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

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