private void checkSnap(AbstractGauge gauge, int x, int y, int w, int h)
            {
                int r = NanoGauges.configuration.GetSnapinRange();

                foreach (AbstractGauge g in gauges)
                {
                    int x0 = g.GetX();
                    int y0 = g.GetY();
                    int w0 = g.GetWidth();
                    int h0 = g.GetHeight();
                    int x1 = x0 + w0;
                    int y1 = y0 + h0;

                    // snap left side
                    if (Math.Abs(x - x1) <= r && Math.Abs(y - y0) <= r)
                    {
                        snapGaugeAt(gauge, x1 + Gauges.LAYOUT_GAP, y0);
                    }
                    // snap right side
                    else if (Math.Abs(x0 - (x + w)) <= r && Math.Abs(y - y0) <= r)
                    {
                        snapGaugeAt(gauge, x0 - w - Gauges.LAYOUT_GAP, y0);
                    }
                    // snap bottom side
                    else if (Math.Abs(y0 - (y + h)) <= r && Math.Abs(x - x0) <= r)
                    {
                        snapGaugeAt(gauge, x0, y0 - h - Gauges.LAYOUT_GAP);
                    }
                    // snap top side
                    else if (Math.Abs(y1 - y) <= r && Math.Abs(x - x0) <= r)
                    {
                        snapGaugeAt(gauge, x0, y1 + Gauges.LAYOUT_GAP);
                    }
                }
            }
 public TooltipWindow(AbstractGauge gauge)
     : base(Constants.WINDOW_ID_TOOLTIP, gauge.GetName())
 {
     this.gauge = gauge;
     SetSize(TOOLTIP_WIDTH, gauge.GetHeight());
     this.title = gauge.GetName();
     this.text  = gauge.GetDescription();
 }
Exemple #3
0
 public Sprite(AbstractGauge gauge, Texture2D skin, int x = 0, int y = 0)
 {
     this.gauge      = gauge;
     this.skin       = skin;
     this.position.x = x;
     this.position.y = y;
     this.width      = skin.width;
     this.height     = skin.height;
 }
 private void snapGaugeAt(AbstractGauge gauge, int x, int y)
 {
     gauge.SetPosition(x, y);
     NanoGauges.configuration.SetWindowPosition(gauge);
     if (Log.IsLogable(Log.LEVEL.DETAIL))
     {
         Log.Detail("snapped window " + gauge.GetName() + " at " + x + "/" + y);
     }
 }
Exemple #5
0
 public Flag(AbstractGauge gauge, Texture2D skin, float a = 0.260f)
 {
     this.gauge      = gauge;
     this.skin       = skin;
     this.max_offset = skin.height;
     this.a          = a;
     this.d          = 0;
     this.state      = STATE.UP;
 }
Exemple #6
0
            public Button(AbstractGauge gauge, Texture2D off, Texture2D on, float width, float height)
            {
                this.gauge   = gauge;
                this.skinOff = off;
                this.skinOn  = on;
                this.pressed = false;
                this.clicked = false;

                this.position.width  = width;
                this.position.height = height;
            }
Exemple #7
0
 public Flag(AbstractGauge gauge, Texture2D texture, double scale = Configuration.GAUGE_SCALE_100, float a = 0.240f)
 {
     this.gauge      = gauge;
     this.texture    = texture;
     this.max_offset = texture.height;
     this.a          = a;
     this.d          = 0;
     this.state      = STATE.UP;
     this.offset     = Y_UP;
     this.width      = (int)(texture.width * scale);
     this.height     = (int)(texture.height * scale);
 }
 public DigitalDisplay(AbstractGauge gauge, int numberOfDigits = 2, bool leadingZeros = true, bool signed = true)
     : base(gauge, BACKGROUND)
 {
     this.numberOfDigits = numberOfDigits;
     this.leadingZeros   = leadingZeros;
     this.signed         = signed;
     digits = new Sprite[10];
     for (int i = 0; i < 10; i++)
     {
         digits[i] = new Sprite(gauge, Utils.GetTexture("Nereid/NanoGauges/Resource/" + i + "-digit"));
     }
     seg7              = new Sprite(gauge, Utils.GetTexture("Nereid/NanoGauges/Resource/digit"));
     seg7I             = new Sprite(gauge, Utils.GetTexture("Nereid/NanoGauges/Resource/I-digit"));
     seg7H             = new Sprite(gauge, Utils.GetTexture("Nereid/NanoGauges/Resource/H-digit"));
     seg7minus         = new Sprite(gauge, Utils.GetTexture("Nereid/NanoGauges/Resource/--digit"));
     limit             = (int)Math.Pow(10, numberOfDigits);
     this.scaling      = (float)NanoGauges.configuration.gaugeScaling;
     this.widthOfDigit = WIDTH_PER_DIGIT * this.scaling;
     SetScaling(this.scaling);
 }
 public Needle(AbstractGauge gauge, Texture2D texture)
     : base(gauge, texture)
 {
     traverseDamper = new Damper(1.0f, int.MinValue, int.MaxValue);
     this.offset    = (float)texture.width / 2.0f;
 }
Exemple #10
0
 public void SetWindowPosition(AbstractGauge gauge)
 {
     currentGaugeSet.SetWindowPosition(gauge.GetWindowId(), gauge.GetX(), gauge.GetY());
 }
Exemple #11
0
 public RFlag(AbstractGauge gauge)
     : base(gauge, TEXTURE)
 {
 }
Exemple #12
0
 public LimiterFlag(AbstractGauge gauge)
     : base(gauge, TEXTURE)
 {
 }
Exemple #13
0
 public PowerOffFlag(AbstractGauge gauge)
     : base(gauge, TEXTURE)
 {
 }
Exemple #14
0
 public PowerOffFlag(AbstractGauge gauge)
     : base(gauge, SKIN)
 {
 }
Exemple #15
0
 public void SetWindowPosition(AbstractGauge gauge, int x, int y)
 {
     currentGaugeSet.SetWindowPosition(gauge.GetWindowId(), x, y);
 }
Exemple #16
0
 public LimiterFlag(AbstractGauge gauge)
     : base(gauge, SKIN)
 {
 }
Exemple #17
0
            public void Update()
            {
                if (trimIndicatorsEnabled)
                {
                    trimIndicators.Update();
                }

                gauges.Update();

                // check for keys
                //
                KeyCode hotkey        = configuration.GetKeyCodeForHotkey();
                bool    hotkeyPressed = Input.GetKey(hotkey);

                gauges.ShowCloseButtons(hotkeyPressed);

                if (hotkeyPressed)
                {
                    AbstractGauge g = gauges.GetGauge(Constants.WINDOW_ID_GAUGE_AOA);
                }

                // Hotkeys for Gaugesets
                if (Input.GetKeyDown(KeyCode.Numlock))
                {
                    if (gauges.Hidden())
                    {
                        gauges.Unhide();
                    }
                    else
                    {
                        gauges.Hide();
                    }
                }
                if (hotkeyPressed)
                {
                    if (Input.GetKeyDown(KeyCode.Alpha1))
                    {
                        SetGaugeSet(GaugeSet.ID.STANDARD);
                    }
                    else if (Input.GetKeyDown(KeyCode.Alpha2))
                    {
                        SetGaugeSet(GaugeSet.ID.LAUNCH);
                    }
                    else if (Input.GetKeyDown(KeyCode.Alpha3))
                    {
                        SetGaugeSet(GaugeSet.ID.LAND);
                    }
                    else if (Input.GetKeyDown(KeyCode.Alpha4))
                    {
                        SetGaugeSet(GaugeSet.ID.DOCK);
                    }
                    else if (Input.GetKeyDown(KeyCode.Alpha5))
                    {
                        SetGaugeSet(GaugeSet.ID.ORBIT);
                    }
                    else if (Input.GetKeyDown(KeyCode.Alpha6))
                    {
                        SetGaugeSet(GaugeSet.ID.FLIGHT);
                    }
                    else if (Input.GetKeyDown(KeyCode.Alpha7))
                    {
                        SetGaugeSet(GaugeSet.ID.SET1);
                    }
                    else if (Input.GetKeyDown(KeyCode.Alpha8))
                    {
                        SetGaugeSet(GaugeSet.ID.SET2);
                    }
                    else if (Input.GetKeyDown(KeyCode.Alpha9))
                    {
                        SetGaugeSet(GaugeSet.ID.SET3);
                    }
                    else if (Input.GetKeyDown(KeyCode.Alpha0))
                    {
                        gauges.EnableAllGauges();
                    }
                    else if (Input.GetKeyDown(KeyCode.KeypadEnter))
                    {
                        createConfigOnce();
                        toggleConfigVisibility();
                    }
                    else if (Input.GetKeyDown(KeyCode.Backspace))
                    {
                        gauges.LayoutCurrentGaugeSet(new StandardLayout(NanoGauges.gauges, configuration));
                    }
                    else if (Input.GetKeyDown(KeyCode.Tab) || Input.GetKeyDown(KeyCode.Delete) || Input.GetKeyDown(KeyCode.KeypadDivide))
                    {
                        if (gauges.Hidden())
                        {
                            gauges.Unhide();
                        }
                        else
                        {
                            gauges.Hide();
                        }
                    }
                    else if (Input.GetKeyDown(KeyCode.KeypadMultiply) || Input.GetKeyDown(KeyCode.Insert))
                    {
                        gauges.AutoLayout();
                    }
                }
            }
Exemple #18
0
 public static HashSet <AbstractGauge> GetCluster(AbstractGauge gauge)
 {
     return(gauges.GetCluster(gauge));
 }
Exemple #19
0
 public void snap(AbstractGauge gauge)
 {
     checkSnap(gauge, gauge.GetX(), gauge.GetY(), gauge.GetWidth(), gauge.GetHeight());
 }