ohai / ruby-sdl2

A Ruby wrapper for SDL 2.x
GNU Lesser General Public License v3.0
72 stars 16 forks source link

SDL_GetError? #19

Closed hukaidong closed 4 years ago

hukaidong commented 4 years ago

Is there any reason we are not including this function in this binding? I'm trying to build a SDL project, but seems window.destroy not working well. How should we destroy a window without terminate the program?

ohai commented 4 years ago

That is because the SDL2 document says that "The message is only applicable when an SDL function has signaled an error". Ruby/SDL2 users do not need to call SDL_GetError directly. Instead, Ruby/SDL2 detects all errors from a return value of an SDL function and raises an exception.

In fact, Window.destroy did not work because Ruby/SDL2 forgot calling SDL_DestroyWindow. The problem was fixed in 7f1404e2aa96895f4853020b68fa978d69a2579c. The new version 0.3.5 is released now to fix some problems including this one.

hukaidong commented 4 years ago

nice to hear that