25개 이상의 토픽을 선택하실 수 없습니다. Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

caca++.cpp 1.7 KiB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  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. It comes without any warranty, to
  9. * the extent permitted by applicable law. You can redistribute it
  10. * and/or modify it under the terms of the Do What The Fuck You Want
  11. * To Public License, Version 2, as published by Sam Hocevar. See
  12. * http://sam.zoy.org/wtfpl/COPYING for more details.
  13. */
  14. /*
  15. * This file contains the main functions used by \e libcaca++ applications to
  16. * initialise the library, get the screen properties, set the framerate and
  17. * so on.
  18. */
  19. #include "caca++.h"
  20. Caca::Caca(Cucul *cv)
  21. {
  22. dp = caca_create_display(cv->get_cucul_canvas_t());
  23. if(!dp)
  24. throw -1;
  25. }
  26. Caca::~Caca()
  27. {
  28. caca_free_display(dp);
  29. }
  30. void Caca::Attach(Cucul *cv)
  31. {
  32. dp = caca_create_display(cv->get_cucul_canvas_t());
  33. if(!dp)
  34. throw -1;
  35. }
  36. void Caca::Detach()
  37. {
  38. caca_free_display(dp);
  39. }
  40. void Caca::setDisplayTime(unsigned int d)
  41. {
  42. caca_set_display_time(dp, d);
  43. }
  44. void Caca::Display()
  45. {
  46. caca_refresh_display(dp);
  47. }
  48. unsigned int Caca::getDisplayTime()
  49. {
  50. return caca_get_display_time(dp);
  51. }
  52. unsigned int Caca::getWidth()
  53. {
  54. return caca_get_display_width(dp);
  55. }
  56. unsigned int Caca::getHeight()
  57. {
  58. return caca_get_display_height(dp);
  59. }
  60. int Caca::setTitle(char const *s)
  61. {
  62. return caca_set_display_title(dp, s);
  63. }
  64. int Caca::getEvent(unsigned int g, Event *n, int aa)
  65. {
  66. return caca_get_event(dp, g, &n->e, aa);
  67. }
  68. unsigned int Caca::getMouseX()
  69. {
  70. return caca_get_mouse_x(dp);
  71. }
  72. unsigned int Caca::getMouseY()
  73. {
  74. return caca_get_mouse_x(dp);
  75. }
  76. void Caca::setMouse(int v)
  77. {
  78. caca_set_mouse(dp, v);
  79. }