Example #1
0
		//internal const float LINKS_BottomMargin = 0.03f;

		protected BasePage(ScreenSpace screen)
		{
			this.screen = screen;
			links = new List<LogoLink>();
			new Command(OnMouseMovement).Add(new MouseMovementTrigger());
			new Command(OnMouseClick).Add(new MouseButtonTrigger());
		}
Example #2
0
 protected ScreenSpace(Window window)
 {
     this.window = window;
     viewportPixelSize = window.ViewportPixelSize;
     window.ViewportSizeChanged += Update;
     window.OrientationChanged += UpdateOrientationChanged;
     current = this;
 }
Example #3
0
		public GameOverPage(ScreenSpace screen)
			: base(screen)
		{  
			SetTitle("GameOver", 0.25f, 4f, 0.05f);
			AddButton(MenuButton.Home, 0.2f, 4f);
			AddButton(MenuButton.Retry, 0.2f, 4f);
			AddButton(MenuButton.Exit, 0.2f, 4f);
		} 
Example #4
0
		public PausePage(ScreenSpace screen)
			: base(screen)
		{
			SetViewportBackground("PauseBackground");
			SetTitle("Pause", 0.25f, 4f, 0.05f);
			AddButton(MenuButton.Resume, 0.2f, 4f);
			AddButton(MenuButton.NewGame, 0.2f, 4f);
			AddButton(MenuButton.Abort, 0.2f, 4f);						
		} 
Example #5
0
		public Game(ScreenSpace screen, Window window)
		{
			this.screen = screen;
			this.window = window;
			window.Title = "Delta Ninja - A Delta Engine sample";
			window.ViewportPixelSize = new Size(1280, 720);
			InitBackground();
			InitInput();
			InitPages();
			home.Show();
		}
		private void SquareWindowShouldAlwaysReturnRelativeValues(ScreenSpace screen)
		{
			window.ViewportPixelSize = new Size(100, 100);
			Assert.AreEqual(Vector2D.Zero, screen.TopLeft);
			Assert.AreEqual(Vector2D.One, screen.BottomRight);
			Assert.AreEqual(Rectangle.One, screen.Viewport);
			Assert.AreEqual(Vector2D.One, screen.FromPixelSpace(new Vector2D(100, 100)));
			Assert.AreEqual(Vector2D.Half, screen.FromPixelSpace(new Vector2D(50, 50)));
			Assert.IsTrue(
				screen.FromPixelSpace(new Rectangle(10, 10, 80, 80)).IsNearlyEqual(new Rectangle(0.1f, 0.1f,
					0.8f, 0.8f)));
		}
Example #7
0
 public Console()
     : base(Rectangle.Zero, Color.Black)
 {
     screen = ScreenSpace.Current;
     screen.ViewportSizeChanged += UpdateDrawArea;
     CreateText();
     UpdateDrawArea();
     Add(new InteractiveState { WantsFocus = true });
     Start<ControlUpdater>();
     Start<Keyboard>();
     AddKeyboardCommands();
     IsEnabled = true;
 }
Example #8
0
		public HomePage(ScreenSpace screen)
			: base(screen)
		{
			SetTitle("DeltaNinjaHome", 0.4f, 3f, 0f);
			AddLogoLink("DeltaEngineLink", "http://deltaengine.net/", 0.07f, -2);
			AddLogoLink("CodePlexLink", "http://deltaninja.codeplex.com/", 0.07f, 2);
			AddButton(MenuButton.NewGame, 0.2f, 4f);
			AddButton(MenuButton.About, 0.2f, 4f);
			AddButton(MenuButton.Exit, 0.2f, 4f);
			new Command(CheckAboutBox).Add(new MouseButtonTrigger());
			aboutBox = new Sprite("AboutBox",
				Rectangle.FromCenter(Vector2D.Half, new Size(0.38f, 0.38f * 0.6070f)));
			aboutBox.RenderLayer = 9000;
			aboutBox.IsActive = false;
		}
Example #9
0
		public Match(ScreenSpace screen, NumberFactory numberFactory, LogoFactory logoFactory)
			: base(Rectangle.Zero)
		{
			this.screen = screen;
			this.logoFactory = logoFactory;
			hud = new HudScene(screen, numberFactory);
			pause = new PausePage(screen);
			pause.Hide();
			Slice = new Slice();
			PointsTips = new List<PointsTip>();
			ErrorFlags = new List<ErrorFlag>();
			HideScore();
			screen.ViewportSizeChanged += RefreshSize;
			RefreshSize();
		}
Example #10
0
		public HudScene(ScreenSpace screen, NumberFactory numberFactory)
		{
			var view = screen.Viewport;
			var center = view.Width / 2f;
			var left = view.Left;
			var top = view.Top;
			var right = view.Right;
			pointsNumber = numberFactory.CreateNumber(this, left, top, 0.05f, Alignment.Left, 0,
				DefaultColors.Gray);
			levelCaption = new Sprite("LevelCaption",
				Rectangle.FromCenter(center, top + 0.02f, 0.07f, 0.03f));
			levelCaption.Color = DefaultColors.Yellow;
			// ReSharper disable DoNotCallOverridableMethodsInConstructor
			Add(levelCaption);
			levelNumber = numberFactory.CreateNumber(this, center, levelCaption.DrawArea.Bottom, 0.022f,
				Alignment.Center, 2, DefaultColors.Gray);
			var offsets = new[,] { { 0.108f, 0.025f }, { 0.083f, 0.033f }, { 0.05f, 0.05f } };
			errorIcons = new Sprite[3];
			for (int i = 0; i < errorIcons.Length; i++)
				Add(errorIcons[i] = new Sprite("ErrorIcon",
					new Rectangle(right - offsets[i, 0], top, offsets[i, 1], offsets[i, 1])));
			foreach (var control in Controls.FindAll(x => x is Sprite))
				control.RenderLayer = (int)GameRenderLayer.Hud;
		}
Example #11
0
 public void Dispose()
 {
     window.ViewportSizeChanged -= Update;
     window.OrientationChanged  -= UpdateOrientationChanged;
     current = null;
 }
Example #12
0
		public Background(ScreenSpace screen)
			: base("Background", screen.Viewport)
		{
			RenderLayer = (int)GameRenderLayer.Background;
			screen.ViewportSizeChanged += () => DrawArea = screen.Viewport;
		}
Example #13
0
		public LogoFactory(ScreenSpace screen)
		{
			this.screen = screen;
		}
Example #14
0
 public void Dispose()
 {
     window.ViewportSizeChanged -= Update;
     window.OrientationChanged -= UpdateOrientationChanged;
     current = null;
 }
Example #15
0
		public GameLogic(ScreenSpace screen, NumberFactory numberFactory)
		{
			this.numberFactory = numberFactory;
			this.screen = screen;
			waveTimeout = GameSettings.InitialWaveTimeout;
		}