ohai / ruby-sdl2

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

How to take a screenshot of the screen? #28

Open akicho8 opened 1 year ago

akicho8 commented 1 year ago

Thank you for creating a convenient library. I am looking for a way to take a screenshot while displaying a screen in Ruby/SDL2, but I don't know how to create the surface to pass to save_bmp.

This article uses SDL_RenderReadPixels to transfer from renderer to surface. https://gigi.nullneuron.net/gigilabs/saving-screenshots-in-sdl2/

However, I cannot find a place where SDL_RenderReadPixels is being executed in the C code of Ruby/SDL2. Any advice would be appreciated.

ohai commented 1 year ago

Hello,

As you say, SDL_RenderReadPixels is not supported now in Ruby/SDL2. I will try this when I have time.