source: gaycko/trunk/src/window/window.c @ 4749

Last change on this file since 4749 was 4749, checked in by Jean-Yves Lamoureux, 9 years ago
  • libcaca test
File size: 1.1 KB
Line 
1/*
2 *  Gaycko        Text mode web browser
3 *  Copyright (c) 2011 Jean-Yves Lamoureux <jylam@lnxscene.org>
4 *                All Rights Reserved
5 *
6 *  This library is free software. It comes without any warranty, to
7 *  the extent permitted by applicable law. You can redistribute it
8 *  and/or modify it under the terms of the Do What The Fuck You Want
9 *  To Public License, Version 2, as published by Sam Hocevar. See
10 *  http://sam.zoy.org/wtfpl/COPYING for more details.
11 */
12#include <stdio.h>
13#include <stdlib.h>
14
15#include "window/window.h"
16
17gWindow *gaycko_create_window(int width, int height) {
18        gWindow *window = NULL;   
19    window = (gWindow*) malloc(sizeof(window));
20   
21    window->cv = caca_create_canvas(width, height);
22        return window;
23}
24
25void gaycko_destroy_window(gWindow *window) {
26        caca_free_canvas(window->cv);   
27}
28
29void gaycko_display_window(gWindow *window) {
30    size_t size = 0;
31        char *buffer = caca_export_canvas_to_memory (window->cv, "ansi", &size);
32    if(buffer) {
33        printf("%s\n", buffer);
34        free(buffer);
35    } else {
36        printf("Error while rendering caca canvas\n");   
37    }
38}
Note: See TracBrowser for help on using the repository browser.