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

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