Mercurial > sdl-ios-xcode
diff test/testdraw2.c @ 3596:f638ded38b8a
Added SDL_RenderClear() as a fast method of clearing the screen to the drawing color.
Renamed SDL_RenderPoint() and SDL_RenderLine() to SDL_RenderDrawPoint() and SDL_RenderDrawLine().
Added API for rectangle drawing (as opposed to filling)
Added placeholder API functions for circles and ellipses ... I'm not sure whether these will stay.
Optimized software line drawing quite a bit.
Added support for Wu's anti-aliased line drawing, currently disabled by default.
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Wed, 23 Dec 2009 01:55:00 +0000 |
parents | 65848493e08e |
children | 64ce267332c6 |
line wrap: on
line diff
--- a/test/testdraw2.c Fri Dec 18 08:19:18 2009 +0000 +++ b/test/testdraw2.c Wed Dec 23 01:55:00 2009 +0000 @@ -58,7 +58,7 @@ x = rand() % window_w; y = rand() % window_h; - SDL_RenderPoint(x, y); + SDL_RenderDrawPoint(x, y); } SDL_SetRenderDrawBlendMode(SDL_BLENDMODE_NONE); } @@ -102,16 +102,16 @@ (Uint8) current_color, (Uint8) current_alpha); if (i == 0) { - SDL_RenderLine(0, 0, window_w - 1, window_h - 1); - SDL_RenderLine(0, window_h - 1, window_w - 1, 0); - SDL_RenderLine(0, window_h / 2, window_w - 1, window_h / 2); - SDL_RenderLine(window_w / 2, 0, window_w / 2, window_h - 1); + SDL_RenderDrawLine(0, 0, window_w - 1, window_h - 1); + SDL_RenderDrawLine(0, window_h - 1, window_w - 1, 0); + SDL_RenderDrawLine(0, window_h / 2, window_w - 1, window_h / 2); + SDL_RenderDrawLine(window_w / 2, 0, window_w / 2, window_h - 1); } else { x1 = (rand() % (window_w*2)) - window_w; x2 = (rand() % (window_w*2)) - window_w; y1 = (rand() % (window_h*2)) - window_h; y2 = (rand() % (window_h*2)) - window_h; - SDL_RenderLine(x1, y1, x2, y2); + SDL_RenderDrawLine(x1, y1, x2, y2); } } SDL_SetRenderDrawBlendMode(SDL_BLENDMODE_NONE); @@ -159,7 +159,7 @@ rect.h = rand() % (window_h / 2); rect.x = (rand() % (window_w*2) - window_w) - (rect.w / 2); rect.y = (rand() % (window_h*2) - window_h) - (rect.h / 2); - SDL_RenderRect(&rect); + SDL_RenderFillRect(&rect); } SDL_SetRenderDrawBlendMode(SDL_BLENDMODE_NONE); } @@ -231,7 +231,7 @@ for (i = 0; i < state->num_windows; ++i) { SDL_SelectRenderer(state->windows[i]); SDL_SetRenderDrawColor(0xA0, 0xA0, 0xA0, 0xFF); - SDL_RenderRect(NULL); + SDL_RenderClear(); } srand(time(NULL)); @@ -251,7 +251,7 @@ case SDL_WINDOWEVENT_EXPOSED: SDL_SelectRenderer(event.window.windowID); SDL_SetRenderDrawColor(0xA0, 0xA0, 0xA0, 0xFF); - SDL_RenderRect(NULL); + SDL_RenderClear(); break; } break; @@ -262,7 +262,7 @@ for (i = 0; i < state->num_windows; ++i) { SDL_SelectRenderer(state->windows[i]); SDL_SetRenderDrawColor(0xA0, 0xA0, 0xA0, 0xFF); - SDL_RenderRect(NULL); + SDL_RenderClear(); DrawRects(state->windows[i]); DrawLines(state->windows[i]);