MCPcopy Create free account
hub / github.com/RavEngine/RavEngine / DrawPoints

Function DrawPoints

deps/SDL2/test/testdraw2.c:38–79  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

36int done;
37
38void
39DrawPoints(SDL_Renderer * renderer)
40{
41 int i;
42 int x, y;
43 SDL_Rect viewport;
44
45 /* Query the sizes */
46 SDL_RenderGetViewport(renderer, &viewport);
47
48 for (i = 0; i < num_objects * 4; ++i) {
49 /* Cycle the color and alpha, if desired */
50 if (cycle_color) {
51 current_color += cycle_direction;
52 if (current_color < 0) {
53 current_color = 0;
54 cycle_direction = -cycle_direction;
55 }
56 if (current_color > 255) {
57 current_color = 255;
58 cycle_direction = -cycle_direction;
59 }
60 }
61 if (cycle_alpha) {
62 current_alpha += cycle_direction;
63 if (current_alpha < 0) {
64 current_alpha = 0;
65 cycle_direction = -cycle_direction;
66 }
67 if (current_alpha > 255) {
68 current_alpha = 255;
69 cycle_direction = -cycle_direction;
70 }
71 }
72 SDL_SetRenderDrawColor(renderer, 255, (Uint8) current_color,
73 (Uint8) current_color, (Uint8) current_alpha);
74
75 x = rand() % viewport.w;
76 y = rand() % viewport.h;
77 SDL_RenderDrawPoint(renderer, x, y);
78 }
79}
80
81void
82DrawLines(SDL_Renderer * renderer)

Callers 1

loopFunction · 0.70

Calls 4

SDL_RenderGetViewportFunction · 0.85
SDL_SetRenderDrawColorFunction · 0.85
SDL_RenderDrawPointFunction · 0.85
randFunction · 0.50

Tested by

no test coverage detected