source: libcaca/trunk/cpp/caca++.cpp @ 837

Last change on this file since 837 was 831, checked in by Sam Hocevar, 15 years ago
  • Fixed a segfault in the C++ bindings. Vieux porc !
  • Property svn:keywords set to Id
File size: 1.7 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 831 2006-04-21 20:24:04Z sam $
7 *
8 *  This library is free software; you can redistribute it and/or
9 *  modify it under the terms of the Do What The Fuck You Want To
10 *  Public License, Version 2, as published by Sam Hocevar. See
11 *  http://sam.zoy.org/wtfpl/COPYING for more details.
12 */
13
14/*
15 *  This file contains the main functions used by \e libcaca++ applications to
16 *  initialise the library, get the screen properties, set the framerate and
17 *  so on.
18 */
19
20
21#include "caca++.h"
22
23Caca::Caca(void)
24{
25
26}
27
28Caca::Caca(Cucul *cv)
29{
30    dp = caca_create_display(cv->get_cucul_canvas_t());
31    if(!dp)
32        throw -1;
33}
34
35Caca::~Caca()
36{
37    caca_free_display(dp);
38}
39
40void Caca::attach(Cucul *cv)
41{
42    dp = caca_create_display(cv->get_cucul_canvas_t());
43    if(!dp)
44        throw -1;
45}
46
47void Caca::detach()
48{
49    caca_free_display(dp);
50}
51
52void Caca::set_delay(unsigned int d)
53{
54    caca_set_delay(dp, d);
55}
56
57void Caca::display()
58{
59    caca_refresh_display(dp);
60}
61
62unsigned int Caca::get_rendertime()
63{
64    return caca_get_rendertime(dp);
65}
66
67unsigned int Caca::get_display_width()
68{
69    return caca_get_display_width(dp);
70}
71
72unsigned int Caca::get_display_height()
73{
74    return caca_get_display_height(dp);
75}
76
77int Caca::set_display_title(char const *s)
78{
79    return caca_set_display_title(dp, s);
80}
81
82int Caca::get_event(unsigned int g, Event *n, int aa)
83{
84    return caca_get_event(dp, g, &n->e, aa);
85}
86
87unsigned int Caca::get_mouse_x()
88{
89    return caca_get_mouse_x(dp);
90}
91
92unsigned int Caca::get_mouse_y()
93{
94    return caca_get_mouse_x(dp);
95}
96
97void Caca::set_mouse(int v)
98{
99     caca_set_mouse(dp, v);
100}
101
Note: See TracBrowser for help on using the repository browser.