Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.
 
 
 
 
 
 

86 rader
1.6 KiB

  1. /*
  2. * libcaca++ C++ bindings for libcaca
  3. * Copyright (c) 2006 Jean-Yves Lamoureux <jylam@lnxscene.org>
  4. * All Rights Reserved
  5. *
  6. * $Id$
  7. *
  8. * This library is free software; you can redistribute it and/or
  9. * modify it under the terms of the Do What The Fuck You Want To
  10. * Public License, Version 2, as published by Sam Hocevar. See
  11. * http://sam.zoy.org/wtfpl/COPYING for more details.
  12. */
  13. /*
  14. * This file contains the main functions used by \e libcaca++ applications to
  15. * initialise the library, get the screen properties, set the framerate and
  16. * so on.
  17. */
  18. #include "caca++.h"
  19. Caca::Caca(void)
  20. {
  21. }
  22. Caca::Caca(Cucul *qq)
  23. {
  24. kk = caca_attach(qq->get_cucul_t());
  25. if(!kk) throw -1;
  26. }
  27. Caca::~Caca()
  28. {
  29. caca_detach(kk);
  30. }
  31. void Caca::attach(Cucul *qq)
  32. {
  33. kk = caca_attach(qq->get_cucul_t());
  34. if(!kk) throw -1;
  35. }
  36. void Caca::detach ()
  37. {
  38. caca_detach(kk);
  39. }
  40. void Caca::set_delay (unsigned int d)
  41. {
  42. caca_set_delay(kk, d);
  43. }
  44. void Caca::display ()
  45. {
  46. caca_display(kk);
  47. }
  48. unsigned int Caca::get_rendertime ()
  49. {
  50. return caca_get_rendertime(kk);
  51. }
  52. unsigned int Caca::get_window_width ()
  53. {
  54. return caca_get_window_width(kk);
  55. }
  56. unsigned int Caca::get_window_height ()
  57. {
  58. return caca_get_window_height(kk);
  59. }
  60. int Caca::set_window_title (char const *s)
  61. {
  62. return caca_set_window_title(kk, s);
  63. }
  64. int Caca::get_event (unsigned int g, Event *n, int aa)
  65. {
  66. return caca_get_event(kk, g, n->e, aa);
  67. }
  68. unsigned int Caca::get_mouse_x ()
  69. {
  70. return caca_get_mouse_x(kk);
  71. }
  72. unsigned int Caca::get_mouse_y ()
  73. {
  74. return caca_get_mouse_x(kk);
  75. }
  76. void Caca::set_mouse (int v)
  77. {
  78. caca_set_mouse(kk, v);
  79. }