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.
 
 
 
 
 
 

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