Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.
 
 
 
 
 
 

102 rindas
1.7 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 *cv)
  23. {
  24. dp = caca_create_display(cv->get_cucul_canvas_t());
  25. if(!dp)
  26. throw -1;
  27. }
  28. Caca::~Caca()
  29. {
  30. caca_free_display(dp);
  31. }
  32. void Caca::attach(Cucul *cv)
  33. {
  34. dp = caca_create_display(cv->get_cucul_canvas_t());
  35. if(!dp)
  36. throw -1;
  37. }
  38. void Caca::detach()
  39. {
  40. caca_free_display(dp);
  41. }
  42. void Caca::set_delay(unsigned int d)
  43. {
  44. caca_set_delay(dp, d);
  45. }
  46. void Caca::display()
  47. {
  48. caca_refresh_display(dp);
  49. }
  50. unsigned int Caca::get_rendertime()
  51. {
  52. return caca_get_rendertime(dp);
  53. }
  54. unsigned int Caca::get_display_width()
  55. {
  56. return caca_get_display_width(dp);
  57. }
  58. unsigned int Caca::get_display_height()
  59. {
  60. return caca_get_display_height(dp);
  61. }
  62. int Caca::set_display_title(char const *s)
  63. {
  64. return caca_set_display_title(dp, s);
  65. }
  66. int Caca::get_event(unsigned int g, Event *n, int aa)
  67. {
  68. return caca_get_event(dp, g, &n->e, aa);
  69. }
  70. unsigned int Caca::get_mouse_x()
  71. {
  72. return caca_get_mouse_x(dp);
  73. }
  74. unsigned int Caca::get_mouse_y()
  75. {
  76. return caca_get_mouse_x(dp);
  77. }
  78. void Caca::set_mouse(int v)
  79. {
  80. caca_set_mouse(dp, v);
  81. }