application_surface_enable


语法:

application_surface_enable(enable);

参数 描述
enable 设置为启用 ()禁用 () 应用表面层。


Returns:

N/A(无返回值)


描述

可以用这个函数启用或禁用应用表面层。默认是启用应用表面层,所有绘制事件中的绘制将会在应用表面层中结束,然后将这个表面层绘制到屏幕上。然而在一些旧设备或特定的芯片组上,这可能会导致很差的性能。In those cases you can switch off drawing to the application surface and all Draw event drawing will then be done directly to the screen buffer.

你可以游戏中的任何时间使用这个函数启用或禁用应用表面层,但应该注意更改生效至少需要一帧(一步)。Switching it off will switch off all aspect ratio correction, as set in the Game Options for the target platform. 这意味着,你需要额外的方法设置缩放到设备、窗口或屏幕相应的尺寸上。If you switch it back on again, then the Game Options will take effect again the next step.

It is recommended that you use this function carefully as it will impact on how everything is drawn to the screen. In general you would want to have it as an option in a menu of your game, or call it only once at the start of your game and write your code around whether you have it enabled or disabled.


例如:

if keyboard_check_pressed(vk_space)
   {
   if application_surface_is_enabled()
      {
      application_surface_enable(false);
      }
   else
      {
      application_surface_enable(true);
      }
   }

上述代码检测按键并根据它的状态切换应用表面的启用(就像菜单的选项)。