You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

98 lines
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(Cucul *cv)
  20. {
  21. dp = caca_create_display(cv->get_cucul_canvas_t());
  22. if(!dp)
  23. throw -1;
  24. }
  25. Caca::~Caca()
  26. {
  27. caca_free_display(dp);
  28. }
  29. void Caca::Attach(Cucul *cv)
  30. {
  31. dp = caca_create_display(cv->get_cucul_canvas_t());
  32. if(!dp)
  33. throw -1;
  34. }
  35. void Caca::Detach()
  36. {
  37. caca_free_display(dp);
  38. }
  39. void Caca::setDisplayTime(unsigned int d)
  40. {
  41. caca_set_display_time(dp, d);
  42. }
  43. void Caca::Display()
  44. {
  45. caca_refresh_display(dp);
  46. }
  47. unsigned int Caca::getDisplayTime()
  48. {
  49. return caca_get_display_time(dp);
  50. }
  51. unsigned int Caca::getWidth()
  52. {
  53. return caca_get_display_width(dp);
  54. }
  55. unsigned int Caca::getHeight()
  56. {
  57. return caca_get_display_height(dp);
  58. }
  59. int Caca::setTitle(char const *s)
  60. {
  61. return caca_set_display_title(dp, s);
  62. }
  63. int Caca::getEvent(unsigned int g, Event *n, int aa)
  64. {
  65. return caca_get_event(dp, g, &n->e, aa);
  66. }
  67. unsigned int Caca::getMouseX()
  68. {
  69. return caca_get_mouse_x(dp);
  70. }
  71. unsigned int Caca::getMouseY()
  72. {
  73. return caca_get_mouse_x(dp);
  74. }
  75. void Caca::setMouse(int v)
  76. {
  77. caca_set_mouse(dp, v);
  78. }