示例#1
0
文件: Button.cs 项目: xoxota99/Myre
        private void MouseDown(IGesture gesture, GameTime time, IInputDevice device)
        {
            if (RespondOnMouseDown)
                OnSelected();

            _mouseDown = true;
        }
        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);
        }
示例#3
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();
        }
示例#4
0
文件: Demo.cs 项目: martindevans/Myre
        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);
        }
示例#5
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();
        }
示例#6
0
        public override void Draw(GameTime gameTime)
        {
            if (Game.DisplayUI)
                UI.Draw(gameTime);

            base.Draw(gameTime);
        }
示例#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);
 }
示例#8
0
        public override void Update(GameTime gameTime)
        {
            foreach (var actor in UI.Actors)
                actor.Update(gameTime);

            UI.Update(gameTime);
            base.Update(gameTime);
        }
示例#9
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);
        }
示例#10
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);
     }
 }
示例#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();
        }
示例#12
0
        public void Update(GameTime gameTime)
        {
            _previousState = _currentState;
            _currentState = Keyboard.GetState(_player);

            lock (_newCharacters)
            {
                _characters.Clear();
                _characters.AddRange(_newCharacters);
                _newCharacters.Clear();
            }
        }
示例#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);
        }
示例#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();
            }
        }
示例#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;
     }
 }
示例#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);
        }
示例#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;
        }
示例#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();
        }
示例#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);
     }
 }
示例#20
0
		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
			);
		}
示例#21
0
文件: TextTest.cs 项目: xoxota99/Myre
        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);
            }
        }
示例#22
0
 public virtual void update(Microsoft.Xna.Framework.GameTime Time)
 {
     this.timeRemaining -= Time.ElapsedGameTime.Milliseconds;
     this.timeRemainingUntilNextTrigger -= Time.ElapsedGameTime.Milliseconds;
 }
示例#23
0
 public void Update(Microsoft.Xna.Framework.GameTime GameTime)
 {
     Time = GameTime;
 }
示例#24
0
 private void NextOption(IGesture gesture, GameTime time, IInputDevice device)
 {
     SelectedOption++;
 }
示例#25
0
 public override void Update(Microsoft.Xna.Framework.GameTime gameTime)
 {
     Map.CursorPosition        = new Microsoft.Xna.Framework.Vector3(CursorPosition.X, CursorPosition.Y, Map.CursorPosition.Z);
     Map.CursorPositionVisible = Map.CursorPosition;
     IsEnded = true;
 }
示例#26
0
 /// <summary>
 /// Draws a frame with a default clear color.
 /// </summary>
 /// <param name="gameTime">Time passed since last <see cref="Draw(GameTime)"/>.</param>
 public void Draw(GameTime gameTime)
 {
     FramesPerSecond = (float)(1 / gameTime.ElapsedGameTime.TotalSeconds);
     Draw(gameTime, Color.DarkOliveGreen);
 }
示例#27
0
 /// <summary>
 /// Updates sound manager.
 /// </summary>
 /// <param name="time">Data containing game time information.</param>
 public void Update(Microsoft.Xna.Framework.GameTime time)
 {
     //Updates FMOD
     CheckError(m_System.update());
 }
示例#28
0
 public override void Update(Microsoft.Xna.Framework.GameTime gameTime)
 {
 }
示例#29
0
        public override void Draw(GameTime gameTime)
        {
            _quad.Draw(_material, _metadata);

            base.Draw(gameTime);
        }
示例#30
0
 protected override void Draw(Microsoft.Xna.Framework.GameTime gameTime, RenderHelper render)
 {
 }
示例#31
0
 protected override void Draw(Microsoft.Xna.Framework.GameTime gameTime)
 {
     RenderProcess.Draw();
     base.Draw(gameTime);
 }
示例#32
0
 protected override void Update(Microsoft.Xna.Framework.GameTime gameTime)
 {
     base.Update(gameTime);
 }
 public override void Update(Microsoft.Xna.Framework.GameTime gameTime)
 {
     //_engine.Update();
     base.Update(gameTime);
 }
示例#34
0
 public void Update(Microsoft.Xna.Framework.GameTime time)
 {
     Tiles.ForEach(tile => tile.Update(time));
 }
示例#35
0
 /// <summary>
 /// Draws this instance.
 /// </summary>
 /// <param name="gameTime">The game time.</param>
 public virtual void Draw(GameTime gameTime)
 {
 }
示例#36
0
文件: TextTest.cs 项目: xoxota99/Myre
        public override void Draw(GameTime gameTime)
        {
            base.Draw(gameTime);

            _scene.Draw();
        }
 public void Update(Microsoft.Xna.Framework.GameTime gameTime)
 {
     _model.Update(gameTime);
 }
示例#38
0
 public void PreDrawnPhase(Microsoft.Xna.Framework.GameTime gt, SceneControl.IWorld mundo, SceneControl.IObject obj, Cameras.ICamera cam, IList <Light.ILight> lights, SceneControl.RenderHelper render)
 {
     material.PreDrawnPhase(gt, mundo, obj, cam, lights, render);
 }
示例#39
0
 /// <summary>
 /// Runs any operations needed at the beginning of the <see cref="Komodo.Core.Game.Update(GameTime)"/> loop.
 /// </summary>
 /// <remarks>
 /// Will initialize any new uninitialized <see cref="Komodo.Core.ECS.Components.SoundComponent"/> objects.
 /// </remarks>
 /// <param name="_">Time passed since last <see cref="Komodo.Core.Game.Update(GameTime)"/>.</param>
 public void PreUpdate(GameTime _)
 {
     InitializeComponents();
 }
 /// <summary>
 /// Update.
 /// </summary>
 /// <param name="gametime">The gametime.</param>
 /// <param name="obj">The obj.</param>
 /// <param name="lights">The lights.</param>
 public void Update(Microsoft.Xna.Framework.GameTime gametime, SceneControl.IObject obj, IWorld world)
 {
     shader.Update(gametime, obj, world.Lights);
 }
示例#41
0
 public override void Update(Microsoft.Xna.Framework.GameTime gameTime)
 {
     UnitSpawner.Update(gameTime);
     IsEnded = UnitSpawner.IsEnded;
 }
示例#42
0
 public override void Update(Microsoft.Xna.Framework.GameTime gameTime)
 {
     CMasterControl.mapManager.updateMap(gameTime);
 }
示例#43
0
        public override void Update(GameTime gameTime)
        {
            base.Update(gameTime);

            _scene.Update((float) gameTime.ElapsedGameTime.TotalSeconds);
        }
 /// <summary>
 /// This is called when the game should draw itself.
 /// </summary>
 /// <param name="gameTime">Provides a snapshot of timing values.</param>
 protected override void Draw(Microsoft.Xna.Framework.GameTime gameTime)
 {
     GraphicsDevice.Clear(ClearColor);
     base.Draw(gameTime);
 }
示例#45
0
 private void PreviousOption(IGesture gesture, GameTime time, IInputDevice device)
 {
     SelectedOption--;
 }
 public virtual void Update(Microsoft.Xna.Framework.GameTime time)
 {
     CurrentWorld.Update(time);
 }
示例#47
0
 public void Update(GameTime gameTime)
 {
     _previousState = _currentState;
     _currentState = Mouse.GetState();
 }
        protected override void AfterDraw(PloobsEngine.SceneControl.RenderHelper render, Microsoft.Xna.Framework.GameTime gt, ref Microsoft.Xna.Framework.Matrix activeView, ref Microsoft.Xna.Framework.Matrix activeProjection)
        {
            foreach (var item in primitives)
            {
                item.iDraw(activeView, activeProjection, render, batch);
            }

            base.AfterDraw(render, gt, ref activeView, ref activeProjection);
        }
示例#49
0
 /// <summary>
 /// Spricht die View im vorgegebenen Takt an.
 /// </summary>
 /// <remarks>
 /// Um den Aufruf muss sich nicht gekümmert werden.
 /// </remarks>
 /// <param name="gameTime">Weiterreichung von der Game-Klasse</param>
 public override void ViewUpdate(Microsoft.Xna.Framework.GameTime gameTime)
 {
     //Sorgt dafür, dass das Spiel im Hintergrund des Pausemenüs gerendert wird - TB
     previousState.ViewUpdate(gameTime);
     base.ViewUpdate(gameTime);
 }
示例#50
0
 public override void Draw(Microsoft.Xna.Framework.GameTime gt, Microsoft.Xna.Framework.Graphics.SpriteBatch batch, Tantric.Graphical.Camera cam)
 {
 }
示例#51
0
文件: SsaoTest.cs 项目: xoxota99/Myre
 public override void Update(GameTime gameTime)
 {
     _scene.Update(gameTime);
     base.Update(gameTime);
 }
示例#52
0
 public override void Update(Microsoft.Xna.Framework.GameTime gameTime)
 {
     Map.LayerManager.ListLayer[0].LayerGrid.ReplaceForegrounds(ListForegrounds);
 }
示例#53
0
 /// <summary>
 /// Updates the screen.
 /// </summary>
 /// <param name="gameTime">The game time.</param>
 public virtual void Update(GameTime gameTime)
 {
 }
示例#54
0
 public override void Update(Microsoft.Xna.Framework.GameTime gameTime)
 {
     Map.PlayerRoster.TeamCharacters.RemoveAll(_CharacterName);
     ExecuteEvent(this, 0);
     IsEnded = true;
 }
示例#55
0
 public void Draw(Microsoft.Xna.Framework.GameTime gameTime, SpriteBatch spriteBatch)
 {
     currentSprite.Draw(gameTime, spriteBatch);
 }
示例#56
0
文件: Deck.cs 项目: iblaauw/Aegis
 protected override void UpdateObject(Microsoft.Xna.Framework.GameTime gameTime)
 {
     //NOOP
 }
示例#57
0
 /// <summary>
 /// Pos drawn Function.
 /// Called after all objects are Draw
 /// </summary>
 /// <param name="gt">The gt.</param>
 /// <param name="obj">The obj.</param>
 /// <param name="cam">The cam.</param>
 /// <param name="lights">The lights.</param>
 /// <param name="render">The render.</param>
 public void PosDrawnPhase(Microsoft.Xna.Framework.GameTime gt, SceneControl.IObject obj, Cameras.ICamera cam, IList <Light.ILight> lights, SceneControl.RenderHelper render)
 {
     shader.PosDrawPhase(gt, obj, render, cam, lights);
 }
示例#58
0
 /// <summary>
 /// Erlaubt die Ausführung der in der View enthalten Spielmechanik.
 /// </summary>
 /// <param name="game">Referenz des Games aus dem XNA Framework.</param>
 /// <param name="gameTime">Bietet die aktuelle Spielzeit an.</param>
 /// <param name="state">Gibt den aktuellen State an von dem diese Funktion aufgerufen wurde.</param>
 public void Update(GameManager game, Microsoft.Xna.Framework.GameTime gameTime, State state)
 {
 }
 public override void Update(Microsoft.Xna.Framework.GameTime gameTime)
 {
     throw new NotImplementedException();
 }
示例#60
0
 public void Update(Microsoft.Xna.Framework.GameTime gametime, SceneControl.IObject obj, SceneControl.IWorld world)
 {
     material.Update(gametime, obj, world);
 }