This is used to create a HUD display which lists objects, such as for an on-HUD inventory. When you add an new object, it will start in the corner which you define and every new object you add to the HUD will be added to that row, either progressively left or right depending on where your start corner is, until the row is full and then it will either move up or down a column and fill in another row. When the entire box that you've defined is full, you will not be able to add more objects to the display.
You need to define a new display_hud, which should look like this:
start_x = 1
start_y = 8
end_x = 4
end_y = 5
pixel_offset_x = 0
pixel_offset_y = 0
The start_x and start_y values represent the corner where objects will start being added first - typically the top-left, but this is up to user preference. The end_x and end_y values should be the opposite corner, so if your start corner is the top-left, then your ending corner should be the bottom-right. Assign the coordinates for where you want the start and ending corners to be located.
If your HUD uses pixel offsets, you can offset the display HUD's objects using the pixel_offset_x and pixel_offset_y values.
You need to create the display HUD for the client that will be using it. If this is something which will be used for all players, then you might use something like this:
var/display_hud/backpack/backpack = new()
Make sure you have a list to store objects in, since that is not included as part of this library.
As an example, if each player has their own backpack display HUD which is going to display the player's contents list, then we can add new items to the display HUD like this:
verb/Get(obj/object as obj in view(src, 1))
if(src.client.backpack.Add(src, object, src.contents))
src << "You acquired [object]!"
src << "You don't have any more room!"
The display_hud.Add() function will add the object to the contents list, but it will NOT call the Move() proc. If you want to use Move() to check whether an item can be added to the list, you'll have to do that yourself.
If you want to remove an item from the list, you can do that like this:
verb/Drop(obj/object as obj in src.contents)
if(src.client.backpack.Remove(src, object, src.contents))
object.loc = src.loc
src << "You dropped [object]."
src << "You can not drop [object]!"
And that's all there is to it!