public GameMenu(GamePrototype gameParent) : base(gameParent) { TextRectangle = new Rectangle(168, 12, 218, 69); RectangleOfContentDrawing = new Rectangle(100, 155, 350, 475); RectangleOfContentAfterResizeing = false; BkgColor = Color.White; }
private static Effect GetGlowingEffect(GamePrototype game) { if (_glowingEffect is null) { _glowingEffect = game.Content.Load <Effect>("Effects/UI.GlowingEffect"); } return(_glowingEffect); }
public Panel(GamePrototype gameParent) : base(gameParent) { LookingChanged += (sender, e) => { if (_toMiddleXAfterLayoutResume) { InnerToMiddleX(); _toMiddleXAfterLayoutResume = false; } }; }
public DrawScoreBars(GamePrototype gameParent) : base(gameParent) { BkgTransparent = true; _scoreBarApearance = new ControlApearance(); Player1ScoreBar = new ScoreBar(gameParent) { IsLeft = true, ControlApearance = _scoreBarApearance }; Player2ScoreBar = new ScoreBar(gameParent) { IsLeft = false, SpriteEffect = SpriteEffects.FlipHorizontally, ControlApearance = _scoreBarApearance }; Controls.AddRange(Player1ScoreBar, Player2ScoreBar); }
/// <summary> /// Using GamePrototype.SpriteBatch and GamePrototype.GraphicsDevice. /// Do not use between SpriteBatch.Begin and SpriteBatch.End. /// </summary> /// <typeparam name="T"></typeparam> /// <param name="texture"></param> /// <param name=""></param> /// <param name="effect"></param> /// <returns></returns> public static Texture2D ActiveEffectOnTexture(this Texture2D texture, GamePrototype game, Effect effect) { var graphicsDevice = game.GraphicsDevice; int width = texture.Width; int height = texture.Height; RenderTarget2D effectedTexture = new RenderTarget2D( graphicsDevice, graphicsDevice.PresentationParameters.BackBufferWidth, graphicsDevice.PresentationParameters.BackBufferHeight, false, graphicsDevice.PresentationParameters.BackBufferFormat, DepthFormat.Depth24); graphicsDevice.SetRenderTarget(effectedTexture); graphicsDevice.DepthStencilState = new DepthStencilState() { DepthBufferEnable = true }; // Draw the scene var spriteBatch = game.SpriteBatch; graphicsDevice.Clear(Color.Transparent); spriteBatch.Begin(SpriteSortMode.Deferred, null, null, null, null, effect, null); spriteBatch.Draw(texture, Vector2.Zero, Color.White); spriteBatch.End(); Texture2D newTexture = effectedTexture; // Drop the render target graphicsDevice.SetRenderTarget(null); return(newTexture); }
public LevelsMenu(GamePrototype gameParent, int levels) : base(gameParent) { Text = "Choose Level"; _buttons = new MenuButton[levels]; }
public MainMenu(GamePrototype gameParent) : base(gameParent) { Text = "Main Menu"; }
public GameTextBox(GamePrototype gameParent) : base(gameParent) { Size = new Vector2(200, 50) * 1.6f; }
public TextBox(GamePrototype gameParent) : base(gameParent) { BkgTransparent = false; }
public MathCardDraw(GamePrototype gameParent, MathCard mathCard) : base(gameParent) { Card = mathCard; }
public ScoreLabel(GamePrototype gameParent) : base(gameParent) { }
public ChangeApearanceRelativeMouseControl(GamePrototype gameParent) : base(gameParent) { }
public static Texture2D GlowingTexture(this Texture2D texture, GamePrototype game) { Effect glowingEffect = GetGlowingEffect(game); return(ActiveEffectOnTexture(texture, game, glowingEffect)); }
public static Texture2D DarkingTexture(this Texture2D texture, GamePrototype game) { Effect darkingEffect = GetDarkingEffect(game); return(ActiveEffectOnTexture(texture, game, darkingEffect)); }
public UIObject(GamePrototype gameParent) { GameParent = gameParent; }
public ControlsCollection(GamePrototype gameParent) { GameParent = gameParent; _controls = new List <Control>(); }
public Button(GamePrototype gameParent) : base(gameParent) { BkgTransparent = false; TextAnchor = Anchor.Center | Anchor.Middle; }
public NumCardDraw(GamePrototype gameParent, float result) : base(gameParent) { Card = new NumCard(result); }
public MenuButton(GamePrototype gameParent) : base(gameParent) { Size = new Vector2(200, 50) * 1.6f; BkgTransparent = false; }