SDL_RenderSetScale

Use this function to set the drawing scale for rendering on the current target. 使用该函数可以为当前的渲染目标上的渲染操作设置缩放比例。

Syntax 语法

  1. int SDL_RenderSetScale(SDL_Renderer* renderer,
  2. float scaleX,
  3. float scaleY)

Function Parameters 函数参数

renderer the rendering context 渲染器
scaleX the horizontal scaling factor 水平方向的缩放比例因子
scaleY the vertical scaling factor 竖直方向的缩放比例因子

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 注意

The drawing coordinates are scaled by the x/y scaling factors before they are used by the renderer. This allows resolution independent drawing with a single coordinate system.在被渲染器渲染之前绘制坐标就以x/y缩放比例因子进行缩放。这就允许了独立于分辨率的单一坐标系统的实现。

If this results in scaling or subpixel drawing by the rendering backend, it will be handled using the appropriate quality hints. For best results use integer scaling factors.如果这一操作导致在显示终端上的像素缩放或小于一个像素的绘制,会自动运用合适的显示模式。但最好还是用整数作为缩放比例因子。

Version 版本

This function is available since SDL 2.0.0.该函数在SDL2.0.0及其以后的版本中才可使用。

Related Functions 相关函数

SDL_RenderGetScale

SDL_RenderSetLogicalSize