private HudMain() : base(ApiModuleTypes.HudMain, false, true)
                {
                    if (_instance != null)
                    {
                        throw new Exception("Only one instance of HudMain can exist at any give time!");
                    }

                    _instance = this;
                    var members = GetApiData();

                    cursor = new HudCursor(members.Item1);
                    GetTextBoardDataFunc = members.Item2;
                    GetOrSetMemberFunc   = members.Item3;
                    UnregisterAction     = members.Item4;

                    PixelToWorldRef = new MatrixD[1];
                    root            = new HudClientRoot();
                    highDpiRoot     = new ScaledSpaceNode(root)
                    {
                        UpdateScaleFunc = () => ResScale
                    };

                    Action <List <HudUpdateAccessors>, byte> rootDelegate = root.GetUpdateAccessors,
                                                             safeAccessor = (List <HudUpdateAccessors> list, byte depth) =>
                    {
                        ExceptionHandler.Run(() => rootDelegate(list, depth));
                    };

                    // Register update delegate
                    GetOrSetMemberFunc(safeAccessor, (int)HudMainAccessors.GetUpdateAccessors);

                    root.CustomDrawAction  = HudMasterDraw;
                    root.CustomInputAction = HudMasterInput;
                    UpdateCache();
                }
Exemple #2
0
            private HudMain() : base(false, true)
            {
                if (instance == null)
                {
                    instance = this;
                }
                else
                {
                    throw new Exception("Only one instance of HudMain can exist at any given time.");
                }

                _root        = new HudRoot();
                _highDpiRoot = new ScaledSpaceNode(_root)
                {
                    UpdateScaleFunc = () => ResScale
                };
                _cursor = new HudCursor(_root);

                UpdateScreenScaling();
                TreeManager.Init();
            }