27 lines
587 B
C
27 lines
587 B
C
|
SDL_Rect box = { 10, 10, 50, 10 };
|
||
|
|
||
|
while (!quit) {
|
||
|
if (SDL_PollEvent(&event)) {
|
||
|
switch (event.type) {
|
||
|
case SDL_QUIT:
|
||
|
quit = true;
|
||
|
break;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
// clear render
|
||
|
SDL_SetRenderDrawColor(renderer, 0, 0, 0, 0);
|
||
|
SDL_RenderClear(renderer);
|
||
|
|
||
|
box.w += 1;
|
||
|
|
||
|
SDL_SetRenderDrawColor(renderer, 255, 255, 255, 0);
|
||
|
SDL_RenderFillRect(renderer, &box);
|
||
|
SDL_SetRenderDrawColor(renderer, 255, 0, 0, 0);
|
||
|
SDL_RenderDrawRect(renderer, &box);
|
||
|
|
||
|
// render
|
||
|
SDL_RenderPresent(renderer);
|
||
|
SDL_Delay(10);
|
||
|
}
|