source: libcaca/trunk/cpp/cucul++.h @ 783

Last change on this file since 783 was 783, checked in by Jean-Yves Lamoureux, 15 years ago
  • Fixed C++ printf(), added it in example
  • Property svn:keywords set to Id
File size: 4.0 KB
Line 
1#ifndef _CUCUL_PP_H
2#define _CUCUL_PP_H
3#include <stdio.h> // BUFSIZ
4#include <stdarg.h> // va_*
5#include "config.h"
6#include "cucul.h"
7
8
9class Cucul {
10    friend class Caca;
11 public:
12    Cucul();
13    Cucul(int width, int height);
14    ~Cucul();
15
16    /* Ugly, I know */
17    class Font {
18        friend class Cucul;
19    protected:
20        cucul_font *font;
21    };
22    class Sprite {
23        friend class Cucul;
24    protected:
25        cucul_sprite *sprite;
26    };
27    class Dither {
28        friend class Cucul;
29    protected:
30        cucul_dither *dither;
31    };
32    class Buffer {
33        friend class Cucul;
34    protected:
35        cucul_buffer *buffer;
36    };
37
38
39
40    void set_size(unsigned int w, unsigned int h);
41    unsigned int get_width(void);
42    unsigned int get_height(void);
43    void set_color(unsigned int f, unsigned int b);
44    char const * get_color_name (unsigned int color);
45    void        printf ( int x , int y , char const * format,...);
46    void putchar (int x, int y, char c);
47    void putstr (int x, int y, char *str);
48    void        clear ();
49    void        blit ( int, int, Cucul* c1, Cucul* c2);
50    void        invert ();
51    void        flip ();
52    void        flop ();
53    void        rotate ();
54    void        draw_line ( int, int, int, int, char const *);
55    void        draw_polyline ( int const x[], int const y[], int, char const *);
56    void        draw_thin_line ( int, int, int, int);
57    void        draw_thin_polyline ( int const x[], int const y[], int);
58    void        draw_circle ( int, int, int, char const *);
59    void        draw_ellipse ( int, int, int, int, char const *);
60    void        draw_thin_ellipse ( int, int, int, int);
61    void        fill_ellipse ( int, int, int, int, char const *);
62    void        draw_box ( int, int, int, int, char const *);
63    void        draw_thin_box ( int, int, int, int);
64    void        fill_box ( int, int, int, int, char const *);
65    void        draw_triangle ( int, int, int, int, int, int, char const *);
66    void        draw_thin_triangle ( int, int, int, int, int, int);
67    void        fill_triangle ( int, int, int, int, int, int, char const *);
68    int         rand (int, int);
69    unsigned int        sqrt (unsigned int);
70    Sprite *    load_sprite (char const *);
71    int         get_sprite_frames (Cucul::Sprite const *);
72    int         get_sprite_width (Cucul::Sprite const *, int);
73    int         get_sprite_height (Cucul::Sprite const *, int);
74    int         get_sprite_dx (Cucul::Sprite const *, int);
75    int         get_sprite_dy (Cucul::Sprite const *, int);
76    void        draw_sprite ( int, int, Cucul::Sprite const *, int);
77    void        free_sprite (Cucul::Sprite*);
78    Dither *    create_dither (unsigned int, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int);
79    void        set_dither_palette (Cucul::Dither *, unsigned int r[], unsigned int g[], unsigned int b[], unsigned int a[]);
80    void        set_dither_brightness (Cucul::Dither *, float);
81    void        set_dither_gamma (Cucul::Dither *, float);
82    void        set_dither_contrast (Cucul::Dither *, float);
83    void        set_dither_invert (Cucul::Dither *, int);
84    void        set_dither_antialias (Cucul::Dither *, char const *);
85    char const *const *         get_dither_antialias_list (Cucul::Dither const *);
86    void        set_dither_color (Cucul::Dither *, char const *);
87    char const *const *         get_dither_color_list (Cucul::Dither const *);
88    void        set_dither_charset (Cucul::Dither *, char const *);
89    char const *const *         get_dither_charset_list (Cucul::Dither const *);
90    void        set_dither_mode (Cucul::Dither *, char const *);
91    char const *const *         get_dither_mode_list (Cucul::Dither const *);
92    void        dither_bitmap ( int, int, int, int, Cucul::Dither const *, void *);
93    void        free_dither (Cucul::Dither *);
94    Font *      load_font (void const *, unsigned int);
95    char const *const *         get_font_list (void);
96    unsigned int        get_font_width (Font *);
97    unsigned int        get_font_height (Font *);
98    void        render_canvas ( Font *, unsigned char *, unsigned int, unsigned int, unsigned int);
99    void        free_font (Font *);
100    Buffer *    create_export ( char const *);
101    char const *const *         get_export_list (void);
102
103
104 protected:
105    cucul_t *get_cucul_t();
106
107 private:
108    cucul_t *qq;
109
110
111};
112
113
114#endif /* _CUCUL_PP_H */
Note: See TracBrowser for help on using the repository browser.