source: libcaca/trunk/cxx/caca++.cpp @ 2821

Last change on this file since 2821 was 2821, checked in by Sam Hocevar, 11 years ago

Starting refactoring to get rid of libcucul. The initial reason for the
split is rendered moot by the plugin system: when enabled, binaries do
not link directly with libX11 or libGL. I hope this is a step towards
more consisteny and clarity.

  • Property svn:keywords set to Id
File size: 1.8 KB
Line 
1/*
2 *  libcaca++      C++ bindings for libcaca
3 *  Copyright (c) 2006 Jean-Yves Lamoureux <jylam@lnxscene.org>
4 *                All Rights Reserved
5 *
6 *  $Id: caca++.cpp 2821 2008-09-27 13:12:46Z sam $
7 *
8 *  This library is free software. It comes without any warranty, to
9 *  the extent permitted by applicable law. You can redistribute it
10 *  and/or modify it under the terms of the Do What The Fuck You Want
11 *  To Public License, Version 2, as published by Sam Hocevar. See
12 *  http://sam.zoy.org/wtfpl/COPYING for more details.
13 */
14
15/*
16 *  This file contains the main functions used by \e libcaca++ applications to
17 *  initialise the library, get the screen properties, set the framerate and
18 *  so on.
19 */
20
21#include "config.h"
22
23#include <iostream>
24
25#include "caca++.h"
26
27Caca::Caca(Canvas *cv)
28{
29    dp = caca_create_display(cv->get_caca_canvas_t());
30    if(!dp)
31        throw -1;
32}
33
34Caca::~Caca()
35{
36    caca_free_display(dp);
37}
38
39void Caca::Attach(Canvas *cv)
40{
41    dp = caca_create_display(cv->get_caca_canvas_t());
42    if(!dp)
43        throw -1;
44}
45
46void Caca::Detach()
47{
48    caca_free_display(dp);
49}
50
51void Caca::setDisplayTime(unsigned int d)
52{
53    caca_set_display_time(dp, d);
54}
55
56void Caca::Display()
57{
58    caca_refresh_display(dp);
59}
60
61unsigned int Caca::getDisplayTime()
62{
63    return caca_get_display_time(dp);
64}
65
66unsigned int Caca::getWidth()
67{
68    return caca_get_display_width(dp);
69}
70
71unsigned int Caca::getHeight()
72{
73    return caca_get_display_height(dp);
74}
75
76int Caca::setTitle(char const *s)
77{
78    return caca_set_display_title(dp, s);
79}
80
81int Caca::getEvent(unsigned int g, Event *n, int aa)
82{
83    return caca_get_event(dp, g, n ? &n->e : NULL, aa);
84}
85
86unsigned int Caca::getMouseX()
87{
88    return caca_get_mouse_x(dp);
89}
90
91unsigned int Caca::getMouseY()
92{
93    return caca_get_mouse_x(dp);
94}
95
96void Caca::setMouse(int v)
97{
98    caca_set_mouse(dp, v);
99}
100
101const char * Caca::getVersion()
102{
103    return caca_get_version();
104}
105
Note: See TracBrowser for help on using the repository browser.