comparison src/render/SDL_sysrender.h @ 5157:fb424691cfc7

Moved the rendering code out to a separate directory in the hope that it can someday be completely decoupled from the rest of the library and be expanded to an awesome 2D on 3D library.
author Sam Lantinga <slouken@libsdl.org>
date Wed, 02 Feb 2011 14:34:54 -0800
parents
children 307ccc9c135e
comparison
equal deleted inserted replaced
5156:3e4086b3bcd2 5157:fb424691cfc7
1 /*
2 SDL - Simple DirectMedia Layer
3 Copyright (C) 1997-2010 Sam Lantinga
4
5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
9
10 This library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public
16 License along with this library; if not, write to the Free Software
17 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18
19 Sam Lantinga
20 slouken@libsdl.org
21 */
22 #include "SDL_config.h"
23
24 #ifndef _SDL_sysrender_h
25 #define _SDL_sysrender_h
26
27 #include "SDL_render.h"
28 #include "SDL_events.h"
29
30 /* The SDL 2D rendering system */
31
32 typedef struct SDL_RenderDriver SDL_RenderDriver;
33
34 /* Define the SDL texture structure */
35 struct SDL_Texture
36 {
37 const void *magic;
38 Uint32 format; /**< The pixel format of the texture */
39 int access; /**< SDL_TextureAccess */
40 int w; /**< The width of the texture */
41 int h; /**< The height of the texture */
42 int modMode; /**< The texture modulation mode */
43 SDL_BlendMode blendMode; /**< The texture blend mode */
44 Uint8 r, g, b, a; /**< Texture modulation values */
45
46 SDL_Renderer *renderer;
47
48 void *driverdata; /**< Driver specific texture representation */
49
50 SDL_Texture *prev;
51 SDL_Texture *next;
52 };
53
54 /* Define the SDL renderer structure */
55 struct SDL_Renderer
56 {
57 const void *magic;
58
59 void (*WindowEvent) (SDL_Renderer * renderer, const SDL_WindowEvent *event);
60 int (*CreateTexture) (SDL_Renderer * renderer, SDL_Texture * texture);
61 int (*QueryTexturePixels) (SDL_Renderer * renderer, SDL_Texture * texture,
62 void **pixels, int *pitch);
63 int (*SetTextureColorMod) (SDL_Renderer * renderer,
64 SDL_Texture * texture);
65 int (*SetTextureAlphaMod) (SDL_Renderer * renderer,
66 SDL_Texture * texture);
67 int (*SetTextureBlendMode) (SDL_Renderer * renderer,
68 SDL_Texture * texture);
69 int (*UpdateTexture) (SDL_Renderer * renderer, SDL_Texture * texture,
70 const SDL_Rect * rect, const void *pixels,
71 int pitch);
72 int (*LockTexture) (SDL_Renderer * renderer, SDL_Texture * texture,
73 const SDL_Rect * rect, int markDirty, void **pixels,
74 int *pitch);
75 void (*UnlockTexture) (SDL_Renderer * renderer, SDL_Texture * texture);
76 void (*DirtyTexture) (SDL_Renderer * renderer, SDL_Texture * texture,
77 int numrects, const SDL_Rect * rects);
78 int (*RenderClear) (SDL_Renderer * renderer);
79 int (*RenderDrawPoints) (SDL_Renderer * renderer, const SDL_Point * points,
80 int count);
81 int (*RenderDrawLines) (SDL_Renderer * renderer, const SDL_Point * points,
82 int count);
83 int (*RenderFillRects) (SDL_Renderer * renderer, const SDL_Rect ** rects,
84 int count);
85 int (*RenderCopy) (SDL_Renderer * renderer, SDL_Texture * texture,
86 const SDL_Rect * srcrect, const SDL_Rect * dstrect);
87 int (*RenderReadPixels) (SDL_Renderer * renderer, const SDL_Rect * rect,
88 Uint32 format, void * pixels, int pitch);
89 int (*RenderWritePixels) (SDL_Renderer * renderer, const SDL_Rect * rect,
90 Uint32 format, const void * pixels, int pitch);
91 void (*RenderPresent) (SDL_Renderer * renderer);
92 void (*DestroyTexture) (SDL_Renderer * renderer, SDL_Texture * texture);
93
94 void (*DestroyRenderer) (SDL_Renderer * renderer);
95
96 /* The current renderer info */
97 SDL_RendererInfo info;
98
99 /* The window associated with the renderer */
100 SDL_Window *window;
101
102 /* The list of textures */
103 SDL_Texture *textures;
104
105 Uint8 r, g, b, a; /**< Color for drawing operations values */
106 SDL_BlendMode blendMode; /**< The drawing blend mode */
107
108 void *driverdata;
109 };
110
111 /* Define the SDL render driver structure */
112 struct SDL_RenderDriver
113 {
114 SDL_Renderer *(*CreateRenderer) (SDL_Window * window, Uint32 flags);
115
116 /* Info about the renderer capabilities */
117 SDL_RendererInfo info;
118 };
119
120 #if SDL_VIDEO_RENDER_D3D
121 extern SDL_RenderDriver D3D_RenderDriver;
122 #endif
123 #if SDL_VIDEO_RENDER_OGL
124 extern SDL_RenderDriver GL_RenderDriver;
125 #endif
126 #if SDL_VIDEO_RENDER_OGL_ES
127 extern SDL_RenderDriver GL_ES_RenderDriver;
128 #endif
129 extern SDL_RenderDriver SW_RenderDriver;
130
131 #endif /* _SDL_sysrender_h */
132
133 /* vi: set ts=4 sw=4 expandtab: */