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

Last change on this file since 897 was 897, checked in by Jean-Yves Lamoureux, 14 years ago
  • Updated libcaca c++ bindings
  • Property svn:keywords set to Id
File size: 1.6 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 897 2006-04-26 11:57:30Z jylam $
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
23
24Caca::Caca(Cucul *cv)
25{
26    dp = caca_create_display(cv->get_cucul_canvas_t());
27    if(!dp)
28        throw -1;
29}
30
31Caca::~Caca()
32{
33    caca_free_display(dp);
34}
35
36void Caca::Attach(Cucul *cv)
37{
38    dp = caca_create_display(cv->get_cucul_canvas_t());
39    if(!dp)
40        throw -1;
41}
42
43void Caca::Detach()
44{
45    caca_free_display(dp);
46}
47
48void Caca::setDelay(unsigned int d)
49{
50    caca_set_delay(dp, d);
51}
52
53void Caca::Display()
54{
55    caca_refresh_display(dp);
56}
57
58unsigned int Caca::getRendertime()
59{
60    return caca_get_rendertime(dp);
61}
62
63unsigned int Caca::getWidth()
64{
65    return caca_get_display_width(dp);
66}
67
68unsigned int Caca::getHeight()
69{
70    return caca_get_display_height(dp);
71}
72
73int Caca::setTitle(char const *s)
74{
75    return caca_set_display_title(dp, s);
76}
77
78int Caca::getEvent(unsigned int g, Event *n, int aa)
79{
80    return caca_get_event(dp, g, &n->e, aa);
81}
82
83unsigned int Caca::getMouseX()
84{
85    return caca_get_mouse_x(dp);
86}
87
88unsigned int Caca::getMouseY()
89{
90    return caca_get_mouse_x(dp);
91}
92
93void Caca::setMouse(int v)
94{
95     caca_set_mouse(dp, v);
96}
97
Note: See TracBrowser for help on using the repository browser.