images.cpp 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. #include <stdio.h>
  2. #include <string.h>
  3. #include "images.h"
  4. #include <iconv.h>
  5. class IConv {
  6. iconv_t ic;
  7. public:
  8. IConv(const char *to, const char *from) : ic(iconv_open(to, from)) {}
  9. ~IConv() { iconv_close(ic); }
  10. int convert(char *input, char *output, size_t outbufsize) {
  11. size_t inbufsize = strlen(input);
  12. size_t orig_size = outbufsize;
  13. memset(output, 0, outbufsize);
  14. return iconv(ic, &input, &inbufsize, &output, &outbufsize);
  15. }
  16. };
  17. IConv converter("UTF-8", "CP437");
  18. #include "terminal.h"
  19. struct console_details console;
  20. char display_line(char *line) {
  21. char output[1024];
  22. int len;
  23. converter.convert(line, output, sizeof(output));
  24. printf("%s\n", output);
  25. }
  26. int main() {
  27. int x;
  28. int size = (sizeof(skull) / sizeof(char *));
  29. for (x = 0; x < size; x++) {
  30. display_line(skull[x]);
  31. }
  32. fflush(stdout);
  33. getchar();
  34. printf("\n\n");
  35. size = (sizeof(skullblink) / sizeof(char *));
  36. for (x = 0; x < size; x++) {
  37. display_line(skullblink[x]);
  38. }
  39. fflush(stdout);
  40. getchar();
  41. printf("\n\n");
  42. size = (sizeof(ghead) / sizeof(char *));
  43. for (x = 0; x < size; x++) {
  44. display_line(ghead[x]);
  45. }
  46. fflush(stdout);
  47. getchar();
  48. printf("\n\n");
  49. size = (sizeof(ghost) / sizeof(char *));
  50. for (x = 0; x < size; x++) {
  51. display_line(ghost[x]);
  52. }
  53. fflush(stdout);
  54. getchar();
  55. printf("\n\n");
  56. size = (sizeof(wolf) / sizeof(char *));
  57. for (x = 0; x < size; x++) {
  58. display_line(wolf[x]);
  59. }
  60. fflush(stdout);
  61. getchar();
  62. printf("\n\n");
  63. size = (sizeof(panther) / sizeof(char *));
  64. for (x = 0; x < size; x++) {
  65. display_line(panther[x]);
  66. }
  67. fflush(stdout);
  68. getchar();
  69. printf("\n\n");
  70. size = (sizeof(bat) / sizeof(char *));
  71. for (x = 0; x < size; x++) {
  72. display_line(bat[x]);
  73. }
  74. fflush(stdout);
  75. getchar();
  76. printf("\n\n");
  77. return 0;
  78. }