MCPcopy Create free account
hub / github.com/BohemiaInteractive/CWR / saveScreenshot

Function saveScreenshot

apps/tools/Studio/main.cpp:126–137  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

124}
125
126static void saveScreenshot(SDL_Renderer* renderer, const char* path)
127{
128 SDL_Surface* surface = SDL_RenderReadPixels(renderer, nullptr);
129 if (!surface)
130 return;
131 SDL_Surface* rgb = SDL_ConvertSurface(surface, SDL_PIXELFORMAT_RGB24);
132 SDL_SaveBMP(rgb ? rgb : surface, path);
133 if (rgb)
134 SDL_DestroySurface(rgb);
135 SDL_DestroySurface(surface);
136 fprintf(stdout, "Screenshot saved: %s\n", path);
137}
138
139int main(int argc, char* argv[])
140{

Callers 1

mainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected