Changeset 2017


Ignore:
Timestamp:
11/18/07 14:37:24 (6 years ago)
Author:
pterjan
Message:
  • Add missing methods in Caca::Display and add empty Caca::Event
Location:
libcaca/trunk/ruby
Files:
2 added
2 edited

Legend:

Unmodified
Added
Removed
  • libcaca/trunk/ruby/Makefile.am

    r2015 r2017  
    1313 
    1414caca_la_CPPFLAGS = -I$(top_srcdir)/caca -I$(RUBY_ARCHDIR) 
    15 caca_la_SOURCES = caca.c caca-display.c 
     15caca_la_SOURCES = caca.c caca-display.c caca-event.c 
    1616caca_la_LDFLAGS = -module -avoid-version -shared -L$(RUBY_LIBDIR) -l$(RUBY_SO_NAME) 
    1717caca_la_LIBADD = ../caca/libcaca.la 
     
    2020             cucul-dither.h \ 
    2121             cucul-font.h \ 
     22             caca-display.h \ 
     23             caca-event.h \ 
    2224             common.h \ 
    2325             test.rb \ 
  • libcaca/trunk/ruby/caca-display.c

    r2015 r2017  
    1313#include <caca.h> 
    1414#include <errno.h> 
     15#include "caca-event.h" 
    1516#include "cucul-canvas.h" 
    1617#include "common.h" 
     
    9899} 
    99100 
     101static VALUE get_mouse_x(VALUE self) 
     102{ 
     103    return NUM2UINT(caca_get_mouse_x(_SELF)); 
     104} 
     105 
     106static VALUE get_mouse_y(VALUE self) 
     107{ 
     108    return NUM2UINT(caca_get_mouse_y(_SELF)); 
     109} 
     110 
     111static VALUE set_mouse(VALUE self, VALUE visible) 
     112{ 
     113    caca_set_display_time(_SELF, visible); 
     114    return visible; 
     115} 
     116 
     117static VALUE set_mouse2(VALUE self, VALUE visible) 
     118{ 
     119    set_mouse(self, visible); 
     120    return self; 
     121} 
     122 
     123static VALUE get_event(VALUE self, VALUE event_mask, VALUE timeout) 
     124{ 
     125    caca_event_t ev; 
     126    if(caca_get_event(_SELF, NUM2UINT(event_mask), &ev, NUM2INT(timeout)) == 0) 
     127    { 
     128        return Qnil; 
     129    } 
     130    //FIXME 
     131    return Qnil; 
     132} 
     133 
    100134void Init_caca_display(VALUE mCaca) 
    101135{ 
     
    112146    rb_define_method(cDisplay, "title=", set_title, 1); 
    113147    rb_define_method(cDisplay, "set_title", set_title2, 1); 
     148    rb_define_method(cDisplay, "mouse_x", get_mouse_x, 0); 
     149    rb_define_method(cDisplay, "mouse_y", get_mouse_y, 0); 
     150    rb_define_method(cDisplay, "mouse=", set_mouse, 1); 
     151    rb_define_method(cDisplay, "set_mouse", set_mouse2, 1); 
     152    rb_define_method(cDisplay, "get_event", get_event, 3); 
    114153} 
Note: See TracChangeset for help on using the changeset viewer.