public override void Update(GameTime gameTime)
        {
            var time = gameTime.TotalGameTime.TotalSeconds;
            _metadata.Set(new TypedName<Vector4>("colour"), new Vector4((float)Math.Sin(time), (float)Math.Sin(time * 2), (float)Math.Sin(time * 3), 1f));

            base.Update(gameTime);
        }
Example #2
0
        public override void Draw(GameTime gameTime)
        {
            if (Game.DisplayUI)
                UI.Draw(gameTime);

            base.Draw(gameTime);
        }
Example #3
0
        public override void Update(GameTime gameTime)
        {
            var keyboard = Keyboard.GetState();
            if (keyboard.IsKeyDown(Keys.D1))
                _ssaoPlan.Apply();
            else if (keyboard.IsKeyDown(Keys.D3))
                _edgeDetectPlan.Apply();
            else if (keyboard.IsKeyDown(Keys.D4))
                _lightingPlan.Apply();
            else if (keyboard.IsKeyDown(Keys.D5))
                _normalPlan.Apply();
            else if (keyboard.IsKeyDown(Keys.D6))
                _depthPlan.Apply();
            else if (keyboard.IsKeyDown(Keys.D7))
                _diffusePlan.Apply();
            else if (keyboard.IsKeyDown(Keys.D8))
                _noAaPlan.Apply();
            else
                _fullPlan.Apply();

            if (keyboard.IsKeyDown(Keys.D2))
                _ssaoIntensity.Value = 0;
            else
                _ssaoIntensity.Value = 20;

            _scene.Update(gameTime);
            base.Update(gameTime);
        }
Example #4
0
        public void Evaluate(GameTime gameTime, Control focused, UserInterface ui)
        {
            ui.FindControls(Position, _controls);

            foreach (var item in _cooled)
                item.HeatCount--;
            foreach (var item in _warmed)
                item.HeatCount++;

            var type = typeof(MouseDevice);

            for (int i = 0; i < _controls.Count; i++)
            {
                _controls[i].Gestures.Evaluate(gameTime, this);

                if (_controls[i].Gestures.BlockedDevices.Contains(type))
                    break;
            }

            ui.EvaluateGlobalGestures(gameTime, this);

            _previous.Clear();
            _previous.AddRange(_controls);
            _blocked.Clear();
            _controls.Clear();
        }
Example #5
0
        private void MouseDown(IGesture gesture, GameTime time, IInputDevice device)
        {
            if (RespondOnMouseDown)
                OnSelected();

            _mouseDown = true;
        }
Example #6
0
        public void Evaluate(GameTime gameTime, Control focused, UserInterface ui)
        {
            var type = typeof(TouchDevice);

            for (int i = 0; i < _touches.Count; i++)
            {
                var t = _touches[i];
                Current = t;

                ui.FindControls(t.Position.FromXNA(), _buffer);
                _current.AddRange(_buffer);

                for (int j = 0; j < _buffer.Count; j++)
                {
                    _buffer[j].Gestures.Evaluate(gameTime, this);

                    if (_buffer[j].Gestures.BlockedDevices.Contains(type))
                        break;
                }

                ui.EvaluateGlobalGestures(gameTime, this);
                _blocked.Clear();
                _buffer.Clear();
            }

            foreach (var item in _cooled)
                item.HeatCount--;
            foreach (var item in _warmed)
                item.HeatCount++;

            _previous.Clear();
            _previous.AddRange(_current);
            _current.Clear();
        }
Example #7
0
 /// <summary>
 /// Updates the control and its' children.
 /// </summary>
 /// <param name="gameTime">The current game time.</param>
 public override void Update(GameTime gameTime)
 {
     var c = IsFocused || IsWarm ? Highlight : Colour;
     Label.Colour = c;
     SetSize((int)Label.TextSize.X, (int)Label.TextSize.Y);
     base.Update(gameTime);
 }
Example #8
0
        public override void Update(GameTime gameTime)
        {
            base.Update(gameTime);

            _scene.Update((float)gameTime.ElapsedGameTime.TotalSeconds);
            //_dude.Transform *= Matrix4x4.CreateTranslation(50 * new Vector3(_animationPlayer.RootBoneTransfomationDelta.Translation.X, 0, _animationPlayer.RootBoneTransfomationDelta.Translation.Z));
            //_dude.Transform = Matrix4x4.CreateFromAxisAngle(Vector3.UnitY, (float)gameTime.TotalSeconds() / 4) * Matrix4x4.CreateScale(20f) * Matrix4x4.CreateTranslation(0, 0, 175);
        }
Example #9
0
 /// <summary>
 /// Draws visible screens.
 /// </summary>
 /// <param name="gameTime">The game time.</param>
 public void Draw(GameTime gameTime)
 {
     foreach (var screen in _screens)
     {
         if (screen.TransitionState != TransitionState.Hidden)
             screen.Draw(gameTime);
     }
 }
Example #10
0
        public override void Update(GameTime gameTime)
        {
            foreach (var actor in UI.Actors)
                actor.Update(gameTime);

            UI.Update(gameTime);
            base.Update(gameTime);
        }
Example #11
0
        public void Update(GameTime gameTime)
        {
            _touches = TouchPanel.GetState();
            _buffer = new List<Control>();
            _current = new List<Control>();
            _previous = new List<Control>();
            _blocked = new List<int>();

            _cooled = _previous.Except(_current).Distinct();
            _warmed = _current.Except(_previous).Distinct();
        }
Example #12
0
        public void Update(GameTime gameTime)
        {
            _previousState = _currentState;
            _currentState = Keyboard.GetState(_player);

            lock (_newCharacters)
            {
                _characters.Clear();
                _characters.AddRange(_newCharacters);
                _newCharacters.Clear();
            }
        }
Example #13
0
        public override void Update(GameTime gameTime)
        {
            if (Keyboard.GetState().IsKeyDown(Keys.Space) && !_keyboardState.IsKeyDown(Keys.Space))
                _spin = !_spin;
            _keyboardState = Keyboard.GetState();

            if (_spin)
                _rotation += (float)gameTime.ElapsedGameTime.TotalSeconds;
            _camera.View = Matrix4x4.CreateLookAt(new Vector3((float)Math.Sin(_rotation) * 300, 0, (float)Math.Cos(_rotation) * 300), new Vector3(0, 0, 0), Vector3.UnitY);

            _scene.Update((float)gameTime.ElapsedGameTime.TotalSeconds);
            base.Update(gameTime);
        }
Example #14
0
        public override void Update(GameTime gameTime)
        {
            _scene.Update(gameTime);
            base.Update(gameTime);

            if (!Keyboard.GetState().IsKeyDown(Keys.F))
            {
                _fullPlan.Apply();
            }
            else
            {
                _noAaPlan.Apply();
            }
        }
Example #15
0
 public void Draw(GameTime gametime)
 {
     if (!drawn)
     {
         drawn = true;
         room.Draw(gametime);
         foreach (RoomGraph n in neighbourg.Values)
         {
             if (!n.drawn)
                 n.Draw(gametime);
         }
         drawn = false;
     }
 }
Example #16
0
        public override void Update(GameTime gameTime)
        {
            if (_tracker.Statistic.IsDisposed)
            {
                Dispose();
                return;
            }

            bool read, changed;
            float value = _tracker.GetValue(out read, out changed);
            if (read)
                _graph.Add(value);
            if (changed)
                _value.Text = value.ToString(CultureInfo.InvariantCulture);
            base.Update(gameTime);
        }
Example #17
0
        public Server(string[] args)
        {
            Log("Setting up server ..");
            _random = new Random(Guid.NewGuid().GetHashCode());
            _logic = new PureLogic(this, null, _random);
            foreach (Actor a in _logic.map.actors)
            {
                a.online = false;
            }
            _clients = new Dictionary<IPEndPoint, ClientData>();
            _gameTime = new Microsoft.Xna.Framework.GameTime();

            discoveredBy = new List<string>();
            if (args.Length > 0)
            {
                _servername = args[0];
            }
            try
            {
                _config = new NetPeerConfiguration("DungeonCrawler");
                _config.EnableMessageType(NetIncomingMessageType.DiscoveryRequest);
                _config.EnableMessageType(NetIncomingMessageType.ConnectionApproval);
                _config.Port = 666;
                _config.PingInterval = 0.25f;
                _config.ConnectionTimeout = 20f;

                _config.MaximumHandshakeAttempts = 3;
                _config.ResendHandshakeInterval = 5;
                _config.UseMessageRecycling = true;
                _config.EnableUPnP = true;
                _config.AcceptIncomingConnections = false;

                _server = new NetServer(_config);

                _server.Start();
                _server.UPnP.ForwardPort(666, "Dungeon Crawler");

            }
            catch (Exception ex)
            {
                Log("Error during startup: " + ex.Message);
                error = true;
            }

            Console.CursorTop = 0;
            Console.CursorLeft = 0;
        }
Example #18
0
        public void Evaluate(GameTime gameTime, Control focused, UserInterface ui)
        {
            var type = typeof(KeyboardDevice);
            _charactersBlocked = false;

            for (var control = focused; control != null; control = control.Parent)
            {
                control.Gestures.Evaluate(gameTime, this);

                if (control.Gestures.BlockedDevices.Contains(type))
                    break;
            }

            ui.EvaluateGlobalGestures(gameTime, this);

            _blocked.Clear();
        }
Example #19
0
 /// <summary>
 /// Updates the transition.
 /// </summary>
 /// <param name="gameTime">Game time.</param>
 public void Update(GameTime gameTime)
 {
     var dt = gameTime.Seconds();
     if (_targettingOn)
     {
         if (_onTime.Ticks == 0)
             _progress = 1;
         else
             _progress = MathHelper.Clamp(_progress + (dt / (float)_onTime.TotalSeconds), 0, 1);
     }
     else
     {
         if (_offTime.Ticks == 0)
             _progress = 0;
         else
             _progress = MathHelper.Clamp(_progress - (dt / (float)_offTime.TotalSeconds), 0, 1);
     }
 }
		public override void Run()
		{
			//Grab the Update method manually since it's protected
			var vanilla = this.SourceDefinition.Type("Terraria.Main").Method("Update");

			var tmp = new Microsoft.Xna.Framework.GameTime();
			var cbkBegin = this.Method(() => OTAPI.Callbacks.Terraria.Main.UpdateBegin(null, ref tmp));
			var cbkEnd = this.Method(() => OTAPI.Callbacks.Terraria.Main.UpdateEnd(null, ref tmp));

			vanilla.Wrap
			(
				beginCallback: cbkBegin,
				endCallback: cbkEnd,
				beginIsCancellable: false,
				noEndHandling: false,
				allowCallbackInstance: true
			);
		}
Example #21
0
        public override void Update(GameTime gameTime)
        {
            base.Update(gameTime);

            _scene.Update((float)gameTime.ElapsedGameTime.TotalSeconds);

            MouseState mouse = Mouse.GetState();
            KeyboardState keyboard = Keyboard.GetState();

            Game.IsMouseVisible = false;
            if (mouse.IsButtonDown(MouseButtons.Right))
            {
                var mousePosition = new Vector2(mouse.X, mouse.Y);
                var mouseDelta = mousePosition - _resolution.Value / 2;

                _cameraRotation.Y -= mouseDelta.X * gameTime.Seconds() * 0.1f;
                _cameraRotation.X -= mouseDelta.Y * gameTime.Seconds() * 0.1f;

                var rotation = Matrix4x4.CreateFromYawPitchRoll(_cameraRotation.Y, _cameraRotation.X, _cameraRotation.Z);
                var forward = Vector3.TransformNormal(-Vector3.UnitZ, rotation);
                var right = Vector3.TransformNormal(Vector3.UnitX, rotation);

                if (keyboard.IsKeyDown(Keys.W))
                    _cameraPosition += forward * gameTime.Seconds() * 50;
                if (keyboard.IsKeyDown(Keys.S))
                    _cameraPosition -= forward * gameTime.Seconds() * 50f;
                if (keyboard.IsKeyDown(Keys.A))
                    _cameraPosition -= right * gameTime.Seconds() * 50f;
                if (keyboard.IsKeyDown(Keys.D))
                    _cameraPosition += right * gameTime.Seconds() * 50f;

                Matrix4x4 invView;
                Matrix4x4.Invert(rotation * Matrix4x4.CreateTranslation(_cameraPosition), out invView);
                _camera.View = invView;

                Mouse.SetPosition((int)_resolution.Value.X / 2, (int)_resolution.Value.Y / 2);
                //camera.View = Matrix.CreateLookAt(new Vector3(0, 60, -7), new Vector3(50, 30, -50), Vector3.Up);
            }
        }
Example #22
0
        public override void Draw(GameTime gameTime)
        {
            base.Draw(gameTime);

            _scene.Draw();
        }
Example #23
0
 private void PreviousOption(IGesture gesture, GameTime time, IInputDevice device)
 {
     SelectedOption--;
 }
        public override void Draw(GameTime gameTime)
        {
            _quad.Draw(_material, _metadata);

            base.Draw(gameTime);
        }
Example #25
0
        public override void Update(GameTime gameTime)
        {
            base.Update(gameTime);

            _scene.Update((float) gameTime.ElapsedGameTime.TotalSeconds);
        }
Example #26
0
 private void NextOption(IGesture gesture, GameTime time, IInputDevice device)
 {
     SelectedOption++;
 }
Example #27
0
 public void Update(GameTime gameTime)
 {
     _previousState = _currentState;
     _currentState = Mouse.GetState();
 }
Example #28
0
 /// <summary>
 /// Updates the screen.
 /// </summary>
 /// <param name="gameTime">The game time.</param>
 public virtual void Update(GameTime gameTime)
 {
 }
Example #29
0
 /// <summary>
 /// Draws this instance.
 /// </summary>
 /// <param name="gameTime">The game time.</param>
 public virtual void Draw(GameTime gameTime)
 {
 }
Example #30
0
 public override void Update(GameTime gameTime)
 {
     _scene.Update(gameTime);
     base.Update(gameTime);
 }