Mercurial > sdl-ios-xcode
comparison test/testnative.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 | 4cf533f434d8 |
children | f638ded38b8a |
comparison
equal
deleted
inserted
replaced
3535:b403f790df65 | 3536:0267b8b1595c |
---|---|
81 SDL_QueryTexture(sprite, NULL, NULL, &sprite_w, &sprite_h); | 81 SDL_QueryTexture(sprite, NULL, NULL, &sprite_w, &sprite_h); |
82 | 82 |
83 /* Move the sprite, bounce at the wall, and draw */ | 83 /* Move the sprite, bounce at the wall, and draw */ |
84 n = 0; | 84 n = 0; |
85 SDL_SetRenderDrawColor(0xA0, 0xA0, 0xA0, 0xFF); | 85 SDL_SetRenderDrawColor(0xA0, 0xA0, 0xA0, 0xFF); |
86 SDL_RenderFill(NULL); | 86 SDL_RenderRect(NULL); |
87 for (i = 0; i < NUM_SPRITES; ++i) { | 87 for (i = 0; i < NUM_SPRITES; ++i) { |
88 position = &positions[i]; | 88 position = &positions[i]; |
89 velocity = &velocities[i]; | 89 velocity = &velocities[i]; |
90 position->x += velocity->x; | 90 position->x += velocity->x; |
91 if ((position->x < 0) || (position->x >= (window_w - sprite_w))) { | 91 if ((position->x < 0) || (position->x >= (window_w - sprite_w))) { |
156 } | 156 } |
157 | 157 |
158 /* Clear the window, load the sprite and go! */ | 158 /* Clear the window, load the sprite and go! */ |
159 SDL_SelectRenderer(window); | 159 SDL_SelectRenderer(window); |
160 SDL_SetRenderDrawColor(0xA0, 0xA0, 0xA0, 0xFF); | 160 SDL_SetRenderDrawColor(0xA0, 0xA0, 0xA0, 0xFF); |
161 SDL_RenderFill(NULL); | 161 SDL_RenderRect(NULL); |
162 | 162 |
163 sprite = LoadSprite(window, "icon.bmp"); | 163 sprite = LoadSprite(window, "icon.bmp"); |
164 if (!sprite) { | 164 if (!sprite) { |
165 quit(6); | 165 quit(6); |
166 } | 166 } |
197 case SDL_WINDOWEVENT: | 197 case SDL_WINDOWEVENT: |
198 switch (event.window.event) { | 198 switch (event.window.event) { |
199 case SDL_WINDOWEVENT_EXPOSED: | 199 case SDL_WINDOWEVENT_EXPOSED: |
200 SDL_SelectRenderer(event.window.windowID); | 200 SDL_SelectRenderer(event.window.windowID); |
201 SDL_SetRenderDrawColor(0xA0, 0xA0, 0xA0, 0xFF); | 201 SDL_SetRenderDrawColor(0xA0, 0xA0, 0xA0, 0xFF); |
202 SDL_RenderFill(NULL); | 202 SDL_RenderRect(NULL); |
203 break; | 203 break; |
204 } | 204 } |
205 break; | 205 break; |
206 case SDL_QUIT: | 206 case SDL_QUIT: |
207 done = 1; | 207 done = 1; |