SDL_RenderSetViewport

Use this function to set the drawing area for rendering on the current target.使用该函数可以为当前渲染目标上的渲染操作设置绘制区域。

Syntax 语法

  1. int SDL_RenderSetViewport(SDL_Renderer* renderer,
  2. const SDL_Rect* rect)

Function Parameters 函数参数

rendererthe rendering context渲染器
rectthe SDL_Rect structure representing the drawing area, or NULL to set the viewport to the entire target表示绘制区域的SDL_Rect结构,或者为NULL以表示绘制区域为整个渲染目标

Return Value 返回值

Returns 0 on success or a negative error code on failure; call SDL_GetError() for more information.执行成功返回0,执行失败则返回一个负的错误码,调用SDL_GetError()以获得更多的错误信息。

Code Examples 示例代码

  1. 暂无

Remarks 注意

When the window is resized, the current viewport is automatically centered within the new window size.当窗口重新调整大小后,当前的绘制区域也会自动调整至新的窗口尺寸的中央。

Related Functions 相关函数

SDL_RenderGetViewport


translated by SteDeshain Reference to http://wiki.libsdl.org/SDL_RenderSetViewport