Difference between revisions of "Global Command: setWindowTitle"

From The Official Visionaire Studio: Adventure Game Engine Wiki
m
 
(2 intermediate revisions by 2 users not shown)
Line 1: Line 1:
<div class="toccolours mw-collapsible mw-collapsed tbl-ds">
+
Set a custom title in the game application title bar. Only applicable, if the game is running in window mode.
<span class="bold">Function History</span>
 
<div class="mw-collapsible-content">
 
<div class="alt-bg">Available since v4.0</div>
 
</div></div>
 
  
  
Allows you to set a custom title in the game application title bar. (only applicable for ''window mode'')
+
== Syntax ==
 
+
<syntaxhighlight lang="lua">
 
+
setWindowTitle(title)
Syntax:
 
<syntaxhighlight>
 
setWindowTitle("title")
 
 
</syntaxhighlight>
 
</syntaxhighlight>
  
  
Example 1: basic set window title method
+
== Parameters ==
<syntaxhighlight>
 
setWindowTitle("my new game title")
 
</syntaxhighlight>
 
  
Example 2: set window title based on current users system language
+
{| class="ts"
<syntaxhighlight>
+
|-
sysLang = getProperty("system_language") -- store current os language
+
! style="width:15%" | Parameter
 +
! style="width:15%" | Type
 +
! Description
 +
|-
 +
| title
 +
| string
 +
| The new title for the game window.
 +
|}
  
-- let's set the window title based on os language
 
if sysLang == "English" then
 
setWindowTitle("my new title in english")
 
elseif sysLang == "German" then
 
setWindowTitle("mein neue titel auf deutsch")
 
end
 
</syntaxhighlight>
 
  
Example 3: set window title based on current game language
+
== Return values ==
<syntaxhighlight>
 
local lang = game:getLink(VGameCurrentLanguage):getName() -- store current game language
 
  
if lang == "English" then
+
none
setWindowTitle("my new title in english")
 
elseif lang == "German" then
 
setWindowTitle("mein neue titel auf deutsch")
 
end
 
</syntaxhighlight>
 
  
  
 +
== Examples ==
  
<span class="bold underline">Arguments</span>
+
'''Example 1:''' Set the window title based on the user's operating system language.
 +
<syntaxhighlight lang="lua">
 +
sysLang = getProperty("system_language")
  
<span class="bold">title</span>: "string" <br/>
+
if sysLang == "German" then
This should include the text you want to be displayed in the application title bar (window mode)
+
  setWindowTitle("Mein neuer Titel auf Deutsch")
 
+
else
 
+
  setWindowTitle("My new title in English")
<span class="bold underline">Flags</span>
+
end
 
+
</syntaxhighlight>
none
+
{{toc}}
 
 
 
 
<span class="bold underline">Return</span>
 
 
 
none
 

Latest revision as of 23:29, 15 May 2023

Set a custom title in the game application title bar. Only applicable, if the game is running in window mode.


Syntax

setWindowTitle(title)


Parameters

Parameter Type Description
title string The new title for the game window.


Return values

none


Examples

Example 1: Set the window title based on the user's operating system language.

sysLang = getProperty("system_language")

if sysLang == "German" then
  setWindowTitle("Mein neuer Titel auf Deutsch")
else
  setWindowTitle("My new title in English")
end