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 796 2006-04-17 13:23:28Z 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 | |
---|
24 | Caca::Caca(void) |
---|
25 | { |
---|
26 | |
---|
27 | } |
---|
28 | Caca::Caca(Cucul *qq) |
---|
29 | { |
---|
30 | kk = caca_attach(qq->get_cucul_t()); |
---|
31 | if(!kk) throw -1; |
---|
32 | } |
---|
33 | Caca::~Caca() |
---|
34 | { |
---|
35 | caca_detach(kk); |
---|
36 | } |
---|
37 | void Caca::attach(Cucul *qq) |
---|
38 | { |
---|
39 | kk = caca_attach(qq->get_cucul_t()); |
---|
40 | if(!kk) throw -1; |
---|
41 | } |
---|
42 | void Caca::detach () |
---|
43 | { |
---|
44 | caca_detach(kk); |
---|
45 | } |
---|
46 | void Caca::set_delay (unsigned int d) |
---|
47 | { |
---|
48 | caca_set_delay(kk, d); |
---|
49 | } |
---|
50 | void Caca::display () |
---|
51 | { |
---|
52 | caca_display(kk); |
---|
53 | } |
---|
54 | unsigned int Caca::get_rendertime () |
---|
55 | { |
---|
56 | return caca_get_rendertime(kk); |
---|
57 | } |
---|
58 | unsigned int Caca::get_window_width () |
---|
59 | { |
---|
60 | return caca_get_window_width(kk); |
---|
61 | } |
---|
62 | unsigned int Caca::get_window_height () |
---|
63 | { |
---|
64 | return caca_get_window_height(kk); |
---|
65 | } |
---|
66 | int Caca::set_window_title (char const *s) |
---|
67 | { |
---|
68 | return caca_set_window_title(kk, s); |
---|
69 | } |
---|
70 | int Caca::get_event (unsigned int g, Event *n, int aa) |
---|
71 | { |
---|
72 | return caca_get_event(kk, g, n->e, aa); |
---|
73 | } |
---|
74 | unsigned int Caca::get_mouse_x () |
---|
75 | { |
---|
76 | return caca_get_mouse_x(kk); |
---|
77 | } |
---|
78 | unsigned int Caca::get_mouse_y () |
---|
79 | { |
---|
80 | return caca_get_mouse_x(kk); |
---|
81 | } |
---|
82 | void Caca::set_mouse (int v) |
---|
83 | { |
---|
84 | caca_set_mouse(kk, v); |
---|
85 | } |
---|