Пример #1
0
 void CreateJoystickPointerControls(Window window)
 {
     joystickWindows.Clear();
     joystickPointers.Clear();
     joystickPointerAxis.Clear();
     for (int z = 0; z < FrameWorkStaticHelper.GetCurrentJoystick(joysticks).JoyStickState.AxisCount; z++)
     {
         CreateJoystickPointerControl(window, joystickWindowsInitialY, z);
     }
 }
Пример #2
0
        public override int AddControlsInfoToGui(Window guiWindow, GUI mGui, int left, int top, int initialTopSpacing, float width, float textVSpacing, uint fontSize)
        {
            var    joystick    = FrameWorkStaticHelper.GetCurrentJoystick(joysticks);
            int    y           = initialTopSpacing;
            int    h           = (int)textVSpacing;
            uint   oldFontSize = mGui.mFontSize;
            float  spaceSize   = ViewHelper.MeasureText(mGui.mFont, " ", mGui.mFontSize);
            int    leftOrg     = left;
            Button b;

            // przesuniecie o szerokosc guzika (fontsize) + fontSize
            left += (int)(fontSize + fontSize);
            Vector4 pos;

            Setup(mGui, guiWindow);
            OverlayContainer c;

            y += (int)(h * 1);

            mGui.mFontSize = fontSize;
            y = AddControlLine(LanguageKey.OK, KeyMap.Instance.JoystickEnter, "", guiWindow, mGui, left, top, width, fontSize, y, h, leftOrg);


            y += (int)(h * 1);
            y  = AddControlLine(LanguageKey.Back, KeyMap.Instance.JoystickEscape, "", guiWindow, mGui, left, top, width, fontSize, y, h, leftOrg);


            y += (int)(h * 1);
            y  = AddControlLine(LanguageKey.Engine, KeyMap.Instance.JoystickEngine, " (" + LanguageResources.GetString(LanguageKey.Hold) + ")", guiWindow, mGui, left, top, width, fontSize, y, h, leftOrg);

            y += (int)(h * 1);
            y  = AddControlLine(LanguageKey.Gear, KeyMap.Instance.JoystickGear, "", guiWindow, mGui, left, top, width, fontSize, y, h, leftOrg);

            y += (int)(h * 1);
            y  = AddControlLine(LanguageKey.Gun, KeyMap.Instance.JoystickGun, "", guiWindow, mGui, left, top, width, fontSize, y, h, leftOrg);

            y += (int)(h * 1);
            y  = AddControlLine(LanguageKey.Bombs, KeyMap.Instance.JoystickRocket, "/" + LanguageResources.GetString(LanguageKey.Rockets) + ": ", guiWindow, mGui, left, top, width, fontSize, y, h, leftOrg);

            y += (int)(h * 1);
            y  = AddControlLine(LanguageKey.Spin, KeyMap.Instance.JoystickSpin, "", guiWindow, mGui, left, top, width, fontSize, y, h, leftOrg);

            y += (int)(h * 1);
            y  = AddControlLine(LanguageKey.Camera, KeyMap.Instance.JoystickCamera, "", guiWindow, mGui, left, top, width, fontSize, y, h, leftOrg);

            y += (int)(h * 1);
            y  = AddControlLine(LanguageKey.BulletTimeEffect, KeyMap.Instance.JoystickBulletiTimeEffect, "", guiWindow, mGui, left, top, width, fontSize, y, h, leftOrg);


            y += (int)(h * 1);

            y = AddControlLine(LanguageKey.RearmEndMission, KeyMap.Instance.JoystickRocket, "", guiWindow, mGui, left, top, width, fontSize, y, h, leftOrg, true);

            y  += (int)(h * 1);
            pos = new Vector4(left, top + y, width, h);

            // horizontal axis
            string txt;
            float  controlTxtWidth;


            txt             = LanguageResources.GetString(LanguageKey.ChooseHorizontalAxisNo) + ":";
            controlTxtWidth = ViewHelper.MeasureText(mGui.mFont, txt, mGui.mFontSize);

            guiWindow.createStaticText(pos, txt);
            pos.x += controlTxtWidth + spaceSize;
            //  pos.y -= mGui.mFontSize
            pos.z = spaceSize * 2;

            for (int i = 0; i < FrameWorkStaticHelper.GetCurrentJoystick(joysticks).JoyStickState.AxisCount; i++)
            {
                horizontalAxesButtonIDs.Add(++lastButtonId);
                var material = (KeyMap.Instance.JoystickHorizontalAxisNo != i) ? "bgui.button" : "bgui.selected.button";

                OnChangeButtonAddedDo(guiWindow.createButton(pos, material, i.ToString(), new Callback(this), lastButtonId));
                pos.x += pos.z;
            }

            y  += (int)(h * 1);
            pos = new Vector4(left, top + y, width, h);

            // vertical axis
            //FrameWorkStaticHelper.GetCurrentJoystick(joysticks).JoyStickState.VectorCount
            txt             = LanguageResources.GetString(LanguageKey.ChooseVerticalAxisNo) + ":";
            controlTxtWidth = ViewHelper.MeasureText(mGui.mFont, txt, mGui.mFontSize);

            guiWindow.createStaticText(pos, txt);
            pos.x += controlTxtWidth + spaceSize;
            //  pos.y -= mGui.mFontSize
            pos.z = spaceSize * 2;

            for (int i = 0; i < FrameWorkStaticHelper.GetCurrentJoystick(joysticks).JoyStickState.AxisCount; i++)
            {
                verticalAxesButtonIDs.Add(++lastButtonId);
                var material = (KeyMap.Instance.JoystickVerticalAxisNo != i) ? "bgui.button" : "bgui.selected.button";

                OnChangeButtonAddedDo(guiWindow.createButton(pos, material, i.ToString(), new Callback(this), lastButtonId));
                pos.x += pos.z;
            }

            y  += (int)(h * 1);
            pos = new Vector4(left, top + y, width, h);


            // deadzone
            txt             = LanguageResources.GetString(LanguageKey.JoystickDeadzone) + " 0.";
            controlTxtWidth = ViewHelper.MeasureText(mGui.mFont, txt, mGui.mFontSize);

            guiWindow.createStaticText(pos, txt);
            pos.x += controlTxtWidth;
            pos.z  = spaceSize * 2;
            joystickDeadzoneTi                 = guiWindow.createTextInput(pos, "bgui.textinput", KeyMap.Instance.JoystickDeadZone.ToString(ci).Substring(2).PadRight(2, '0'), 2);
            joystickDeadzoneTi.Validator       = new NumberValidator();
            joystickDeadzoneTi.onValueChanged += joystickDeadzoneTi_onValueChanged;


            y  += (int)(h * 1);
            pos = new Vector4(left, top + y, width, h);
            // sensitivity
            txt             = LanguageResources.GetString(LanguageKey.JoystickSensitivity) + " (0.01 - 3.00):";
            controlTxtWidth = ViewHelper.MeasureText(mGui.mFont, txt, mGui.mFontSize);

            guiWindow.createStaticText(pos, txt);
            pos.x += controlTxtWidth + spaceSize;
            pos.z  = spaceSize * 3;
            joystickSensitivityTi                 = guiWindow.createTextInput(pos, "bgui.textinput", KeyMap.Instance.JoystickSensivity.ToString(ci), 4);
            joystickSensitivityTi.Validator       = new NumberAndDotValidator();
            joystickSensitivityTi.onValueChanged += joystickSensitivityTi_onValueChanged;


            return(y + top);
        }