X Tutup
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 14 additions & 12 deletions data/pigui/libs/buttons.lua
Original file line number Diff line number Diff line change
Expand Up @@ -40,25 +40,27 @@ end
--
-- Function: ui.coloredSelectedButton
--
-- ui.coloredSelectedButton(label, thesize, is_selected, bg_color, tooltip, enabled)
-- > clicked = ui.coloredSelectedIconButton(label, button_size, is_selected,
-- > bg_color, tooltip, enabled)
--
--
-- Example:
--
-- >
-- > clicked = ui.coloredSelectedButton("Click me", Vector2(100,0), false,
-- > ui.theme.colors.buttonBlue, "Does the thing", true)
--
-- Parameters:
--
-- label - string,
-- thesize - Vector2,
-- is_selected - boolean,
-- bg_color - Color, for background
-- fg_color - Color, for forground
-- tint_color - Color,
-- tooltip - string, mouseover text, will be used as ID, must be unique, append "##uniqueID" if needed
-- label - string, text rendered on the button, must be unique, can append with "##..."
-- thesize - Vector2 object, giving size of button
-- is_selected - boolean, if false, uses a darker tint of the button
-- bg_color - Color(R,G,B), for background
-- tooltip - string, mouseover text
-- enabled - enable tootip text and highlight of button when mouse over
--
-- Returns:
--
-- boolean - true if button was clicked
-- clicked - true if button was clicked, (note: is_selected and enabled does not affect this)
--
function ui.coloredSelectedButton(label, thesize, is_selected, bg_color, tooltip, enabled)
if is_selected then
Expand Down Expand Up @@ -93,7 +95,7 @@ end
--
-- Function: ui.coloredSelectedIconButton
--
-- > clicked = ui.coloredSelectedIconButton(icon, button_size, is_selected,
-- > clicked = ui.coloredSelectedIconButton(icon, thesize, is_selected,
-- > frame_padding, bg_color, fg_color, tooltip, img_size)
--
--
Expand All @@ -105,7 +107,7 @@ end
-- Parameters:
--
-- icon - image to place on button, e.g. from ui.theme.icons
-- button_size - size of button, Vector2
-- thesize - size of button, Vector2
-- is_selected - bool
-- frame_padding - number
-- bg_color - Color(R,G,B), for background
Expand Down
6 changes: 3 additions & 3 deletions data/pigui/modules/info-view/01-ship-info.lua
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ end
local collapsingHeaderFlags = ui.TreeNodeFlags { "DefaultOpen" }

local function shipStats()
local closed = ui.withFont(fonts.pionillium.medium, function()
local closed = ui.withFont(fonts.pionillium.medlarge, function()
return not ui.collapsingHeader("Ship Information", collapsingHeaderFlags)
end)

Expand Down Expand Up @@ -126,7 +126,7 @@ local function shipStats()
end

local function equipmentList()
local closed = ui.withFont(fonts.pionillium.medium, function()
local closed = ui.withFont(fonts.pionillium.medlarge, function()
return not ui.collapsingHeader("Equipment", collapsingHeaderFlags)
end)

Expand Down Expand Up @@ -166,7 +166,7 @@ InfoView:registerView({
icon = ui.theme.icons.info,
showView = true,
draw = function()
ui.withFont(fonts.pionillium.medium, function()
ui.withFont(fonts.pionillium.medlarge, function()
if _OLD_LAYOUT then
ui.columns(2, "shipInfo")

Expand Down
37 changes: 37 additions & 0 deletions src/lua/LuaPiGui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -480,6 +480,18 @@ static int l_pigui_columns(lua_State *l)
return 0;
}

/*
* Function: getColumnWidth
*
* Return width of column, as float
*
* > local col_width = ui.getColumnWidth()
*
* Returns:
*
* col_width - float, width of column
*
*/
static int l_pigui_get_column_width(lua_State *l)
{
int column_index = LuaPull<int>(l, 1, -1);
Expand Down Expand Up @@ -515,6 +527,19 @@ static int l_pigui_set_column_width(lua_State *l)
return 1;
}

/*
* Function: setColumnOffset
*
* Set offset of column
*
* > ui.setColumnOffset(index, width)
*
* Parameters:
*
* index - int, index of column
* width - float, offset of x coordinate
*
*/
static int l_pigui_set_column_offset(lua_State *l)
{
PROFILE_SCOPED()
Expand All @@ -524,6 +549,18 @@ static int l_pigui_set_column_offset(lua_State *l)
return 0;
}

/*
* Function: getScrollY
*
* returns a float
*
* > local scroll = ui.getScrollY()
*
* Returns:
*
* scroll - float
*
*/
static int l_pigui_get_scroll_y(lua_State *l)
{
PROFILE_SCOPED()
Expand Down
X Tutup