Changeset 897


Ignore:
Timestamp:
Apr 26, 2006, 1:57:30 PM (15 years ago)
Author:
Jean-Yves Lamoureux
Message:
  • Updated libcaca c++ bindings
Location:
libcaca/trunk/cpp
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • libcaca/trunk/cpp/caca++.cpp

    r831 r897  
    2121#include "caca++.h"
    2222
    23 Caca::Caca(void)
    24 {
    2523
    26 }
    27 
    28 Caca::Caca(Cucul *cv)
     24Caca::Caca(Cucul *cv)
    2925{
    3026    dp = caca_create_display(cv->get_cucul_canvas_t());
     
    3329}
    3430
    35 Caca::~Caca() 
     31Caca::~Caca()
    3632{
    3733    caca_free_display(dp);
    3834}
    3935
    40 void Caca::attach(Cucul *cv)
     36void Caca::Attach(Cucul *cv)
    4137{
    4238    dp = caca_create_display(cv->get_cucul_canvas_t());
     
    4541}
    4642
    47 void Caca::detach()
     43void Caca::Detach()
    4844{
    4945    caca_free_display(dp);
    5046}
    5147
    52 void Caca::set_delay(unsigned int d)
     48void Caca::setDelay(unsigned int d)
    5349{
    5450    caca_set_delay(dp, d);
    5551}
    5652
    57 void Caca::display()
     53void Caca::Display()
    5854{
    5955    caca_refresh_display(dp);
    6056}
    6157
    62 unsigned int Caca::get_rendertime()
     58unsigned int Caca::getRendertime()
    6359{
    6460    return caca_get_rendertime(dp);
    6561}
    6662
    67 unsigned int Caca::get_display_width()
     63unsigned int Caca::getWidth()
    6864{
    6965    return caca_get_display_width(dp);
    7066}
    7167
    72 unsigned int Caca::get_display_height()
     68unsigned int Caca::getHeight()
    7369{
    7470    return caca_get_display_height(dp);
    7571}
    7672
    77 int Caca::set_display_title(char const *s)
     73int Caca::setTitle(char const *s)
    7874{
    7975    return caca_set_display_title(dp, s);
    8076}
    8177
    82 int Caca::get_event(unsigned int g, Event *n, int aa)
     78int Caca::getEvent(unsigned int g, Event *n, int aa)
    8379{
    8480    return caca_get_event(dp, g, &n->e, aa);
    8581}
    8682
    87 unsigned int Caca::get_mouse_x()
     83unsigned int Caca::getMouseX()
    8884{
    8985    return caca_get_mouse_x(dp);
    9086}
    9187
    92 unsigned int Caca::get_mouse_y()
     88unsigned int Caca::getMouseY()
    9389{
    9490    return caca_get_mouse_x(dp);
    9591}
    9692
    97 void Caca::set_mouse(int v)
     93void Caca::setMouse(int v)
    9894{
    9995     caca_set_mouse(dp, v);
  • libcaca/trunk/cpp/caca++.h

    r838 r897  
    5757    ~Caca();
    5858
    59     void attach(Cucul *cv);
    60     void detach();
    61     void set_delay(unsigned int);
    62     void display();
    63     unsigned int get_rendertime();
    64     unsigned int get_display_width();
    65     unsigned int get_display_height();
    66     int set_display_title(char const *);
    67     int get_event(unsigned int, Event*, int);
    68     unsigned int get_mouse_x();
    69     unsigned int get_mouse_y();
    70     void set_mouse(int);
     59    void Attach(Cucul *cv);
     60    void Detach();
     61    void setDelay(unsigned int);
     62    void Display();
     63    unsigned int getRendertime();
     64    unsigned int getWidth();
     65    unsigned int getHeight();
     66    int setTitle(char const *);
     67    int getEvent(unsigned int, Event*, int);
     68    unsigned int getMouseX();
     69    unsigned int getMouseY();
     70    void setMouse(int);
    7171
    7272  private:
  • libcaca/trunk/cpp/cpptest.cpp

    r892 r897  
    6868    }
    6969
    70     kk->set_delay(20000);
     70    kk->setDelay(20000);
    7171
    72     while(!kk->get_event(ev.CACA_EVENT_KEY_PRESS, &ev, 0)) {
     72    while(!kk->getEvent(ev.CACA_EVENT_KEY_PRESS, &ev, 0)) {
    7373
    7474        /* Draw pig */
     
    8383
    8484        /* Blit */
    85         kk->display();
     85        kk->Display();
    8686
    8787        x+=ix;
  • libcaca/trunk/cpp/cucul++.cpp

    r892 r897  
    3737}
    3838
     39Cucul::Cucul(void const *data, unsigned int size, char const *format)
     40{
     41    cv = cucul_import_canvas(data, size, format);
     42    if(!cv) throw -1;
     43}
     44
    3945Cucul::~Cucul()
    4046{
     
    288294{
    289295    font = cucul_load_font(s, v);
     296    if(!font) throw -1;
    290297}
    291298
     
    318325{
    319326    buffer = cucul_export_canvas(cv->get_cucul_canvas_t(), buf);
     327    if(!buffer) throw -1;
    320328}
    321329
  • libcaca/trunk/cpp/cucul++.h

    r892 r897  
    9292    Cucul();
    9393    Cucul(int width, int height);
     94    Cucul(void const *, unsigned int, char const *);
    9495    ~Cucul();
    9596
Note: See TracChangeset for help on using the changeset viewer.