-
-
Notifications
You must be signed in to change notification settings - Fork 28
Screen
The screen API is used to create different menus on the 3D2D and pop-up screens in the interior. To create a screen, you should place it in the modules/screens
folder of either the exterior or interior. Placing it in the interior will make it only available when the interior exists.
Returns the resolution of the screen as a multiplier
Returns the width of the screen in pixels
Returns the height of the screen in pixels
Returns a suitable padding space, factoring in the screen resolution
Returns ENT.screengap * 2
All fonts are scaled by screen resolution, meaning some may be copies of other fonts but scaled appropriately
DermaDefault
font scaled
Roboto size 50
Roboto size 40
Roboto size 24
Roboto size 20
ENT:AddScreen(string name, function callback)
This function is used to add a screen to the array of buttons presented to the user when they open the menu. The callback has 3 arguments: entity self, panel frame, panel screen
. self
is the exterior entity, frame
is the frame which you should parent your derma items to, and screen
is the entire screen panel.
ENT:GetScreens()
Returns all screens that were registered with ENT:AddScreen
as a table.
ENT:ScreenActive(string name)
Returns a table of every screen that is currently displaying the given screen name, or nil if there isn't any. Can be used an as optimisation - don't run intensive code if the screen isn't being shown anywhere.
ENT:PushScreen(string name, panel screen, panel f, panel f2)
Pushes f2 onto the 'directory' stack and hides f. name
is appended to the page title, e.g. Settings/Options/Music
ENT:PopScreen(panel screen, bool all)
Reverses the process of ENT:PushScreen
, going back up the stack in order. If all
is true, then the function will recursively call itself until it is at the top level.
ENT:HUDScreen()
Creates a new 2D screen and displays it to the user.
ENT:LoadScreenUI(panel screen)
Loads the TARDIS Interface onto the given panel.
ENT:LoadButtons(panel frame, function func)
This function takes a frame and prepares it for the familar 9-button paged layout. It then calls the func
callback with 1 argument, frame
- which is the same frame given to the function when called. The callback should return a table of buttons (DButton
) which have had their parent set (frame
), and all other information other than the position and size which is handled by the function.
ENT:LoadScreen(string id)
This will load a 3D2D screen and set its ID to the supplied one before returning it.