From 935098991c1a68d3d64426e56958ce4c5d324843 Mon Sep 17 00:00:00 2001 From: Sam Hocevar Date: Wed, 26 Apr 2006 12:17:22 +0000 Subject: [PATCH] * Removed legacy cpp directory. --- cpp/Makefile.am | 24 ---- cpp/caca++.cpp | 97 -------------- cpp/caca++.h | 76 ----------- cpp/caca++.pc.in | 12 -- cpp/cpptest.cpp | 103 -------------- cpp/cucul++.cpp | 333 ---------------------------------------------- cpp/cucul++.h | 135 ------------------- cpp/cucul++.pc.in | 12 -- 8 files changed, 792 deletions(-) delete mode 100644 cpp/Makefile.am delete mode 100644 cpp/caca++.cpp delete mode 100644 cpp/caca++.h delete mode 100644 cpp/caca++.pc.in delete mode 100644 cpp/cpptest.cpp delete mode 100644 cpp/cucul++.cpp delete mode 100644 cpp/cucul++.h delete mode 100644 cpp/cucul++.pc.in diff --git a/cpp/Makefile.am b/cpp/Makefile.am deleted file mode 100644 index eee6316..0000000 --- a/cpp/Makefile.am +++ /dev/null @@ -1,24 +0,0 @@ -# $Id: Makefile.am 552 2006-04-13 16:10:16Z jylam $ - -AM_CPPFLAGS = -I$(top_srcdir)/cucul -I$(top_srcdir)/caca - -if USE_CPP -include_HEADERS = cucul++.h caca++.h -lib_LTLIBRARIES = libcucul++.la libcaca++.la -endif - -libcucul___la_SOURCES = cucul++.cpp cucul++.h -libcucul___la_LDFLAGS = -no-undefined -version-info @LT_VERSION@ -libcucul___la_LIBADD = ../cucul/libcucul.la - -libcaca___la_SOURCES = caca++.cpp caca++.h -libcaca___la_LDFLAGS = -no-undefined -version-info @LT_VERSION@ -libcaca___la_LIBADD = ../caca/libcaca.la - -if USE_CPP -noinst_PROGRAMS = cpptest -endif - -cpptest_SOURCES = cpptest.cpp -cpptest_LDADD = libcaca++.la libcucul++.la ../caca/libcaca.la ../cucul/libcucul.la @CACA_LIBS@ - diff --git a/cpp/caca++.cpp b/cpp/caca++.cpp deleted file mode 100644 index bf3d168..0000000 --- a/cpp/caca++.cpp +++ /dev/null @@ -1,97 +0,0 @@ -/* - * libcaca++ C++ bindings for libcaca - * Copyright (c) 2006 Jean-Yves Lamoureux - * All Rights Reserved - * - * $Id$ - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the Do What The Fuck You Want To - * Public License, Version 2, as published by Sam Hocevar. See - * http://sam.zoy.org/wtfpl/COPYING for more details. - */ - -/* - * This file contains the main functions used by \e libcaca++ applications to - * initialise the library, get the screen properties, set the framerate and - * so on. - */ - - -#include "caca++.h" - - -Caca::Caca(Cucul *cv) -{ - dp = caca_create_display(cv->get_cucul_canvas_t()); - if(!dp) - throw -1; -} - -Caca::~Caca() -{ - caca_free_display(dp); -} - -void Caca::Attach(Cucul *cv) -{ - dp = caca_create_display(cv->get_cucul_canvas_t()); - if(!dp) - throw -1; -} - -void Caca::Detach() -{ - caca_free_display(dp); -} - -void Caca::setDelay(unsigned int d) -{ - caca_set_delay(dp, d); -} - -void Caca::Display() -{ - caca_refresh_display(dp); -} - -unsigned int Caca::getRendertime() -{ - return caca_get_rendertime(dp); -} - -unsigned int Caca::getWidth() -{ - return caca_get_display_width(dp); -} - -unsigned int Caca::getHeight() -{ - return caca_get_display_height(dp); -} - -int Caca::setTitle(char const *s) -{ - return caca_set_display_title(dp, s); -} - -int Caca::getEvent(unsigned int g, Event *n, int aa) -{ - return caca_get_event(dp, g, &n->e, aa); -} - -unsigned int Caca::getMouseX() -{ - return caca_get_mouse_x(dp); -} - -unsigned int Caca::getMouseY() -{ - return caca_get_mouse_x(dp); -} - -void Caca::setMouse(int v) -{ - caca_set_mouse(dp, v); -} - diff --git a/cpp/caca++.h b/cpp/caca++.h deleted file mode 100644 index c089dbd..0000000 --- a/cpp/caca++.h +++ /dev/null @@ -1,76 +0,0 @@ -/* - * libcaca++ C++ bindings for libcaca - * Copyright (c) 2006 Jean-Yves Lamoureux - * All Rights Reserved - * - * $Id$ - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the Do What The Fuck You Want To - * Public License, Version 2, as published by Sam Hocevar. See - * http://sam.zoy.org/wtfpl/COPYING for more details. - */ - -/** \file caca++.h - * \version \$Id$ - * \author Jean-Yves Lamoureux - * \brief The \e libcaca++ public header. - * - * This header contains the public types and functions that applications - * using \e libcaca++ may use. - */ -#ifndef _CACA_PP_H -#define _CACA_PP_H - -#include -#include - -#include - -class Event -{ - friend class Caca; - public: - enum caca_event_type - { - CACA_EVENT_NONE = 0x0000, /**< No event. */ - - CACA_EVENT_KEY_PRESS = 0x0001, /**< A key was pressed. */ - CACA_EVENT_KEY_RELEASE = 0x0002, /**< A key was released. */ - CACA_EVENT_MOUSE_PRESS = 0x0004, /**< A mouse button was pressed. */ - CACA_EVENT_MOUSE_RELEASE = 0x0008, /**< A mouse button was released. */ - CACA_EVENT_MOUSE_MOTION = 0x0010, /**< The mouse was moved. */ - CACA_EVENT_RESIZE = 0x0020, /**< The window was resized. */ - - CACA_EVENT_ANY = 0xffff /**< Bitmask for any event. */ - } type; - - protected: - caca_event e; -}; - -class Caca -{ - public: - Caca(); - Caca(Cucul *cv); - ~Caca(); - - void Attach(Cucul *cv); - void Detach(); - void setDelay(unsigned int); - void Display(); - unsigned int getRendertime(); - unsigned int getWidth(); - unsigned int getHeight(); - int setTitle(char const *); - int getEvent(unsigned int, Event*, int); - unsigned int getMouseX(); - unsigned int getMouseY(); - void setMouse(int); - - private: - caca_display_t *dp; -}; - -#endif /* _CACA_PP_H */ diff --git a/cpp/caca++.pc.in b/cpp/caca++.pc.in deleted file mode 100644 index d63e0a4..0000000 --- a/cpp/caca++.pc.in +++ /dev/null @@ -1,12 +0,0 @@ -prefix=@prefix@ -exec_prefix=@exec_prefix@ -libdir=@libdir@ -includedir=@includedir@ - -Name: caca++ -Description: Colour ASCII-Art library C++ bindings -Version: @VERSION@ -Requires: cucul++ = @VERSION@ -Conflicts: -Libs: -L${libdir} -lcaca -lcucul -lcucul++ -Cflags: -I${includedir} diff --git a/cpp/cpptest.cpp b/cpp/cpptest.cpp deleted file mode 100644 index 8292f4b..0000000 --- a/cpp/cpptest.cpp +++ /dev/null @@ -1,103 +0,0 @@ -/* - * cpptest libcaca++ rendering test - * Copyright (c) 2006 Jean-Yves Lamoureux - * All Rights Reserved - * - * $Id$ - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the Do What The Fuck You Want To - * Public License, Version 2, as published by Sam Hocevar. See - * http://sam.zoy.org/wtfpl/COPYING for more details. - */ - -#include "config.h" - -#include - -#include -#include - -using namespace std; - - -static char const *pig[]= { - " ", - " _ ", - " _._ _..._ .-', _.._(`)) ", - " '-. ` ' /-._.-' ',/ ", - " ) \\ '. ", - " / _ _ | \\ ", - " | a a / | ", - " \\ .-. ; " , - " '-('' ).-' ,' ; ", - " '-; | .' ", - " \\ \\ / ", - " | 7 .__ _.-\\ \\ ", - " | | | ``/ /` / ", - " jgs /,_| | /,_/ / ", - " /,_/ '`-' ", - " ", - NULL -}; - -int main(int argc, char *argv[]) -{ - Cucul *qq; - Caca *kk; - Event ev; - - int x = 0, y = 0, ix = 1, iy = 1; - - - - try { - qq = new Cucul(); - } - catch (int e) { - cerr << "Error while initializing cucul (" << e << ")" << endl; - return -1; - } - - try { - kk = new Caca(qq); - } - catch(int e) { - cerr << "Error while attaching cucul to caca (" << e << ")" << endl; - return -1; - } - - kk->setDelay(20000); - - while(!kk->getEvent(ev.CACA_EVENT_KEY_PRESS, &ev, 0)) { - - /* Draw pig */ - qq->setColor(CUCUL_COLOR_LIGHTMAGENTA, CUCUL_COLOR_BLACK); - - for(int i = 0; pig[i]; i++) - qq->putStr(x, y+i, (char*)pig[i]); - - /* printf works */ - qq->setColor(CUCUL_COLOR_LIGHTBLUE, CUCUL_COLOR_BLACK); - qq->Printf(30,15, "Powered by libcaca %s", VERSION); - - /* Blit */ - kk->Display(); - - x+=ix; - y+=iy; - - if(x>=(qq->getWidth()-35) || x<0 ) - ix=-ix; - if(y>=(qq->getHeight()-15) || y<0 ) - iy=-iy; - - - } - - - delete kk; - delete qq; - - return 0; -} diff --git a/cpp/cucul++.cpp b/cpp/cucul++.cpp deleted file mode 100644 index 6d864a1..0000000 --- a/cpp/cucul++.cpp +++ /dev/null @@ -1,333 +0,0 @@ -/* - * libcucul++ C++ bindings for libcucul - * Copyright (c) 2006 Jean-Yves Lamoureux - * All Rights Reserved - * - * $Id$ - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the Do What The Fuck You Want To - * Public License, Version 2, as published by Sam Hocevar. See - * http://sam.zoy.org/wtfpl/COPYING for more details. - */ - -/* - * This file contains the main functions used by \e libcucul++ applications - * to initialise a drawing context. - */ - -#include "config.h" - -#include // BUFSIZ -#include // va_* - -#include "cucul++.h" - -Cucul::Cucul() -{ - cv = cucul_create_canvas(0, 0); - if(!cv) - throw -1; -} - -Cucul::Cucul(int width, int height) -{ - cv = cucul_create_canvas(width, height); - if(!cv) throw -1; -} - -Cucul::Cucul(void const *data, unsigned int size, char const *format) -{ - cv = cucul_import_canvas(data, size, format); - if(!cv) throw -1; -} - -Cucul::~Cucul() -{ - if(cv) - cucul_free_canvas(cv); -} - -cucul_canvas_t *Cucul::get_cucul_canvas_t() -{ - return cv; -} - -void Cucul::setSize(unsigned int width, unsigned int height) -{ - cucul_set_canvas_size(cv, width, height); -} - -unsigned int Cucul::getWidth(void) -{ - return cucul_get_canvas_width(cv); -} - -unsigned int Cucul::getHeight(void) -{ - return cucul_get_canvas_height(cv); -} - -void Cucul::setColor(unsigned int f, unsigned int b) -{ - cucul_set_color(cv, f, b); -} - -char const * Cucul::getColorName(unsigned int color) -{ - return cucul_get_color_name(color); -} - -void Cucul::putChar(int x, int y, char ch) -{ - cucul_putchar(cv, x, y, ch); -} - -void Cucul::putStr(int x, int y, char *str) -{ - cucul_putstr(cv, x, y, str); -} - -void Cucul::Printf(int x, int y, char const * format,...) -{ - char tmp[BUFSIZ]; - char *buf = tmp; - va_list args; - - va_start(args, format); -#if defined(HAVE_VSNPRINTF) - vsnprintf(buf, getWidth() - x + 1, format, args); -#else - vsprintf(buf, format, args); -#endif - buf[getWidth() - x] = '\0'; - va_end(args); - - putStr(x, y, buf); -} - -void Cucul::Clear(void) -{ - cucul_clear_canvas(cv); -} - -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()); -} - -void Cucul::Invert() -{ - cucul_invert(cv); -} - -void Cucul::Flip() -{ - cucul_flip(cv); -} - -void Cucul::Flop() -{ - cucul_flop(cv); -} - -void Cucul::Rotate() -{ - cucul_rotate(cv); -} - -void Cucul::drawLine(int x1, int y1, int x2, int y2, char const *ch) -{ - cucul_draw_line(cv, x1, y1, x2, y2, ch); -} - -void Cucul::drawPolyline(int const x[], int const y[], int f, char const *ch) -{ - cucul_draw_polyline(cv, x, y, f, ch); -} - -void Cucul::drawThinLine(int x1, int y1, int x2, int y2) -{ - cucul_draw_thin_line(cv, x1, y1, x2, y2); -} - -void Cucul::drawThinPolyline(int const x[], int const y[], int f) -{ - cucul_draw_thin_polyline(cv, x, y, f); -} - -void Cucul::drawCircle(int x, int y, int d, char const *ch) -{ - cucul_draw_circle(cv, x, y, d, ch); -} - -void Cucul::drawEllipse(int x, int y, int d1, int d2, char const *ch) -{ - cucul_draw_ellipse(cv, x, y, d1, d2, ch); -} - -void Cucul::drawThinEllipse(int x, int y, int d1, int d2) -{ - cucul_draw_thin_ellipse(cv, x, y, d1, d2); -} - -void Cucul::fillEllipse(int x, int y, int d1, int d2, char const *ch) -{ - cucul_fill_ellipse(cv, x, y, d1, d2, ch); -} - -void Cucul::drawBox(int x, int y, int w, int h, char const *ch) -{ - cucul_draw_box(cv, x, y, w, h, ch); -} - -void Cucul::drawThinBox(int x, int y, int w, int h) -{ - cucul_draw_thin_box(cv, x, y, w, h); -} - -void Cucul::fillBox(int x, int y, int w, int h, char const *ch) -{ - cucul_fill_box(cv, x, y, w, h, ch); -} - -void Cucul::drawTriangle(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); -} - -void Cucul::drawThinTriangle(int x1, int y1, int x2, int y2, int x3, int y3) -{ - cucul_draw_thin_triangle(cv, x1, y1, x2, y2, x3, y3); -} - -void Cucul::fillTriangle(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); -} - -int Cucul::Rand(int min, int max) -{ - return cucul_rand(min, max); -} - -Dither::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) -{ - dither = cucul_create_dither(v1, v2, v3, v4, v5, v6, v7, v8); -} -Dither::~Dither() -{ - cucul_free_dither(dither); -} - -void Dither::setPalette(unsigned int r[], unsigned int g[], unsigned int b[], unsigned int a[]) -{ - cucul_set_dither_palette(dither, r, g, b, a); -} - -void Dither::setBrightness(float f) -{ - cucul_set_dither_brightness(dither, f); -} - -void Dither::setGamma(float f) -{ - cucul_set_dither_gamma(dither, f); -} - -void Dither::setContrast(float f) -{ - cucul_set_dither_contrast(dither, f); -} - -void Dither::setInvert(int i) -{ - cucul_set_dither_invert(dither, i); -} - -void Dither::setAntialias(char const *cv) -{ - cucul_set_dither_antialias(dither, cv); -} - -char const *const * Dither::getAntialiasList() -{ - return cucul_get_dither_antialias_list(dither); -} - -void Dither::setColor(char const *cv) -{ - cucul_set_dither_color(dither, cv); -} - -char const *const * Dither::getColorList() -{ - return cucul_get_dither_color_list(dither); -} - -void Dither::setCharset(char const *cv) -{ - cucul_set_dither_charset(dither, cv); -} - -char const *const * Dither::getCharsetList() -{ - return cucul_get_dither_charset_list(dither); -} - -void Dither::setMode(char const *cv) -{ - cucul_set_dither_mode(dither, cv); -} - -char const *const * Dither::getModeList(void) -{ - return cucul_get_dither_mode_list(dither); -} - -void Dither::Bitmap(Cucul *cv, int x, int y, int w, int h, void *v) -{ - cucul_dither_bitmap(cv->get_cucul_canvas_t(), x, y, w, h, dither, v); -} - -Font::Font(void const *s, unsigned int v) -{ - font = cucul_load_font(s, v); - if(!font) throw -1; -} - -char const *const * Font::getList(void) -{ - return cucul_get_font_list(); -} - -unsigned int Font::getWidth() -{ - return cucul_get_font_width(font); -} - -unsigned int Font::getHeight() -{ - return cucul_get_font_height(font); -} - -void Font::renderCanvas(Cucul *cv, unsigned char *buf, unsigned int x, unsigned int y, unsigned int w) -{ - cucul_render_canvas(cv->get_cucul_canvas_t(), font, buf, x, y, w); -} - -Font::~Font() -{ - cucul_free_font(font); -} - -Buffer::Buffer(Cucul *cv, char const *buf) -{ - buffer = cucul_export_canvas(cv->get_cucul_canvas_t(), buf); - if(!buffer) throw -1; -} - -char const *const * Buffer::getExportList(void) -{ - return cucul_get_export_list(); -} diff --git a/cpp/cucul++.h b/cpp/cucul++.h deleted file mode 100644 index df16f2e..0000000 --- a/cpp/cucul++.h +++ /dev/null @@ -1,135 +0,0 @@ -/* - * libcucul++ C++ bindings for libcucul - * Copyright (c) 2006 Jean-Yves Lamoureux - * All Rights Reserved - * - * $Id$ - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the Do What The Fuck You Want To - * Public License, Version 2, as published by Sam Hocevar. See - * http://sam.zoy.org/wtfpl/COPYING for more details. - */ - -/** \file cucul++.h - * \version \$Id$ - * \author Jean-Yves Lamoureux - * \brief The \e libcucul++ public header. - * - * This header contains the public types and functions that applications - * using \e libcucul++ may use. - */ - -#ifndef _CUCUL_PP_H -#define _CUCUL_PP_H - -#include - - -class Cucul; - -/* Ugly, I know */ -class Font -{ - public: - ~Font(); - Font(void const *, unsigned int); - char const *const * getList(void); - unsigned int getWidth(); - unsigned int getHeight(); - void renderCanvas(Cucul *, unsigned char *, unsigned int, unsigned int, unsigned int); - - private: - cucul_font *font; - -}; - -class Dither -{ - public: - Dither(unsigned int, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int); - ~Dither(); - - void setPalette(unsigned int r[], unsigned int g[], unsigned int b[], unsigned int a[]); - void setBrightness(float); - void setGamma(float); - void setContrast(float); - void setInvert(int); - void setAntialias(char const *); - char const *const * getAntialiasList(); - void setColor(char const *); - char const *const * getColorList(); - void setCharset(char const *); - char const *const * getCharsetList(); - void setMode(char const *); - char const *const * getModeList(); - void Bitmap(Cucul *, int, int, int, int, void *); - - private: - cucul_dither *dither; - -}; - -class Buffer -{ - public: - Buffer(Cucul *cv, char const *); - ~Buffer(); - char const *const * getExportList(void); - - private: - cucul_buffer *buffer; -}; - - -class Cucul -{ - friend class Caca; - friend class Dither; - friend class Font; - friend class Buffer; - public: - Cucul(); - Cucul(int width, int height); - Cucul(void const *, unsigned int, char const *); - ~Cucul(); - - void setSize(unsigned int w, unsigned int h); - unsigned int getWidth(void); - unsigned int getHeight(void); - void setColor(unsigned int f, unsigned int b); - char const * getColorName(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(void); - void Blit(int, int, Cucul* c1, Cucul* c2); - void Invert(); - void Flip(); - void Flop(); - void Rotate(); - void drawLine(int, int, int, int, char const *); - void drawPolyline(int const x[], int const y[], int, char const *); - void drawThinLine(int, int, int, int); - void drawThinPolyline(int const x[], int const y[], int); - void drawCircle(int, int, int, char const *); - void drawEllipse(int, int, int, int, char const *); - void drawThinEllipse(int, int, int, int); - void fillEllipse(int, int, int, int, char const *); - void drawBox(int, int, int, int, char const *); - void drawThinBox(int, int, int, int); - void fillBox(int, int, int, int, char const *); - void drawTriangle(int, int, int, int, int, int, char const *); - void drawThinTriangle(int, int, int, int, int, int); - void fillTriangle(int, int, int, int, int, int, char const *); - int Rand(int, int); - - protected: - cucul_canvas_t *get_cucul_canvas_t(); - - private: - cucul_canvas_t *cv; -}; - - -#endif /* _CUCUL_PP_H */ diff --git a/cpp/cucul++.pc.in b/cpp/cucul++.pc.in deleted file mode 100644 index 5ea9ebe..0000000 --- a/cpp/cucul++.pc.in +++ /dev/null @@ -1,12 +0,0 @@ -prefix=@prefix@ -exec_prefix=@exec_prefix@ -libdir=@libdir@ -includedir=@includedir@ - -Name: cucul++ -Description: Canvas for ultrafast compositing of Unicode letters C++ binding -Version: @VERSION@ -Requires: -Conflicts: -Libs: -L${libdir} -lcucul -lcaca -Cflags: -I${includedir}