Forums » Community Projects

Prototype MDI HUD

12»
Oct 06, 2013 draugath link
Lately I've been toying around with creating an MDI HUD that would allow anything displayed on-HUD to be free moveable without the risk of them dropping behind the HUD and being inaccessible.

At the present time I have a rather feature complete prototype that works. It uses a combination of frames to represent pseudo-dialogs which are then displayed inside a cbox. The areas that allow each pseudo-dialog to be dragged from are defined by canvas controls.

In order to move things around, enter management mode by opening chat.

Feature expansion and bugfixes are ongoing, especially with regards to how interactive content cause problems for the interface.

Screenshots: [1], [2], [3], [4], [5], [6], [7], [8], [9]

I have set up a public git repo in case anyone wants to stay abreast of updates or potentially contribute.

*** NOTE ***
1) In order for the border image to load properly, this needs to be installed into a directory named "vo-mdi"
2) This plugin DOES NOT work with targetless installed.

Packaged: alpha version 3 (35b47a1; does not require DevKit)

Current Features: (list represents features available in the repo)
* Most default HUD elements are freely moveable.
* The Chat Window is resizeable by dragging the top, bottom, left and right borders.
* Global auto-hide for titlebars and borders
* Option to keep the chat bar open after sending a message
* Context menus (via right-click), supporting toggled items and sub-menus
* Configuration dialog to change options and reshow hidden windows
* Window shading (hide all but the titlebar; double-click the titlebar or use the context menu)
* Window auto-hide, to only show a window in management mode
* Edge resistance to aid in aligning windows.
    - windows with no border are ignored unless holding CTRL
    - holding SHIFT disables resistance entirely

---------------------------------------------------------------------------------------

MDI TargetList git repo (can be used standalone or in conjunction with the latest repo version of VO-MDI)
MDI Targetlist (ZIP) (works with alpha2)

Provides a top10 target list for use with the MDI HUD project. It has not received a lot of testing and I don't yet know if it will cause lag in sectors with a large number of targets.
/settargetbinds -- Sets 1-0 to target item 1-10, and "-" to toggle PC only
/target<n> -- Targets <n> in the list (e.g. /target3)
/targetnext -- Changes to the next target in the list (not set by /settargetbinds)
/targetprev -- Changes to the previous target in the list (not set by /settargetbinds)
/togglepconly -- Filters the list to only show PCs
/targetlist pos <x> <y> -- (repo version only, only useful if used standalone)

---------------------------------------------------------------------------------------

MDI RoidDB git repo (requires the latest commit from the VO-MDI repo)
MDI RoidDB (ZIP) (works with alpha3)

Provides a rudimentary Asteroid DB. Has not received a lot of testing and may cause lag when there are a lot of items in the database. This plugin can be used standalone or in conjunction with VO-MDI. With the MDI, some options are available in the windows context menus. Search and browsing are not yet supported but these are planned features.

Clicking a roid in the list will target it, if it's in range.

Standalone commands:
/roiddb -- open the roiddb dialog
/roiddb import -- import data from Targetless. This is a non-destructive additive import. Targetless notes will not be imported.

Last edited: 2013-12-15 19:30 UTC
Oct 07, 2013 draugath link
API REFERENCE
The API is not yet finalized and may change as features are added.

mdi:CreateWindow(<id>, <content>, [params], [contextmenu])
     id (string) :: identifier of the pseudo dialog
     content (userdata or function) :: a single IUP control or a function that returns an IUP control and optionally a post processor function
     params (table) :: a table containing parameters for the pseudo-dialog (optional)
     contextmenu (table) :: a table containing context menu items (optional)

     If the HUD is scaled, either the content userdata will be preserved or the content function re-run and the window will be automatically recreated.

mdi:DestroyWindow(<id>)
id (string) :: identifier of the pseudo dialog

mdi.dont_hide = <true|false> :: prevents the HUD from trying to perform the Auto-Hide routine under certain conditions

EVENTS
MDI_ZORDER_SHIFT :: triggers after clicking the control surface of a window (titlebar or body depending upon the titlebar attribute) and raising the pseudo-dialog to the top of the zorder. This is important because some controls can behave oddly after being detached and appended (e.g. listboxes)

MDI_rHUDxscale_FINISHED :: triggers after the rHUDxscale event and the MDI has been recreated

PSEUDO-DIALOG ATTRIBUTES
border :: Show a border around the content. Possible values: "YES" and "NO". Default: "YES"

cx, cy :: Position in pixels relative to the top-left corner of the screen.

resize :: Determines if the pseudo-dialog can be resized. Possible values: "YES" and "NO". Default: "NO". This attribute is currently only supported for the chat window.

size :: Initial size of the pseudo-dialog. Will be ignored if the dialog has been resized.

title :: Title to place on the the titlebar and identify the window in the config dialog.

titlebar :: Show a titlebar on the pseudo-dialog. Possible values: "YES" and "NO". Default: "YES"

CONTEXT MENU STRUCTURE
{
     {
          title=<string or function>,
          type = "toggle", -- optional
          value = <function|expression>, -- optional
          action = <function>
     }
}

- If title has a value of "SEPARATOR", then action does not need to be defined and a separator line will be inserted between the items.
- If title is a function, that function should return a string value.
- If type == "toggle" then value is required to set it's state
- Value needs to return a value of "ON" or "OFF"
- All functions in the menu item definition will be passed a reference to the pseudo-dialog the context menu is associated with

ADDITIONAL NOTES
Listboxes-of-controls
When a pseudo-dialog's zorder is changed after clicking on it's titlebar or body, if the pdialog contains a listbox, the listbox will wind up displaying a horizontal scrollbar, even if one wasn't present before. In order to return the listbox to it's original state, you will need to register the event MDI_ZORDER_SHIFT and then remap the listbox. This will only be effective if you first clear the 1st index, then map the listbox, then set the 1st index.

When clearing or adding items to a listbox, it will naturally call other code that will result in MDI management mode being exited. To prevent this, set mdi.dont_hide to true before continuing. Be sure to unset this flag when the operation is complete.

TOOLS
This small plugin will allow you to see what all of the various frame types look like with default values.
ViewFrames

Just install it and use the command /viewframes

It has a little trouble showing the (h|v)divider frames, but the others show up well enough.

Last updated: 2013-12-06 23:03 UTC
Oct 11, 2013 draugath link
As of the latest commit, I have most of the default HUD elements moveable, including the Chat Window. Chat was a little tricky since it appear to normally size itself based on filling empty space in a container, and it didn't like being moved into it's new pseudo-dialog. So I was forced to arbitrarily size it.

Positions are still not saved/recalled, and due to issues with the X and Y attributes not returning the values they're supposed to, everything just gets lumped into one pile and needs to be pulled apart.

Screenshot6

I'm planning to try to make it possible to resize windows. How successful I'll be is unknown at this point. Some elements may just not be resizeable.
Oct 16, 2013 draugath link
The latest commit saves/restores window positions between reloads. It still requires DevKit to be installed.

EDIT: It appears that it still doesn't properly intercept HUD elements during initial login. Just reload the interface upon logging in.
Oct 17, 2013 TheRedSpy link
Why does it require devkit to be installed, is that just because youre using some of your fav functions from devkit and need to move them?
Oct 17, 2013 draugath link
Yes. It's still just in the alpha stages and I'm not removing my debugging function calls just to facilitate easier usage.

EDIT:
It now properly shows the Chat Window during jumps and the cbox won't remain focused after a jump.
Oct 23, 2013 draugath link
I have packaged a version that does not have the DevKit requirement. You can download the alpha version 1 using the link in the first post above. I will not be updating the packaged versions as frequently as the repo.

Alpha version 1 has a few options that can be toggled by editing the code. They are boolean variables at the top of the main.lua.

Targetless DOES NOT work with this installed and will result in the game crashing.

EDIT:
Fixed an issue that was causing lua errors to pop up when logging in with a fresh client. The original zip was updated, so just download it again.
Nov 07, 2013 draugath link
Since the last post I've added a basic config dialog for configuring some of the options without editing the code and to allow you to show/hide windows from a central location. Basic context menus are also available now; currently the only options are to lock the window's position/size or to hide it.

I took a new screenshot which doesn't really show a whole lot more, aside from the context menu (on the Target Info window). You can also see how the MDI Target List I wrote looks.
Nov 10, 2013 Kierky link
I like what you've done with the target list. Clean, easy to read, and won't slow your game down.
Nov 10, 2013 draugath link
With the recent new feature addition of edge resistance, aligning windows is really easy. Also, context menus and window shading have been added. I have released a cleaned up alpha2 that does not require DevKit.

EDIT:
Turns out the alpha2 isn't quite ready like I hoped. A bug already cropped up and I'll need to fix it.

EDIT2:
Okay, the bug has been squashed and alpha2.1 is now available.
Nov 11, 2013 idd link
Looks interesting, except now the screen looks cluttered :/
Nov 11, 2013 draugath link
Borders and titlebars are configurable. I just happen to have them turned on for a lot of things at the moment for development purposes. Currently titlebars are also hidden automatically by default when you exit management mode, though borders can be hidden in the same way.
Dec 09, 2013 draugath link
In conjunction with the first release of my RoidDB (available above), I have also released a Alpha3.

There are a few new features to found in this release.
- Context menus now support visual toggles and sub-menus
- Window Auto-Hide, to only display a window when in management mode
- New windows for Cargo, Addons, Skirmish info, and the Mission Update Icon.

(The mission update icon needs a little more work)
Dec 11, 2013 i82blikeu link
i'm using MDI hud/targetlist and i like it.
any chance to add a couple of keys to switch target selection in targetlist?

tnx for your time.
Dec 11, 2013 draugath link
I'm not sure what you mean. it already supports using 1-0 for target switching.
Dec 12, 2013 i82blikeu link
i was thinking about two keys like:
-previous target in list
-next target in list

...so i can use my mouse-wheel to do the job.
when things go wild my target of choice is never in the same position for enough time.

o/
Dec 15, 2013 draugath link
/targetnext and /targetprev have been added to targetlist
Dec 16, 2013 i82blikeu link
exactly what i was looking for, tnx man.

U ROCK!
May 22, 2014 Thetis link
draug i am currently trying to use the vo-mdi-roiddb as a standalone as well as integrated in the hud. I am having a problem with the dialog opening with /roiddb. It is installed in it;s own plugin folder. Downloade3d both the git repo and the zip for mdi-hud 3.0 so far just getting an error when trying to open the dialog. opens in the hud options just fine but will not close or open on it's own. Is there anything i can download or install to send you any debug info?
May 22, 2014 Kierky link
Why not just post it here?