我在哪里可以找到“SDL_Window"的定义 [英] Where can I find the definition of 'SDL_Window'
问题描述
我刚刚开始在 Linux 中学习 SDL2.我正在阅读 LazyFoo 的第一个教程,我看到有该代码:
I've just started learning SDL2 in Linux. I am reading the very first tutorial from LazyFoo and I see have that code:
//The window we'll be rendering to
SDL_Window* window = NULL;
我在哪里可以找到 SDL_Window
的定义以便阅读它?
Where can I find the definition of SDL_Window
in order to read about it ?
推荐答案
这个结构不暴露给用户端;SDL_video.h
文件包含它的前向声明:
This structure isn't exposed to user side; SDL_video.h
file contains forward declaration of it:
typedef struct SDL_Window SDL_Window;
前向声明意味着您只能将其用作指针类型,因为实际数据布局对您是隐藏的.
Forward declaration means you can only use it as pointer type because actual data layout is hidden from you.
实际类型 struct SDL_Window
当前在 src/video/SDL_sysvideo.h
(在 SDL 源代码:,不在开发库:"中:
Actual type struct SDL_Window
is currently declared in src/video/SDL_sysvideo.h
(in SDL Source Code:, not in 'Development Libraries:') as:
struct SDL_Window
{
const void *magic;
Uint32 id;
char *title;
SDL_Surface *icon;
int x, y;
int w, h;
int min_w, min_h;
int max_w, max_h;
Uint32 flags;
Uint32 last_fullscreen_flags;
/* Stored position and size for windowed mode */
SDL_Rect windowed;
SDL_DisplayMode fullscreen_mode;
float brightness;
Uint16 *gamma;
Uint16 *saved_gamma; /* (just offset into gamma) */
SDL_Surface *surface;
SDL_bool surface_valid;
SDL_bool is_hiding;
SDL_bool is_destroying;
SDL_WindowShaper *shaper;
SDL_HitTest hit_test;
void *hit_test_data;
SDL_WindowUserData *data;
void *driverdata;
SDL_Window *prev;
SDL_Window *next;
};
但是,如果您不是在开发/调试 SDL,则此信息几乎没有用处,而且最重要的是,可能会在任何未来版本中更改.同样最有趣的部分 - 指向 SDL_WindowUserData
的指针 - 是特定于平台的,并且因不同的操作系统和 SDL 视频驱动程序而异.
However, if you're not developing/debugging SDL, this information is pretty much useless, and, most importantly, can change in any future release. Also most interesting part - pointer to SDL_WindowUserData
- is platform-specific and varies between different OSes and SDL videodrivers.
您应该改用 SDL2 视频 API.
You should use SDL2 video API instead.
这篇关于我在哪里可以找到“SDL_Window"的定义的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!