flyx / OpenGLAda

Thick Ada binding for OpenGL and GLFW
flyx.github.io/OpenGLAda/
MIT License
95 stars 13 forks source link

How do I get scroll data? #76

Closed rogermc2 closed 6 years ago

rogermc2 commented 7 years ago

I have been unable to figure out how to get scroll x, y data as a replacement for the C callback routine

void scroll_callback(GLFWwindow* window, double x, double y);

How to implement?

rogermc2 commented 7 years ago

Also, how to implement?

void cursor_position_callback(GLFWwindow* window, double x, double y)
{
    if (glfwGetInputMode(window, GLFW_CURSOR) == GLFW_CURSOR_DISABLED)
flyx commented 7 years ago

Just so you know I am aware of your issues… I am very sorry that I do not find the time to react to them. I hope this will get better soon.

rogermc2 commented 7 years ago

No problem. Whenever its convenient for you is fine.

flyx commented 7 years ago

This is implemented in the GLFW 3 API. You basically do:

type My_Window_Type is new Glfw.Windows.Window with null record;

overriding procedure Mouse_Scrolled (Object : not null access Window;
                                     X, Y   : Input.Mouse.Scroll_Offset);

And then somewhere in your code:

My_Window.Enable_Callback (Glfw.Windows.Callbacks.Mouse_Scroll);

After that, the implementation of your Mouse_Scrolled procedure will be called on mouse scrolling.

flyx commented 6 years ago

Closing this since functionality is already there.