Where can I find the definition of 'SDL_Window'

独自空忆成欢 提交于 2019-12-05 06:41:52

问题


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;

Where can I find the definition of SDL_Window in order to read about it ?


回答1:


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.

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;
};

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.

You should use SDL2 video API instead.



来源:https://stackoverflow.com/questions/32246738/where-can-i-find-the-definition-of-sdl-window

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