User Tools

Site Tools



gui_api

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
gui_api [2019/11/26 07:55] madaopvpgui_api [2023/04/21 07:34] (current) kali
Line 40: Line 40:
 ===Important Information=== ===Important Information===
   * To get an overview what is possible with the GUI, open the ingame console (CTRL + C) and execute this command: ''ml_gui.showtestwindow = true''\\   * To get an overview what is possible with the GUI, open the ingame console (CTRL + C) and execute this command: ''ml_gui.showtestwindow = true''\\
 +  * **AUTOMATIC TRANSLATIONS** - Wrap all your static text like: GUI:Button("I am a Label") to GUI:Button(GetString("I am a Label")), this will allow automatic translation to all languages later on.
   * If you find something in that Testwindow but you are not sure how to code the same in LUA, have a look in the c++ source of it: [[https://github.com/ocornut/imgui/blob/master/imgui_demo.cpp]], the used function names and syntax are 99% the same, just the arguments might be slightly different due to LUA not supporting references.\\   * If you find something in that Testwindow but you are not sure how to code the same in LUA, have a look in the c++ source of it: [[https://github.com/ocornut/imgui/blob/master/imgui_demo.cpp]], the used function names and syntax are 99% the same, just the arguments might be slightly different due to LUA not supporting references.\\
  
Line 52: Line 53:
 GUI:Button("Banana###123hohoho" GUI:Button("Banana###123hohoho"
 GUI:Button("Pineapple###123hohoho") GUI:Button("Pineapple###123hohoho")
 +Example: Different name in UI, same internal identifier with auto **Translations**: 
 +GUI:Button(GetString("Banana").."###123hohoho"
 +GUI:Button(GetString("Pineapple").."###123hohoho")
 </code> </code>
  
Line 468: Line 472:
   ***''GUI:InputTextMultiline( //string// label, //string// text, __//number// sizeX__, __//number// sizeY__ , __//[[gui_api#InputTextFlags|InputTextFlags]]// flags__)''**   ***''GUI:InputTextMultiline( //string// label, //string// text, __//number// sizeX__, __//number// sizeY__ , __//[[gui_api#InputTextFlags|InputTextFlags]]// flags__)''**
     *Returns: //string// text, //bool// changed     *Returns: //string// text, //bool// changed
 +
 +  ***''GUI:InputTextEditor( //string// label, //string// text, __//number// sizeX__, __//number// sizeY__ , __//[[gui_api#InputTextFlags|InputTextFlags]]// flags__)''**
 +    *Returns: //string// text, //bool// changed
 +    *Lua syntax highlighting version of GUI:InputTextMultiline
  
   ***''GUI:InputFloat( //string// label, //number// val, __//number// step__, __//number// step_fast__, __//number// decimal_precision__, __//[[gui_api#InputTextFlags|InputTextFlags]]// flags__)''**   ***''GUI:InputFloat( //string// label, //number// val, __//number// step__, __//number// step_fast__, __//number// decimal_precision__, __//[[gui_api#InputTextFlags|InputTextFlags]]// flags__)''**
Line 602: Line 610:
 ===Widgets Tooltip=== ===Widgets Tooltip===
   ***''GUI:SetTooltip( //string// label )''**   ***''GUI:SetTooltip( //string// label )''**
-    *set tooltip under mouse-cursor, typically use with GUI:IsHovered(). last call wins+    *set tooltip under mouse-cursor, typically use with GUI:IsItemHovered. last call wins
   ***''GUI:BeginTooltip( )''**   ***''GUI:BeginTooltip( )''**
     *use to create full-featured tooltip windows that aren't just text     *use to create full-featured tooltip windows that aren't just text
Line 807: Line 815:
   ***''GUI:SetClipboardText( //string// input)''**   ***''GUI:SetClipboardText( //string// input)''**
     *set text data to the clipboard     *set text data to the clipboard
 +
 +
 +
 +===Custom Widgets===
 +  ***''GUI:Keybind( //string// label, //number// virtualKey, __//number// width__)''**
 +    *Returns: //number// virtualKey, //string// keyName, //boolean// changed
 +    *Clicking the widget will start a listener for the next key press event
  
  
Line 830: Line 845:
  
   ***''GUI:AddImage( //string// texturepath, //number// X1, //number// Y1, //number// X2, //number// Y2)''**   ***''GUI:AddImage( //string// texturepath, //number// X1, //number// Y1, //number// X2, //number// Y2)''**
 +
 +  ***''RenderManager:WorldToScreen(//table// worldpos, //bool// true)''**
 +    *Returns: //number// X1, //number// Y1, screenpos
 +    *USE THIS ONE IF POSSIBLE, it is A LOT FASTER than the one below! Converts a worldposition x,y,z to a screenposition x,y , IF that point is currently visible on the screen
  
   ***''RenderManager:WorldToScreen(//table// worldpos)''**   ***''RenderManager:WorldToScreen(//table// worldpos)''**
     *Returns: //table// screenpos     *Returns: //table// screenpos
     *Converts a worldposition x,y,z to a screenposition x,y , IF that point is currently visible on the screen     *Converts a worldposition x,y,z to a screenposition x,y , IF that point is currently visible on the screen
 +
 ===Enums & Flags=== ===Enums & Flags===
 These are registered values in the GUI metatable. //Usage: d(GUI.WindowFlags_NoMove)// will print "2" into the console. These are registered values in the GUI metatable. //Usage: d(GUI.WindowFlags_NoMove)// will print "2" into the console.
gui_api.1574754945.txt.gz · Last modified: 2019/11/26 07:55 by madaopvp