当前位置:   article > 正文

UE4中窗口模式切换_buseborderlessfullscreen=true

buseborderlessfullscreen=true

1、设置游戏启动的默认窗口模式

       设置默认模式可通过修改配置文件的方式,配置文件名DefaultGameUserSettings.ini,位于Config目录下,如果没有该文件可新建一个,配置项如下

[/Script/Engine.GameUserSettings]
 bUseVSync=False
 ResolutionSizeX=1280
 ResolutionSizeY=720
 LastUserConfirmedResolutionSizeX=1280
 LastUserConfirmedResolutionSizeY=720
 WindowPosX=-1
 WindowPosY=-1
 bUseDesktopResolutionForFullscreen=True
 FullscreenMode=2
 LastConfirmedFullscreenMode=2

修改FullscreenMode的值可设置为全屏或窗口模式,0表示全屏模式,1表示窗口全屏模式,2表示窗口模式,UE4中定义为

  1. UENUM(BlueprintType)
  2. namespace EWindowMode
  3. {
  4. enum Type
  5. {
  6. /** The window is in true fullscreen mode */
  7. Fullscreen,
  8. /** The window has no border and takes up the entire area of the screen */
  9. WindowedFullscreen,
  10. /** The window has a border and may not take up the entire screen area */
  11. Windowed,
  12. };
  13. }

修改ResolutionSizeX和ResolutionSizeY,可设置窗口分辨率

 

2、运行中切换窗口模式

       游戏运行中可通过UGameUserSettings类实现窗口模式切换

void SetFullScreenMode(bool bFull)
{
    if (bFull)
	{
		UGameUserSettings::GetGameUserSettings()->SetFullscreenMode(EWindowMode::WindowedFullscreen);//或者EWindowMode::Fullscreen
	}
	else
	{
		UGameUserSettings::GetGameUserSettings()->SetFullscreenMode(EWindowMode::Windowed);
	}
	UGameUserSettings::GetGameUserSettings()->ApplyResolutionSettings(false);
}

3、通过命令行模式启动窗口或全屏模式。以下为官方文档对部分命令行参数的说明:

  1. ConsoleX: Horizontal position for console output window.
  2. ConsoleY: Vertical position for console output window.
  3. WinX: Set the horizontal position of the game window on the screen.
  4. WinY: Set the vertical position of the game window on the screen.
  5. ResX: Set horizontal resolution for game window.
  6. ResY: Set vertical resolution for game window.
  7. VSync: Activate the VSYNC via command line. (prevents tearing of the image but costs fps and causes input latency)
  8. NoVSync: Deactivate the VSYNC via command line
  9. BENCHMARK: Run game at fixed-step in order to process each frame without skipping any frames. This is useful in conjunction with DUMPMOVIE options.
  10. DUMPMOVIE: Dump rendered frames to files using current resolution of game.
  11. EXEC: Executes the specified exec file.
  12. FPS: Set the frames per second for benchmarking.
  13. FULLSCREEN: Set game to run in fullscreen mode.
  14. SECONDS: Set the maximum tick time.
  15. WINDOWED: Set game to run in windowed mode.

启动窗口模式命令行参数 -WINDOWED -ResX=1280 -ResY=720

启动全屏模式命令行参数 -FULLSCREEN

以命令行参数启动有下面两种方式启动:

(1)将WindowsNoEditor下的exe文件创建快捷方式

并在快捷方式属性中添加命令行参数,然后以快捷方式启动程序即可。

(2)在WindowsNoEditor下新建一个文本文档,重命名为run.bat,打开文件编辑内容如下,然后运行run.bat即可。

start ThirdPerson.exe -WINDOWED -ResX=1280 -ResY=720

 

 

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/盐析白兔/article/detail/94863
推荐阅读
相关标签
  

闽ICP备14008679号