ohai / ruby-sdl2

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

Where's SDL_RWops? #23

Closed ghost closed 4 years ago

ghost commented 4 years ago

I want to read a some pixel data from memory instead of from a file, but there doesn't seem to be an wrapper for SDL_RWops. Was there a technical limitation that cause this?

ohai commented 4 years ago

Hello. That is because SDL_RWops deeply depends on the C language. Careless usage of SDL_RWopds from Ruby will make SEGV easily.

If your data is "raw" pixel data, SDL2::Surface.from_string method is available.

If your data is PNG or something, it is impossible to use the data now. If you have a use-case of loading such data from Ruby's string, I will add SDL2::Surface.load_from_string method.

ghost commented 4 years ago

Okay, I get it. It's fine I can do without it.