ruby-sdl2 icon indicating copy to clipboard operation
ruby-sdl2 copied to clipboard

How to take a screenshot of the screen?

Open akicho8 opened this issue 2 years ago • 1 comments

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.

akicho8 avatar Aug 26 '23 05:08 akicho8

Hello,

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

ohai avatar Sep 15 '23 04:09 ohai