Lua Player Plus Vita
Documentation of lpp-vita
Gui

Module that handles 2D GUI development through dear ImGui wrapper. More...

Enumerations

enum  GuiTheme { DARK_THEME , LIGHT_THEME , CLASSIC_THEME }
 Themes constants to use with Gui.setTheme. More...
 
enum  WinFlags {
  FLAG_NONE , FLAG_NO_COLLAPSE , FLAG_NO_MOVE , FLAG_NO_RESIZE ,
  FLAG_NO_SCROLLBAR , FLAG_NO_TITLEBAR , FLAG_HORIZONTAL_SCROLLBAR
}
 Window flags to use with Gui.initWindow. More...
 
enum  ConfigMode { SET_ONCE , SET_ALWAYS }
 Function mode to alter frequency of execution. More...
 

Functions

void Gui::init (void)
 Init Gui sub-system. More...
 
void Gui::term (void)
 Terminate Gui sub-system. More...
 
void Gui::initBlend (void)
 Init Gui drawing phase. More...
 
void Gui::termBlend (void)
 Terminate Gui drawing phase. More...
 
void Gui::setTheme (GuiTheme theme)
 Change theme for the running Gui. More...
 
void Gui::setInputMode (bool use_touch, bool use_rear, bool use_buttons, bool indirect_touch)
 Change input mode for the running Gui. More...
 
bool Gui::initMainMenubar (void)
 Init screen menubar. More...
 
void Gui::termMainMenubar (void)
 Terminate screen menubar. More...
 
bool Gui::initMenu (string label, bool enabled)
 Init a menu. More...
 
void Gui::termMenu (void)
 Terminate a menu. More...
 
bool Gui::drawMenuItem (string label, bool selected, bool enabled)
 Draw a menu item. More...
 
void Gui::drawText (string label, int color)
 Draw a text. More...
 
number[] Gui::getTextSize (string text)
 Calculate a text size. More...
 
void Gui::drawDisabledText (string label)
 Draw a greyed out text. More...
 
void Gui::drawWrappedText (string label)
 Draw a text with automatic newlines to fit the window. More...
 
bool Gui::drawButton (string label, number width, number height)
 Draw a button. More...
 
bool Gui::drawSmallButton (string label)
 Draw a small button. More...
 
bool Gui::drawCheckbox (string label, bool status)
 Draw a checkbox. More...
 
bool Gui::drawRadioButton (string label, bool status)
 Draw a radiobutton. More...
 
void Gui::resetLine (void)
 Make next element be drawn on current line. More...
 
void Gui::initWindow (string label, WinFlags flags)
 Init a window. More...
 
void Gui::termWindow (void)
 Terminate a window. More...
 
void Gui::setWindowPos (number x, number y, ConfigMode mode)
 Set next window position. More...
 
void Gui::setWindowSize (number w, number h, ConfigMode mode)
 Set next window size. More...
 
void Gui::drawSeparator (void)
 Draw a separator. More...
 
void Gui::drawTooltip (string label)
 Draw a tooltip when cursor hover on the previous item. More...
 
number[] Gui::drawSlider (string label, number val_min, number val_max, number val1, number val2, number val3, number val4)
 Draw a slider with variable amount of values. More...
 
int[] Gui::drawIntSlider (string label, int val_min, int val_max, int val1, int val2, int val3, int val4)
 Draw a slider with variable amount of integer values. More...
 
int Gui::drawComboBox (string label, int index, table elements)
 Draw a combobox. More...
 
int Gui::drawListBox (string label, int index, table elements)
 Draw a listbox. More...
 
int Gui::drawColorPicker (string label, int color, bool alpha)
 Draw a color picker. More...
 
void Gui::drawProgressbar (number fraction, number w, number h)
 Draw a progressbar. More...
 
void Gui::drawImage (int img, number width, number height, number img_x, number img_y, number img_w, number img_h, int color)
 Draw an image in the Gui subsystem. More...
 
void Gui::setWidgetPos (number x, number y)
 Set next widget position. More...
 
void Gui::setWidgetWidth (number w)
 Set next widgets width. More...
 
void Gui::resetWidgetWidth ()
 Reset next widgets width to original values. More...
 

Detailed Description

Module that handles 2D GUI development through dear ImGui wrapper.

Enumeration Type Documentation

◆ GuiTheme

enum GuiTheme

Themes constants to use with Gui.setTheme.

Enumerator
DARK_THEME 

Dark Theme.

LIGHT_THEME 

Light Theme.

CLASSIC_THEME 

Classic Theme.

◆ WinFlags

enum WinFlags

Window flags to use with Gui.initWindow.

Enumerator
FLAG_NONE 

No flags.

FLAG_NO_COLLAPSE 

The window can't be collapsed.

FLAG_NO_MOVE 

The window can't be moved.

FLAG_NO_RESIZE 

The window can't be resized.

FLAG_NO_SCROLLBAR 

The window has no vertical scrollbar.

FLAG_NO_TITLEBAR 

The window doesn't show a label.

FLAG_HORIZONTAL_SCROLLBAR 

The window has an horizontal scrollbar.

◆ ConfigMode

enum ConfigMode

Function mode to alter frequency of execution.

Enumerator
SET_ONCE 

The function is executed only once.

SET_ALWAYS 

The function is executed at every frame.

Function Documentation

◆ init()

void Gui::init ( void  )

Init Gui sub-system.

Usage example:
Definition: luaGui.cpp:39
void init(void)
Init Gui sub-system.

◆ term()

void Gui::term ( void  )

Terminate Gui sub-system.

Usage example:
void term(void)
Terminate Gui sub-system.

◆ initBlend()

void Gui::initBlend ( void  )

Init Gui drawing phase.

Usage example:
void initBlend(void)
Init Gui drawing phase.

◆ termBlend()

void Gui::termBlend ( void  )

Terminate Gui drawing phase.

Usage example:
void termBlend(void)
Terminate Gui drawing phase.

◆ setTheme()

void Gui::setTheme ( GuiTheme  theme)

Change theme for the running Gui.

Usage example:
void setTheme(GuiTheme theme)
Change theme for the running Gui.
@ DARK_THEME
Dark Theme.
Definition: luaGui.cpp:11
Parameters
theme- The theme to set.

◆ setInputMode()

void Gui::setInputMode ( bool  use_touch,
bool  use_rear,
bool  use_buttons,
bool  indirect_touch 
)

Change input mode for the running Gui.

Usage example:
Gui.setInputMode(true, false, true, true)
void setInputMode(bool use_touch, bool use_rear, bool use_buttons, bool indirect_touch)
Change input mode for the running Gui.
Parameters
use_touch- Enable front touch usage for cursor movement.
use_rear- Enable rearpad touch usage for cursor movement.
use_buttons- Enable buttons usage for cursor movement.
indirect_touch- If enabled, cursor is moved by dragging it. If disabled, cursor jumps to the touched location.

◆ initMainMenubar()

bool Gui::initMainMenubar ( void  )

Init screen menubar.

Usage example:
end
bool initMainMenubar(void)
Init screen menubar.
void termMainMenubar(void)
Terminate screen menubar.
Returns
true if the menubar is opened, false otherwise.

◆ termMainMenubar()

void Gui::termMainMenubar ( void  )

Terminate screen menubar.

Usage example:

◆ initMenu()

bool Gui::initMenu ( string  label,
bool  enabled 
)

Init a menu.

Usage example:
if Gui.initMenu("My Menu") then
end
void termMenu(void)
Terminate a menu.
bool initMenu(string label, bool enabled)
Init a menu.
Parameters
label- The label to show.
enabled- The menu status to set (optional).
Returns
true if the menu is opened, false otherwise.

◆ termMenu()

void Gui::termMenu ( void  )

Terminate a menu.

Usage example:
if Gui.initMenu() then
end

◆ drawMenuItem()

bool Gui::drawMenuItem ( string  label,
bool  selected,
bool  enabled 
)

Draw a menu item.

Usage example:
if Gui.drawMenuItem("Feature", is_enabled) then
is_enabled = true
end
bool drawMenuItem(string label, bool selected, bool enabled)
Draw a menu item.
Parameters
label- The label to show.
selected- The item checked status (optional).
enabled- The item status to set (optional).
Returns
true if clicked, false otherwise.

◆ drawText()

void Gui::drawText ( string  label,
int  color 
)

Draw a text.

Usage example:
Gui.drawText("Hello World", Color.new(255, 255, 0))
Definition: luaColor.cpp:6
int new(int r, int g, int b, int a)
Create a new color.
void drawText(string label, int color)
Draw a text.
Parameters
label- The label to show.
color- A valid color (See Color) (optional).

◆ getTextSize()

number [] Gui::getTextSize ( string  text)

Calculate a text size.

Usage example:
w, h = Gui.getTextSize("Hello World")
end
number[] getTextSize(string text)
Calculate a text size.
Parameters
text- The text to calculate the size about.
Returns
The size of the text in pixels.

◆ drawDisabledText()

void Gui::drawDisabledText ( string  label)

Draw a greyed out text.

Usage example:
Gui.drawDisabledText("Hello World")
void drawDisabledText(string label)
Draw a greyed out text.
Parameters
label- The label to show.

◆ drawWrappedText()

void Gui::drawWrappedText ( string  label)

Draw a text with automatic newlines to fit the window.

Usage example:
Gui.drawWrappedText("Hello World")
void drawWrappedText(string label)
Draw a text with automatic newlines to fit the window.
Parameters
label- The label to show.

◆ drawButton()

bool Gui::drawButton ( string  label,
number  width,
number  height 
)

Draw a button.

Usage example:
if Gui.drawButton("Exit") then
end
Definition: luaSystem.cpp:78
bool drawButton(string label, number width, number height)
Draw a button.
void exit(void)
Close the interpreter.
Parameters
label- The label to show.
width- The width of the button (optional).
height- The height of the button (optional).
Returns
true if the button has been clicked, false otherwise.

◆ drawSmallButton()

bool Gui::drawSmallButton ( string  label)

Draw a small button.

Usage example:
if Gui.drawSmallButton("Exit") then
end
bool drawSmallButton(string label)
Draw a small button.
Parameters
label- The label to show.
Returns
true if the button has been clicked, false otherwise.

◆ drawCheckbox()

bool Gui::drawCheckbox ( string  label,
bool  status 
)

Draw a checkbox.

Usage example:
is_checked = Gui.drawCheckbox("Check", is_checked)
bool drawCheckbox(string label, bool status)
Draw a checkbox.
Parameters
label- The label to show.
status- The initial checked status of the checkbox.
Returns
true if the checkbox is checked, false otherwise.

◆ drawRadioButton()

bool Gui::drawRadioButton ( string  label,
bool  status 
)

Draw a radiobutton.

Usage example:
is_checked = Gui.drawRadiobutton("Check", is_checked)
Parameters
label- The label to show.
status- The initial checked status of the radiobutton.
Returns
true if the radiobutton is checked, false otherwise.

◆ resetLine()

void Gui::resetLine ( void  )

Make next element be drawn on current line.

Usage example:
void resetLine(void)
Make next element be drawn on current line.

◆ initWindow()

void Gui::initWindow ( string  label,
WinFlags  flags 
)

Init a window.

Usage example:
void initWindow(string label, WinFlags flags)
Init a window.
@ FLAG_NO_MOVE
The window can't be moved.
Definition: luaGui.cpp:23
@ FLAG_NO_RESIZE
The window can't be resized.
Definition: luaGui.cpp:24
@ FLAG_NO_TITLEBAR
The window doesn't show a label.
Definition: luaGui.cpp:26
@ FLAG_NO_COLLAPSE
The window can't be collapsed.
Definition: luaGui.cpp:22
Parameters
label- The label to show.
flags- The flags to use with the window.

◆ termWindow()

void Gui::termWindow ( void  )

Terminate a window.

Usage example:
void termWindow(void)
Terminate a window.

◆ setWindowPos()

void Gui::setWindowPos ( number  x,
number  y,
ConfigMode  mode 
)

Set next window position.

Usage example:
void setWindowPos(number x, number y, ConfigMode mode)
Set next window position.
@ SET_ALWAYS
The function is executed at every frame.
Definition: luaGui.cpp:36
Parameters
x- X coordinate of the window position in pixels.
y- Y coordinate of the window position in pixels.
mode- A mode to use for the function.

◆ setWindowSize()

void Gui::setWindowSize ( number  w,
number  h,
ConfigMode  mode 
)

Set next window size.

Usage example:
void setWindowSize(number w, number h, ConfigMode mode)
Set next window size.
Parameters
w-Width of the window in pixels.
h- Height of the window in pixels.
mode- A mode to use for the function.

◆ drawSeparator()

void Gui::drawSeparator ( void  )

Draw a separator.

Usage example:
void drawSeparator(void)
Draw a separator.

◆ drawTooltip()

void Gui::drawTooltip ( string  label)

Draw a tooltip when cursor hover on the previous item.

Usage example:
Gui.drawText("Text")
Gui.drawTooltip("This is a textbox")
void drawTooltip(string label)
Draw a tooltip when cursor hover on the previous item.
Parameters
label- The label to show.

◆ drawSlider()

number [] Gui::drawSlider ( string  label,
number  val_min,
number  val_max,
number  val1,
number  val2,
number  val3,
number  val4 
)

Draw a slider with variable amount of values.

Usage example:
slider_val = Gui.drawSlider("A slider", 0, 100, slider_val)
number[] drawSlider(string label, number val_min, number val_max, number val1, number val2, number val3, number val4)
Draw a slider with variable amount of values.
Parameters
label- The label to show.
val_min- The minimum value settable through the slider.
val_max- The maximum value settable through the slider.
val1- The first value to handle with the slider.
val2- The second value to handle with the slider (optional).
val3- The third value to handle with the slider (optional).
val4- The forth value to handle with the slider (optional).
Returns
The updated values after the frame execution.

◆ drawIntSlider()

int [] Gui::drawIntSlider ( string  label,
int  val_min,
int  val_max,
int  val1,
int  val2,
int  val3,
int  val4 
)

Draw a slider with variable amount of integer values.

Usage example:
slider_val = Gui.drawIntSlider("A int slider", 0, 100, slider_val)
int[] drawIntSlider(string label, int val_min, int val_max, int val1, int val2, int val3, int val4)
Draw a slider with variable amount of integer values.
Parameters
label- The label to show.
val_min- The minimum value settable through the slider.
val_max- The maximum value settable through the slider.
val1- The first value to handle with the slider.
val2- The second value to handle with the slider (optional).
val3- The third value to handle with the slider (optional).
val4- The forth value to handle with the slider (optional).
Returns
The updated values after the frame execution.

◆ drawComboBox()

int Gui::drawComboBox ( string  label,
int  index,
table  elements 
)

Draw a combobox.

Usage example:
elems = {"Element 1", "Element 2", "Element 3", "Element 4"}
combo_idx = Gui.drawComboBox("##combo", combo_idx, elems)
end
int drawComboBox(string label, int index, table elements)
Draw a combobox.
Parameters
label- The label to show.
index- The currently selected element.
elements- The elements to use for the combobox.
Returns
The updated selected element.

◆ drawListBox()

int Gui::drawListBox ( string  label,
int  index,
table  elements 
)

Draw a listbox.

Usage example:
elems = {"Element 1", "Element 2", "Element 3", "Element 4"}
list_idx = Gui.drawListBox("##list", list_idx, elems)
end
int drawListBox(string label, int index, table elements)
Draw a listbox.
Parameters
label- The label to show.
index- The currently selected element.
elements- The elements to use for the combobox.
Returns
The updated selected element.

◆ drawColorPicker()

int Gui::drawColorPicker ( string  label,
int  color,
bool  alpha 
)

Draw a color picker.

Usage example:
color = Color.new(255, 127, 65)
color = Gui.drawColorPicker("##color_picker", color)
end
int drawColorPicker(string label, int color, bool alpha)
Draw a color picker.
Parameters
label- The label to show.
color- The currently picked color (See Color)
alpha- If true, alpha value will be pickable, not otherwise. (optional).
Returns
The updated picked color.

◆ drawProgressbar()

void Gui::drawProgressbar ( number  fraction,
number  w,
number  h 
)

Draw a progressbar.

Usage example:
Gui.drawProgressbar(0.25, 200, 0)
end
void drawProgressbar(number fraction, number w, number h)
Draw a progressbar.
Parameters
fraction- Progress value to show in 0.0 - 1.0 range.
w- Width of the element in pixels (optional).
h- Height of the element in pixels (optional).

◆ drawImage()

void Gui::drawImage ( int  img,
number  width,
number  height,
number  img_x,
number  img_y,
number  img_w,
number  img_h,
int  color 
)

Draw an image in the Gui subsystem.

Usage example:
icon = Graphics.loadImage("app0:/icon.png")
Gui.drawImage(icon, 32, 32, 0, 0, 20, 20)
Definition: luaGraphics.cpp:15
int loadImage(string filename)
Load a .png/.jpg/.bmp image.
void drawImage(int img, number width, number height, number img_x, number img_y, number img_w, number img_h, int color)
Draw an image in the Gui subsystem.
Parameters
img- A valid image ID.
width- Width in pixels of the widget (optional).
height- Height in pixels of the widget (optional).
img_x- Source image X coordinate (optional).
img_y- Source image Y coordinate (optional).
img_w- Source image width (optional).
img_h- Source image height (optional).
color- Image tint color (See Color) (optional).

◆ setWidgetPos()

void Gui::setWidgetPos ( number  x,
number  y 
)

Set next widget position.

Usage example:
Gui.setWidgetPos(300, 200)
Gui.drawText("Hello World")
end
void setWidgetPos(number x, number y)
Set next widget position.
Parameters
x- X coordinate in pixels.
y- Y coordinate in pixels.

◆ setWidgetWidth()

void Gui::setWidgetWidth ( number  w)

Set next widgets width.

Usage example:
color = Color.new(255, 255, 255)
color = Gui.drawColorPicker("##color_picker", color)
end
void setWidgetWidth(number w)
Set next widgets width.
Parameters
w- Width of the element in pixels.

◆ resetWidgetWidth()

void Gui::resetWidgetWidth ( )

Reset next widgets width to original values.

Usage example:
color = Color.new(255, 255, 255)
color = Gui.drawColorPicker("##color_picker", color)
end
void resetWidgetWidth()
Reset next widgets width to original values.