Mercurial > sdl-ios-xcode
comparison test/testdraw2.c @ 3536:0267b8b1595c
Added interfaces for batch drawing of points, lines and rects:
SDL_DrawPoints()
SDL_BlendPoints()
SDL_BlendLines()
SDL_DrawLines()
SDL_FillRects()
SDL_BlendRects()
SDL_RenderPoints()
SDL_RenderLines()
SDL_RenderRects()
Renamed SDL_RenderFill() to SDL_RenderRect()
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Wed, 09 Dec 2009 15:56:56 +0000 |
parents | 438ba87e9578 |
children | 65848493e08e |
comparison
equal
deleted
inserted
replaced
3535:b403f790df65 | 3536:0267b8b1595c |
---|---|
157 | 157 |
158 rect.w = rand() % (window_h / 2); | 158 rect.w = rand() % (window_h / 2); |
159 rect.h = rand() % (window_h / 2); | 159 rect.h = rand() % (window_h / 2); |
160 rect.x = (rand() % window_w) - (rect.w / 2); | 160 rect.x = (rand() % window_w) - (rect.w / 2); |
161 rect.y = (rand() % window_w) - (rect.h / 2); | 161 rect.y = (rand() % window_w) - (rect.h / 2); |
162 SDL_RenderFill(&rect); | 162 SDL_RenderRect(&rect); |
163 } | 163 } |
164 SDL_SetRenderDrawBlendMode(SDL_BLENDMODE_NONE); | 164 SDL_SetRenderDrawBlendMode(SDL_BLENDMODE_NONE); |
165 } | 165 } |
166 | 166 |
167 int | 167 int |
229 | 229 |
230 /* Create the windows and initialize the renderers */ | 230 /* Create the windows and initialize the renderers */ |
231 for (i = 0; i < state->num_windows; ++i) { | 231 for (i = 0; i < state->num_windows; ++i) { |
232 SDL_SelectRenderer(state->windows[i]); | 232 SDL_SelectRenderer(state->windows[i]); |
233 SDL_SetRenderDrawColor(0xA0, 0xA0, 0xA0, 0xFF); | 233 SDL_SetRenderDrawColor(0xA0, 0xA0, 0xA0, 0xFF); |
234 SDL_RenderFill(NULL); | 234 SDL_RenderRect(NULL); |
235 } | 235 } |
236 | 236 |
237 srand(time(NULL)); | 237 srand(time(NULL)); |
238 | 238 |
239 /* Main render loop */ | 239 /* Main render loop */ |
249 case SDL_WINDOWEVENT: | 249 case SDL_WINDOWEVENT: |
250 switch (event.window.event) { | 250 switch (event.window.event) { |
251 case SDL_WINDOWEVENT_EXPOSED: | 251 case SDL_WINDOWEVENT_EXPOSED: |
252 SDL_SelectRenderer(event.window.windowID); | 252 SDL_SelectRenderer(event.window.windowID); |
253 SDL_SetRenderDrawColor(0xA0, 0xA0, 0xA0, 0xFF); | 253 SDL_SetRenderDrawColor(0xA0, 0xA0, 0xA0, 0xFF); |
254 SDL_RenderFill(NULL); | 254 SDL_RenderRect(NULL); |
255 break; | 255 break; |
256 } | 256 } |
257 break; | 257 break; |
258 default: | 258 default: |
259 break; | 259 break; |
260 } | 260 } |
261 } | 261 } |
262 for (i = 0; i < state->num_windows; ++i) { | 262 for (i = 0; i < state->num_windows; ++i) { |
263 SDL_SelectRenderer(state->windows[i]); | 263 SDL_SelectRenderer(state->windows[i]); |
264 SDL_SetRenderDrawColor(0xA0, 0xA0, 0xA0, 0xFF); | 264 SDL_SetRenderDrawColor(0xA0, 0xA0, 0xA0, 0xFF); |
265 SDL_RenderFill(NULL); | 265 SDL_RenderRect(NULL); |
266 | 266 |
267 DrawRects(state->windows[i]); | 267 DrawRects(state->windows[i]); |
268 DrawLines(state->windows[i]); | 268 DrawLines(state->windows[i]); |
269 DrawPoints(state->windows[i]); | 269 DrawPoints(state->windows[i]); |
270 | 270 |