Skip to content

github-is-garbage/port-ui

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Port UI

Garry's Mod menu state surface based UI
Using render.SetViewPort and render.SetScissorRect

Installation and Usage

  1. Download the repository here
  2. Extract the ZIP file into garrysmod/addons/port-ui
  3. Add the following line at the bottom of your garrysmod/lua/menu/menu.lua file to load the script:
RunString(file.Read("addons/port-ui/lua/port-ui/init.lua", "GAME"), "addons/port-ui/lua/port-ui/init.lua")
  1. Now you can access the portui global table and create elements like so:
local ExampleWindow = portui.Elements.Create("Window")
ExampleWindow:SetPos(10, 10)
ExampleWindow:SetSize(200, 150)
ExampleWindow:SetTitle("I am a Beautiful Window")

Result:

port-ui Window

Tip

You can view documentation for everything in the docs folder.

Important

Known Issues / Jank

  • Due to this being made with View Ports, Elements rendered with a screen X or Y position off the screen bounds will be clipped due to DirectX clipping. This is NOT able to be fixed with DisableClipping.

  • Due to how the current Rendering and Input systems work, there is no :IsHovered function for elements. Since there are no Render Targets in menu state, fixing this would require looping all elements multiple times per frame, which is very detrimental to performance.

  • Text rendering is weird inside Elements because of the View Ports due to how the View Ports mess with aspect ratio. This is allegedly due to a lack of cam.Start availability in menu state. This has been partially remedied by the implementation of the portui.Elements.Renderer.SwapPortRect() and portui.Elements.> Renderer.UnSwapPortRect() functions.

  • The ColorPicker's sub Elements don't have their handles in the correct location on instantiation

About

Garry's Mod menu state surface based UI

Resources

Stars

Watchers

Forks

Languages