@@ -15,6 +15,7 @@ libcaca_la_SOURCES = \ | |||||
driver_gl.c \ | driver_gl.c \ | ||||
driver_ncurses.c \ | driver_ncurses.c \ | ||||
driver_network.c \ | driver_network.c \ | ||||
driver_raw.c \ | |||||
driver_slang.c \ | driver_slang.c \ | ||||
driver_vga.c \ | driver_vga.c \ | ||||
driver_win32.c \ | driver_win32.c \ | ||||
@@ -1,6 +1,6 @@ | |||||
/* | /* | ||||
* libcaca Colour ASCII-Art library | * libcaca Colour ASCII-Art library | ||||
* Copyright (c) 2002-2006 Sam Hocevar <sam@zoy.org> | |||||
* Copyright (c) 2006 Sam Hocevar <sam@zoy.org> | |||||
* All Rights Reserved | * All Rights Reserved | ||||
* | * | ||||
* This library is free software; you can redistribute it and/or | * This library is free software; you can redistribute it and/or | ||||
@@ -133,6 +133,7 @@ static int caca_init_driver(caca_t *kk) | |||||
#if defined(USE_GL) | #if defined(USE_GL) | ||||
if(!strcasecmp(var, "gl")) return gl_install(kk); | if(!strcasecmp(var, "gl")) return gl_install(kk); | ||||
#endif | #endif | ||||
if(!strcasecmp(var, "raw")) return raw_install(kk); | |||||
#if defined(USE_SLANG) | #if defined(USE_SLANG) | ||||
if(!strcasecmp(var, "slang")) return slang_install(kk); | if(!strcasecmp(var, "slang")) return slang_install(kk); | ||||
#endif | #endif | ||||
@@ -170,9 +171,6 @@ static int caca_init_driver(caca_t *kk) | |||||
#if defined(USE_NCURSES) | #if defined(USE_NCURSES) | ||||
if(ncurses_install(kk) == 0) return 0; | if(ncurses_install(kk) == 0) return 0; | ||||
#endif | #endif | ||||
#if defined(USE_NETWORK) | |||||
if(network_install(kk) == 0) return 0; | |||||
#endif | |||||
return -1; | return -1; | ||||
} | } | ||||
@@ -39,57 +39,59 @@ typedef long unsigned int uintptr_t; | |||||
enum caca_driver | enum caca_driver | ||||
{ | { | ||||
CACA_DRIVER_NONE = 0, | CACA_DRIVER_NONE = 0, | ||||
CACA_DRIVER_RAW = 1, | |||||
#if defined(USE_CONIO) | #if defined(USE_CONIO) | ||||
CACA_DRIVER_CONIO = 1, | |||||
CACA_DRIVER_CONIO = 2, | |||||
#endif | |||||
#if defined(USE_GL) | |||||
CACA_DRIVER_GL = 3, | |||||
#endif | |||||
#if defined(USE_NETWORK) | |||||
CACA_DRIVER_NETWORK = 4, | |||||
#endif | #endif | ||||
#if defined(USE_NCURSES) | #if defined(USE_NCURSES) | ||||
CACA_DRIVER_NCURSES = 2, | |||||
CACA_DRIVER_NCURSES = 5, | |||||
#endif | #endif | ||||
#if defined(USE_SLANG) | #if defined(USE_SLANG) | ||||
CACA_DRIVER_SLANG = 3, | |||||
CACA_DRIVER_SLANG = 6, | |||||
#endif | #endif | ||||
#if defined(USE_X11) | |||||
CACA_DRIVER_X11 = 4, | |||||
#if defined(USE_VGA) | |||||
CACA_DRIVER_VGA = 7, | |||||
#endif | #endif | ||||
#if defined(USE_WIN32) | #if defined(USE_WIN32) | ||||
CACA_DRIVER_WIN32 = 5, | |||||
CACA_DRIVER_WIN32 = 8, | |||||
#endif | #endif | ||||
#if defined(USE_GL) | |||||
CACA_DRIVER_GL = 6, | |||||
#endif | |||||
#if defined(USE_NETWORK) | |||||
CACA_DRIVER_NETWORK = 7, | |||||
#endif | |||||
#if defined(USE_VGA) | |||||
CACA_DRIVER_VGA = 8, | |||||
#if defined(USE_X11) | |||||
CACA_DRIVER_X11 = 9, | |||||
#endif | #endif | ||||
}; | }; | ||||
/* Available drivers */ | |||||
/* Available external drivers */ | |||||
#if defined(USE_CONIO) | #if defined(USE_CONIO) | ||||
int conio_install(caca_t *); | int conio_install(caca_t *); | ||||
#endif | #endif | ||||
#if defined(USE_GL) | #if defined(USE_GL) | ||||
int gl_install(caca_t *); | int gl_install(caca_t *); | ||||
#endif | #endif | ||||
#if defined(USE_NETWORK) | |||||
int network_install(caca_t *); | |||||
#endif | |||||
#if defined(USE_NCURSES) | #if defined(USE_NCURSES) | ||||
int ncurses_install(caca_t *); | int ncurses_install(caca_t *); | ||||
#endif | #endif | ||||
int raw_install(caca_t *); | |||||
#if defined(USE_SLANG) | #if defined(USE_SLANG) | ||||
int slang_install(caca_t *); | int slang_install(caca_t *); | ||||
#endif | #endif | ||||
#if defined(USE_VGA) | |||||
int vga_install(caca_t *); | |||||
#endif | |||||
#if defined(USE_WIN32) | #if defined(USE_WIN32) | ||||
int win32_install(caca_t *); | int win32_install(caca_t *); | ||||
#endif | #endif | ||||
#if defined(USE_X11) | #if defined(USE_X11) | ||||
int x11_install(caca_t *); | int x11_install(caca_t *); | ||||
#endif | #endif | ||||
#if defined(USE_NETWORK) | |||||
int network_install(caca_t *); | |||||
#endif | |||||
#if defined(USE_VGA) | |||||
int vga_install(caca_t *); | |||||
#endif | |||||
/* Timer structure */ | /* Timer structure */ | ||||
struct caca_timer | struct caca_timer | ||||
@@ -0,0 +1,106 @@ | |||||
/* | |||||
* libcaca Colour ASCII-Art library | |||||
* Copyright (c) 2002-2006 Sam Hocevar <sam@zoy.org> | |||||
* All Rights Reserved | |||||
* | |||||
* 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 driver_raw.c | |||||
* \version \$Id$ | |||||
* \author Sam Hocevar <sam@zoy.org> | |||||
* \brief raw driver | |||||
* | |||||
* This file contains the libcaca raw input and output driver | |||||
*/ | |||||
#include "config.h" | |||||
#if !defined(__KERNEL__) | |||||
# include <stdio.h> | |||||
#endif | |||||
#include "caca.h" | |||||
#include "caca_internals.h" | |||||
#include "cucul.h" | |||||
#include "cucul_internals.h" | |||||
static int raw_init_graphics(caca_t *kk) | |||||
{ | |||||
return 0; | |||||
} | |||||
static int raw_end_graphics(caca_t *kk) | |||||
{ | |||||
return 0; | |||||
} | |||||
static int raw_set_window_title(caca_t *kk, char const *title) | |||||
{ | |||||
return 0; | |||||
} | |||||
static unsigned int raw_get_window_width(caca_t *kk) | |||||
{ | |||||
return 0; | |||||
} | |||||
static unsigned int raw_get_window_height(caca_t *kk) | |||||
{ | |||||
return 0; | |||||
} | |||||
static void raw_display(caca_t *kk) | |||||
{ | |||||
uint8_t *attr = kk->qq->attr; | |||||
uint32_t *chars = kk->qq->chars; | |||||
int n; | |||||
fprintf(stdout, "CACA %i %i\n", kk->qq->width, kk->qq->height); | |||||
for(n = kk->qq->height * kk->qq->width; n--; ) | |||||
{ | |||||
uint32_t c = *chars++; | |||||
uint8_t a = *attr++; | |||||
fprintf(stdout, "%c%c%c%c %c", (c >> 24), (c >> 16) & 0xff, | |||||
(c >> 8) & 0xff, c & 0xff, a); | |||||
} | |||||
fprintf(stdout, "ACAC\n"); | |||||
fflush(stdout); | |||||
} | |||||
static void raw_handle_resize(caca_t *kk) | |||||
{ | |||||
; | |||||
} | |||||
static int raw_get_event(caca_t *kk, struct caca_event *ev) | |||||
{ | |||||
ev->type = CACA_EVENT_NONE; | |||||
return 0; | |||||
} | |||||
/* | |||||
* Driver initialisation | |||||
*/ | |||||
int raw_install(caca_t *kk) | |||||
{ | |||||
kk->drv.driver = CACA_DRIVER_RAW; | |||||
kk->drv.init_graphics = raw_init_graphics; | |||||
kk->drv.end_graphics = raw_end_graphics; | |||||
kk->drv.set_window_title = raw_set_window_title; | |||||
kk->drv.get_window_width = raw_get_window_width; | |||||
kk->drv.get_window_height = raw_get_window_height; | |||||
kk->drv.display = raw_display; | |||||
kk->drv.handle_resize = raw_handle_resize; | |||||
kk->drv.get_event = raw_get_event; | |||||
kk->drv.set_mouse = NULL; | |||||
return 0; | |||||
} | |||||