官术网_书友最值得收藏!

Clearing the SDL renderer

After the initialization is complete, we will need to clear out the renderer. We can clear our renderer with any color we choose. To do this, we will make a call to the SDL_RenderDrawColor function:

SDL_SetRenderDrawColor( renderer, 0, 0, 0, 255 );
SDL_RenderClear( renderer );

That sets the drawing color for the renderer to black with full opacity. 0, 0, 0 are the RGB color values, and 255 is the alpha opacity. These numbers all range from 0 to 255, where 255 is the full color on the color spectrum. We set this up so that when we call the SDL_RenderClear function in the next line, it will clear the renderer with the color black. If we wanted the color to clear red instead of black, we would have to modify the call in the following way:

SDL_SetRenderDrawColor( renderer, 255, 0, 0, 255 );

That is not what we want, so we will not make that change. I just wanted to point out that we could clear the renderer with any color we like.

主站蜘蛛池模板: 新竹市| 金寨县| 兴城市| 公安县| 梅州市| 芜湖县| 玛曲县| 龙山县| 南投县| 民勤县| 渝北区| 商城县| 和林格尔县| 宝清县| 五家渠市| 嘉黎县| 乌拉特后旗| 斗六市| 沛县| 云龙县| 高密市| 郑州市| 巴青县| 丽江市| 阿拉善右旗| 柳江县| 措勤县| 平陆县| 鄂尔多斯市| 禹州市| 南澳县| 湖南省| 黔南| 休宁县| 岐山县| 绵竹市| 林西县| 昭平县| 宁晋县| 沛县| 宁武县|