SDL_function决定了SDL_surface的width/height?

SDL_function that determine the width/height of an SDL_surface?

我想制作一个包含 SDL_Surface 、 SDL_Rect 、表面的宽度和高度的结构,

这是原型:

typedef struct wall wall;

struct wall {
    SDL_Surface *wall;
    SDL_Rect  wallpos;
    int x;             
    int y;
};

问题是我不想手动生成 wall.x & wall.y。

是否有任何 SDL_function 可以根据加载的图像尺寸确定 SDL_surface 的 width/height?

您不需要此功能。表面的宽度和高度可以直接从结构成员 wh 中读取(例如,给定 SDL_Surface *s,您可以读取 s->ws->h ).