[ruby-opengl-devel] new callback added in glut_callbacks.i
minh thu
noteed at gmail.com
Wed Aug 30 08:10:42 EDT 2006
'llo 'verybody,
I've added a new function for callback in glut_callbacks.i (the one
which made me jump in this project :).
Index: ext/glut/glut_callbacks.i
===================================================================
--- ext/glut/glut_callbacks.i (revision 28)
+++ ext/glut/glut_callbacks.i (working copy)
@@ -111,6 +111,7 @@
WINDOW_CALLBACK_SETUP(EntryFunc);
WINDOW_CALLBACK_SETUP(VisibilityFunc);
+WINDOW_CALLBACK_SETUP(KeyboardUpFunc);
/*
WINDOW_CALLBACK_SETUP(SpecialFunc);
@@ -212,6 +213,17 @@
rb_funcall(func, callId, 1, INT2NUM(state));
}
+static void
+glut_KeyboardUpFuncCallback(key, x, y)
+unsigned char key;
+int x,y;
+{
+ VALUE func;
+ func = rb_ary_entry(KeyboardUpFunc, glutGetWindow());
+ if (!NIL_P(func))
+ rb_funcall(func, callId, 3, INT2FIX(key), INT2FIX(x), INT2FIX(y));
+}
+
%}
%init %{
@@ -224,6 +236,7 @@
WINDOW_CALLBACK_DEFINE(EntryFunc);
WINDOW_CALLBACK_DEFINE(VisibilityFunc);
+ WINDOW_CALLBACK_DEFINE(KeyboardUpFunc);
callId = rb_intern("call");
%}
@@ -237,3 +250,5 @@
%ignore glutPassiveMotionFunc;
%ignore glutEntryFunc;
%ignore glutVisibilityFunc;
+
+%ignore glutKeyboardUpFunc;
Is-it the correct way to go ? Or do you see another way in the future ?
A problem : I don't know in which version of glut this function is
made available; I think it's in 3.7.
A very simple new sample code get along : see in attachment. (btw :
maybe could you rename all_tests.rb in all_samples.rb)
Maybe do you have specific things you want me to tackle ?
If I can, I will do it happily.
See ya,
thu
More information about the ruby-opengl-devel
mailing list