SDL2:将图像另存为 png 错误 [英] SDL2: saving image as png error

查看:61
本文介绍了SDL2:将图像另存为 png 错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试制作一个二维地图编辑器.现在,如果我的地图完成了,我想保存它.

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

我试过了:

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

但没有任何反应.没有图像被保存,也没有错误.

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

这是我的窗口的创建:

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

以下是我的内容:

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

推荐答案

该死,我只是在文件路径上失败了.我忘了最后一个词:(filename.png).

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

但现在我的图像是全黑的:S.

But now my image is total black :S.

这篇关于SDL2:将图像另存为 png 错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆