示例#1
0
 public StoryMenu(Microsoft.DirectX.DirectInput.Key skipKey)
 {
     drawer2D            = new Drawer2D();
     texto1              = new CustomSprite();
     texto2              = new CustomSprite();
     texto3              = new CustomSprite();
     texto_skip          = new CustomSprite();
     this.skipKey        = skipKey;
     b1                  = new CustomBitmap(VariablesGlobales.mediaDir + "Bitmaps\\Start\\1.png", D3DDevice.Instance.Device);
     b2                  = new CustomBitmap(VariablesGlobales.mediaDir + "Bitmaps\\Start\\2.png", D3DDevice.Instance.Device);
     b3                  = new CustomBitmap(VariablesGlobales.mediaDir + "Bitmaps\\Start\\3.png", D3DDevice.Instance.Device);
     skip                = new CustomBitmap(VariablesGlobales.mediaDir + "Bitmaps\\Start\\skip.png", D3DDevice.Instance.Device);
     texto1.Position     = new TGCVector2(D3DDevice.Instance.Width * .1f, D3DDevice.Instance.Height * .1f);
     texto2.Position     = new TGCVector2(D3DDevice.Instance.Width * .5f, D3DDevice.Instance.Height * .3f);
     texto3.Position     = new TGCVector2(D3DDevice.Instance.Width * .2f, D3DDevice.Instance.Height * .6f);
     texto_skip.Position = new TGCVector2(D3DDevice.Instance.Width * .9f, D3DDevice.Instance.Height * .8f);
     texto1.Scaling      = CommonHelper.CalculateRelativeScaling(b1, .3f);
     texto2.Scaling      = CommonHelper.CalculateRelativeScaling(b2, .3f);
     texto3.Scaling      = CommonHelper.CalculateRelativeScaling(b3, .3f);
     texto_skip.Scaling  = CommonHelper.CalculateRelativeScaling(skip, .05f);
     texto1.Bitmap       = b1;
     texto2.Bitmap       = b2;
     texto3.Bitmap       = b3;
     texto_skip.Bitmap   = skip;
     VariablesGlobales.managerSonido.PauseAll();
     VariablesGlobales.managerSonido.ReproducirSonido(SoundManager.SONIDOS.FORCE_THEME);
 }
示例#2
0
 private void Input_OnKeyDown(Microsoft.DirectX.DirectInput.Key which)
 {
     if (which == Microsoft.DirectX.DirectInput.Key.Escape)
     {
         Core.Kill();
     }
 }
示例#3
0
 protected virtual void Input_OnKeyDown(Microsoft.DirectX.DirectInput.Key which)
 {
     if (which == Microsoft.DirectX.DirectInput.Key.Escape)
     {
         Core.Kill();
     }
 }
        public static KeysInputVariable Read(XmlNode xml)
        {
            KeysInputVariable result      = new KeysInputVariable();
            string            id          = xml.Attributes["id"].Value;
            string            description = xml.Attributes["description"].Value;
            bool repeat         = bool.Parse(xml.Attributes["repeat"].Value);
            int  repeatAfter    = int.Parse(xml.Attributes["repeatAfter"].Value);
            int  repeatInterval = int.Parse(xml.Attributes["repeatInterval"].Value);
            List <Microsoft.DirectX.DirectInput.Key> ks = new List <Microsoft.DirectX.DirectInput.Key>();
            XmlNodeList kNodes = xml.SelectNodes("key");

            if (kNodes != null && kNodes.Count > 0)
            {
                foreach (XmlNode keyNode in kNodes)
                {
                    Microsoft.DirectX.DirectInput.Key k = (Microsoft.DirectX.DirectInput.Key)Enum.Parse(typeof(Microsoft.DirectX.DirectInput.Key), keyNode.Attributes["value"].Value);
                    if (!ks.Contains(k))
                    {
                        ks.Add(k);
                    }
                }
            }
            return(new KeysInputVariable()
            {
                ID = id,
                Description = description,
                Keys = ks.ToArray(),
                Repeat = repeat,
                RepeatAfter = repeatAfter,
                RepeatInterval = repeatInterval
            });
        }
示例#5
0
        public ToggleButton AddToggleButton(Keys shortcutKey)
        {
            ToggleButton button = this.AddToggleButton();

            mShortcutAssociation.Add(shortcutKey, button);

            return(button);
        }
示例#6
0
        public ToggleButton AddToggleButton(ToolsButton toolsButton, Keys shortcutKey)
        {
            ToggleButton button = this.AddToggleButton(toolsButton);

#if FRB_XNA
            if (shortcutKey != Keys.None)
#endif
            {
                mShortcutAssociation.Add(shortcutKey, button);
            }

            return(button);
        }
示例#7
0
        internal static void SetKey(string function, Microsoft.DirectX.DirectInput.Key key)
        {
            DataRow row = dataSet.Tables["Input.Keyboard"].Rows.Find(function);

            if (row != null)
            {
                row["Key"] = key;
            }
            else
            {
                dataSet.Tables["Input.Keyboard"].Rows.Add(function, key);
            }
            // save changes
            SaveSettings();
        }
示例#8
0
        public static void CameraControlFps(Camera camera)
        {
            GuiManager.Cursor.StaticPosition = true;
            Vector3 up = new Vector3(0, 1, 0);

            camera.Velocity = new Vector3();

            Keys forwardKey = Keys.W;
            Keys backKey    = Keys.S;
            Keys leftKey    = Keys.A;
            Keys rightKey   = Keys.D;

            FlatRedBall.Input.Keyboard keyboard = InputManager.Keyboard;

            float movementSpeed = 7;

            if (keyboard.KeyDown(forwardKey))
            {
                camera.Velocity +=
                    new Vector3(camera.RotationMatrix.M31, camera.RotationMatrix.M32, camera.RotationMatrix.M33) *
                    movementSpeed;
            }
            else if (keyboard.KeyDown(backKey))
            {
                camera.Velocity +=
                    new Vector3(camera.RotationMatrix.M31, camera.RotationMatrix.M32, camera.RotationMatrix.M33) *
                    -movementSpeed;
            }

            if (keyboard.KeyDown(leftKey))
            {
                camera.Velocity +=
                    new Vector3(camera.RotationMatrix.M11, camera.RotationMatrix.M12, camera.RotationMatrix.M13) *
                    -movementSpeed;
            }
            if (keyboard.KeyDown(rightKey))
            {
                camera.Velocity +=
                    new Vector3(camera.RotationMatrix.M11, camera.RotationMatrix.M12, camera.RotationMatrix.M13) *
                    movementSpeed;
            }

#if FRB_XNA
            // These vaules may be way too fast/slow because I modified it to use pixels rather
            // than the somewhat arbitrary world coordinates
            camera.RotationMatrix *=
                Matrix.CreateFromAxisAngle(
                    camera.RotationMatrix.Right,
                    -.2f * GuiManager.Cursor.ScreenYChange * TimeManager.SecondDifference);

            camera.RotationMatrix *=
                Matrix.CreateFromAxisAngle(
                    up,
                    -.2f * GuiManager.Cursor.ScreenXChange * TimeManager.SecondDifference);
#elif FRB_MDX
            camera.RotationMatrix *=
                Matrix.RotationAxis(
                    new Vector3(camera.RotationMatrix.M11, camera.RotationMatrix.M12, camera.RotationMatrix.M13),
                    -.2f * GuiManager.Cursor.YVelocity * TimeManager.SecondDifference);

            camera.RotationMatrix *=
                Matrix.RotationAxis(
                    up,
                    -.2f * GuiManager.Cursor.XVelocity * TimeManager.SecondDifference);
#endif
        }
示例#9
0
        public ToggleButton AddToggleButton(ToolsButton toolsButton, Keys shortcutKey)
        {
            ToggleButton button = this.AddToggleButton(toolsButton);

#if FRB_XNA
            if (shortcutKey != Keys.None)
#endif
            {
                mShortcutAssociation.Add(shortcutKey, button);
            }

            return button;
        }
示例#10
0
        public ToggleButton AddToggleButton(Keys shortcutKey)
        {
            ToggleButton button = this.AddToggleButton();

            mShortcutAssociation.Add(shortcutKey, button);

            return button;
        }
示例#11
0
 public static string KeyToFriendlyName(Microsoft.DirectX.DirectInput.Key key)
 {
     return(string.Format("{0}", key));
 }
示例#12
0
 public bool keyUp(Key key)
 {
     return(keyboard.keyUp(key));
 }
示例#13
0
 public bool keyDown(Key key)
 {
     return(keyboard.keyDown(key));
 }
示例#14
0
 public bool keyPressed(Key key)
 {
     return(keyboard.keyPressed(key));
 }