src/render/SDL_sysrender.h
author Sam Lantinga <slouken@libsdl.org>
Fri, 26 Aug 2016 12:18:08 -0700
changeset 10226 cb13d22b7f09
parent 10039 56c514efb1fa
child 10638 d11daa346140
permissions -rw-r--r--
Added SDL_PrivateJoystickAdded() and SDL_PrivateJoystickRemoved()
Updated the removal code to iterate over all joystick add messages instead of just the first one.
     1 /*
     2   Simple DirectMedia Layer
     3   Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
     4 
     5   This software is provided 'as-is', without any express or implied
     6   warranty.  In no event will the authors be held liable for any damages
     7   arising from the use of this software.
     8 
     9   Permission is granted to anyone to use this software for any purpose,
    10   including commercial applications, and to alter it and redistribute it
    11   freely, subject to the following restrictions:
    12 
    13   1. The origin of this software must not be misrepresented; you must not
    14      claim that you wrote the original software. If you use this software
    15      in a product, an acknowledgment in the product documentation would be
    16      appreciated but is not required.
    17   2. Altered source versions must be plainly marked as such, and must not be
    18      misrepresented as being the original software.
    19   3. This notice may not be removed or altered from any source distribution.
    20 */
    21 #include "../SDL_internal.h"
    22 
    23 #ifndef _SDL_sysrender_h
    24 #define _SDL_sysrender_h
    25 
    26 #include "SDL_render.h"
    27 #include "SDL_events.h"
    28 #include "SDL_yuv_sw_c.h"
    29 
    30 /* The SDL 2D rendering system */
    31 
    32 typedef struct SDL_RenderDriver SDL_RenderDriver;
    33 
    34 typedef struct
    35 {
    36     float x;
    37     float y;
    38 } SDL_FPoint;
    39 
    40 typedef struct
    41 {
    42     float x;
    43     float y;
    44     float w;
    45     float h;
    46 } SDL_FRect;
    47 
    48 /* Define the SDL texture structure */
    49 struct SDL_Texture
    50 {
    51     const void *magic;
    52     Uint32 format;              /**< The pixel format of the texture */
    53     int access;                 /**< SDL_TextureAccess */
    54     int w;                      /**< The width of the texture */
    55     int h;                      /**< The height of the texture */
    56     int modMode;                /**< The texture modulation mode */
    57     SDL_BlendMode blendMode;    /**< The texture blend mode */
    58     Uint8 r, g, b, a;           /**< Texture modulation values */
    59 
    60     SDL_Renderer *renderer;
    61 
    62     /* Support for formats not supported directly by the renderer */
    63     SDL_Texture *native;
    64     SDL_SW_YUVTexture *yuv;
    65     void *pixels;
    66     int pitch;
    67     SDL_Rect locked_rect;
    68 
    69     void *driverdata;           /**< Driver specific texture representation */
    70 
    71     SDL_Texture *prev;
    72     SDL_Texture *next;
    73 };
    74 
    75 /* Define the SDL renderer structure */
    76 struct SDL_Renderer
    77 {
    78     const void *magic;
    79 
    80     void (*WindowEvent) (SDL_Renderer * renderer, const SDL_WindowEvent *event);
    81     int (*GetOutputSize) (SDL_Renderer * renderer, int *w, int *h);
    82     int (*CreateTexture) (SDL_Renderer * renderer, SDL_Texture * texture);
    83     int (*SetTextureColorMod) (SDL_Renderer * renderer,
    84                                SDL_Texture * texture);
    85     int (*SetTextureAlphaMod) (SDL_Renderer * renderer,
    86                                SDL_Texture * texture);
    87     int (*SetTextureBlendMode) (SDL_Renderer * renderer,
    88                                 SDL_Texture * texture);
    89     int (*UpdateTexture) (SDL_Renderer * renderer, SDL_Texture * texture,
    90                           const SDL_Rect * rect, const void *pixels,
    91                           int pitch);
    92     int (*UpdateTextureYUV) (SDL_Renderer * renderer, SDL_Texture * texture,
    93                             const SDL_Rect * rect,
    94                             const Uint8 *Yplane, int Ypitch,
    95                             const Uint8 *Uplane, int Upitch,
    96                             const Uint8 *Vplane, int Vpitch);
    97     int (*LockTexture) (SDL_Renderer * renderer, SDL_Texture * texture,
    98                         const SDL_Rect * rect, void **pixels, int *pitch);
    99     void (*UnlockTexture) (SDL_Renderer * renderer, SDL_Texture * texture);
   100     int (*SetRenderTarget) (SDL_Renderer * renderer, SDL_Texture * texture);
   101     int (*UpdateViewport) (SDL_Renderer * renderer);
   102     int (*UpdateClipRect) (SDL_Renderer * renderer);
   103     int (*RenderClear) (SDL_Renderer * renderer);
   104     int (*RenderDrawPoints) (SDL_Renderer * renderer, const SDL_FPoint * points,
   105                              int count);
   106     int (*RenderDrawLines) (SDL_Renderer * renderer, const SDL_FPoint * points,
   107                             int count);
   108     int (*RenderFillRects) (SDL_Renderer * renderer, const SDL_FRect * rects,
   109                             int count);
   110     int (*RenderCopy) (SDL_Renderer * renderer, SDL_Texture * texture,
   111                        const SDL_Rect * srcrect, const SDL_FRect * dstrect);
   112     int (*RenderCopyEx) (SDL_Renderer * renderer, SDL_Texture * texture,
   113                        const SDL_Rect * srcquad, const SDL_FRect * dstrect,
   114                        const double angle, const SDL_FPoint *center, const SDL_RendererFlip flip);
   115     int (*RenderReadPixels) (SDL_Renderer * renderer, const SDL_Rect * rect,
   116                              Uint32 format, void * pixels, int pitch);
   117     void (*RenderPresent) (SDL_Renderer * renderer);
   118     void (*DestroyTexture) (SDL_Renderer * renderer, SDL_Texture * texture);
   119 
   120     void (*DestroyRenderer) (SDL_Renderer * renderer);
   121 
   122     int (*GL_BindTexture) (SDL_Renderer * renderer, SDL_Texture *texture, float *texw, float *texh);
   123     int (*GL_UnbindTexture) (SDL_Renderer * renderer, SDL_Texture *texture);
   124 
   125     /* The current renderer info */
   126     SDL_RendererInfo info;
   127 
   128     /* The window associated with the renderer */
   129     SDL_Window *window;
   130     SDL_bool hidden;
   131 
   132     /* The logical resolution for rendering */
   133     int logical_w;
   134     int logical_h;
   135     int logical_w_backup;
   136     int logical_h_backup;
   137 
   138     /* Whether or not to force the viewport to even integer intervals */
   139     SDL_bool integer_scale;
   140 
   141     /* The drawable area within the window */
   142     SDL_Rect viewport;
   143     SDL_Rect viewport_backup;
   144 
   145     /* The clip rectangle within the window */
   146     SDL_Rect clip_rect;
   147     SDL_Rect clip_rect_backup;
   148 
   149     /* Wether or not the clipping rectangle is used. */
   150     SDL_bool clipping_enabled;
   151     SDL_bool clipping_enabled_backup;
   152 
   153     /* The render output coordinate scale */
   154     SDL_FPoint scale;
   155     SDL_FPoint scale_backup;
   156 
   157     /* The list of textures */
   158     SDL_Texture *textures;
   159     SDL_Texture *target;
   160 
   161     Uint8 r, g, b, a;                   /**< Color for drawing operations values */
   162     SDL_BlendMode blendMode;            /**< The drawing blend mode */
   163 
   164     void *driverdata;
   165 };
   166 
   167 /* Define the SDL render driver structure */
   168 struct SDL_RenderDriver
   169 {
   170     SDL_Renderer *(*CreateRenderer) (SDL_Window * window, Uint32 flags);
   171 
   172     /* Info about the renderer capabilities */
   173     SDL_RendererInfo info;
   174 };
   175 
   176 #if !SDL_RENDER_DISABLED
   177 
   178 #if SDL_VIDEO_RENDER_D3D
   179 extern SDL_RenderDriver D3D_RenderDriver;
   180 #endif
   181 #if SDL_VIDEO_RENDER_D3D11
   182 extern SDL_RenderDriver D3D11_RenderDriver;
   183 #endif
   184 #if SDL_VIDEO_RENDER_OGL
   185 extern SDL_RenderDriver GL_RenderDriver;
   186 #endif
   187 #if SDL_VIDEO_RENDER_OGL_ES2
   188 extern SDL_RenderDriver GLES2_RenderDriver;
   189 #endif
   190 #if SDL_VIDEO_RENDER_OGL_ES
   191 extern SDL_RenderDriver GLES_RenderDriver;
   192 #endif
   193 #if SDL_VIDEO_RENDER_DIRECTFB
   194 extern SDL_RenderDriver DirectFB_RenderDriver;
   195 #endif
   196 #if SDL_VIDEO_RENDER_PSP
   197 extern SDL_RenderDriver PSP_RenderDriver;
   198 #endif
   199 extern SDL_RenderDriver SW_RenderDriver;
   200 
   201 #endif /* !SDL_RENDER_DISABLED */
   202 
   203 #endif /* _SDL_sysrender_h */
   204 
   205 /* vi: set ts=4 sw=4 expandtab: */