public BouncingLogoWithGravity(Content content, Randomizer random, InputCommands inputCommands)
     : base(content, random)
 {
     inputCommands.Add(Key.Space, () => Reset(random));
     inputCommands.Add(MouseButton.Left, mouse => Reset(random));
     inputCommands.Add((Touch touch) => Reset(random));
 }
Esempio n. 2
0
 public ItemHandler(Game game, Score score, Content content, InputCommands inputCommands,
     Renderer renderer)
 {
     this.game = game;
     this.score = score;
     this.renderer = renderer;
     CreateItems(content);
     CreateIcons(content);
     SelectItem(0);
     inputCommands.AddMouseMovement(mouse => CurrentItem.UpdatePosition(mouse.Position));
     inputCommands.Add(MouseButton.Left, State.Pressing,
         mouse => SelectIconOrHandleItemInGame(mouse.Position));
     inputCommands.Add(touch => SelectIconOrHandleItemInGame(touch.GetPosition(0)));
 }
Esempio n. 3
0
 public UI(ItemHandler items, Score score, Content content, Renderer renderer, Window window,
     InputCommands inputCommands)
     : base(content.Load<Image>("GrassBackground"), renderer.Screen.Viewport)
 {
     window.ShowCursor = false;
     window.Title = "Game Of Death - Kill rabbits before they occupy more than 75% of the world!";
     inputCommands.Add(Key.Escape, window.Dispose);
     RenderLayer = MinRenderLayer;
     AddUITop(content, renderer);
     AddUIBottom(content, renderer);
     AddUILeft(content, renderer);
     AddUIRight(content, renderer);
     renderer.Screen.ViewportSizeChanged += () => Update(renderer);
 }
Esempio n. 4
0
 private void RegisterInputCommands(InputCommands inputCommands, Time time)
 {
     inputCommands.Add(Key.CursorLeft, State.Pressed,
         () => xPosition -= PaddleMovementSpeed * time.CurrentDelta);
     inputCommands.Add(Key.CursorRight, State.Pressed,
         () => xPosition += PaddleMovementSpeed * time.CurrentDelta);
     inputCommands.Add(MouseButton.Left, State.Pressed,
         mouse => xPosition += mouse.Position.X - Position.X);
     inputCommands.Add(State.Pressed, touch => xPosition += touch.GetPosition(0).X - Position.X);
     inputCommands.Add(GamePadButton.Left, State.Pressed,
         () => xPosition -= PaddleMovementSpeed * time.CurrentDelta);
     inputCommands.Add(GamePadButton.Right, State.Pressed,
         () => xPosition += PaddleMovementSpeed * time.CurrentDelta);
 }
Esempio n. 5
0
 private void RegisterFireBallCommand(InputCommands inputCommands)
 {
     inputCommands.Add(Key.Space, State.Pressing, () => FireBallFromPaddle());
     inputCommands.Add(MouseButton.Left, State.Pressing, mouse => FireBallFromPaddle());
     inputCommands.Add((Touch touch) => FireBallFromPaddle());
     inputCommands.Add(GamePadButton.A, State.Pressing, () => FireBallFromPaddle());
 }