source: trunk/tools/make-font.cpp @ 1486

Last change on this file since 1486 was 1486, checked in by sam, 8 years ago

build: a few hacks to allow building with MinGW on Windows.

  • Property svn:keywords set to Id
File size: 1.0 KB
Line 
1//
2// Deus Hax (working title)
3// Copyright (c) 2010 Sam Hocevar <sam@hocevar.net>
4//
5
6#if defined HAVE_CONFIG_H
7#   include "config.h"
8#endif
9
10#include <cstdlib>
11#include <cstdio>
12
13#include <caca.h>
14
15/* FIXME: ugly MinGW hack */
16#if defined _WIN32 && defined __GNUC__
17extern "C"
18{
19int sprintf_s(char *s, size_t n, const char *fmt, ...)
20{
21    va_list args;
22    int ret;
23    va_start(args, fmt);
24    ret = vsnprintf(s, n, fmt, args);
25    va_end(args);
26    return ret;
27}
28
29int vsnprintf_s(char *s, size_t n, size_t c, const char *fmt, va_list args)
30{
31    return vsnprintf(s, n, fmt, args);
32}
33
34int _time32(__time32_t *timer)
35{
36    return 0;
37}
38}
39#endif
40
41int main(void)
42{
43    caca_canvas_t *cv = caca_create_canvas(16, 16);
44    caca_set_color_ansi(cv, CACA_WHITE, CACA_TRANSPARENT);
45
46    for (unsigned int n = 0; n < 256; n++)
47        caca_put_char(cv, n % 16, n / 16, n);
48
49    size_t len;
50    void *buffer = caca_export_canvas_to_memory(cv, "tga", &len);
51    fwrite(buffer, len, 1, stdout);
52    free(buffer);
53
54    caca_free_canvas(cv);
55
56    return 0;
57}
58
Note: See TracBrowser for help on using the repository browser.