Skip to content

Commit

Permalink
ui(radar): tweak layout
Browse files Browse the repository at this point in the history
Move the new radar buttons to the left edge of the radar area.

This also necessitates moving the ship-internals window a bit to the
left. Overall this looks less cluttered.

Also added a debugReload() function to the ship-internals window.
  • Loading branch information
mwerle committed Nov 11, 2024
1 parent fb9e5a0 commit e37bf1c
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
5 changes: 3 additions & 2 deletions data/pigui/modules/radar.lua
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,7 @@ local function displayRadar()
-- Draw the radar mode button in bottom-left corner
-- Button currently does not react to mouse click nor shows tooltip on hover - WHY??
local button_size = size / 3.5 -- 25
ui.setCursorPos(Vector2(center.x - size - button_size, center.y + size - button_size - SCREEN_BORDER))
ui.setCursorPos(Vector2(center.x - ui.reticuleCircleRadius * 0.9, center.y + size - button_size - SCREEN_BORDER))
local clicked = ui.mainMenuButton(icons.equip_radar, "Toggle scanner mode", false, Vector2(button_size))
if toggle_radar or clicked then
shouldDisplay2DRadar = not shouldDisplay2DRadar
Expand All @@ -346,7 +346,8 @@ local function displayRadar()
-- local mode = manual_zoom and '[M]' or '[A]'
local mode = instrument:isAutoZoom() and 'A' or 'M'
button_size = button_size / 1.5
ui.setCursorPos(Vector2(center.x - size + 4, center.y + size - button_size - SCREEN_BORDER))
ui.sameLine()
ui.setCursorPos(Vector2(ui.getCursorPos().x, center.y + size - button_size - SCREEN_BORDER))
ui.button(mode, Vector2(button_size), false, "Zoom Mode")
end
end
Expand Down
10 changes: 8 additions & 2 deletions data/pigui/modules/ship-internals-window.lua
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ local function displayShipFunctionWindow()
assert(thrust_widget_size.y >= mainButtonSize.y)
local window_width = ui.getWindowPadding().x * 2 + (mainButtonSize.x + ui.getItemSpacing().x) * buttons + thrust_widget_size.x
local window_height = thrust_widget_size.y + ui.getWindowPadding().y * 2
local window_posx = ui.screenWidth/2 - ui.reticuleCircleRadius - window_width + 12 -- manual move a little closer to the center
local window_posx = ui.screenWidth/2 - ui.reticuleCircleRadius - window_width
local window_posy = ui.screenHeight - window_height
ui.setNextWindowPos(Vector2(window_posx, window_posy), "Always")
ui.window("ShipFunctions", windowFlags, function()
Expand All @@ -128,6 +128,12 @@ local function displayShipFunctionWindow()
end)
end

ui.registerModule("game", { id = "ship-internals-window", draw = displayShipFunctionWindow })
ui.registerModule("game", {
id = "ship-internals-window",
draw = displayShipFunctionWindow,
debugReload = function()
package.reimport()
end,
})

return {}

0 comments on commit e37bf1c

Please sign in to comment.