mirror of
https://gitea.wildfiregames.com/0ad/0ad.git
synced 2026-06-21 01:29:50 +00:00
Do not require restart when chaning Background pause option
Background pause does require a game restart to take effect. Adding function to update it on runtime since only place where it is used is in main.cpp. Differential revision: D4181 Fixes: #6236 Tested by: @Langbart This was SVN commit r25866.
This commit is contained in:
@@ -19,7 +19,8 @@
|
||||
"type": "boolean",
|
||||
"label": "Background pause",
|
||||
"tooltip": "Pause single-player games when window loses focus.",
|
||||
"config": "pauseonfocusloss"
|
||||
"config": "pauseonfocusloss",
|
||||
"function": "PauseOnFocusLoss"
|
||||
},
|
||||
{
|
||||
"type": "boolean",
|
||||
|
||||
@@ -188,6 +188,11 @@ bool SetFile(const std::wstring& cfgNsString, const Path& path)
|
||||
return true;
|
||||
}
|
||||
|
||||
void PauseOnFocusLoss(bool pause)
|
||||
{
|
||||
g_PauseOnFocusLoss = pause;
|
||||
}
|
||||
|
||||
void RegisterScriptFunctions(const ScriptRequest& rq)
|
||||
{
|
||||
ScriptFunction::Register<&HasChanges>(rq, "ConfigDB_HasChanges");
|
||||
@@ -201,5 +206,6 @@ void RegisterScriptFunctions(const ScriptRequest& rq)
|
||||
ScriptFunction::Register<&CreateAndWriteValueToFile>(rq, "ConfigDB_CreateAndWriteValueToFile");
|
||||
ScriptFunction::Register<&SetFile>(rq, "ConfigDB_SetFile");
|
||||
ScriptFunction::Register<&Reload>(rq, "ConfigDB_Reload");
|
||||
ScriptFunction::Register<&PauseOnFocusLoss>(rq, "PauseOnFocusLoss");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 2019 Wildfire Games.
|
||||
/* Copyright (C) 2021 Wildfire Games.
|
||||
* This file is part of 0 A.D.
|
||||
*
|
||||
* 0 A.D. is free software: you can redistribute it and/or modify
|
||||
@@ -18,6 +18,7 @@
|
||||
#ifndef INCLUDED_JSI_CONFIGDB
|
||||
#define INCLUDED_JSI_CONFIGDB
|
||||
|
||||
extern bool g_PauseOnFocusLoss;
|
||||
class ScriptRequest;
|
||||
|
||||
namespace JSI_ConfigDB
|
||||
|
||||
Reference in New Issue
Block a user