Ejemplo n.º 1
0
        /// <summary>
        /// Allows the game to run logic such as updating the world,
        /// checking for collisions, gathering input, and playing audio.
        /// </summary>
        /// <param name="gameTime">Provides a snapshot of timing values.</param>
        protected override void Update(GameTime gameTime)
        {
            if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed || Keyboard.GetState().IsKeyDown(Keys.Escape))
            {
                Exit();
            }
            if (InputEngine.IsKeyPressed(Keys.Right))
            {
                if (current.Next != null)
                {
                    current = current.Next;
                }
            }
            if (InputEngine.IsKeyPressed(Keys.Left))
            {
                if (current.Previous != null)
                {
                    current = current.Previous;
                }
            }

            // TODO: Add your update logic here

            base.Update(gameTime);
        }
Ejemplo n.º 2
0
        public void Update(GameTime gameTime)
        {
            SpritePosition = InputEngine.CurrentMouseState.Position.ToVector2();
            Bounds         = new Rectangle((int)SpritePosition.X, (int)SpritePosition.Y, TextureManager.AllTextures[SpriteTextureKey].Width, TextureManager.AllTextures[SpriteTextureKey].Height);

            if (InputEngine.IsMouseLeftHeld() && HoldingACoin == false)
            {
                var q = Helper.AllCoins.FirstOrDefault(c => c.Bounds.Intersects(Bounds));

                if (q != null && HoldingACoin == false)
                {
                    q.Selected   = true;
                    HoldingACoin = true;
                }
            }
            else if (!InputEngine.IsMouseLeftHeld())
            {
                HoldingACoin = false;
                var q = Helper.AllCoins.FirstOrDefault(c => c.Selected == true);

                if (q != null)
                {
                    q.Selected = false;
                }
            }
        }
        public override void Update(GameTime gametime)
        {
            if (InputEngine.IsKeyHeld(Keys.X))
            {
                AngleOfRotation += RotationSpeed;
            }
            if (InputEngine.IsKeyHeld(Keys.Z))
            {
                AngleOfRotation -= RotationSpeed;
            }

            if (InputEngine.IsKeyHeld(Keys.Up))
            {
                PixelPosition += new Vector2(
                    (float)Math.Sin(AngleOfRotation),
                    -(float)Math.Cos(AngleOfRotation)) * 5;
            }

            if (InputEngine.IsKeyHeld(Keys.Down))
            {
                PixelPosition -= new Vector2(
                    (float)Math.Sin(AngleOfRotation),
                    -(float)Math.Cos(AngleOfRotation)) * 5;
            }

            base.Update(gametime);
        }
Ejemplo n.º 4
0
 public override void onButtonClick(InputEngine.MouseArgs e)
 {
     if (IsIn(e.curState.X, e.curState.Y))
     {
         e.Handled = true;
     }
 }
        /// <summary>
        /// Allows the game to run logic such as updating the world,
        /// checking for collisions, gathering input, and playing audio.
        /// </summary>
        /// <param name="gameTime">Provides a snapshot of timing values.</param>
        protected override void Update(GameTime gameTime)
        {
            if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed || Keyboard.GetState().IsKeyDown(Keys.Escape))
            {
                Exit();
            }
            if (InputEngine.IsKeyPressed(Keys.Down))
            {
                if (current.Next != null)
                {
                    current.Value.InFocus = false;
                    current = current.Next;
                    current.Value.InFocus = true;
                }

                // add rap around
            }
            if (InputEngine.IsKeyPressed(Keys.Up))
            {
                if (current.Previous != null)
                {
                    current.Value.InFocus = false;
                    current = current.Previous;
                    current.Value.InFocus = true;
                }
            }
            // add rap around

            // add a check to check and see if one of the menu Items is selected.

            // TODO: Add your update logic here

            base.Update(gameTime);
        }
Ejemplo n.º 6
0
        public void Update(GameTime gameTime, Viewport v)
        {
            //         if(gameTime.TotalGameTime.Seconds % 1 == 0)
            //         {

            //             Vector2 newPosition = Vector2.Clamp(Position + new Vector2(rnd.Next(-10, 10), rnd.Next(-10, 10)), new Vector2(rnd.Next(-10, 10), rnd.Next(-10, 10)), new Vector2(v.X-Image.Width, v.Y-Image.Height));
            ////             Vector2 newPosition = Vector2.SmoothStep(Position, new Vector2(rnd.Next(-10, 10), rnd.Next(-10, 10)), 0.1f);


            //             //Vector2 newPosition = new Vector2(rnd.Next(-10, 10), rnd.Next(-10, 10));
            //             Position += newPosition;
            //             BoundingRect = new Rectangle((int)Position.X, (int)Position.Y, Image.Width, Image.Height);
            //         }
            if (InputEngine.IsMouseLeftClick() && BoundingRect.Contains(InputEngine.MousePosition))
            {
                IsClicked = true;
            }
            //if (gameTime.TotalGameTime.Seconds % 3 == 0)
            //{
            Position = Vector2.Lerp(Position, Target, 0.1f);
            if (Vector2.DistanceSquared(Position, Target) <= 0.1f)
            {
                Position = Target;
                Target   = new Vector2(rnd.Next(0, v.Width - Image.Width), rnd.Next(0, v.Height - Image.Height));
                Console.WriteLine("Position : " + Position);
                Console.WriteLine("Target : " + Target);
            }
            BoundingRect = new Rectangle((int)Position.X, (int)Position.Y, Image.Width, Image.Height);
            //}
        }
Ejemplo n.º 7
0
        public override void Update(GameTime gameTime)
        {
            keyboard.Update(gameTime);

            if (InputEngine.IsKeyPressed(Keys.Enter) && !firstText && !Done)
            {
                Name            = Output;
                Output          = string.Empty;
                firstText       = true;
                keyboard.Output = string.Empty;
                InputEngine.ClearState();
            }
            if (InputEngine.IsKeyPressed(Keys.Enter) && firstText && !Done)
            {
                Output          = string.Empty;
                keyboard.Output = string.Empty;
                Done            = true;
                Enabled         = false;
                Visible         = false;
            }
            if (InputEngine.IsKeyPressed(Keys.Back))
            {
                if (Output.Length > 0)
                {
                    Output = Output.Remove(Output.Length - 1);
                }
            }
            if (InputEngine.IsKeyPressed(Keys.Space))
            {
                Output += " ";
            }

            base.Update(gameTime);
        }
Ejemplo n.º 8
0
 public void newClick(object sender, InputEngine.MouseArgs e)
 {
     Sound.SoundPlayer.PlayButtonClick();
     GUIEngine.s_componentSelector.ResetSelection();
     create = true;
     delete = false;
 }
Ejemplo n.º 9
0
 public void clrClick(object sender, InputEngine.MouseArgs e)
 {
     Sound.SoundPlayer.PlayButtonClick();
     Logics.PlacableAreasManager.Clear();
     delete = false;
     create = false;
 }
Ejemplo n.º 10
0
        public override void Reset()
        {
            var a = InputEngine.GetCursorGameCoords();

            W.IsConnected = InputEngine.curMouse.LeftButton == ButtonState.Pressed && isIn((int)a.X, (int)a.Y);
            base.Reset();
        }
Ejemplo n.º 11
0
        /// <summary>
        /// Allows the game to run logic such as updating the world,
        /// checking for collisions, gathering input, and playing audio.
        /// </summary>
        /// <param name="gameTime">Provides a snapshot of timing values.</param>
        protected override void Update(GameTime gameTime)
        {
            if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed || Keyboard.GetState().IsKeyDown(Keys.Escape))
            {
                Exit();
            }
            if (InputEngine.IsKeyPressed(Keys.R))
            {
                reset();
            }
            if (GraphicsDevice.Viewport.Bounds.Contains(InputEngine.MousePosition))
            {
                if (InputEngine.MousePosition != InputEngine.PreviousMouseState.Position.ToVector2())
                {
                    p.Position = InputEngine.MousePosition;
                }
            }
            // To update the position of the Bounding box of the player
            p.Update();
            // Se if the collectables are collected by the player
            foreach (var c in collectables)
            {
                c.Update(p);
            }

            base.Update(gameTime);
        }
Ejemplo n.º 12
0
 public GetGameInputComponent(Game g) : base(g)
 {
     g.Components.Add(this);
     IsMouseVisible = true;
     input          = new InputEngine(g);
     keyboard       = new SimpleKeyboard(new Vector2(10, 10));
 }
Ejemplo n.º 13
0
 public override void backClick(object sender, InputEngine.MouseArgs e)
 {
     Sound.SoundPlayer.PlayButtonClick();
     GUIEngine.ChangeScene(GUIEngine.s_levelsMenu, "GUILevels");
     //Main.curState = "GUILevels";
     //GUIEngine.curScene = GUIEngine.s_levelsMenu;
 }
Ejemplo n.º 14
0
        /// <summary>
        /// Allows the game to run logic such as updating the world,
        /// checking for collisions, gathering input, and playing audio.
        /// </summary>
        /// <param name="gameTime">Provides a snapshot of timing values.</param>
        protected override void Update(GameTime gameTime)
        {
            if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed || Keyboard.GetState().IsKeyDown(Keys.Escape))
            {
                Exit();
            }
            // Turn on chat mode
            if (InputEngine.IsKeyPressed(Keys.F1))
            {
                // line represent the current line to be captured
                line     = string.Empty;
                chatMode = !chatMode;
            }
            // if chatting then do not update game window
            if (chatMode)
            {
                if (InputEngine.IsKeyPressed(Keys.Enter))
                {
                    // replace connection id with name of logged in player
                    chatproxy.Invoke("SendMess", new object[] { connection.ConnectionId, line });
                    line = string.Empty;
                    //chatMessages.Add(line);
                }
                else
                {
                    //if (InputEngine.PressedKeys.Length > 0)

                    if (InputEngine.currentKey != Keys.None)
                    {
                        line += InputEngine.lookupKeys[InputEngine.currentKey];
                    }
                }
            }
            // update game window
            else
            {
                if (Keyboard.GetState().IsKeyDown(Keys.Space))
                {
                    proxy.Invoke("GetPoint");
                }
                if (!(PlayerAuthentication.PlayerStatus == AUTHSTATUS.OK))
                {
                    Exitcount -= gameTime.ElapsedGameTime.TotalSeconds;
                    if (Exitcount < 1)
                    {
                        Exit();
                    }
                }
                if (Keyboard.GetState().IsKeyDown(Keys.Enter))
                {
                    scores = PlayerAuthentication.getScores(5, "Battle Call");
                    if (scores != null)
                    {
                        _scoreboard = true;
                    }
                }
            }
            // TODO: Add your update logic here
            base.Update(gameTime);
        }
Ejemplo n.º 15
0
 public virtual void Update()
 {
     if (InputEngine.IsMouseLeftClick() && _bounds.Contains(InputEngine.MousePosition))
     {
         _selected = true;
     }
 }
        public override void Update(GameTime gameTime)
        {
            //if(Site != null)
            //    Site.Update(gameTime);
            if (MyProjectile != null &&
                MyProjectile.ProjectileState == Projectile.PROJECTILE_STATE.STILL)
            {
                myProjectile.TilePosition = TilePosition;
                // fire the rocket and it looks for the target
                if (InputEngine.IsKeyHeld(Keys.Space) || InputEngine.IsMouseLeftClick() ||
                    InputEngine.CurrentPadState.Buttons.A == ButtonState.Pressed)
                {
                    MyProjectile.fire(Site.TilePosition);
                }
            }

            //if (MyProjectile != null)
            //    MyProjectile.Update(gameTime);
            // update the health bar object
            //if (Hbar != null)
            //{
            //    Hbar.position = PixelPosition + new Vector2(-10, -20);
            //    Hbar.health = Health;
            //}
            base.Update(gameTime);
        }
Ejemplo n.º 17
0
 public void Update()
 {
     if (InputEngine.IsMouseLeftClick() && Bound.Contains(InputEngine.MousePosition))
     {
         Selected = true;
     }
 }
Ejemplo n.º 18
0
        public void Update(GameTime gametime)
        {
            foreach (var key in keys)
            {
                var rect = new Rectangle((int)key.Position.X, (int)key.Position.Y, key.Width, key.Height);

                if (rect.Contains((int)InputEngine.MousePosition.X, (int)InputEngine.MousePosition.Y))
                {
                    key.IsMouseOver = true;

                    if (InputEngine.IsMouseLeftClick())
                    {
                        if (key.Text == "Space")
                        {
                            Output += " ";
                        }
                        else if (key.Text == "Delete")
                        {
                            if (Output.Length > 0)
                            {
                                Output = Output.Remove(Output.Length - 1);
                            }
                        }
                        else
                        {
                            Output += key.Text;
                        }
                    }
                }
                else
                {
                    key.IsMouseOver = false;
                }
            }
        }
Ejemplo n.º 19
0
        public override void Update(GameTime gameTime)
        {
            if (InputEngine.IsKeyHeld(Keys.Left))
            {
                move(new Vector2(-1, 0) * CameraSpeed, Game.GraphicsDevice.Viewport);
            }
            if (InputEngine.IsKeyHeld(Keys.Right))
            {
                move(new Vector2(1, 0) * CameraSpeed, Game.GraphicsDevice.Viewport);
            }
            if (InputEngine.IsKeyHeld(Keys.Down))
            {
                move(new Vector2(0, 1) * CameraSpeed, Game.GraphicsDevice.Viewport);
            }
            if (InputEngine.IsKeyHeld(Keys.Up))
            {
                move(new Vector2(0, -1) * CameraSpeed, Game.GraphicsDevice.Viewport);
            }

            TilePlayer p = (TilePlayer)Game.Services.GetService(typeof(TilePlayer));

            if (p != null)
            {
                follow(p.PixelPosition, Game.GraphicsDevice.Viewport);

                //Make sure the player stays in the bounds
                p.PixelPosition = Vector2.Clamp(p.PixelPosition, Vector2.Zero,
                                                new Vector2(_worldBound.X - p.BoundingRectangle.Width,
                                                            _worldBound.Y - p.BoundingRectangle.Height));
            }
            base.Update(gameTime);
        }
Ejemplo n.º 20
0
 private void HandleSelection()
 {
     if (InputEngine.IsKeyPressed(ActivateKey))
     {
         Slots[SlotPosition].isClicked = true;
     }
 }
Ejemplo n.º 21
0
 public void backClick(object sender, InputEngine.MouseArgs e)
 {
     Sound.SoundPlayer.PlayButtonClick();
     GUIEngine.ChangeScene(GUIEngine.s_mainMenu, "GUIMainMenu");
     //Main.curState = "GUIMainMenu";
     //GUIEngine.curScene = GUIEngine.s_mainMenu;
 }
Ejemplo n.º 22
0
        private void UpdateSelectPosition()
        {
            Position = Vector2.Lerp(Position, new Vector2(
                                        Slots[SlotPosition].Position.X - SPACING,
                                        Slots[SlotPosition].Position.Y), CURSOR_SPEED);

            if (InputEngine.IsKeyPressed(Keys.S) ||
                InputEngine.IsKeyPressed(Keys.Down) &&
                SlotPosition <= (Slots.Count - 1))
            {
                SceneManager.AudioResource["snd_cursor"].Play();
                SlotPosition++;
                if (SlotPosition == (Slots.Count))
                {
                    SlotPosition = 0;
                }
            }
            else if (InputEngine.IsKeyPressed(Keys.W) ||
                     InputEngine.IsKeyPressed(Keys.Up) &&
                     SlotPosition >= 0)
            {
                SceneManager.AudioResource["snd_cursor"].Play();
                if (SlotPosition == 0)
                {
                    SlotPosition = Slots.Count;
                }
                SlotPosition--;
            }
        }
Ejemplo n.º 23
0
 void invert_onClicked(object sender, InputEngine.MouseArgs e)
 {
     Swapper s = AssociatedComponent as Swapper;
     s.Swapped = !s.Swapped;
     if (Settings.GameState == Settings.GameStates.Stopped)
         s.OrigSwapped = !s.OrigSwapped;
 }
Ejemplo n.º 24
0
        public override void Update()
        {
            float   radius = (Material as DirectionalLightMaterial).Attenuation;
            Color   color  = (Material as DirectionalLightMaterial).LightColor;
            Vector3 pos    = (Material as DirectionalLightMaterial).Position;

            if (InputEngine.IsKeyHeld(Keys.Add))
            {
                (Material as DirectionalLightMaterial).Attenuation += 0.5f;
            }
            else if (InputEngine.IsKeyHeld(Keys.Subtract))
            {
                (Material as DirectionalLightMaterial).Attenuation -= 0.5f;
            }

            if (InputEngine.IsKeyHeld(Keys.Left))
            {
                (Material as DirectionalLightMaterial).Position -= new Vector3(1, 0, 0);
            }
            else if (InputEngine.IsKeyHeld(Keys.Right))
            {
                (Material as DirectionalLightMaterial).Position += new Vector3(1, 0, 0);
            }

            base.Update();
        }
Ejemplo n.º 25
0
        public override void OnMouseDown(InputEngine.MouseArgs e)
        {
            base.OnMouseDown(e);

            x = e.curState.X;
            y = e.curState.Y;
            btn = e.button;
        }
Ejemplo n.º 26
0
 public void update()
 {
     if (InputEngine.IsKeyPressed(Keys.Enter))
     {
         SoundEffectInstance soundPlayer = null;
         AudioPlayer.AudioManager.Play(ref soundPlayer, text);
     }
 }
Ejemplo n.º 27
0
 public override void onButtonUp(InputEngine.MouseArgs e)
 {
     if (e.button == 0 && isdnd)
     {
         isdnd = false;
         e.Handled = true;
     }
 }
Ejemplo n.º 28
0
 public override void onButtonDown(InputEngine.MouseArgs e)
 {
     base.onButtonDown(e);
     e.Handled = true;
     if (!bok.IsIn(e.curState.X, e.curState.Y) && !breset.IsIn(e.curState.X, e.curState.Y) &&
         !bcancel.IsIn(e.curState.X, e.curState.Y))
         seq.AddRecord();
 }
Ejemplo n.º 29
0
        public override void OnMouseUp(InputEngine.MouseArgs e)
        {
            base.OnMouseUp(e);

            btn = -1;
            x = 0;
            y = 0;
        }
Ejemplo n.º 30
0
 private void Awake()
 {
     InputEngine = InputEngine ?? FindObjectOfType <InputEngine>();
     Debug.Assert(InputEngine != null);
     Debug.Assert(InputEngine.LinePrefab != null);
     Debug.Assert(PolylineMaterial != null);
     Debug.Assert(SplineMaterial != null);
 }
Ejemplo n.º 31
0
 public override void onMouseMove(InputEngine.MouseMoveArgs e)
 {
     bool wasover = isMouseOver;
     base.onMouseMove(e);
     if (isMouseOver && !wasover)
     {
         Sound.SoundPlayer.MenuMouseOver();
     }
 }
Ejemplo n.º 32
0
        public override void OnMouseMove(InputEngine.MouseMoveArgs e)
        {
            base.OnMouseMove(e);

            if (btn != -1)
            {
                Resistance += (float)(e.dy)/10f;
            }
        }
Ejemplo n.º 33
0
 public void Clear()
 {
     firstText = false;
     Name      = string.Empty;
     output    = string.Empty;
     input.KeysPressedInLastFrame.Clear();
     InputEngine.ClearState();
     Done = false;
 }
Ejemplo n.º 34
0
        public void PlaySound()
        {
            if (InputEngine.IsMouseLeftClick() && bounds.Contains(InputEngine.CurrentMouseState.Position))
            {
                //Console.WriteLine("Doing this");

                AudioManager.Play(ref player, soundKey);
            }
        }
Ejemplo n.º 35
0
        protected override void Update(GameTime gameTime)
        {
            if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed || Keyboard.GetState().IsKeyDown(Keys.Escape))
            {
                LeaveGame();
                Exit();

                #region starting in menu and switching to game
                //sets mouse state
                mouseState = Mouse.GetState();

                //switch for setting the scene
                switch (CurrentScreen)
                {
                case MENU:
                    //What we want to happen in the MENU screen goes in here.
                    //GO TO PLAYGAME SCREEN

                    if (playGameButton.update(new Vector2(mouseState.X, mouseState.Y)) == true && mouseState != previousMouseState && mouseState.LeftButton == ButtonState.Pressed && !firstText && !Done)
                    {
                        Name      = Output;
                        Output    = string.Empty;
                        firstText = true;
                        InputEngine.ClearState();
                        CurrentScreen = PLAYGAME;
                    }

                    if (InputEngine.IsKeyPressed(Keys.Enter) && firstText && !Done)
                    {
                        Output = string.Empty;
                        Done   = true;
                    }
                    if (InputEngine.IsKeyPressed(Keys.Back))
                    {
                        if (Output.Length > 0)
                        {
                            Output = Output.Remove(Output.Length - 1);
                        }
                    }
                    if (InputEngine.IsKeyPressed(Keys.Space))
                    {
                        Output += " ";
                    }
                    break;

                case PLAYGAME:
                    //What we want to happen when we play our GAME goes in here.
                    startGame();
                    break;
                }
            }
            // TODO: Add your update logic here

            previousMouseState = mouseState;
            #endregion
            base.Update(gameTime);
        }
Ejemplo n.º 36
0
 public override void onButtonDown(InputEngine.MouseArgs e)
 {
     if (IsIn(e.curState.X, e.curState.Y) && e.button == 0)
     {
         isdnd = true;
         ChangeScale(e.curState.X);
         e.Handled = true;
     }
 }
Ejemplo n.º 37
0
 public void deleteClick(object sender, InputEngine.MouseArgs e)
 {
     Sound.SoundPlayer.PlayButtonClick();
     if (saves.SelectedIndex == -1) return;
     mb = YesNoMessageBox.Show("Are you sure you want\r\nto delete the following file: \r\n" +
         saves.GetSelected() + "?");
     mb.onButtonClicked += new YesNoMessageBox.ButtonClickedEventHandler(mb_onButtonClicked);
     GUIEngine.AddHUDScene(mb);
 }
        public void Update()
        {
            if (InputEngine.IsKeyPressed(Keys.P))
            {
                // The line below acts as a toggle, much quicker than an if else statement.
                Active = !Active;
            }

            if (!Active)
            {
                return;
            }
            if (InputEngine.IsKeyPressed(Keys.Down))
            {
                if (current.Next != null)
                {
                    current.Value.InFocus = false;
                    current = current.Next;
                    current.Value.InFocus = true;
                }
                else
                {
                    current.Value.InFocus = false;
                    current = MenuList.First;
                    current.Value.InFocus = true;
                }

                // add rap around
            }
            if (InputEngine.IsKeyPressed(Keys.Up))
            {
                if (current.Previous != null)
                {
                    current.Value.InFocus = false;
                    current = current.Previous;
                    current.Value.InFocus = true;
                }
                else
                {
                    current.Value.InFocus = false;
                    current = MenuList.Last;
                    current.Value.InFocus = true;
                }
            }

            // add a check to check and see if one of the menu Items is selected.
            if (InputEngine.IsKeyPressed(Keys.Enter))
            {
                current.Value.Selected = true;
            }

            if (current.Value.Selected)
            {
                SelectedText           = current.Value.text;
                current.Value.Selected = false;
            }
        }
Ejemplo n.º 39
0
 /// <summary>
 /// Allows the game to perform any initialization it needs to before starting to run.
 /// This is where it can query for any required services and load any non-graphic
 /// related content.  Calling base.Initialize will enumerate through any components
 /// and initialize them as well.
 /// </summary>
 protected override void Initialize()
 {
     // TODO: Add your initialization logic here
     //worldRect = new Rectangle(new Point(0, 0), worldSize.ToPoint());
     //followCamera = new FollowCamera(this, Vector2.Zero, worldSize);
     inputEngine = new InputEngine(this);
     LidgrenClient.StartServer();
     base.Initialize();
 }
Ejemplo n.º 40
0
        public override void OnMouseWheel(InputEngine.MouseWheelMoveArgs e)
        {
            base.OnMouseWheel(e);

            if (e.delta != 0)
            {
                Resistance += (float)(e.delta) / 120f;
            }
        }
Ejemplo n.º 41
0
        private void copy()
        {
            if (SelectionStart == -1 || SelectionLength == 0)
            {
                return;
            }
            String s = SelectedText;

            InputEngine.SetClipboardText(s);
        }
Ejemplo n.º 42
0
        //if the spacebar is pressed
        //Use Engine.LoadScene to load the BowlingScene
        public override void HandleInput()
        {
            if (InputEngine.IsKeyPressed(Keys.Space))//load the level scene when pressed
            {
                Engine.LoadScene(new DartScene(Engine));
                MediaPlayer.Play(Music);//plays the backing theme , bonus points if you recognise it
            }

            base.HandleInput();
        }
Ejemplo n.º 43
0
 public override void onKeyPressed(InputEngine.KeyboardArgs e)
 {
     if (e.key == Keys.Delete.GetHashCode() && bRemove.isEnabled)
     {
         bRemove_onClicked(null, null);
         e.Handled = true;
         return;
     }
     base.onKeyPressed(e);
 }
Ejemplo n.º 44
0
        public override void Update()
        {
            if (warningFadeState < 100)
            {
                if (fbo == null || fbo.Width != Main.WindowWidth)
                {
                    fbo = new RenderTarget2D(GraphicsEngine.Renderer.GraphicsDevice, Main.WindowWidth, Main.WindowHeight);
                }
                GraphicsEngine.Renderer.EnableFBO(fbo);
                GraphicsEngine.Renderer.BeginUnscaled();

                #region ActualDraw
                GraphicsEngine.Renderer.Draw(title, new Rectangle(0, 0, Main.WindowWidth, Main.WindowHeight), Color.White);
                GraphicsEngine.Renderer.Draw(dots, new Rectangle(
                                                 439 * Main.WindowWidth / 1920, 872 * Main.WindowHeight / 1080,
                                                 1003 * Main.WindowWidth / 1920, 14 * Main.WindowHeight / 1080),
                                             Color.White);
                GraphicsEngine.Renderer.Draw(gradient, new Rectangle(
                                                 gradStart, 872 * Main.WindowHeight / 1080,
                                                 480 * Main.WindowWidth / 1920, 14 * Main.WindowHeight / 1080),
                                             Color.White);
                #endregion

                GraphicsEngine.Renderer.End();
                GraphicsEngine.Renderer.DisableFBO();
            }

            if (warningFadeState != 0 && warningFadeState < 200)
            {
                warningFadeState += 4;
            }
            else if (warningFadeState == 200)
            {
                warningTimeout++;
                InputEngine.Update();
                if (InputEngine.curMouse.LeftButton != ButtonState.Released || InputEngine.curMouse.RightButton != ButtonState.Released ||
                    InputEngine.curKeyboard.GetPressedKeys().Length != 0)
                {
                    warningFadeState += 4;
                }
                if (warningTimeout >= 800)
                {
                    warningFadeState += 4;
                }
            }
            else if (warningFadeState > 200)
            {
                warningFadeState += 4;
                if (warningFadeState >= 300)
                {
                    Graphics.GUI.GUIEngine.ChangeScene(Graphics.GUI.GUIEngine.s_mainMenu, "GUIMain");
                }
            }
        }
Ejemplo n.º 45
0
 private bool InputShoot()
 {
     if (InputEngine.IsMouseLeftHeld() || InputEngine.IsButtonHeld(Buttons.RightTrigger))
     {
         return(true);
     }
     else
     {
         return(false);
     }
 }
Ejemplo n.º 46
0
 public virtual void onButtonClick(InputEngine.MouseArgs e)
 {
     lock (controls)
     {
         foreach (Control c in controls)
         {
             if (c.isVisible) c.onButtonClick(e);
             if (InputEngine.eventHandled) break;
         }
     }
 }
Ejemplo n.º 47
0
 public bool EscapeScene()
 {
     if (InputEngine.IsKeyPressed(EscapeKey))
     {
         return(true);
     }
     else
     {
         return(false);
     }
 }
Ejemplo n.º 48
0
 public override void onButtonClick(InputEngine.MouseArgs e)
 {
     if (!IsIn(e.curState.X, e.curState.Y) && !GUIEngine.s_subComponentButtons.IsIn(e.curState.X, e.curState.Y))
     {
         GUIEngine.RemoveHUDScene(this);
         GUIEngine.RemoveHUDScene(GUIEngine.s_subComponentButtons);
         GUIEngine.s_subComponentButtons.isVisible = false;
         e.Handled = true;
     }
     base.onButtonClick(e);
 }
Ejemplo n.º 49
0
 public override void onButtonClick(InputEngine.MouseArgs e)
 {
     base.onButtonClick(e);
     if (tbCode.isVisible)
     {
         if (!tbCode.IsIn(e.curState.X, e.curState.Y))
         {
             tbCode.isVisible = false;
         }
         e.Handled = true;
     }
 }
Ejemplo n.º 50
0
        public void loadClick(object sender, InputEngine.MouseArgs e)
        {
            Sound.SoundPlayer.PlayButtonClick();
            if (saves.SelectedIndex == -1) return;

            GUIEngine.ChangeScene(GUIEngine.s_loading, "GUILoading");
            //GUIEngine.curScene = GUIEngine.s_loading;
            //Main.curState = "GUILoading";

            System.Threading.Thread t = new System.Threading.Thread(new System.Threading.ThreadStart(_load));
            t.Start();
        }
Ejemplo n.º 51
0
 void close_onClicked(object sender, InputEngine.MouseArgs e)
 {
     close.StaySelected = false;
     close.isMouseOver = false;
     close.WasInitiallyDrawn = false;
     Close();
 }
Ejemplo n.º 52
0
 public override void onKeyUp(InputEngine.KeyboardArgs e)
 {
     base.onKeyUp(e);
     e.Handled = true;
 }
Ejemplo n.º 53
0
 public override void onKeyPressed(InputEngine.KeyboardArgs e)
 {
     base.onKeyPressed(e);
     Close();
     e.Handled = true;
 }
Ejemplo n.º 54
0
 public override void onButtonUp(InputEngine.MouseArgs e)
 {
     base.onButtonUp(e);
     e.Handled = true;
 }
Ejemplo n.º 55
0
 public override void onButtonClick(InputEngine.MouseArgs e)
 {
     base.onButtonClick(e);
     //Close();
     e.Handled = true;
 }
Ejemplo n.º 56
0
 public override void onMouseWheelMove(InputEngine.MouseWheelMoveArgs e)
 {
     if (IsIn(e.curState.X,e.curState.Y))
     {
         e.Handled = true;
     }
     base.onMouseWheelMove(e);
 }
Ejemplo n.º 57
0
 public override void onMouseMove(InputEngine.MouseMoveArgs e)
 {
     base.onMouseMove(e);
     e.Handled = true;
 }
Ejemplo n.º 58
0
 public override void onButtonUp(InputEngine.MouseArgs e)
 {
     if (IsFading)
     {
         e.Handled = true;
         return;
     }
     base.onButtonUp(e);
 }
Ejemplo n.º 59
0
 public override void onMouseWheelMove(InputEngine.MouseWheelMoveArgs e)
 {
     if (!e.Handled)
     {
         logoffset -= e.delta / 120 * 4;
         CheckLogRange();
         updateLog();
     }
     e.Handled = true;
 }
Ejemplo n.º 60
0
        public override void onKeyPressed(InputEngine.KeyboardArgs e)
        {
            e.Handled = true;
            if (e.key == Keys.Enter.GetHashCode() && InputEngine.Control)
            {
                DoCommand(tbinput.Text);
                for (int i = InputHistory.Length - 1; i > 0; i--)
                {
                    InputHistory[i] = InputHistory[i - 1];
                }
                InputHistory[0] = tbinput.Text;
                tbinput.Text = "";
                CurInputHistorySelected = -1;
                logoffset = OutputEngine.LOG_LENGTH;
                CheckLogRange();
                updateLog();
                return;
            }
            if (e.key == Keys.Up.GetHashCode())
            {
                CurInputHistorySelected++;
                if (CurInputHistorySelected >= InputHistory.Length)
                    CurInputHistorySelected = InputHistory.Length - 1;

                if (InputHistory[CurInputHistorySelected] == null)
                    CurInputHistorySelected--;

                if (CurInputHistorySelected == -1)
                    tbinput.Text = "";
                else
                    tbinput.Text = InputHistory[CurInputHistorySelected];
                tbinput.Cursor = tbinput.Text.Length;
                return;
            }
            if (e.key == Keys.Down.GetHashCode())
            {
                CurInputHistorySelected--;
                if (CurInputHistorySelected < -1)
                    CurInputHistorySelected = -1;

                if (CurInputHistorySelected == -1)
                    tbinput.Text = "";
                else
                    tbinput.Text = InputHistory[CurInputHistorySelected];
                tbinput.Cursor = tbinput.Text.Length;
                return;
            }
            InputEngine.eventHandled = false;
            CurInputHistorySelected = -1;
            base.onKeyPressed(e);
            e.Handled = true;
        }