src/video/SDL_sysvideo.h
branchSDL-1.3
changeset 1670 eef792d31de8
parent 1669 9857d21967bb
child 1671 89f7510fe17a
     1.1 --- a/src/video/SDL_sysvideo.h	Mon May 29 05:08:33 2006 +0000
     1.2 +++ b/src/video/SDL_sysvideo.h	Wed Jun 07 16:10:28 2006 +0000
     1.3 @@ -39,9 +39,71 @@
     1.4  
     1.5  /* The SDL video driver */
     1.6  
     1.7 +typedef struct SDL_Window SDL_Window;
     1.8 +typedef struct SDL_Texture SDL_Texture;
     1.9 +typedef struct SDL_Renderer SDL_Renderer;
    1.10 +typedef struct SDL_RenderDriver SDL_RenderDriver;
    1.11 +typedef struct SDL_VideoDisplay SDL_VideoDisplay;
    1.12 +typedef struct SDL_VideoDevice SDL_VideoDevice;
    1.13 +
    1.14 +/* Define the SDL texture structure */
    1.15 +struct SDL_Texture
    1.16 +{
    1.17 +    Uint32 id;
    1.18 +
    1.19 +    Uint32 format;      /**< The pixel format of the texture */
    1.20 +    int access;         /**< SDL_TextureAccess */
    1.21 +    int w;              /**< The width of the texture */
    1.22 +    int h;              /**< The height of the texture */
    1.23 +
    1.24 +    SDL_Renderer *renderer;
    1.25 +
    1.26 +    void *driverdata;   /**< Driver specific texture representation */
    1.27 +
    1.28 +    SDL_Texture *next;
    1.29 +};
    1.30 +
    1.31 +/* Define the SDL renderer structure */
    1.32 +struct SDL_Renderer
    1.33 +{
    1.34 +    int (*CreateTexture) (SDL_Texture * texture);
    1.35 +    int (*UpdateTexture) (SDL_Texture * texture, SDL_Rect * rect,
    1.36 +                          const void *pixels, int pitch);
    1.37 +    int (*LockTexture) (SDL_Texture * texture, SDL_Rect * rect, int markDirty,
    1.38 +                        void **pixels, int *pitch);
    1.39 +    void (*UnlockTexture) (SDL_Texture * texture);
    1.40 +    void (*DirtyTexture) (SDL_Texture * texture, int numrects,
    1.41 +                          SDL_Rect * rects);
    1.42 +    void (*SelectRenderTexture) (SDL_Texture * texture);
    1.43 +    void (*RenderFill) (SDL_Rect * rect, Uint32 color);
    1.44 +    int (*RenderCopy) (SDL_Texture * texture, SDL_Rect * srcrect,
    1.45 +                       SDL_Rect * dstrect, int blendMode, int scaleMode);
    1.46 +    int (*RenderReadPixels) (SDL_Rect * rect, void *pixels, int pitch);
    1.47 +    int (*RenderWritePixels) (SDL_Rect * rect, const void *pixels, int pitch);
    1.48 +    void (*RenderPresent) (void);
    1.49 +    void (*DestroyTexture) (SDL_Texture * texture);
    1.50 +
    1.51 +    void (*DestroyRenderer) (SDL_Renderer * renderer);
    1.52 +
    1.53 +    /* The current renderer info */
    1.54 +    SDL_RendererInfo info;
    1.55 +
    1.56 +    /* The window associated with the renderer */
    1.57 +    SDL_Window *window;
    1.58 +
    1.59 +    void *driverdata;
    1.60 +};
    1.61 +
    1.62 +/* Define the SDL render driver structure */
    1.63 +struct SDL_RenderDriver
    1.64 +{
    1.65 +    SDL_Renderer *(*CreateRenderer) (SDL_Window * window, Uint32 flags);
    1.66 +
    1.67 +    /* Info about the renderer capabilities */
    1.68 +    SDL_RendererInfo info;
    1.69 +};
    1.70 +
    1.71  /* Define the SDL window structure, corresponding to toplevel windows */
    1.72 -typedef struct SDL_Window SDL_Window;
    1.73 -
    1.74  struct SDL_Window
    1.75  {
    1.76      Uint32 id;
    1.77 @@ -51,10 +113,10 @@
    1.78      int w, h;
    1.79      Uint32 flags;
    1.80  
    1.81 -    SDL_Surface *surface;
    1.82 -    SDL_Surface *shadow;
    1.83      Uint16 *gamma;
    1.84  
    1.85 +    SDL_Renderer *renderer;
    1.86 +
    1.87      void *userdata;
    1.88      void *driverdata;
    1.89  };
    1.90 @@ -62,21 +124,26 @@
    1.91  /* Define the SDL display structure
    1.92     This corresponds to physical monitors attached to the system.
    1.93   */
    1.94 -typedef struct SDL_VideoDisplay
    1.95 +struct SDL_VideoDisplay
    1.96  {
    1.97      int num_display_modes;
    1.98      SDL_DisplayMode *display_modes;
    1.99      SDL_DisplayMode desktop_mode;
   1.100      SDL_DisplayMode current_mode;
   1.101  
   1.102 -    int max_windows;
   1.103 +    int num_render_drivers;
   1.104 +    SDL_RenderDriver *render_drivers;
   1.105 +
   1.106      int num_windows;
   1.107      SDL_Window *windows;
   1.108  
   1.109 +    SDL_Renderer *current_renderer;
   1.110 +
   1.111 +    /* The hash list of textures */
   1.112 +    SDL_Texture *textures[64];
   1.113 +
   1.114      void *driverdata;
   1.115 -} SDL_VideoDisplay;
   1.116 -
   1.117 -typedef struct SDL_VideoDevice SDL_VideoDevice;
   1.118 +};
   1.119  
   1.120  /* Define the SDL video driver structure */
   1.121  #define _THIS	SDL_VideoDevice *_this
   1.122 @@ -105,6 +172,13 @@
   1.123       */
   1.124      int (*SetDisplayMode) (_THIS, const SDL_DisplayMode * mode);
   1.125  
   1.126 +    /* Sets the color entries { firstcolor .. (firstcolor+ncolors-1) }
   1.127 +       of the physical palette to those in 'colors'.  The return value
   1.128 +       is 0 if all entries could be set properly or -1 otherwise.
   1.129 +     */
   1.130 +    int (*SetDisplayColors) (_THIS, int firstcolor, int ncolors,
   1.131 +                             SDL_Color * colors);
   1.132 +
   1.133      /* * * */
   1.134      /* Window functions
   1.135       */
   1.136 @@ -122,22 +196,6 @@
   1.137      void (*SetWindowGrab) (_THIS, SDL_Window * window);
   1.138      void (*DestroyWindow) (_THIS, SDL_Window * window);
   1.139  
   1.140 -    void (*CreateWindowSurface) (_THIS, SDL_Window * window, Uint32 flags);
   1.141 -    void (*UpdateWindowSurface) (_THIS, SDL_Window * window, int numrects,
   1.142 -                                 SDL_Rect * rects);
   1.143 -    void (*FlipWindowSurface) (_THIS, SDL_Window * window);
   1.144 -
   1.145 -    /* Sets the color entries { firstcolor .. (firstcolor+ncolors-1) }
   1.146 -       of the physical palette to those in 'colors'. If the device is
   1.147 -       using a software palette (SDL_HWPALETTE not set), then the
   1.148 -       changes are reflected in the logical palette of the screen
   1.149 -       as well.
   1.150 -       The return value is 1 if all entries could be set properly
   1.151 -       or 0 otherwise.
   1.152 -     */
   1.153 -    int (*SetWindowColors) (_THIS, SDL_Window * window,
   1.154 -                            int firstcolor, int ncolors, SDL_Color * colors);
   1.155 -
   1.156      /* Get some platform dependent window information */
   1.157        SDL_bool(*GetWindowWMInfo) (_THIS, SDL_Window * window,
   1.158                                    SDL_SysWMinfo * info);
   1.159 @@ -157,9 +215,6 @@
   1.160      /* * * */
   1.161      /* Hardware acceleration functions */
   1.162  
   1.163 -    /* Information about the video hardware */
   1.164 -    SDL_VideoInfo info;
   1.165 -
   1.166      /* The pixel format used when SDL_CreateRGBSurface creates SDL_HWSURFACEs with alpha */
   1.167      SDL_PixelFormat *displayformatalphapixel;
   1.168  
   1.169 @@ -242,23 +297,23 @@
   1.170      /* Free a window manager cursor
   1.171         This function can be NULL if CreateWMCursor is also NULL.
   1.172       */
   1.173 -    void (*FreeWMCursor) (_THIS, WMcursor * cursor);
   1.174 +    void (*FreeCursor) (_THIS, SDL_Cursor * cursor);
   1.175  
   1.176      /* If not NULL, create a black/white window manager cursor */
   1.177 -    WMcursor *(*CreateWMCursor) (_THIS,
   1.178 +    SDL_Cursor *(*CreateCursor) (_THIS,
   1.179                                   Uint8 * data, Uint8 * mask, int w, int h,
   1.180                                   int hot_x, int hot_y);
   1.181  
   1.182      /* Show the specified cursor, or hide if cursor is NULL */
   1.183 -    int (*ShowWMCursor) (_THIS, WMcursor * cursor);
   1.184 +    int (*ShowCursor) (_THIS, SDL_Cursor * cursor);
   1.185  
   1.186      /* Warp the window manager cursor to (x,y)
   1.187         If NULL, a mouse motion event is posted internally.
   1.188       */
   1.189 -    void (*WarpWMCursor) (_THIS, Uint16 x, Uint16 y);
   1.190 +    void (*WarpCursor) (_THIS, SDL_WindowID windowID, int x, int y);
   1.191  
   1.192      /* If not NULL, this is called when a mouse motion event occurs */
   1.193 -    void (*MoveWMCursor) (_THIS, int x, int y);
   1.194 +    void (*MoveCursor) (_THIS, int x, int y);
   1.195  
   1.196      /* Determine whether the mouse should be in relative mode or not.
   1.197         This function is called when the input grab state or cursor
   1.198 @@ -283,7 +338,7 @@
   1.199      int num_displays;
   1.200      SDL_VideoDisplay *displays;
   1.201      int current_display;
   1.202 -    Uint32 next_window_id;
   1.203 +    Uint32 next_object_id;
   1.204  
   1.205      /* Driver information flags */
   1.206  
   1.207 @@ -428,15 +483,14 @@
   1.208  
   1.209  #define SDL_CurrentDisplay	(_this->displays[_this->current_display])
   1.210  #define SDL_CurrentWindow	(SDL_CurrentDisplay.windows[0])
   1.211 -#define SDL_VideoSurface	((_this && SDL_CurrentDisplay.num_windows > 0) ? SDL_CurrentWindow.surface : NULL)
   1.212 -#define SDL_ShadowSurface	((_this && SDL_CurrentDisplay.num_windows > 0) ? SDL_CurrentWindow.shadow : NULL)
   1.213 -#define SDL_PublicSurface	(SDL_ShadowSurface ? SDL_ShadowSurface : SDL_VideoSurface)
   1.214  
   1.215  extern SDL_VideoDevice *SDL_GetVideoDevice();
   1.216  extern void SDL_AddBasicVideoDisplay(const SDL_DisplayMode * desktop_mode);
   1.217  extern void SDL_AddVideoDisplay(const SDL_VideoDisplay * display);
   1.218 -extern void SDL_AddDisplayMode(int display, const SDL_DisplayMode * mode);
   1.219 -extern SDL_Window *SDL_GetWindowFromSurface(SDL_Surface * surface);
   1.220 +extern void SDL_AddDisplayMode(int displayIndex,
   1.221 +                               const SDL_DisplayMode * mode);
   1.222 +extern void SDL_AddRenderDriver(int displayIndex,
   1.223 +                                const SDL_RenderDriver * driver);
   1.224  
   1.225  #endif /* _SDL_sysvideo_h */
   1.226