[ruby-opengl-devel] new callback added in glut_callbacks.i

John Gabriele jmg3000 at gmail.com
Thu Aug 31 02:31:23 EDT 2006


On 8/30/06, minh thu <noteed at gmail.com> wrote:
> '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;
>

Applied. Thanks.

> Is-it the correct way to go ? Or do you see another way in the future ?

Not sure yet. Still need to learn a bit more about the setup we have here.

---John


More information about the ruby-opengl-devel mailing list