test/testlines2.c
changeset 2892 e4bafaa29c65
parent 2887 f8c0c5ef6d54
child 2895 9328f53a0ca2
equal deleted inserted replaced
2891:3e7856518a34 2892:e4bafaa29c65
    61             }
    61             }
    62         }
    62         }
    63         SDL_SetRenderDrawColor(255, (Uint8) current_color,
    63         SDL_SetRenderDrawColor(255, (Uint8) current_color,
    64                                (Uint8) current_color, (Uint8) current_alpha);
    64                                (Uint8) current_color, (Uint8) current_alpha);
    65 
    65 
    66         x1 = rand() % window_w;
    66         if (i == 0) {
    67         x2 = rand() % window_w;
    67             SDL_RenderLine(0, 0, window_w, window_h);
    68         y1 = rand() % window_h;
    68             SDL_RenderLine(0, window_h, window_w, 0);
    69         y2 = rand() % window_h;
    69             SDL_RenderLine(0, window_h/2, window_w, window_h/2);
    70         SDL_RenderLine(x1, y1, x2, y2);
    70             SDL_RenderLine(window_w/2, 0, window_w/2, window_h);
       
    71         } else {
       
    72             x1 = rand() % window_w;
       
    73             x2 = rand() % window_w;
       
    74             y1 = rand() % window_h;
       
    75             y2 = rand() % window_h;
       
    76             SDL_RenderLine(x1, y1, x2, y2);
       
    77         }
    71     }
    78     }
    72     SDL_SetRenderDrawBlendMode(SDL_BLENDMODE_NONE);
    79     SDL_SetRenderDrawBlendMode(SDL_BLENDMODE_NONE);
    73 
    80 
    74     /* Update the screen! */
    81     /* Update the screen! */
    75     SDL_RenderPresent();
    82     SDL_RenderPresent();