LuaGUI.wiki
changeset 1798 e9c222ae9879
parent 1762 a74e65cdb9db
child 1843 5bc2abb28338
equal deleted inserted replaced
1797:e8c8ffe6e22b 1798:e9c222ae9879
     1 #summary List of functions in the Lua API that affect the GUI
     1 #summary List of functions in the Lua API that affect the GUI
     2 
     2 
     3 = Lua API: GUI functions =
     3 = Lua API: GUI functions =
     4 This page is a list of all functios in the [LuaAPI Lua API] that affect the GUI (graphical user interface).
     4 This page is a list of all functios in the [LuaAPI Lua API] that affect the GUI (graphical user interface).
     5 
     5 
     6 <wiki:toc max_depth="3" />
     6 <wiki:toc max_depth="2" />
     7 
     7 
     8 == Captions ==
     8 == <tt>!AddCaption(text)</tt> ==
     9 === <tt>!AddCaption(text)</tt> ===
       
    10 Display an event text in the upper part of the screen. The text will be white and the caption group will be `capgrpMessage`.
     9 Display an event text in the upper part of the screen. The text will be white and the caption group will be `capgrpMessage`.
    11 
    10 
    12 Example:
    11 Example:
    13 <code language="lua">
    12 <code language="lua">
    14 AddCaption("Hello, world!")
    13 AddCaption("Hello, world!")
    15 </code>
    14 </code>
    16 
    15 
    17 === <tt>!AddCaption(text, color, captiongroup)</tt> ===
    16 == <tt>!AddCaption(text, color, captiongroup)</tt> ==
    18 Display an event text in the upper part of the screen with the specified RGBA text [LuaOverview#Color color] and caption group. Although an RBGA color is used, Hedgewars does not actually support transparent or semi-transparent captions, so the fourth byte is ignored. We recommend you to always specify a full opacity (`FF` in hexadecimal) for the caption.
    17 Display an event text in the upper part of the screen with the specified RGBA text [LuaOverview#Color color] and caption group. Although an RBGA color is used, Hedgewars does not actually support transparent or semi-transparent captions, so the fourth byte is ignored. We recommend you to always specify a full opacity (`FF` in hexadecimal) for the caption.
    19 
    18 
    20 || *`captiongroup`* || *Meaning* ||
    19 || *`captiongroup`* || *Meaning* ||
    21 || `capgrpGameState` || Used for important global game events, like Sudden Death ||
    20 || `capgrpGameState` || Used for important global game events, like Sudden Death ||
    22 || `capgrpAmmoinfo` || Used for new weapon crates and some other events ||
    21 || `capgrpAmmoinfo` || Used for new weapon crates and some other events ||
    35 <code language="lua">
    34 <code language="lua">
    36 AddCaption("Melon bomb rain in 2 rounds!", 0xFF0000FF, capgrpGameState)
    35 AddCaption("Melon bomb rain in 2 rounds!", 0xFF0000FF, capgrpGameState)
    37 -- Green example message.
    36 -- Green example message.
    38 </code>
    37 </code>
    39 
    38 
    40 == Mission panel ==
    39 == <tt>!ShowMission(caption, subcaption, text, icon, time [, forceDisplay])</tt> ==
    41 === <tt>!ShowMission(caption, subcaption, text, icon, time [, forceDisplay])</tt> ===
       
    42 This function will open the mission panel and set the texts in it.
    40 This function will open the mission panel and set the texts in it.
    43 
    41 
    44 Use to tell the player what he/she is supposed to do. If you use this function, a mission panel is shown for the amount of time specified in `time` (in milliseconds). If `time` is set to 0, it will be displayed for a default amount of time.
    42 Use to tell the player what he/she is supposed to do. If you use this function, a mission panel is shown for the amount of time specified in `time` (in milliseconds). If `time` is set to 0, it will be displayed for a default amount of time.
    45 This function replaces the *entire* text of the mission panel. Compare this to the global `Goals` variable, which *adds* to the default text without replacing it.
    43 This function replaces the *entire* text of the mission panel. Compare this to the global `Goals` variable, which *adds* to the default text without replacing it.
    46 
    44 
    79 ShowMission(loc("Nobody Laugh"), loc("User Challenge"), loc("Eliminate the enemy before the time runs out"), 0, 0)
    77 ShowMission(loc("Nobody Laugh"), loc("User Challenge"), loc("Eliminate the enemy before the time runs out"), 0, 0)
    80 </code>
    78 </code>
    81 
    79 
    82 (Note: `loc` comes from the [LuaLibraryLocale Locale Lua library.)
    80 (Note: `loc` comes from the [LuaLibraryLocale Locale Lua library.)
    83 
    81 
    84 === <tt>!HideMission()</tt> ===
    82 == <tt>!HideMission()</tt> ==
    85 Hides the mission panel if it is currently displayed, otherwise, this function does nothing.
    83 Hides the mission panel if it is currently displayed, otherwise, this function does nothing.
    86 
    84 
    87 == Zoom ==
    85 == <tt>!SetZoom(zoomLevel)</tt> ==
    88 === <tt>!SetZoom(zoomLevel)</tt> ===
       
    89 Sets the zoom level. The value for maximum zoom is currently 1.0 and for minimum 3.0 The default zoom level is 2.0
    86 Sets the zoom level. The value for maximum zoom is currently 1.0 and for minimum 3.0 The default zoom level is 2.0
    90 
    87 
    91 === <tt>!GetZoom()</tt> ===
    88 == <tt>!GetZoom()</tt> ==
    92 Returns the current zoom level.
    89 Returns the current zoom level.
    93 
    90 
    94 == Cinematic mode ==
    91 == <tt>!SetCinematicMode(enable)</tt> (0.9.23) ==
    95 === <tt>!SetCinematicMode(enable)</tt> (0.9.23) ===
       
    96 Turns on or off cinematic mode. Cinematic mode can be used for cutscenes etc.
    92 Turns on or off cinematic mode. Cinematic mode can be used for cutscenes etc.
    97 If `enable` is set to `true`, cinematic mode is enabled,
    93 If `enable` is set to `true`, cinematic mode is enabled,
    98 if it is `false`, cinematic mode is disabled.
    94 if it is `false`, cinematic mode is disabled.
    99 
    95