1.1 --- a/include/SDL_render.h Tue Feb 01 19:15:42 2011 -0800
1.2 +++ b/include/SDL_render.h Tue Feb 01 19:19:43 2011 -0800
1.3 @@ -86,6 +86,12 @@
1.4 } SDL_TextureModulate;
1.5
1.6 /**
1.7 + * \brief A structure representing rendering state
1.8 + */
1.9 +struct SDL_Renderer;
1.10 +typedef struct SDL_Renderer SDL_Renderer;
1.11 +
1.12 +/**
1.13 * \brief An efficient driver-specific representation of pixel data
1.14 */
1.15 struct SDL_Texture;
1.16 @@ -123,37 +129,29 @@
1.17 SDL_RendererInfo * info);
1.18
1.19 /**
1.20 - * \brief Create and make active a 2D rendering context for a window.
1.21 + * \brief Create a 2D rendering context for a window.
1.22 *
1.23 * \param window The window where rendering is displayed.
1.24 * \param index The index of the rendering driver to initialize, or -1 to
1.25 * initialize the first one supporting the requested flags.
1.26 * \param flags ::SDL_RendererFlags.
1.27 *
1.28 - * \return 0 on success, -1 if there was an error creating the renderer.
1.29 + * \return A valid rendering context or NULL if there was an error.
1.30 *
1.31 - * \sa SDL_SelectRenderer()
1.32 * \sa SDL_GetRendererInfo()
1.33 * \sa SDL_DestroyRenderer()
1.34 */
1.35 -extern DECLSPEC int SDLCALL SDL_CreateRenderer(SDL_Window * window,
1.36 +extern DECLSPEC SDL_Renderer * SDLCALL SDL_CreateRenderer(SDL_Window * window,
1.37 int index, Uint32 flags);
1.38
1.39 /**
1.40 - * \brief Select the rendering context for a particular window.
1.41 - *
1.42 - * \return 0 on success, -1 if the selected window doesn't have a
1.43 - * rendering context.
1.44 + * \brief Get information about a rendering context.
1.45 */
1.46 -extern DECLSPEC int SDLCALL SDL_SelectRenderer(SDL_Window * window);
1.47 +extern DECLSPEC int SDLCALL SDL_GetRendererInfo(SDL_Renderer * renderer,
1.48 + SDL_RendererInfo * info);
1.49
1.50 /**
1.51 - * \brief Get information about the current rendering context.
1.52 - */
1.53 -extern DECLSPEC int SDLCALL SDL_GetRendererInfo(SDL_RendererInfo * info);
1.54 -
1.55 -/**
1.56 - * \brief Create a texture for the current rendering context.
1.57 + * \brief Create a texture for a rendering context.
1.58 *
1.59 * \param format The format of the texture.
1.60 * \param access One of the enumerated values in ::SDL_TextureAccess.
1.61 @@ -167,7 +165,7 @@
1.62 * \sa SDL_QueryTexture()
1.63 * \sa SDL_DestroyTexture()
1.64 */
1.65 -extern DECLSPEC SDL_Texture * SDLCALL SDL_CreateTexture(Uint32 format,
1.66 +extern DECLSPEC SDL_Texture * SDLCALL SDL_CreateTexture(SDL_Renderer * renderer, Uint32 format,
1.67 int access, int w,
1.68 int h);
1.69
1.70 @@ -186,10 +184,7 @@
1.71 * \sa SDL_QueryTexture()
1.72 * \sa SDL_DestroyTexture()
1.73 */
1.74 -extern DECLSPEC SDL_Texture * SDLCALL SDL_CreateTextureFromSurface(Uint32
1.75 - format,
1.76 - SDL_Surface
1.77 - * surface);
1.78 +extern DECLSPEC SDL_Texture * SDLCALL SDL_CreateTextureFromSurface(SDL_Renderer * renderer, Uint32 format, SDL_Surface * surface);
1.79
1.80 /**
1.81 * \brief Query the attributes of a texture
1.82 @@ -419,9 +414,10 @@
1.83 * \param a The alpha value used to draw on the rendering target, usually
1.84 * ::SDL_ALPHA_OPAQUE (255).
1.85 *
1.86 - * \return 0 on success, or -1 if there is no rendering context current.
1.87 + * \return 0 on success, or -1 on error
1.88 */
1.89 -extern DECLSPEC int SDL_SetRenderDrawColor(Uint8 r, Uint8 g, Uint8 b,
1.90 +extern DECLSPEC int SDL_SetRenderDrawColor(SDL_Renderer * renderer,
1.91 + Uint8 r, Uint8 g, Uint8 b,
1.92 Uint8 a);
1.93
1.94 /**
1.95 @@ -433,9 +429,10 @@
1.96 * \param a A pointer to the alpha value used to draw on the rendering target,
1.97 * usually ::SDL_ALPHA_OPAQUE (255).
1.98 *
1.99 - * \return 0 on success, or -1 if there is no rendering context current.
1.100 + * \return 0 on success, or -1 on error
1.101 */
1.102 -extern DECLSPEC int SDL_GetRenderDrawColor(Uint8 * r, Uint8 * g, Uint8 * b,
1.103 +extern DECLSPEC int SDL_GetRenderDrawColor(SDL_Renderer * renderer,
1.104 + Uint8 * r, Uint8 * g, Uint8 * b,
1.105 Uint8 * a);
1.106
1.107 /**
1.108 @@ -443,30 +440,32 @@
1.109 *
1.110 * \param blendMode ::SDL_BlendMode to use for blending.
1.111 *
1.112 - * \return 0 on success, or -1 if there is no rendering context current.
1.113 + * \return 0 on success, or -1 on error
1.114 *
1.115 * \note If the blend mode is not supported, the closest supported mode is
1.116 * chosen.
1.117 *
1.118 * \sa SDL_GetRenderDrawBlendMode()
1.119 */
1.120 -extern DECLSPEC int SDLCALL SDL_SetRenderDrawBlendMode(SDL_BlendMode blendMode);
1.121 +extern DECLSPEC int SDLCALL SDL_SetRenderDrawBlendMode(SDL_Renderer * renderer,
1.122 + SDL_BlendMode blendMode);
1.123
1.124 /**
1.125 * \brief Get the blend mode used for drawing operations.
1.126 *
1.127 * \param blendMode A pointer filled in with the current blend mode.
1.128 *
1.129 - * \return 0 on success, or -1 if there is no rendering context current.
1.130 + * \return 0 on success, or -1 on error
1.131 *
1.132 * \sa SDL_SetRenderDrawBlendMode()
1.133 */
1.134 -extern DECLSPEC int SDLCALL SDL_GetRenderDrawBlendMode(SDL_BlendMode *blendMode);
1.135 +extern DECLSPEC int SDLCALL SDL_GetRenderDrawBlendMode(SDL_Renderer * renderer,
1.136 + SDL_BlendMode *blendMode);
1.137
1.138 /**
1.139 * \brief Clear the current rendering target with the drawing color
1.140 */
1.141 -extern DECLSPEC int SDLCALL SDL_RenderClear(void);
1.142 +extern DECLSPEC int SDLCALL SDL_RenderClear(SDL_Renderer * renderer);
1.143
1.144 /**
1.145 * \brief Draw a point on the current rendering target.
1.146 @@ -474,9 +473,10 @@
1.147 * \param x The x coordinate of the point.
1.148 * \param y The y coordinate of the point.
1.149 *
1.150 - * \return 0 on success, or -1 if there is no rendering context current.
1.151 + * \return 0 on success, or -1 on error
1.152 */
1.153 -extern DECLSPEC int SDLCALL SDL_RenderDrawPoint(int x, int y);
1.154 +extern DECLSPEC int SDLCALL SDL_RenderDrawPoint(SDL_Renderer * renderer,
1.155 + int x, int y);
1.156
1.157 /**
1.158 * \brief Draw multiple points on the current rendering target.
1.159 @@ -484,9 +484,10 @@
1.160 * \param points The points to draw
1.161 * \param count The number of points to draw
1.162 *
1.163 - * \return 0 on success, or -1 if there is no rendering context current.
1.164 + * \return 0 on success, or -1 on error
1.165 */
1.166 -extern DECLSPEC int SDLCALL SDL_RenderDrawPoints(const SDL_Point * points,
1.167 +extern DECLSPEC int SDLCALL SDL_RenderDrawPoints(SDL_Renderer * renderer,
1.168 + const SDL_Point * points,
1.169 int count);
1.170
1.171 /**
1.172 @@ -497,9 +498,10 @@
1.173 * \param x2 The x coordinate of the end point.
1.174 * \param y2 The y coordinate of the end point.
1.175 *
1.176 - * \return 0 on success, or -1 if there is no rendering context current.
1.177 + * \return 0 on success, or -1 on error
1.178 */
1.179 -extern DECLSPEC int SDLCALL SDL_RenderDrawLine(int x1, int y1, int x2, int y2);
1.180 +extern DECLSPEC int SDLCALL SDL_RenderDrawLine(SDL_Renderer * renderer,
1.181 + int x1, int y1, int x2, int y2);
1.182
1.183 /**
1.184 * \brief Draw a series of connected lines on the current rendering target.
1.185 @@ -507,9 +509,10 @@
1.186 * \param points The points along the lines
1.187 * \param count The number of points, drawing count-1 lines
1.188 *
1.189 - * \return 0 on success, or -1 if there is no rendering context current.
1.190 + * \return 0 on success, or -1 on error
1.191 */
1.192 -extern DECLSPEC int SDLCALL SDL_RenderDrawLines(const SDL_Point * points,
1.193 +extern DECLSPEC int SDLCALL SDL_RenderDrawLines(SDL_Renderer * renderer,
1.194 + const SDL_Point * points,
1.195 int count);
1.196
1.197 /**
1.198 @@ -517,9 +520,10 @@
1.199 *
1.200 * \param rect A pointer to the destination rectangle, or NULL to outline the entire rendering target.
1.201 *
1.202 - * \return 0 on success, or -1 if there is no rendering context current.
1.203 + * \return 0 on success, or -1 on error
1.204 */
1.205 -extern DECLSPEC int SDLCALL SDL_RenderDrawRect(const SDL_Rect * rect);
1.206 +extern DECLSPEC int SDLCALL SDL_RenderDrawRect(SDL_Renderer * renderer,
1.207 + const SDL_Rect * rect);
1.208
1.209 /**
1.210 * \brief Draw some number of rectangles on the current rendering target.
1.211 @@ -527,9 +531,11 @@
1.212 * \param rects A pointer to an array of destination rectangles.
1.213 * \param count The number of rectangles.
1.214 *
1.215 - * \return 0 on success, or -1 if there is no rendering context current.
1.216 + * \return 0 on success, or -1 on error
1.217 */
1.218 -extern DECLSPEC int SDLCALL SDL_RenderDrawRects(const SDL_Rect ** rects, int count);
1.219 +extern DECLSPEC int SDLCALL SDL_RenderDrawRects(SDL_Renderer * renderer,
1.220 + const SDL_Rect ** rects,
1.221 + int count);
1.222
1.223 /**
1.224 * \brief Fill a rectangle on the current rendering target with the drawing color.
1.225 @@ -537,9 +543,10 @@
1.226 * \param rect A pointer to the destination rectangle, or NULL for the entire
1.227 * rendering target.
1.228 *
1.229 - * \return 0 on success, or -1 if there is no rendering context current.
1.230 + * \return 0 on success, or -1 on error
1.231 */
1.232 -extern DECLSPEC int SDLCALL SDL_RenderFillRect(const SDL_Rect * rect);
1.233 +extern DECLSPEC int SDLCALL SDL_RenderFillRect(SDL_Renderer * renderer,
1.234 + const SDL_Rect * rect);
1.235
1.236 /**
1.237 * \brief Fill some number of rectangles on the current rendering target with the drawing color.
1.238 @@ -547,9 +554,11 @@
1.239 * \param rects A pointer to an array of destination rectangles.
1.240 * \param count The number of rectangles.
1.241 *
1.242 - * \return 0 on success, or -1 if there is no rendering context current.
1.243 + * \return 0 on success, or -1 on error
1.244 */
1.245 -extern DECLSPEC int SDLCALL SDL_RenderFillRects(const SDL_Rect ** rect, int count);
1.246 +extern DECLSPEC int SDLCALL SDL_RenderFillRects(SDL_Renderer * renderer,
1.247 + const SDL_Rect ** rect,
1.248 + int count);
1.249
1.250 /**
1.251 * \brief Copy a portion of the texture to the current rendering target.
1.252 @@ -560,10 +569,10 @@
1.253 * \param dstrect A pointer to the destination rectangle, or NULL for the
1.254 * entire rendering target.
1.255 *
1.256 - * \return 0 on success, or -1 if there is no rendering context current, or the
1.257 - * driver doesn't support the requested operation.
1.258 + * \return 0 on success, or -1 on error
1.259 */
1.260 -extern DECLSPEC int SDLCALL SDL_RenderCopy(SDL_Texture * texture,
1.261 +extern DECLSPEC int SDLCALL SDL_RenderCopy(SDL_Renderer * renderer,
1.262 + SDL_Texture * texture,
1.263 const SDL_Rect * srcrect,
1.264 const SDL_Rect * dstrect);
1.265
1.266 @@ -581,7 +590,8 @@
1.267 *
1.268 * \warning This is a very slow operation, and should not be used frequently.
1.269 */
1.270 -extern DECLSPEC int SDLCALL SDL_RenderReadPixels(const SDL_Rect * rect,
1.271 +extern DECLSPEC int SDLCALL SDL_RenderReadPixels(SDL_Renderer * renderer,
1.272 + const SDL_Rect * rect,
1.273 Uint32 format,
1.274 void *pixels, int pitch);
1.275
1.276 @@ -599,7 +609,8 @@
1.277 *
1.278 * \warning This is a very slow operation, and should not be used frequently.
1.279 */
1.280 -extern DECLSPEC int SDLCALL SDL_RenderWritePixels(const SDL_Rect * rect,
1.281 +extern DECLSPEC int SDLCALL SDL_RenderWritePixels(SDL_Renderer * renderer,
1.282 + const SDL_Rect * rect,
1.283 Uint32 format,
1.284 const void *pixels,
1.285 int pitch);
1.286 @@ -607,7 +618,7 @@
1.287 /**
1.288 * \brief Update the screen with rendering performed.
1.289 */
1.290 -extern DECLSPEC void SDLCALL SDL_RenderPresent(void);
1.291 +extern DECLSPEC void SDLCALL SDL_RenderPresent(SDL_Renderer * renderer);
1.292
1.293 /**
1.294 * \brief Destroy the specified texture.
1.295 @@ -623,7 +634,7 @@
1.296 *
1.297 * \sa SDL_CreateRenderer()
1.298 */
1.299 -extern DECLSPEC void SDLCALL SDL_DestroyRenderer(SDL_Window * window);
1.300 +extern DECLSPEC void SDLCALL SDL_DestroyRenderer(SDL_Renderer * renderer);
1.301
1.302
1.303 /* Ends C function definitions when using C++ */