HeadsUp

by Crispy
Let players drag HUD objects around to customize their screen layout! [More]
To download this library for your Linux/Mac installation, enter this on your command line:

DreamDownload byond://Crispy.HeadsUp##version=0

Emulator users, in the BYOND pager go to File | Open Location and enter this URL:

byond://Crispy.HeadsUp##version=0

924 downloads
Latest Version
Date added: Feb 22 2003
Last updated: Jan 13 2007
6 fans
An automated HUD library. Just define the HUD object under /obj/crhud, give it a default screen_loc, and let the library handle the rest. It's that simple!

Includes the optional ability to drag HUD objects around the screen to customise the interface. This even (optionally) supports pixel offsets!

Version 2 fixes some bugs caused by the changes to client.eye that were made in BYOND versions 336, 338, 339 and 341.

As of the 7th of July 2005, HeadsUp no longer requires a BYONDscape subscription for download.

(Note: Pixel offset dragging is slightly buggy at this point. It works fine, except for a slight cosmetic bug - namely, if you drag a HUD object a short distance (so that the centre of the new position is over a part of the object in its old
position), that counts as a click on the HUD object rather than a drag of it.)

(Note #2: If the player can see past the edge of the map, they will not be able to move HUD objects to some areas of their screen while they are near the edge. To fix this, use client.perspective = EDGE_PERSPECTIVE, or add an impenetrable border around the map, so nobody can ever see past the edge.)

This library has a standard prefix, crhud (no comments from the peanut gallery), which precedes all vars and procs that it defines. This is done to avoid conflicts with other libraries, and with any vars and procs you may have defined.

INSTRUCTIONS:
Include this library in your project by opening your game in Dream Maker, then ticking the checkbox next to 'Crispy.HeadsUp' under the Lib entry on the left panel.

Define each HUD object you need as a separate type under /obj/crhud. For each object, specify its screen_loc (where it appears on the screen; look it up in the DM reference for more information). If you want to use any of this library's advanced capabilities for that HUD object (such as dragging and pixel dragging), set the appropriate vars (see "User-modifiable vars" below).

USER-MODIFABLE VARS:
Crispy.HeadsUp defines the following vars that are designed to be modified by the programmer (you):

/obj/crhud/crhud_addatstart (default: true)
If this is true (default), HeadsUp will automatically add this HUD object to the HUD of everyone who logs in.

/obj/crhud/crhud_draggable (default: false)
If this is true, players can drag this type of HUD object around on their screen to customize their HUD layout.

/obj/crhud/crhud_dragpixel (default: false)
If this is true, players can drag this type of HUD object to locations on the screen with pixel offsets. This var has no effect if crhud_draggable is false.

ATOMS:
Crispy.HeadsUp defines the following atom types:

/obj/crhud
Used for all HUD objects managed by HeadsUp.

CLIENT PROCS:
Crispy.HeadsUp defines the following procs under /client:

crhud_add(hudtype)
Adds a HUD object of the specified type to the client's HUD. hudtype can be any subtype of /atom/movable.

crhud_remove(hudtype)
Like crhud_add(), but removes all HUD objects of the specified type from the client's HUD. Does not remove subtypes of 'hudtype'.