public DialScr (Moggle.Game juego, IScreen baseScreen) : base (juego, baseScreen) { var bt = new Botón (this) { Textura = "outline", Color = Color.Green, Bounds = new RectangleF (400, 400, 50, 50), }; bt.AlClick += delegate { Juego.Exit (); }; Components.Add (bt); }
/// <summary> /// Inicaliza un <see cref="Botón"/> rectangular. /// </summary> /// <param name="screen">Screen.</param> /// <param name="bounds">Límites del rectángulo.</param> public Botón (Moggle.Screens.IScreen screen, RectangleF bounds) : this (screen) { Bounds = new RectangleF (bounds.Location, bounds.Size); }
/// <summary> /// Inicaliza un <see cref="Botón"/> de una forma arbitraria. /// </summary> /// <param name="screen">Screen.</param> /// <param name="shape">Forma del botón</param> public Botón (Moggle.Screens.IScreen screen, IShapeF shape) : this (screen) { Bounds = shape; }
/// <summary> /// Inicaliza un <see cref="Botón"/> rectangular. /// </summary> /// <param name="screen">Screen.</param> public Botón (Moggle.Screens.IScreen screen) : base (screen) { Color = Color.White; }
public Scr (Moggle.Game game) : base (game) { textures = new SimpleTextures (game.GraphicsDevice); buildTextures (); bt = new Botón (this, new RectangleF (100, 100, 50, 50)); bt.Color = Color.Green; bt.Textura = "outline"; bt = new Botón (this, new RectangleF (155, 100, 50, 50)); bt.Color = Color.Green; bt.Textura = "outline"; bt.AlClick += delegate { var newScr = new DialScr (Juego, this); newScr.Ejecutar (); }; MouseObserver.RatónEncima += (sender, e) => Debug.WriteLine ( "Mouse ahora sobre {0}", e.ObservedObject); MouseObserver.RatónSeFue += (sender, e) => Debug.WriteLine ( "Mouse estuvo sobre {0} por {1}", e.ObservedObject, e.TimeOnObject); var ct = new ContenedorSelección<FlyingSprite> (this) { GridSize = new MonoGame.Extended.Size (4, 4), TextureFondoName = "solid", MargenExterno = new MargenType { Top = 3, Left = 3, Right = 3, Bot = 3 }, MargenInterno = new MargenType { Top = 1, Left = 1, Right = 1, Bot = 2 }, BgColor = Color.Gray * 0.3f, TamañoBotón = new MonoGame.Extended.Size (12, 12), Posición = new Point (5, 5), SelectionEnabled = true }; AddComponent (ct); const int numBot = 13; var bts = new FlyingSprite [numBot]; for (int i = 0; i < numBot; i++) { bts [i] = new FlyingSprite (Content) { Color = Color.PaleVioletRed * 0.8f, TextureName = "solid" }; ct.Add (bts [i]); } MouseObserver.ObserveObject (ct); StrListen = new KeyStringListener (Juego.KeyListener); var contImg = new ContenedorImage (this) { MargenExterno = new MargenType { Left = 3, Right = 3, Top = 3, Bot = 3 }, MargenInterno = new MargenType { Left = 2, Right = 2, Top = 2, Bot = 2 }, TamañoBotón = new MonoGame.Extended.Size (20, 20), BgColor = Color.Black, Posición = new Point (400, 5), TextureFondoName = "solid", GridSize = new MonoGame.Extended.Size (4, 4), TipoOrden = Contenedor<FlyingSprite>.TipoOrdenEnum.FilaPrimero }; contImg.Add ("sol_1", Color.White); contImg.Add ("sol_2", Color.White); contImg.Add ("sol_3", Color.White); contImg.Add ("sol_4", Color.White); contImg.Add ("alt_1", Color.White); contImg.Add ("alt_2", Color.White); contImg.Add ("alt_3", Color.White); contImg.Add ("alt_4", Color.White); contImg.Add ("out_1", Color.White); contImg.Add ("out_2", Color.White); contImg.Add ("out_3", Color.White); contImg.Add ("out_4", Color.White); contImg.Add ("out_5", Color.White); AddComponent (contImg); }