Browse Source

* Fixed ugly coding style of the C++ bindings. Vieux porc immonde.

tags/v0.99.beta14
Sam Hocevar sam 18 years ago
parent
commit
07feb84e72
5 changed files with 219 additions and 193 deletions
  1. +30
    -14
      cpp/caca++.cpp
  2. +23
    -26
      cpp/caca++.h
  3. +2
    -0
      cpp/cpptest.cpp
  4. +85
    -74
      cpp/cucul++.cpp
  5. +79
    -79
      cpp/cucul++.h

+ 30
- 14
cpp/caca++.cpp View File

@@ -20,66 +20,82 @@


#include "caca++.h" #include "caca++.h"



Caca::Caca(void) Caca::Caca(void)
{ {


} }

Caca::Caca(Cucul *cv) Caca::Caca(Cucul *cv)
{ {
dp = caca_create_display(cv->get_cucul_canvas_t()); dp = caca_create_display(cv->get_cucul_canvas_t());
if(!dp) throw -1;
if(!dp)
throw -1;
} }

Caca::~Caca() Caca::~Caca()
{ {
caca_free_display(dp); caca_free_display(dp);
} }

void Caca::attach(Cucul *cv) void Caca::attach(Cucul *cv)
{ {
dp = caca_create_display(cv->get_cucul_canvas_t()); dp = caca_create_display(cv->get_cucul_canvas_t());
if(!dp) throw -1;
if(!dp)
throw -1;
} }
void Caca::detach ()

void Caca::detach()
{ {
caca_free_display(dp); caca_free_display(dp);
} }
void Caca::set_delay (unsigned int d)

void Caca::set_delay(unsigned int d)
{ {
caca_set_delay(dp, d); caca_set_delay(dp, d);
} }
void Caca::display ()

void Caca::display()
{ {
caca_refresh_display(dp); caca_refresh_display(dp);
} }
unsigned int Caca::get_rendertime ()

unsigned int Caca::get_rendertime()
{ {
return caca_get_rendertime(dp); return caca_get_rendertime(dp);
} }
unsigned int Caca::get_display_width ()

unsigned int Caca::get_display_width()
{ {
return caca_get_display_width(dp); return caca_get_display_width(dp);
} }
unsigned int Caca::get_display_height ()

unsigned int Caca::get_display_height()
{ {
return caca_get_display_height(dp); return caca_get_display_height(dp);
} }
int Caca::set_display_title (char const *s)

int Caca::set_display_title(char const *s)
{ {
return caca_set_display_title(dp, s); return caca_set_display_title(dp, s);
} }
int Caca::get_event (unsigned int g, Event *n, int aa)

int Caca::get_event(unsigned int g, Event *n, int aa)
{ {
return caca_get_event(dp, g, n->e, aa); return caca_get_event(dp, g, n->e, aa);
} }
unsigned int Caca::get_mouse_x ()

unsigned int Caca::get_mouse_x()
{ {
return caca_get_mouse_x(dp); return caca_get_mouse_x(dp);
} }
unsigned int Caca::get_mouse_y ()

unsigned int Caca::get_mouse_y()
{ {
return caca_get_mouse_x(dp); return caca_get_mouse_x(dp);
} }
void Caca::set_mouse (int v)

void Caca::set_mouse(int v)
{ {
caca_set_mouse(dp, v); caca_set_mouse(dp, v);
} }


+ 23
- 26
cpp/caca++.h View File

@@ -22,16 +22,15 @@
#ifndef _CACA_PP_H #ifndef _CACA_PP_H
#define _CACA_PP_H #define _CACA_PP_H


#include <cucul.h>
#include <caca.h>


#include "cucul.h"
#include "caca.h"
#include <cucul++.h>


#include "cucul++.h"


class Event {
class Event
{
friend class Caca; friend class Caca;
public:
public:
enum caca_event_type enum caca_event_type
{ {
CACA_EVENT_NONE = 0x0000, /**< No event. */ CACA_EVENT_NONE = 0x0000, /**< No event. */
@@ -46,34 +45,32 @@ class Event {
CACA_EVENT_ANY = 0xffff /**< Bitmask for any event. */ CACA_EVENT_ANY = 0xffff /**< Bitmask for any event. */
} type; } type;


protected:
protected:
caca_event *e; caca_event *e;
}; };


class Caca {
public:
class Caca
{
public:
Caca(); Caca();
Caca(Cucul *qq); Caca(Cucul *qq);
~Caca(); ~Caca();


void attach (Cucul *qq);
void detach ();
void set_delay (unsigned int);
void display ();
unsigned int get_rendertime ();
unsigned int get_display_width ();
unsigned int get_display_height ();
int set_display_title (char const *);
int get_event (unsigned int, Event*, int);
unsigned int get_mouse_x ();
unsigned int get_mouse_y ();
void set_mouse (int);
void attach(Cucul *qq);
void detach();
void set_delay(unsigned int);
void display();
unsigned int get_rendertime();
unsigned int get_display_width();
unsigned int get_display_height();
int set_display_title(char const *);
int get_event(unsigned int, Event*, int);
unsigned int get_mouse_x();
unsigned int get_mouse_y();
void set_mouse(int);



private:
private:
caca_display_t *dp; caca_display_t *dp;
}; };



#endif /* _CACA_PP_H */ #endif /* _CACA_PP_H */

+ 2
- 0
cpp/cpptest.cpp View File

@@ -11,6 +11,8 @@
* http://sam.zoy.org/wtfpl/COPYING for more details. * http://sam.zoy.org/wtfpl/COPYING for more details.
*/ */


#include "config.h"

#include <iostream> #include <iostream>


#include <cucul++.h> #include <cucul++.h>


+ 85
- 74
cpp/cucul++.cpp View File

@@ -1,5 +1,5 @@
/* /*
* libcucul++ C++ bindings for libcucul
* libcucul++ C++ bindings for libcucul
* Copyright (c) 2006 Jean-Yves Lamoureux <jylam@lnxscene.org> * Copyright (c) 2006 Jean-Yves Lamoureux <jylam@lnxscene.org>
* All Rights Reserved * All Rights Reserved
* *
@@ -10,29 +10,36 @@
* Public License, Version 2, as published by Sam Hocevar. See * Public License, Version 2, as published by Sam Hocevar. See
* http://sam.zoy.org/wtfpl/COPYING for more details. * http://sam.zoy.org/wtfpl/COPYING for more details.
*/ */

/* /*
* This file contains the main functions used by \e libcucul++ applications * This file contains the main functions used by \e libcucul++ applications
* to initialise a drawing context. * to initialise a drawing context.
*/ */


#include "config.h"

#include <stdio.h> // BUFSIZ
#include <stdarg.h> // va_*


#include "cucul++.h" #include "cucul++.h"


Cucul::Cucul() Cucul::Cucul()
{ {
cv = cucul_create_canvas(0,0);
if(!cv) throw -1;
cv = cucul_create_canvas(0, 0);
if(!cv)
throw -1;
} }

Cucul::Cucul(int width, int height) Cucul::Cucul(int width, int height)
{ {
cv = cucul_create_canvas(width, height); cv = cucul_create_canvas(width, height);
if(!cv) throw -1; if(!cv) throw -1;
} }

Cucul::~Cucul() Cucul::~Cucul()
{ {
if(cv) {
if(cv)
cucul_free_canvas(cv); cucul_free_canvas(cv);
}
} }


cucul_canvas_t *Cucul::get_cucul_canvas_t() cucul_canvas_t *Cucul::get_cucul_canvas_t()
@@ -40,37 +47,42 @@ cucul_canvas_t *Cucul::get_cucul_canvas_t()
return cv; return cv;
} }




void Cucul::set_size(unsigned int width, unsigned int height) void Cucul::set_size(unsigned int width, unsigned int height)
{ {
cucul_set_canvas_size (cv, width, height);
cucul_set_canvas_size(cv, width, height);
} }

unsigned int Cucul::get_width(void) unsigned int Cucul::get_width(void)
{ {
return cucul_get_canvas_width (cv);
return cucul_get_canvas_width(cv);
} }

unsigned int Cucul::get_height(void) unsigned int Cucul::get_height(void)
{ {
return cucul_get_canvas_height (cv);
return cucul_get_canvas_height(cv);
} }

void Cucul::set_color(unsigned int f, unsigned int b) void Cucul::set_color(unsigned int f, unsigned int b)
{ {
cucul_set_color (cv, f, b);
cucul_set_color(cv, f, b);
} }
char const * Cucul::get_color_name (unsigned int color)

char const * Cucul::get_color_name(unsigned int color)
{ {
return cucul_get_color_name (color);
return cucul_get_color_name(color);
} }
void Cucul::putchar (int x, int y, char ch)

void Cucul::putchar(int x, int y, char ch)
{ {
cucul_putchar (cv, x, y, ch);
cucul_putchar(cv, x, y, ch);
} }
void Cucul::putstr (int x, int y, char *str)

void Cucul::putstr(int x, int y, char *str)
{ {
cucul_putstr(cv, x, y, str); cucul_putstr(cv, x, y, str);
} }
void Cucul::printf ( int x , int y , char const * format,...)

void Cucul::printf(int x, int y, char const * format,...)
{ {
char tmp[BUFSIZ]; char tmp[BUFSIZ];
char *buf = tmp; char *buf = tmp;
@@ -86,278 +98,277 @@ void Cucul::printf ( int x , int y , char const * format,...)
va_end(args); va_end(args);


putstr(x, y, buf); putstr(x, y, buf);

} }


void Cucul::clear ( unsigned char bg )
void Cucul::clear(unsigned char bg )
{ {
cucul_clear_canvas(cv, bg); cucul_clear_canvas(cv, bg);
} }


void Cucul::blit ( int x, int y, Cucul* c1, Cucul* c2)
void Cucul::blit(int x, int y, Cucul* c1, Cucul* c2)
{ {
cucul_blit(cv, x, y, c1->get_cucul_canvas_t(), c2->get_cucul_canvas_t()); cucul_blit(cv, x, y, c1->get_cucul_canvas_t(), c2->get_cucul_canvas_t());
} }


void Cucul::invert ()
void Cucul::invert()
{ {
cucul_invert(cv); cucul_invert(cv);
} }


void Cucul::flip ()
void Cucul::flip()
{ {
cucul_flip(cv); cucul_flip(cv);
} }


void Cucul::flop ()
void Cucul::flop()
{ {
cucul_flop(cv); cucul_flop(cv);
} }


void Cucul::rotate ()
void Cucul::rotate()
{ {
cucul_rotate(cv); cucul_rotate(cv);
} }


void Cucul::draw_line (int x1 , int y1, int x2, int y2, char const *ch)
void Cucul::draw_line(int x1, int y1, int x2, int y2, char const *ch)
{ {
cucul_draw_line(cv, x1,y1,x2,y2, ch);
cucul_draw_line(cv, x1, y1, x2, y2, ch);
} }
void Cucul::draw_polyline (int const x[], int const y[], int f, char const *ch)
void Cucul::draw_polyline(int const x[], int const y[], int f, char const *ch)
{ {
cucul_draw_polyline(cv, x, y, f, ch); cucul_draw_polyline(cv, x, y, f, ch);
} }
void Cucul::draw_thin_line (int x1 , int y1, int x2, int y2)
void Cucul::draw_thin_line(int x1, int y1, int x2, int y2)
{ {
cucul_draw_thin_line(cv, x1, y1, x2, y2); cucul_draw_thin_line(cv, x1, y1, x2, y2);
} }


void Cucul::draw_thin_polyline ( int const x[], int const y[], int f)
void Cucul::draw_thin_polyline(int const x[], int const y[], int f)
{ {
cucul_draw_thin_polyline(cv, x, y, f); cucul_draw_thin_polyline(cv, x, y, f);
} }
void Cucul::draw_circle ( int x, int y, int d, char const *ch)
void Cucul::draw_circle(int x, int y, int d, char const *ch)
{ {
cucul_draw_circle(cv, x, y, d, ch); cucul_draw_circle(cv, x, y, d, ch);
} }


void Cucul::draw_ellipse ( int x, int y, int d1, int d2, char const *ch)
void Cucul::draw_ellipse(int x, int y, int d1, int d2, char const *ch)
{ {
cucul_draw_ellipse(cv, x, y, d1, d2, ch); cucul_draw_ellipse(cv, x, y, d1, d2, ch);
} }


void Cucul::draw_thin_ellipse ( int x, int y, int d1, int d2)
void Cucul::draw_thin_ellipse(int x, int y, int d1, int d2)
{ {
cucul_draw_thin_ellipse(cv, x, y, d1, d2); cucul_draw_thin_ellipse(cv, x, y, d1, d2);
} }


void Cucul::fill_ellipse ( int x, int y, int d1, int d2, char const *ch)
void Cucul::fill_ellipse(int x, int y, int d1, int d2, char const *ch)
{ {
cucul_fill_ellipse(cv, x, y, d1, d2, ch); cucul_fill_ellipse(cv, x, y, d1, d2, ch);
} }


void Cucul::draw_box ( int x, int y, int w, int h, char const *ch)
void Cucul::draw_box(int x, int y, int w, int h, char const *ch)
{ {
cucul_draw_box(cv, x, y, w, h, ch); cucul_draw_box(cv, x, y, w, h, ch);
} }
void Cucul::draw_thin_box ( int x, int y, int w, int h)
void Cucul::draw_thin_box(int x, int y, int w, int h)
{ {
cucul_draw_thin_box(cv, x, y, w, h); cucul_draw_thin_box(cv, x, y, w, h);
} }


void Cucul::fill_box ( int x, int y, int w, int h, char const *ch)
void Cucul::fill_box(int x, int y, int w, int h, char const *ch)
{ {
cucul_fill_box(cv, x, y, w, h, ch); cucul_fill_box(cv, x, y, w, h, ch);
} }


void Cucul::draw_triangle ( int x1, int y1, int x2, int y2, int x3, int y3, char const *ch)
void Cucul::draw_triangle(int x1, int y1, int x2, int y2, int x3, int y3, char const *ch)
{ {
cucul_draw_triangle(cv, x1, y1, x2, y2, x3, y3, ch); cucul_draw_triangle(cv, x1, y1, x2, y2, x3, y3, ch);
} }


void Cucul::draw_thin_triangle ( int x1, int y1, int x2, int y2, int x3, int y3)
void Cucul::draw_thin_triangle(int x1, int y1, int x2, int y2, int x3, int y3)
{ {
cucul_draw_thin_triangle(cv, x1, y1, x2, y2, x3, y3); cucul_draw_thin_triangle(cv, x1, y1, x2, y2, x3, y3);
} }


void Cucul::fill_triangle ( int x1, int y1, int x2, int y2, int x3, int y3, const char *ch)
void Cucul::fill_triangle(int x1, int y1, int x2, int y2, int x3, int y3, const char *ch)
{ {
cucul_fill_triangle(cv, x1, y1, x2, y2, x3, y3, ch); cucul_fill_triangle(cv, x1, y1, x2, y2, x3, y3, ch);
} }


int Cucul::rand (int min, int max)
int Cucul::rand(int min, int max)
{ {
return cucul_rand(min, max); return cucul_rand(min, max);
} }


Cucul::Sprite * Cucul::load_sprite (char const *f)
Cucul::Sprite * Cucul::load_sprite(char const *f)
{ {
Cucul::Sprite *s = new Cucul::Sprite(); Cucul::Sprite *s = new Cucul::Sprite();
s->sprite = cucul_load_sprite(f); s->sprite = cucul_load_sprite(f);
return s; return s;
} }


int Cucul::get_sprite_frames (Cucul::Sprite const *s)
int Cucul::get_sprite_frames(Cucul::Sprite const *s)
{ {
return cucul_get_sprite_frames(s->sprite); return cucul_get_sprite_frames(s->sprite);
} }


int Cucul::get_sprite_width (Cucul::Sprite const *s, int v)
int Cucul::get_sprite_width(Cucul::Sprite const *s, int v)
{ {
return cucul_get_sprite_width(s->sprite, v); return cucul_get_sprite_width(s->sprite, v);
} }


int Cucul::get_sprite_height (Cucul::Sprite const *s, int v)
int Cucul::get_sprite_height(Cucul::Sprite const *s, int v)
{ {
return cucul_get_sprite_height(s->sprite, v); return cucul_get_sprite_height(s->sprite, v);
} }


int Cucul::get_sprite_dx (Cucul::Sprite const *s, int v)
int Cucul::get_sprite_dx(Cucul::Sprite const *s, int v)
{ {
return cucul_get_sprite_dx(s->sprite, v); return cucul_get_sprite_dx(s->sprite, v);
} }


int Cucul::get_sprite_dy (Cucul::Sprite const *s, int v)
int Cucul::get_sprite_dy(Cucul::Sprite const *s, int v)
{ {
return cucul_get_sprite_dy(s->sprite, v); return cucul_get_sprite_dy(s->sprite, v);
} }


void Cucul::draw_sprite ( int x, int y, Cucul::Sprite const *s, int v)
void Cucul::draw_sprite(int x, int y, Cucul::Sprite const *s, int v)
{ {
cucul_draw_sprite(cv, x, y, s->sprite, v); cucul_draw_sprite(cv, x, y, s->sprite, v);
} }


void Cucul::free_sprite (Cucul::Sprite *s)
void Cucul::free_sprite(Cucul::Sprite *s)
{ {
cucul_free_sprite(s->sprite); cucul_free_sprite(s->sprite);
} }


Cucul::Dither * Cucul::create_dither (unsigned int v1, unsigned int v2, unsigned int v3, unsigned int v4, unsigned int v5, unsigned int v6, unsigned int v7, unsigned int v8)
Cucul::Dither * Cucul::create_dither(unsigned int v1, unsigned int v2, unsigned int v3, unsigned int v4, unsigned int v5, unsigned int v6, unsigned int v7, unsigned int v8)
{ {
Cucul::Dither *d = new Dither(); Cucul::Dither *d = new Dither();
d->dither = cucul_create_dither(v1,v2,v3,v4,v5,v6,v7,v8);
d->dither = cucul_create_dither(v1, v2, v3, v4, v5, v6, v7, v8);
return d; return d;
} }


void Cucul::set_dither_palette (Cucul::Dither *d, unsigned int r[], unsigned int g[], unsigned int b[], unsigned int a[])
void Cucul::set_dither_palette(Cucul::Dither *d, unsigned int r[], unsigned int g[], unsigned int b[], unsigned int a[])
{ {
cucul_set_dither_palette(d->dither, r, g, b, a); cucul_set_dither_palette(d->dither, r, g, b, a);
} }


void Cucul::set_dither_brightness (Cucul::Dither *d, float f)
void Cucul::set_dither_brightness(Cucul::Dither *d, float f)
{ {
cucul_set_dither_brightness(d->dither, f); cucul_set_dither_brightness(d->dither, f);
} }


void Cucul::set_dither_gamma (Cucul::Dither *d, float f)
void Cucul::set_dither_gamma(Cucul::Dither *d, float f)
{ {
cucul_set_dither_gamma(d->dither, f); cucul_set_dither_gamma(d->dither, f);
} }


void Cucul::set_dither_contrast ( Cucul::Dither *d, float f)
void Cucul::set_dither_contrast(Cucul::Dither *d, float f)
{ {
cucul_set_dither_contrast(d->dither, f); cucul_set_dither_contrast(d->dither, f);
} }


void Cucul::set_dither_invert ( Cucul::Dither *d, int i)
void Cucul::set_dither_invert(Cucul::Dither *d, int i)
{ {
cucul_set_dither_invert(d->dither, i); cucul_set_dither_invert(d->dither, i);
} }


void Cucul::set_dither_antialias ( Cucul::Dither *d, char const *cv)
void Cucul::set_dither_antialias(Cucul::Dither *d, char const *cv)
{ {
cucul_set_dither_antialias(d->dither, cv); cucul_set_dither_antialias(d->dither, cv);
} }
char const *const * Cucul::get_dither_antialias_list ( Cucul::Dither const *d)
char const *const * Cucul::get_dither_antialias_list(Cucul::Dither const *d)
{ {
return cucul_get_dither_antialias_list(d->dither); return cucul_get_dither_antialias_list(d->dither);
} }


void Cucul::set_dither_color ( Cucul::Dither *d, char const *cv)
void Cucul::set_dither_color(Cucul::Dither *d, char const *cv)
{ {
cucul_set_dither_color(d->dither, cv); cucul_set_dither_color(d->dither, cv);
} }


char const *const * Cucul::get_dither_color_list ( Cucul::Dither const *d)
char const *const * Cucul::get_dither_color_list(Cucul::Dither const *d)
{ {
return cucul_get_dither_color_list(d->dither); return cucul_get_dither_color_list(d->dither);
} }
void Cucul::set_dither_charset ( Cucul::Dither *d, char const *cv)
void Cucul::set_dither_charset(Cucul::Dither *d, char const *cv)
{ {
cucul_set_dither_charset(d->dither, cv); cucul_set_dither_charset(d->dither, cv);
} }


char const *const * Cucul::get_dither_charset_list ( Cucul::Dither const *d)
char const *const * Cucul::get_dither_charset_list(Cucul::Dither const *d)
{ {
return cucul_get_dither_charset_list(d->dither); return cucul_get_dither_charset_list(d->dither);
} }
void Cucul::set_dither_mode ( Cucul::Dither *d, char const *cv)
void Cucul::set_dither_mode(Cucul::Dither *d, char const *cv)
{ {
cucul_set_dither_mode(d->dither, cv); cucul_set_dither_mode(d->dither, cv);
} }


char const *const * Cucul::get_dither_mode_list ( Cucul::Dither const *d)
char const *const * Cucul::get_dither_mode_list(Cucul::Dither const *d)
{ {
return cucul_get_dither_mode_list(d->dither); return cucul_get_dither_mode_list(d->dither);
} }


void Cucul::dither_bitmap ( int x, int y, int w, int h, Cucul::Dither const *d, void *v)
void Cucul::dither_bitmap(int x, int y, int w, int h, Cucul::Dither const *d, void *v)
{ {
cucul_dither_bitmap(cv, x, y, w, h, d->dither, v); cucul_dither_bitmap(cv, x, y, w, h, d->dither, v);
} }


void Cucul::free_dither ( Cucul::Dither *d)
void Cucul::free_dither(Cucul::Dither *d)
{ {
cucul_free_dither(d->dither); cucul_free_dither(d->dither);
} }


Cucul::Font * Cucul::load_font (void const *s, unsigned int v)
Cucul::Font * Cucul::load_font(void const *s, unsigned int v)
{ {
Cucul::Font *f = new Cucul::Font(); Cucul::Font *f = new Cucul::Font();
f->font = cucul_load_font(s, v); f->font = cucul_load_font(s, v);
return f; return f;
} }


char const *const * Cucul::get_font_list (void)
char const *const * Cucul::get_font_list(void)
{ {
return cucul_get_font_list(); return cucul_get_font_list();
} }


unsigned int Cucul::get_font_width ( Cucul::Font *f)
unsigned int Cucul::get_font_width(Cucul::Font *f)
{ {
return cucul_get_font_width(f->font); return cucul_get_font_width(f->font);
} }


unsigned int Cucul::get_font_height ( Cucul::Font *f)
unsigned int Cucul::get_font_height(Cucul::Font *f)
{ {
return cucul_get_font_height(f->font); return cucul_get_font_height(f->font);
} }


void Cucul::render_canvas (Cucul::Font *f, unsigned char *buf, unsigned int x, unsigned int y, unsigned int w)
void Cucul::render_canvas(Cucul::Font *f, unsigned char *buf, unsigned int x, unsigned int y, unsigned int w)
{ {
cucul_render_canvas(cv, f->font, buf, x,y,w);
cucul_render_canvas(cv, f->font, buf, x, y, w);
} }


void Cucul::free_font ( Cucul::Font *f)
void Cucul::free_font(Cucul::Font *f)
{ {
cucul_free_font(f->font); cucul_free_font(f->font);
} }


Cucul::Buffer * Cucul::export_canvas (char const *buf)
Cucul::Buffer * Cucul::export_canvas(char const *buf)
{ {
Cucul::Buffer *b = new Cucul::Buffer(); Cucul::Buffer *b = new Cucul::Buffer();
b->buffer = cucul_export_canvas(cv, buf); b->buffer = cucul_export_canvas(cv, buf);
return b; return b;
} }


char const *const * Cucul::get_export_list (void)
char const *const * Cucul::get_export_list(void)
{ {
return cucul_get_export_list(); return cucul_get_export_list();
} }

+ 79
- 79
cpp/cucul++.h View File

@@ -1,5 +1,5 @@
/* /*
* libcucul++ C++ bindings for libcucul
* libcucul++ C++ bindings for libcucul
* Copyright (c) 2006 Jean-Yves Lamoureux <jylam@lnxscene.org> * Copyright (c) 2006 Jean-Yves Lamoureux <jylam@lnxscene.org>
* All Rights Reserved * All Rights Reserved
* *
@@ -22,113 +22,113 @@


#ifndef _CUCUL_PP_H #ifndef _CUCUL_PP_H
#define _CUCUL_PP_H #define _CUCUL_PP_H
#include <stdio.h> // BUFSIZ
#include <stdarg.h> // va_*
#include "config.h"
#include "cucul.h"


#include <cucul.h>


class Cucul {
class Cucul
{
friend class Caca; friend class Caca;
public:
public:
Cucul(); Cucul();
Cucul(int width, int height); Cucul(int width, int height);
~Cucul(); ~Cucul();


/* Ugly, I know */ /* Ugly, I know */
class Font {
class Font
{
friend class Cucul; friend class Cucul;
protected:
protected:
cucul_font *font; cucul_font *font;
}; };
class Sprite {

class Sprite
{
friend class Cucul; friend class Cucul;
protected:
protected:
cucul_sprite *sprite; cucul_sprite *sprite;
}; };
class Dither {

class Dither
{
friend class Cucul; friend class Cucul;
protected:
protected:
cucul_dither *dither; cucul_dither *dither;
}; };
class Buffer {

class Buffer
{
friend class Cucul; friend class Cucul;
protected:
protected:
cucul_buffer *buffer; cucul_buffer *buffer;
}; };




void set_size(unsigned int w, unsigned int h); void set_size(unsigned int w, unsigned int h);
unsigned int get_width(void); unsigned int get_width(void);
unsigned int get_height(void); unsigned int get_height(void);
void set_color(unsigned int f, unsigned int b); void set_color(unsigned int f, unsigned int b);
char const * get_color_name (unsigned int color);
void printf ( int x , int y , char const * format,...);
void putchar (int x, int y, char ch);
void putstr (int x, int y, char *str);
void clear (unsigned char bg);
void blit ( int, int, Cucul* c1, Cucul* c2);
void invert ();
void flip ();
void flop ();
void rotate ();
void draw_line ( int, int, int, int, char const *);
void draw_polyline ( int const x[], int const y[], int, char const *);
void draw_thin_line ( int, int, int, int);
void draw_thin_polyline ( int const x[], int const y[], int);
void draw_circle ( int, int, int, char const *);
void draw_ellipse ( int, int, int, int, char const *);
void draw_thin_ellipse ( int, int, int, int);
void fill_ellipse ( int, int, int, int, char const *);
void draw_box ( int, int, int, int, char const *);
void draw_thin_box ( int, int, int, int);
void fill_box ( int, int, int, int, char const *);
void draw_triangle ( int, int, int, int, int, int, char const *);
void draw_thin_triangle ( int, int, int, int, int, int);
void fill_triangle ( int, int, int, int, int, int, char const *);
int rand (int, int);
Sprite * load_sprite (char const *);
int get_sprite_frames (Cucul::Sprite const *);
int get_sprite_width (Cucul::Sprite const *, int);
int get_sprite_height (Cucul::Sprite const *, int);
int get_sprite_dx (Cucul::Sprite const *, int);
int get_sprite_dy (Cucul::Sprite const *, int);
void draw_sprite ( int, int, Cucul::Sprite const *, int);
void free_sprite (Cucul::Sprite*);
Dither * create_dither (unsigned int, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int);
void set_dither_palette (Cucul::Dither *, unsigned int r[], unsigned int g[], unsigned int b[], unsigned int a[]);
void set_dither_brightness (Cucul::Dither *, float);
void set_dither_gamma (Cucul::Dither *, float);
void set_dither_contrast (Cucul::Dither *, float);
void set_dither_invert (Cucul::Dither *, int);
void set_dither_antialias (Cucul::Dither *, char const *);
char const *const * get_dither_antialias_list (Cucul::Dither const *);
void set_dither_color (Cucul::Dither *, char const *);
char const *const * get_dither_color_list (Cucul::Dither const *);
void set_dither_charset (Cucul::Dither *, char const *);
char const *const * get_dither_charset_list (Cucul::Dither const *);
void set_dither_mode (Cucul::Dither *, char const *);
char const *const * get_dither_mode_list (Cucul::Dither const *);
void dither_bitmap ( int, int, int, int, Cucul::Dither const *, void *);
void free_dither (Cucul::Dither *);
Font * load_font (void const *, unsigned int);
char const *const * get_font_list (void);
unsigned int get_font_width (Font *);
unsigned int get_font_height (Font *);
void render_canvas ( Font *, unsigned char *, unsigned int, unsigned int, unsigned int);
void free_font (Font *);
Buffer * export_canvas ( char const *);
char const *const * get_export_list (void);

char const * get_color_name(unsigned int color);
void printf(int x , int y , char const * format,...);
void putchar(int x, int y, char ch);
void putstr(int x, int y, char *str);
void clear(unsigned char bg);
void blit(int, int, Cucul* c1, Cucul* c2);
void invert();
void flip();
void flop();
void rotate();
void draw_line(int, int, int, int, char const *);
void draw_polyline(int const x[], int const y[], int, char const *);
void draw_thin_line(int, int, int, int);
void draw_thin_polyline(int const x[], int const y[], int);
void draw_circle(int, int, int, char const *);
void draw_ellipse(int, int, int, int, char const *);
void draw_thin_ellipse(int, int, int, int);
void fill_ellipse(int, int, int, int, char const *);
void draw_box(int, int, int, int, char const *);
void draw_thin_box(int, int, int, int);
void fill_box(int, int, int, int, char const *);
void draw_triangle(int, int, int, int, int, int, char const *);
void draw_thin_triangle(int, int, int, int, int, int);
void fill_triangle(int, int, int, int, int, int, char const *);
int rand(int, int);
Sprite * load_sprite(char const *);
int get_sprite_frames(Cucul::Sprite const *);
int get_sprite_width(Cucul::Sprite const *, int);
int get_sprite_height(Cucul::Sprite const *, int);
int get_sprite_dx(Cucul::Sprite const *, int);
int get_sprite_dy(Cucul::Sprite const *, int);
void draw_sprite(int, int, Cucul::Sprite const *, int);
void free_sprite(Cucul::Sprite*);
Dither * create_dither(unsigned int, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int);
void set_dither_palette(Cucul::Dither *, unsigned int r[], unsigned int g[], unsigned int b[], unsigned int a[]);
void set_dither_brightness(Cucul::Dither *, float);
void set_dither_gamma(Cucul::Dither *, float);
void set_dither_contrast(Cucul::Dither *, float);
void set_dither_invert(Cucul::Dither *, int);
void set_dither_antialias(Cucul::Dither *, char const *);
char const *const * get_dither_antialias_list(Cucul::Dither const *);
void set_dither_color(Cucul::Dither *, char const *);
char const *const * get_dither_color_list(Cucul::Dither const *);
void set_dither_charset(Cucul::Dither *, char const *);
char const *const * get_dither_charset_list(Cucul::Dither const *);
void set_dither_mode(Cucul::Dither *, char const *);
char const *const * get_dither_mode_list(Cucul::Dither const *);
void dither_bitmap(int, int, int, int, Cucul::Dither const *, void *);
void free_dither(Cucul::Dither *);
Font * load_font(void const *, unsigned int);
char const *const * get_font_list(void);
unsigned int get_font_width(Font *);
unsigned int get_font_height(Font *);
void render_canvas(Font *, unsigned char *, unsigned int, unsigned int, unsigned int);
void free_font(Font *);
Buffer * export_canvas(char const *);
char const *const * get_export_list(void);


protected:
protected:
cucul_canvas_t *get_cucul_canvas_t(); cucul_canvas_t *get_cucul_canvas_t();


private:
private:
cucul_canvas_t *cv; cucul_canvas_t *cv;


}; };






Loading…
Cancel
Save