コード例 #1
0
ファイル: TrackRenderer.cs プロジェクト: whztt07/DeltaEngine
		private void AddVerticesToBatch(Track track)
		{
			screen = ScreenSpace.Current;
			innerBounds = track.TrackInnerBounds;
			outerBounds = track.TrackOuterBounds;
			var batch =
				(Batch2D)renderer.FindOrCreateBatch(track.Material, BlendMode.Normal, innerBounds.Length);
			for (int index = 0; index < innerBounds.Length; index++)
				AddIndicesAndVerticesForTrackPart(batch, index);
		}
コード例 #2
0
ファイル: Car.cs プロジェクト: whztt07/DeltaEngine
		public Car(Vector2D startPosition, Track setTrack)
			: base("CarImage", new Rectangle(startPosition, new Size(0.075f, 0.05f)))
		{
			track = setTrack;
			velocity = new Vector2D(1f, 0f);
			collisionRadius = DrawArea.Width / 2;
			NextTrackIndex = 0;
			new Command(Command.MoveLeft,
				() => velocity = velocity.Rotate(-speed * RotationStep * Time.Delta));
			new Command(Command.MoveRight,
				() => velocity = velocity.Rotate(speed * RotationStep * Time.Delta));
			new Command(Command.MoveUp, () => speed += Time.Delta * 2);
		}
コード例 #3
0
ファイル: Game.cs プロジェクト: whztt07/DeltaEngine
		public Game(Track track, Window window)
			: base("Background", ScreenSpace.Current.Viewport)
		{
			car = new Car(track.TrackStart, track);
			info = new FontText(Font.Default, "Total Time: 0s",
				new Rectangle(0.0f, ScreenSpace.Current.Top, 1.0f, 0.1f))
			{
				HorizontalAlignment = HorizontalAlignment.Left,
				VerticalAlignment = VerticalAlignment.Top
			};
			RenderLayer = DefaultRenderLayer - 1;
			if (Material.DiffuseMap.AllowTiling)
				UV = new Rectangle(Vector2D.Zero, window.ViewportPixelSize / Material.DiffuseMap.PixelSize);
			lastCarTrackIndex = car.NextTrackIndex;
			finishedRounds = -1;
			new Command(Command.Exit, window.CloseAfterFrame);
		}