Mercurial > sdl-ios-xcode
comparison test/testdraw2.c @ 2902:83c3a4b0e421
Fixed crash in testdraw2, added more points
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Sun, 21 Dec 2008 17:55:02 +0000 |
parents | 133601e3b255 |
children | 438ba87e9578 |
comparison
equal
deleted
inserted
replaced
2901:133601e3b255 | 2902:83c3a4b0e421 |
---|---|
27 | 27 |
28 /* Query the sizes */ | 28 /* Query the sizes */ |
29 SDL_GetWindowSize(window, &window_w, &window_h); | 29 SDL_GetWindowSize(window, &window_w, &window_h); |
30 | 30 |
31 SDL_SetRenderDrawBlendMode(blendMode); | 31 SDL_SetRenderDrawBlendMode(blendMode); |
32 for (i = 0; i < num_objects; ++i) { | 32 for (i = 0; i < num_objects * 4; ++i) { |
33 /* Cycle the color and alpha, if desired */ | 33 /* Cycle the color and alpha, if desired */ |
34 if (cycle_color) { | 34 if (cycle_color) { |
35 current_color += cycle_direction; | 35 current_color += cycle_direction; |
36 if (current_color < 0) { | 36 if (current_color < 0) { |
37 current_color = 0; | 37 current_color = 0; |
100 } | 100 } |
101 SDL_SetRenderDrawColor(255, (Uint8) current_color, | 101 SDL_SetRenderDrawColor(255, (Uint8) current_color, |
102 (Uint8) current_color, (Uint8) current_alpha); | 102 (Uint8) current_color, (Uint8) current_alpha); |
103 | 103 |
104 if (i == 0) { | 104 if (i == 0) { |
105 SDL_RenderLine(0, 0, window_w, window_h); | 105 SDL_RenderLine(0, 0, window_w - 1, window_h - 1); |
106 SDL_RenderLine(0, window_h, window_w, 0); | 106 SDL_RenderLine(0, window_h - 1, window_w - 1, 0); |
107 SDL_RenderLine(0, window_h / 2, window_w, window_h / 2); | 107 SDL_RenderLine(0, window_h / 2, window_w - 1, window_h / 2); |
108 SDL_RenderLine(window_w / 2, 0, window_w / 2, window_h); | 108 SDL_RenderLine(window_w / 2, 0, window_w / 2, window_h - 1); |
109 } else { | 109 } else { |
110 x1 = rand() % window_w; | 110 x1 = rand() % window_w; |
111 x2 = rand() % window_w; | 111 x2 = rand() % window_w; |
112 y1 = rand() % window_h; | 112 y1 = rand() % window_h; |
113 y2 = rand() % window_h; | 113 y2 = rand() % window_h; |
126 | 126 |
127 /* Query the sizes */ | 127 /* Query the sizes */ |
128 SDL_GetWindowSize(window, &window_w, &window_h); | 128 SDL_GetWindowSize(window, &window_w, &window_h); |
129 | 129 |
130 SDL_SetRenderDrawBlendMode(blendMode); | 130 SDL_SetRenderDrawBlendMode(blendMode); |
131 for (i = 0; i < num_objects/4; ++i) { | 131 for (i = 0; i < num_objects / 4; ++i) { |
132 /* Cycle the color and alpha, if desired */ | 132 /* Cycle the color and alpha, if desired */ |
133 if (cycle_color) { | 133 if (cycle_color) { |
134 current_color += cycle_direction; | 134 current_color += cycle_direction; |
135 if (current_color < 0) { | 135 if (current_color < 0) { |
136 current_color = 0; | 136 current_color = 0; |