SDL2: saving image as png error

二次信任 提交于 2019-12-13 20:28:10

问题


I am trying to make a 2d-map editor. Now if my map is finish I want to save it.

I tried this:

IMG_SavePNG(SDL_GetWindowSurface(window), "C:/Users/<MY_NAME>/Desktop");

but nothing happens. No image get saved and also no error.

Here is the creation of my window:

SDL_Window* window = SDL_CreateWindow("Famonex", 100, 100, WINDOW_WIDTH, WINDOW_HEIGHT,    SDL_WINDOW_SHOWN | SDL_WINDOW_RESIZABLE);

Here are my includes:

#include <SDL.h>
#include <SDL_image.h>
#include <SDL_mixer.h>

回答1:


Damn I just failed at the filepath. I forgot the last word: (filename.png).

But now my image is total black :S.



来源:https://stackoverflow.com/questions/23587461/sdl2-saving-image-as-png-error

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!