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

Function DrawPoints

deps/SDL2/test/testintersections.c:40–81  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

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