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.

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. /*
  2. * driver libcaca Unicode rendering test program
  3. * Copyright (c) 2007 Sam Hocevar <sam@zoy.org>
  4. * All Rights Reserved
  5. *
  6. * $Id$
  7. *
  8. * This program 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. #include "config.h"
  15. #include "common.h"
  16. #if !defined(__KERNEL__)
  17. # include <string.h>
  18. # include <stdio.h>
  19. #endif
  20. #include "cucul.h"
  21. #include "caca.h"
  22. int main(int argc, char *argv[])
  23. {
  24. char const * const *list;
  25. caca_display_t *dp;
  26. cucul_canvas_t *cv;
  27. list = caca_get_display_driver_list();
  28. dp = caca_create_display(NULL);
  29. if(dp == NULL)
  30. {
  31. printf("cannot create display\n");
  32. return -1;
  33. }
  34. cv = caca_get_canvas(dp);
  35. cucul_set_color_ansi(cv, CUCUL_WHITE, CUCUL_BLACK);
  36. while(1)
  37. {
  38. char const *driver;
  39. int i, cur = 0;
  40. cucul_put_str(cv, 1, 0, "Available drivers:");
  41. driver = caca_get_display_driver(dp);
  42. for(i = 0; list[i]; i += 2)
  43. {
  44. int match = !strcmp(list[i], driver);
  45. if(match)
  46. cur = i;
  47. cucul_draw_line(cv, 0, i + 2, 9999, i + 2, ' ');
  48. cucul_printf(cv, 2, i + 2, "%c %s (%s)",
  49. match ? '*' : ' ', list[i], list[i + 1]);
  50. }
  51. cucul_put_str(cv, 1, i + 2, "Switching driver in 5 seconds");
  52. caca_refresh_display(dp);
  53. if(caca_get_event(dp, CACA_EVENT_KEY_PRESS, NULL, 5000000))
  54. break;
  55. do
  56. {
  57. cur += 2;
  58. if(list[cur] && !strcmp(list[cur], "raw"))
  59. cur += 2;
  60. if(!list[cur])
  61. cur = 0;
  62. }
  63. while(caca_set_display_driver(dp, list[cur]));
  64. }
  65. caca_free_display(dp);
  66. return 0;
  67. }